From owner-svn-src-projects@FreeBSD.ORG Sun Dec 7 15:42:49 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 15B91604; Sun, 7 Dec 2014 15:42:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 01643F4E; Sun, 7 Dec 2014 15:42:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB7Fgm54063146; Sun, 7 Dec 2014 15:42:48 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB7FgkJ1063134; Sun, 7 Dec 2014 15:42:46 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201412071542.sB7FgkJ1063134@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Sun, 7 Dec 2014 15:42:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r275577 - in projects/routing/sys: net netinet netinet6 X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Dec 2014 15:42:49 -0000 Author: melifaro Date: Sun Dec 7 15:42:46 2014 New Revision: 275577 URL: https://svnweb.freebsd.org/changeset/base/275577 Log: * Add llt_clear_entry() callback which is able to do all lle cleanup including unlinking/freeing * Relax locking in lltable_prefix_free_af/lltable_free * Do not pass @llt to lle free callback: it is always NULL now. * Unify arptimer/nd6_llinfo_timer: explicitly unlock lle avoiding unlock/lock sequinces * Do not pass unlocked lle to nd6_ns_output(): add nd6_llinfo_get_holdsrc() to retrieve preferred source address from lle hold queue and pass it instead of lle. * Finally, make nd6_create() create and return unlocked lle * Separate defrtr handling code from nd6_free(): use nd6_check_del_defrtr() to check if we need to keep entry instead of performing GC, use nd6_check_recalc_defrtr() to perform actual recalc on lle removal. * Move isRouter handling from nd6_cache_lladdr() to separate nd6_check_router() * Add initial code to maintain lle runtime flags in sync. Modified: projects/routing/sys/net/if_llatbl.c projects/routing/sys/net/if_llatbl.h projects/routing/sys/netinet/if_ether.c projects/routing/sys/netinet/if_ether.h projects/routing/sys/netinet/in.c projects/routing/sys/netinet/toecore.c projects/routing/sys/netinet6/in6.c projects/routing/sys/netinet6/nd6.c projects/routing/sys/netinet6/nd6.h projects/routing/sys/netinet6/nd6_nbr.c Modified: projects/routing/sys/net/if_llatbl.c ============================================================================== --- projects/routing/sys/net/if_llatbl.c Sun Dec 7 11:21:41 2014 (r275576) +++ projects/routing/sys/net/if_llatbl.c Sun Dec 7 15:42:46 2014 (r275577) @@ -254,17 +254,17 @@ lltable_free(struct lltable *llt) for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) { LIST_FOREACH_SAFE(lle, &llt->lle_head[i], lle_next, next) { LLE_WLOCK(lle); - llt->llt_stop_timers(lle); LIST_INSERT_HEAD(&dchain, lle, lle_chain); } } IF_AFDATA_RUN_WLOCK(llt->llt_ifp); llentries_unlink(&dchain); IF_AFDATA_RUN_WUNLOCK(llt->llt_ifp); - LIST_FOREACH_SAFE(lle, &dchain, lle_chain, next) - llentry_free(lle); IF_AFDATA_CFG_WUNLOCK(llt->llt_ifp); + LIST_FOREACH_SAFE(lle, &dchain, lle_chain, next) + llt->llt_clear_entry(llt, lle); + free(llt, M_LLTABLE); } @@ -282,7 +282,6 @@ lltable_prefix_free_af(struct lltable *l LIST_FOREACH_SAFE(lle, &llt->lle_head[i], lle_next, next) { if (llt->llt_match_prefix(prefix, mask, flags, lle)) { LLE_WLOCK(lle); - llt->llt_stop_timers(lle); LIST_INSERT_HEAD(&dchain, lle, lle_chain); } } @@ -290,9 +289,10 @@ lltable_prefix_free_af(struct lltable *l IF_AFDATA_RUN_WLOCK(llt->llt_ifp); llentries_unlink(&dchain); IF_AFDATA_RUN_WUNLOCK(llt->llt_ifp); - LIST_FOREACH_SAFE(lle, &dchain, lle_chain, next) - llentry_free(lle); IF_AFDATA_CFG_WUNLOCK(llt->llt_ifp); + + LIST_FOREACH_SAFE(lle, &dchain, lle_chain, next) + llt->llt_clear_entry(llt, lle); } #if 0 Modified: projects/routing/sys/net/if_llatbl.h ============================================================================== --- projects/routing/sys/net/if_llatbl.h Sun Dec 7 11:21:41 2014 (r275576) +++ projects/routing/sys/net/if_llatbl.h Sun Dec 7 15:42:46 2014 (r275577) @@ -68,7 +68,7 @@ struct llentry { /* FIELDS PROTECTED BY LLE rwlock */ struct lltable *lle_tbl; struct llentries *lle_head; - void (*lle_free)(struct lltable *, struct llentry *); + void (*lle_free)(struct llentry *); struct mbuf *la_hold; int la_numheld; /* # of packets currently held */ time_t la_expire; @@ -117,7 +117,7 @@ struct llentry { #define LLE_FREE_LOCKED(lle) do { \ if ((lle)->lle_refcnt == 1) \ - (lle)->lle_free((lle)->lle_tbl, (lle)); \ + (lle)->lle_free((lle)); \ else { \ LLE_REMREF(lle); \ LLE_WUNLOCK(lle); \ @@ -158,7 +158,7 @@ typedef int (llt_dump_entry_t)(struct ll typedef uint32_t (llt_hash_t)(const struct llentry *); typedef int (llt_match_prefix_t)(const struct sockaddr *, const struct sockaddr *, u_int, struct llentry *); -typedef void (llt_stop_timers_t)(struct llentry *lle); +typedef void (llt_clear_entry_t)(struct lltable *, struct llentry *); struct lltable { SLIST_ENTRY(lltable) llt_link; @@ -172,7 +172,7 @@ struct lltable { llt_dump_entry_t *llt_dump_entry; llt_hash_t *llt_hash; llt_match_prefix_t *llt_match_prefix; - llt_stop_timers_t *llt_stop_timers; + llt_clear_entry_t *llt_clear_entry; }; MALLOC_DECLARE(M_LLTABLE); Modified: projects/routing/sys/netinet/if_ether.c ============================================================================== --- projects/routing/sys/netinet/if_ether.c Sun Dec 7 11:21:41 2014 (r275576) +++ projects/routing/sys/netinet/if_ether.c Sun Dec 7 15:42:46 2014 (r275577) @@ -182,43 +182,33 @@ static void arptimer(void *arg) { struct llentry *lle = (struct llentry *)arg; + struct lltable *llt; struct ifnet *ifp; - size_t pkts_dropped; - uint16_t la_flags; - int state; + int evt; if (lle->la_flags & LLE_STATIC) { + /* TODO: ensure we won't get here */ LLE_WUNLOCK(lle); return; } - if (lle->la_falgs & LLE_DELETED) { - /* XXX: Temporary */ + if (lle->la_flags & LLE_DELETED) { /* We have been deleted. Drop callref and return */ - if ((lle->la_flags & LLE_CALLOUTREF) != 0) { - LLE_REMREF(lle); - lle->la_flags &= ~LLE_CALLOUTREF; - } + KASSERT((lle->la_flags & LLE_CALLOUTREF) != 0, + ("arptimer was called without callout reference")); - pkts_dropped = llentry_free(lle); - ARPSTAT_ADD(dropped, pkts_dropped); + /* Assume the entry was already cleared */ + lle->la_flags &= ~LLE_CALLOUTREF; + LLE_FREE_LOCKED(lle); return; } - /* Unlink entry */ - IF_AFDATA_RUN_WLOCK(ifp); - llentry_unlink(lle); - IF_AFDATA_RUN_WUNLOCK(ifp); - - pkts_dropped = llentry_free(lle); - ARPSTAT_ADD(dropped, pkts_dropped); + llt = lle->lle_tbl; + ifp = llt->llt_ifp; - la_flags = lle->la_flags; - state = (la_flags & LLE_DELETED) ? ARP_LLINFO_DELETED : lle->ln_state; - ifp = lle->lle_tbl->llt_ifp; CURVNET_SET(ifp->if_vnet); - switch (state) { + switch (lle->ln_state) { case ARP_LLINFO_REACHABLE: /* @@ -234,6 +224,7 @@ arptimer(void *arg) lle->ln_state = ARP_LLINFO_VERIFY; callout_schedule(&lle->la_timer, hz * V_arpt_rexmit); LLE_WUNLOCK(lle); + CURVNET_RESTORE(); return; case ARP_LLINFO_VERIFY: if (lle->r_kick == 0 && lle->la_preempt > 0) { @@ -245,60 +236,78 @@ arptimer(void *arg) lle->r_kick = 1; callout_schedule(&lle->la_timer, hz * V_arpt_rexmit); LLE_WUNLOCK(lle); + CURVNET_RESTORE(); return; } /* Nothing happened. Reschedule if not too late */ if (lle->la_expire > time_uptime) { callout_schedule(&lle->la_timer, hz * V_arpt_rexmit); LLE_WUNLOCK(lle); + CURVNET_RESTORE(); return; } break; case ARP_LLINFO_INCOMPLETE: - case ARP_LLINFO_DELETED: break; } - if ((lle->la_flags & LLE_DELETED) == 0) { - int evt; + /* We have to delete entr */ + if (lle->la_flags & LLE_VALID) + evt = LLENTRY_EXPIRED; + else + evt = LLENTRY_TIMEDOUT; + EVENTHANDLER_INVOKE(lle_event, lle, evt); - if (lle->la_flags & LLE_VALID) - evt = LLENTRY_EXPIRED; - else - evt = LLENTRY_TIMEDOUT; - EVENTHANDLER_INVOKE(lle_event, lle, evt); - } + llt->llt_clear_entry(llt, lle); - callout_stop(&lle->la_timer); + ARPSTAT_INC(timeouts); - /* XXX: LOR avoidance. We still have ref on lle. */ - LLE_WUNLOCK(lle); - IF_AFDATA_CFG_WLOCK(ifp); - LLE_WLOCK(lle); + CURVNET_RESTORE(); +} - /* - * Note other thread could have removed given entry - * stopping callout and removing LLE reference. - */ - //llt->llt_stop_timers(lle); - if ((lle->la_flags & LLE_CALLOUTREF) != 0) { +/* + * Calback for lltable. + */ +void +arp_lltable_clear_entry(struct lltable *llt, struct llentry *lle) +{ + struct ifnet *ifp; + size_t pkts_dropped; + + LLE_WLOCK_ASSERT(lle); + KASSERT(llt != NULL, ("lltable is NULL")); + + /* Unlink entry from table if not already */ + if ((lle->la_flags & LLE_LINKED) != 0) { + + ifp = llt->llt_ifp; + /* + * Lock order needs to be maintained + */ + LLE_ADDREF(lle); + LLE_WUNLOCK(lle); + IF_AFDATA_CFG_WLOCK(ifp); + LLE_WLOCK(lle); LLE_REMREF(lle); - lle->la_flags &= ~LLE_CALLOUTREF; + + IF_AFDATA_RUN_WLOCK(ifp); + llentry_unlink(lle); + IF_AFDATA_RUN_WUNLOCK(ifp); + + IF_AFDATA_CFG_WUNLOCK(ifp); } - /* Unlink entry */ - IF_AFDATA_RUN_WLOCK(ifp); - llentry_unlink(lle); - IF_AFDATA_RUN_WUNLOCK(ifp); + /* cancel timer */ + if (callout_stop(&lle->la_timer) != 0) { + if ((lle->la_flags & LLE_CALLOUTREF) != 0) { + LLE_REMREF(lle); + lle->la_flags &= ~LLE_CALLOUTREF; + } + } + /* Finally, free entry */ pkts_dropped = llentry_free(lle); ARPSTAT_ADD(dropped, pkts_dropped); - - IF_AFDATA_CFG_WUNLOCK(ifp); - - ARPSTAT_INC(timeouts); - - CURVNET_RESTORE(); } /* Modified: projects/routing/sys/netinet/if_ether.h ============================================================================== --- projects/routing/sys/netinet/if_ether.h Sun Dec 7 11:21:41 2014 (r275576) +++ projects/routing/sys/netinet/if_ether.h Sun Dec 7 15:42:46 2014 (r275577) @@ -112,6 +112,7 @@ struct sockaddr_inarp { extern u_char ether_ipmulticast_min[ETHER_ADDR_LEN]; extern u_char ether_ipmulticast_max[ETHER_ADDR_LEN]; +struct lltable; struct llentry; struct ifaddr; @@ -124,6 +125,7 @@ void arprequest(struct ifnet *, const st void arp_ifinit(struct ifnet *, struct ifaddr *); void arp_ifinit2(struct ifnet *, struct ifaddr *, u_char *); void arp_ifscrub(struct ifnet *, uint32_t); +void arp_lltable_clear_entry(struct lltable *, struct llentry *); #endif #endif Modified: projects/routing/sys/netinet/in.c ============================================================================== --- projects/routing/sys/netinet/in.c Sun Dec 7 11:21:41 2014 (r275576) +++ projects/routing/sys/netinet/in.c Sun Dec 7 15:42:46 2014 (r275577) @@ -994,14 +994,15 @@ struct in_llentry { }; /* - * Deletes an address from the address table. + * Frees unlinked record. * This function is called by the timer functions * such as arptimer() and nd6_llinfo_timer(), and * the caller does the locking. */ static void -in_lltable_free(struct lltable *llt, struct llentry *lle) +in_lltable_free(struct llentry *lle) { + LLE_WUNLOCK(lle); LLE_LOCK_DESTROY(lle); free(lle, M_LLTABLE); @@ -1035,17 +1036,6 @@ in_lltable_new(const struct sockaddr *l3 return (&lle->base); } -static void -in_lltable_stop_timers(struct llentry *lle) -{ - - LLE_WLOCK_ASSERT(lle); - if (callout_stop(&lle->la_timer)) { - LLE_REMREF(lle); - lle->la_flags &= ~LLE_CALLOUTREF; - } -} - #define IN_ARE_MASKED_ADDR_EQUAL(d, a, m) ( \ (((ntohl((d)->sin_addr.s_addr) ^ (a)->sin_addr.s_addr) & (m)->sin_addr.s_addr)) == 0 ) @@ -1314,7 +1304,7 @@ in_domifattach(struct ifnet *ifp) llt->llt_delete = in_lltable_delete; llt->llt_dump_entry = in_lltable_dump_entry; llt->llt_hash = in_lltable_hash; - llt->llt_stop_timers = in_lltable_stop_timers; + llt->llt_clear_entry = arp_lltable_clear_entry; llt->llt_match_prefix = in_lltable_match_prefix; } ii->ii_llt = llt; Modified: projects/routing/sys/netinet/toecore.c ============================================================================== --- projects/routing/sys/netinet/toecore.c Sun Dec 7 11:21:41 2014 (r275576) +++ projects/routing/sys/netinet/toecore.c Sun Dec 7 15:42:46 2014 (r275577) @@ -37,6 +37,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include @@ -453,7 +455,7 @@ toe_route_redirect_event(void *arg __unu static int toe_nd6_resolve(struct ifnet *ifp, struct sockaddr *sa, uint8_t *lladdr) { - struct llentry *lle; + struct llentry *lle, *lle_tmp; struct sockaddr_in6 *sin6 = (void *)sa; int rc, flags = 0; @@ -462,19 +464,39 @@ restart: lle = lltable_lookup_lle(LLTABLE6(ifp), flags, sa); IF_AFDATA_RUNLOCK(ifp); if (lle == NULL) { - IF_AFDATA_CFG_WLOCK(ifp); lle = nd6_create(&sin6->sin6_addr, 0, ifp); - IF_AFDATA_CFG_WUNLOCK(ifp); if (lle == NULL) return (ENOMEM); /* Couldn't create entry in cache. */ lle->ln_state = ND6_LLINFO_INCOMPLETE; - nd6_llinfo_settimer_locked(lle, - (long)ND_IFINFO(ifp)->retrans * hz / 1000); - LLE_WUNLOCK(lle); + IF_AFDATA_CFG_WLOCK(ifp); + LLE_WLOCK(lle); + /* Check if the same record was addded */ + lle_tmp = lltable_lookup_lle(LLTABLE6(ifp), LLE_EXCLUSIVE, sa); + if (lle_tmp == NULL) { + /* + * No entry has been found. Link new one. + */ + IF_AFDATA_RUN_WLOCK(ifp); + llentry_link(LLTABLE6(ifp), lle); + IF_AFDATA_RUN_WUNLOCK(ifp); + } + IF_AFDATA_CFG_WUNLOCK(ifp); + if (lle_tmp == NULL) { + /* Set up timer for our new lle */ + nd6_llinfo_settimer_locked(lle, + (long)ND_IFINFO(ifp)->retrans * hz / 1000); + LLE_WUNLOCK(lle); - nd6_ns_output(ifp, NULL, &sin6->sin6_addr, NULL, 0); + nd6_ns_output(ifp, NULL, &sin6->sin6_addr, NULL, 0); + + return (EWOULDBLOCK); + } - return (EWOULDBLOCK); + /* Existing lle has been found. Free new one */ + LLE_FREE_LOCKED(lle); + lle = lle_tmp; + lle_tmp = NULL; + flags |= LLE_EXCLUSIVE; } if (lle->ln_state == ND6_LLINFO_STALE) { Modified: projects/routing/sys/netinet6/in6.c ============================================================================== --- projects/routing/sys/netinet6/in6.c Sun Dec 7 11:21:41 2014 (r275576) +++ projects/routing/sys/netinet6/in6.c Sun Dec 7 15:42:46 2014 (r275577) @@ -2052,14 +2052,12 @@ struct in6_llentry { }; /* - * Deletes an address from the address table. - * This function is called by the timer functions - * such as arptimer() and nd6_llinfo_timer(), and - * the caller does the locking. + * Frees already unlinked @lle. */ static void -in6_lltable_free(struct lltable *llt, struct llentry *lle) +in6_lltable_free(struct llentry *lle) { + LLE_WUNLOCK(lle); LLE_LOCK_DESTROY(lle); free(lle, M_LLTABLE); @@ -2087,17 +2085,6 @@ in6_lltable_new(const struct sockaddr *l return (&lle->base); } -static void -in6_lltable_stop_timers(struct llentry *lle) -{ - - LLE_WLOCK_ASSERT(lle); - if (callout_stop(&lle->la_timer)) { - LLE_REMREF(lle); - lle->la_flags &= ~LLE_CALLOUTREF; - } -} - static int in6_lltable_match_prefix(const struct sockaddr *prefix, const struct sockaddr *mask, u_int flags, struct llentry *lle) @@ -2219,19 +2206,13 @@ static struct llentry * in6_lltable_create(struct lltable *llt, u_int flags, const struct sockaddr *l3addr) { - const struct sockaddr_in6 *sin6 = (const struct sockaddr_in6 *)l3addr; struct ifnet *ifp = llt->llt_ifp; struct llentry *lle; KASSERT(l3addr->sa_family == AF_INET6, ("sin_family %d", l3addr->sa_family)); - lle = in6_lltable_find_dst(llt, &sin6->sin6_addr); - - if (lle != NULL) { - LLE_WLOCK(lle); - return (lle); - } + IF_AFDATA_CFG_UNLOCK_ASSERT(ifp); /* * A route that covers the given address must have @@ -2248,7 +2229,6 @@ in6_lltable_create(struct lltable *llt, return NULL; } lle->la_flags = flags; - LLE_WLOCK(lle); return (lle); } @@ -2381,7 +2361,7 @@ in6_domifattach(struct ifnet *ifp) ext->lltable->llt_delete = in6_lltable_delete; ext->lltable->llt_dump_entry = in6_lltable_dump_entry; ext->lltable->llt_hash = in6_lltable_hash; - ext->lltable->llt_stop_timers = in6_lltable_stop_timers; + ext->lltable->llt_clear_entry = nd6_lltable_clear_entry; ext->lltable->llt_match_prefix = in6_lltable_match_prefix; } Modified: projects/routing/sys/netinet6/nd6.c ============================================================================== --- projects/routing/sys/netinet6/nd6.c Sun Dec 7 11:21:41 2014 (r275576) +++ projects/routing/sys/netinet6/nd6.c Sun Dec 7 15:42:46 2014 (r275577) @@ -132,10 +132,14 @@ static int nd6_is_new_addr_neighbor(stru static void nd6_setmtu0(struct ifnet *, struct nd_ifinfo *); static void nd6_slowtimo(void *); static int regen_tmpaddr(struct in6_ifaddr *); -static struct llentry *nd6_free(struct llentry *, int); +static void nd6_free(struct llentry *, int); static void nd6_llinfo_timer(void *); static void clear_llinfo_pqueue(struct llentry *); static void nd6_rtrequest(int, struct rtentry *, struct rt_addrinfo *); +static struct in6_addr *nd6_llinfo_get_holdsrc(struct llentry *, + struct in6_addr *); +static int nd6_check_del_defrtr(struct lltable *, struct llentry *); +static void nd6_check_recalc_defrtr(struct lltable *, struct llentry *); static VNET_DEFINE(struct callout, nd6_slowtimo_ch); #define V_nd6_slowtimo_ch VNET(nd6_slowtimo_ch) @@ -433,6 +437,10 @@ nd6_llinfo_settimer_locked(struct llentr ln->la_expire = 0; ln->ln_ntick = 0; canceled = callout_stop(&ln->ln_timer_ch); + if (canceled != 0) { + ln->la_flags &= ~LLE_CALLOUTREF; + LLE_REMREF(ln); + } } else { ln->la_expire = time_uptime + tick / hz; LLE_ADDREF(ln); @@ -445,11 +453,11 @@ nd6_llinfo_settimer_locked(struct llentr canceled = callout_reset(&ln->ln_timer_ch, tick, nd6_llinfo_timer, ln); } + if (canceled != 0) + LLE_REMREF(ln); + else + ln->la_flags |= LLE_CALLOUTREF; } - if (canceled) - LLE_REMREF(ln); - else - ln->la_flags |= LLE_CALLOUTREF; } void @@ -461,6 +469,34 @@ nd6_llinfo_settimer(struct llentry *ln, LLE_WUNLOCK(ln); } +/* + * Gets source address of the first packet in hold queue + * and stores it in @src. + * Returns pointer to @src (if hold queue is not empty) or NULL. + * + */ +static struct in6_addr * +nd6_llinfo_get_holdsrc(struct llentry *ln, struct in6_addr *src) +{ + struct ip6_hdr *phdr; + + if (ln->la_hold == NULL) + return (NULL); + + /* + * assuming every packet in la_hold has the same IP + * header + */ + phdr = mtod(ln->la_hold, struct ip6_hdr *); + /* XXX pullup? */ + if (sizeof(*phdr) < ln->la_hold->m_len) { + *src = phdr->ip6_src; + return (src); + } + + return (NULL); +} + static void nd6_llinfo_timer(void *arg) { @@ -468,13 +504,28 @@ nd6_llinfo_timer(void *arg) struct in6_addr *dst; struct ifnet *ifp; struct nd_ifinfo *ndi = NULL; + struct in6_addr src, *psrc; KASSERT(arg != NULL, ("%s: arg NULL", __func__)); ln = (struct llentry *)arg; LLE_WLOCK_ASSERT(ln); - ifp = ln->lle_tbl->llt_ifp; - CURVNET_SET(ifp->if_vnet); + if (ln->la_flags & LLE_STATIC) { + /* TODO: ensure we won't get here */ + LLE_WUNLOCK(ln); + return; + } + + if (ln->la_flags & LLE_DELETED) { + /* We have been deleted. Drop callref and return */ + KASSERT((ln->la_flags & LLE_CALLOUTREF) != 0, + ("nd6_llinfo_timer was called without callout reference")); + + /* Assume the entry was already cleared */ + ln->la_flags &= ~LLE_CALLOUTREF; + LLE_FREE_LOCKED(ln); + return; + } if (ln->ln_ntick > 0) { if (ln->ln_ntick > INT_MAX) { @@ -484,29 +535,27 @@ nd6_llinfo_timer(void *arg) ln->ln_ntick = 0; nd6_llinfo_settimer_locked(ln, ln->ln_ntick); } - goto done; + LLE_WUNLOCK(ln); + return; } + ifp = ln->lle_tbl->llt_ifp; + CURVNET_SET(ifp->if_vnet); + ndi = ND_IFINFO(ifp); dst = &L3_ADDR_SIN6(ln)->sin6_addr; - if (ln->la_flags & LLE_STATIC) { - goto done; - } - - if (ln->la_flags & LLE_DELETED) { - (void)nd6_free(ln, 0); - ln = NULL; - goto done; - } + /* + * Each case statement needs to unlock @ln before break/return. + */ switch (ln->ln_state) { case ND6_LLINFO_INCOMPLETE: if (ln->la_asked < V_nd6_mmaxtries) { ln->la_asked++; nd6_llinfo_settimer_locked(ln, (long)ndi->retrans * hz / 1000); + psrc = nd6_llinfo_get_holdsrc(ln, &src); LLE_WUNLOCK(ln); - nd6_ns_output(ifp, NULL, dst, ln, 0); - LLE_WLOCK(ln); + nd6_ns_output(ifp, NULL, dst, psrc, 0); } else { struct mbuf *m = ln->la_hold; if (m) { @@ -522,7 +571,7 @@ nd6_llinfo_timer(void *arg) clear_llinfo_pqueue(ln); } EVENTHANDLER_INVOKE(lle_event, ln, LLENTRY_TIMEDOUT); - (void)nd6_free(ln, 0); + nd6_free(ln, 0); ln = NULL; if (m != NULL) icmp6_error2(m, ICMP6_DST_UNREACH, @@ -534,15 +583,17 @@ nd6_llinfo_timer(void *arg) ln->ln_state = ND6_LLINFO_STALE; nd6_llinfo_settimer_locked(ln, (long)V_nd6_gctimer * hz); } + LLE_WUNLOCK(ln); break; case ND6_LLINFO_STALE: /* Garbage Collection(RFC 2461 5.3) */ if (!ND6_LLINFO_PERMANENT(ln)) { EVENTHANDLER_INVOKE(lle_event, ln, LLENTRY_EXPIRED); - (void)nd6_free(ln, 1); + nd6_free(ln, 1); ln = NULL; } + LLE_WUNLOCK(ln); break; case ND6_LLINFO_DELAY: @@ -551,24 +602,25 @@ nd6_llinfo_timer(void *arg) ln->la_asked = 1; ln->ln_state = ND6_LLINFO_PROBE; nd6_llinfo_settimer_locked(ln, (long)ndi->retrans * hz / 1000); + psrc = nd6_llinfo_get_holdsrc(ln, &src); LLE_WUNLOCK(ln); - nd6_ns_output(ifp, dst, dst, ln, 0); - LLE_WLOCK(ln); + nd6_ns_output(ifp, dst, dst, psrc, 0); } else { ln->ln_state = ND6_LLINFO_STALE; /* XXX */ nd6_llinfo_settimer_locked(ln, (long)V_nd6_gctimer * hz); + LLE_WUNLOCK(ln); } break; case ND6_LLINFO_PROBE: if (ln->la_asked < V_nd6_umaxtries) { ln->la_asked++; nd6_llinfo_settimer_locked(ln, (long)ndi->retrans * hz / 1000); + psrc = nd6_llinfo_get_holdsrc(ln, &src); LLE_WUNLOCK(ln); - nd6_ns_output(ifp, dst, dst, ln, 0); - LLE_WLOCK(ln); + nd6_ns_output(ifp, dst, dst, psrc, 0); } else { EVENTHANDLER_INVOKE(lle_event, ln, LLENTRY_EXPIRED); - (void)nd6_free(ln, 0); + nd6_free(ln, 0); ln = NULL; } break; @@ -576,9 +628,7 @@ nd6_llinfo_timer(void *arg) panic("%s: paths in a dark night can be confusing: %d", __func__, ln->ln_state); } -done: - if (ln != NULL) - LLE_FREE_LOCKED(ln); + CURVNET_RESTORE(); } @@ -866,9 +916,8 @@ nd6_lookup(struct in6_addr *addr6, int f return (ln); } -/* - * the caller acquires and releases the lock on the lltbls - * Returns the llentry wlocked +/* + * Creates and returns new, unlinked and unlocked lle. */ struct llentry * nd6_create(struct in6_addr *addr6, int flags, struct ifnet *ifp) @@ -881,15 +930,10 @@ nd6_create(struct in6_addr *addr6, int f sin6.sin6_family = AF_INET6; sin6.sin6_addr = *addr6; - IF_AFDATA_CFG_WLOCK_ASSERT(ifp); + IF_AFDATA_CFG_UNLOCK_ASSERT(ifp); ln = lltable_create_lle(LLTABLE6(ifp), 0, (struct sockaddr *)&sin6); - if (ln != NULL) { - IF_AFDATA_RUN_WLOCK(ifp); - ln->ln_state = ND6_LLINFO_NOSTATE; - llentry_link(LLTABLE6(ifp), ln); - IF_AFDATA_RUN_WUNLOCK(ifp); - } + ln->ln_state = ND6_LLINFO_NOSTATE; return (ln); } @@ -1025,34 +1069,96 @@ nd6_is_addr_neighbor(struct sockaddr_in6 /* * Free an nd6 llinfo entry. - * Since the function would cause significant changes in the kernel, DO NOT - * make it global, unless you have a strong reason for the change, and are sure - * that the change is safe. + * Internal function used by timer code. */ -static struct llentry * +static void nd6_free(struct llentry *ln, int gc) { - struct llentry *next; - struct nd_defrouter *dr; + struct lltable *llt; + + LLE_WLOCK_ASSERT(ln); + + if ((ln->la_flags & LLE_DELETED) != 0) { + /* Unlinked entry. Stop timer/callout. */ + nd6_llinfo_settimer_locked(ln, -1); + llentry_free(ln); + return; + } + + llt = ln->lle_tbl; + /* Check if we can delete/unlink given entry */ + if (gc != 0 && nd6_check_del_defrtr(llt, ln) == 0) { + LLE_WUNLOCK(ln); + return; + } + + llt->llt_clear_entry(ln->lle_tbl, ln); +} + +/* + * Calback for lltable. + */ +void +nd6_lltable_clear_entry(struct lltable *llt, struct llentry *ln) +{ struct ifnet *ifp; LLE_WLOCK_ASSERT(ln); + KASSERT(llt != NULL, ("lltable is NULL")); - /* - * we used to have pfctlinput(PRC_HOSTDEAD) here. - * even though it is not harmful, it was not really necessary. - */ + /* Unlink entry from table */ + if ((ln->la_flags & LLE_LINKED) != 0) { + + ifp = llt->llt_ifp; + /* + * Lock order needs to be maintained + */ + LLE_ADDREF(ln); + LLE_WUNLOCK(ln); + IF_AFDATA_CFG_WLOCK(ifp); + LLE_WLOCK(ln); + LLE_REMREF(ln); + + IF_AFDATA_RUN_WLOCK(ifp); + llentry_unlink(ln); + IF_AFDATA_RUN_WUNLOCK(ifp); + + IF_AFDATA_CFG_WUNLOCK(ifp); + } /* cancel timer */ nd6_llinfo_settimer_locked(ln, -1); - ifp = ln->lle_tbl->llt_ifp; + /* Check if default router needs to be recalculated */ + nd6_check_recalc_defrtr(llt, ln); + + /* Finally, free entry */ + llentry_free(ln); +} + +/* + * Checks if we can delete given entry. + * Perfoms defrtr selection if needed. + * + * return non-zero value if lle can be deleted. + */ +static int +nd6_check_del_defrtr(struct lltable *llt, struct llentry *ln) +{ + struct ifnet *ifp; + struct nd_defrouter *dr; + struct in6_addr dst; + + ifp = llt->llt_ifp; + dst = L3_ADDR_SIN6(ln)->sin6_addr; + + LLE_WLOCK_ASSERT(ln); if (ND_IFINFO(ifp)->flags & ND6_IFF_ACCEPT_RTADV) { - dr = defrouter_lookup(&L3_ADDR_SIN6(ln)->sin6_addr, ifp); + dr = defrouter_lookup(&dst, ifp); if (dr != NULL && dr->expire && - ln->ln_state == ND6_LLINFO_STALE && gc) { + ln->ln_state == ND6_LLINFO_STALE) { /* * If the reason for the deletion is just garbage * collection, and the neighbor is an active default @@ -1072,11 +1178,27 @@ nd6_free(struct llentry *ln, int gc) nd6_llinfo_settimer_locked(ln, (long)V_nd6_gctimer * hz); - next = LIST_NEXT(ln, lle_next); - LLE_REMREF(ln); - LLE_WUNLOCK(ln); - return (next); + return (0); } + } + + return (1); +} + +static void +nd6_check_recalc_defrtr(struct lltable *llt, struct llentry *ln) +{ + struct ifnet *ifp; + struct nd_defrouter *dr; + struct in6_addr dst; + + ifp = llt->llt_ifp; + dst = L3_ADDR_SIN6(ln)->sin6_addr; + + LLE_WLOCK_ASSERT(ln); + + if (ND_IFINFO(ifp)->flags & ND6_IFF_ACCEPT_RTADV) { + dr = defrouter_lookup(&dst, ifp); if (dr) { /* @@ -1103,6 +1225,7 @@ nd6_free(struct llentry *ln, int gc) * defrouter_select() in the block further down for calls * into nd6_lookup(). We still hold a ref. */ + LLE_ADDREF(ln); LLE_WUNLOCK(ln); /* @@ -1110,7 +1233,7 @@ nd6_free(struct llentry *ln, int gc) * is in the Default Router List. * See a corresponding comment in nd6_na_input(). */ - rt6_flush(&L3_ADDR_SIN6(ln)->sin6_addr, ifp); + rt6_flush(&dst, ifp); } if (dr) { @@ -1128,44 +1251,11 @@ nd6_free(struct llentry *ln, int gc) defrouter_select(); } - if (ln->ln_router || dr) + if (ln->ln_router || dr) { LLE_WLOCK(ln); + LLE_REMREF(ln); + } } - - /* - * Before deleting the entry, remember the next entry as the - * return value. We need this because pfxlist_onlink_check() above - * might have freed other entries (particularly the old next entry) as - * a side effect (XXX). - */ - next = LIST_NEXT(ln, lle_next); - - /* - * Save to unlock. We still hold an extra reference and will not - * free(9) in llentry_free() if someone else holds one as well. - */ - LLE_WUNLOCK(ln); - IF_AFDATA_CFG_WLOCK(ifp); - LLE_WLOCK(ln); - - /* - * Note other thread could have removed given entry - * stopping callout and removing LLE reference. - */ - if ((ln->la_flags & LLE_CALLOUTREF) != 0) { - LLE_REMREF(ln); - ln->la_flags &= ~LLE_CALLOUTREF; - } - - IF_AFDATA_RUN_WLOCK(ifp); - llentry_unlink(ln); - IF_AFDATA_RUN_WUNLOCK(ifp); - - llentry_free(ln); - - IF_AFDATA_CFG_WUNLOCK(ifp); - - return (next); } /* @@ -1564,6 +1654,79 @@ nd6_ioctl(u_long cmd, caddr_t data, stru return (error); } +static int +nd6_check_router(int type, int code, int is_new, int old_addr, int new_addr, + int ln_router) +{ + + /* + * ICMP6 type dependent behavior. + * + * NS: clear IsRouter if new entry + * RS: clear IsRouter + * RA: set IsRouter if there's lladdr + * redir: clear IsRouter if new entry + * + * RA case, (1): + * The spec says that we must set IsRouter in the following cases: + * - If lladdr exist, set IsRouter. This means (1-5). + * - If it is old entry (!newentry), set IsRouter. This means (7). + * So, based on the spec, in (1-5) and (7) cases we must set IsRouter. + * A quetion arises for (1) case. (1) case has no lladdr in the + * neighbor cache, this is similar to (6). + * This case is rare but we figured that we MUST NOT set IsRouter. + * + * newentry olladdr lladdr llchange NS RS RA redir + * D R + * 0 n n -- (1) c ? s + * 0 y n -- (2) c s s + * 0 n y -- (3) c s s + * 0 y y n (4) c s s + * 0 y y y (5) c s s + * 1 -- n -- (6) c c c s + * 1 -- y -- (7) c c s c s + * + * (c=clear s=set) + */ + switch (type & 0xff) { + case ND_NEIGHBOR_SOLICIT: + /* + * New entry must have is_router flag cleared. + */ + if (is_new) /* (6-7) */ + ln_router = 0; + break; + case ND_REDIRECT: + /* + * If the icmp is a redirect to a better router, always set the + * is_router flag. Otherwise, if the entry is newly created, + * clear the flag. [RFC 2461, sec 8.3] + */ + if (code == ND_REDIRECT_ROUTER) + ln_router = 1; + else if (is_new) /* (6-7) */ + ln_router = 0; + break; + case ND_ROUTER_SOLICIT: + /* + * is_router flag must always be cleared. + */ + ln_router = 0; + break; + case ND_ROUTER_ADVERT: + /* + * Mark an entry with lladdr as a router. + */ + if ((!is_new && (old_addr || new_addr)) || /* (2-5) */ + (is_new && new_addr)) { /* (7) */ + ln_router = 1; + } + break; + } + + return (ln_router); +} *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Sun Dec 7 17:32:09 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F3BC12A5; Sun, 7 Dec 2014 17:32:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DF1E5C36; Sun, 7 Dec 2014 17:32:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB7HW8s2018138; Sun, 7 Dec 2014 17:32:08 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB7HW7jk018130; Sun, 7 Dec 2014 17:32:07 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201412071732.sB7HW7jk018130@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Sun, 7 Dec 2014 17:32:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r275578 - in projects/routing/sys: net netinet netinet6 X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Dec 2014 17:32:09 -0000 Author: melifaro Date: Sun Dec 7 17:32:06 2014 New Revision: 275578 URL: https://svnweb.freebsd.org/changeset/base/275578 Log: Do not enforce particular lle storage scheme: * move lltable allocation to per-domain callbacks. * make llentry_link/unlink functions overridable llt methods. * make hash table traversal another overridable llt method. Modified: projects/routing/sys/net/if_llatbl.c projects/routing/sys/net/if_llatbl.h projects/routing/sys/netinet/if_ether.c projects/routing/sys/netinet/in.c projects/routing/sys/netinet/toecore.c projects/routing/sys/netinet6/in6.c projects/routing/sys/netinet6/nd6.c Modified: projects/routing/sys/net/if_llatbl.c ============================================================================== --- projects/routing/sys/net/if_llatbl.c Sun Dec 7 15:42:46 2014 (r275577) +++ projects/routing/sys/net/if_llatbl.c Sun Dec 7 17:32:06 2014 (r275578) @@ -71,14 +71,46 @@ static void vnet_lltable_init(void); struct rwlock lltable_rwlock; RW_SYSINIT(lltable_rwlock, &lltable_rwlock, "lltable_rwlock"); +static void lltable_unlink(struct lltable *llt); +static void llentries_unlink(struct lltable *llt, struct llentries *head); +/* Default lltable methods */ +static void llentry_link(struct lltable *llt, struct llentry *lle); +static void llentry_unlink(struct llentry *lle); +static int lltable_foreach_lle(struct lltable *llt, llt_foreach_cb_t *f, + void *farg); +static void lltable_free_tbl(struct lltable *llt); + +/* + * Runs specified callback for each entry in @llt. + * Called does the locking. + * + */ +static int +lltable_foreach_lle(struct lltable *llt, llt_foreach_cb_t *f, void *farg) +{ + struct llentry *lle, *next; + int i, error; + + error = 0; + + for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) { + LIST_FOREACH_SAFE(lle, &llt->lle_head[i], lle_next, next) { + error = f(llt, lle, farg); + if (error != 0) + break; + } + } + + return (error); +} + /* * Dump lle state for a specific address family. */ static int lltable_dump_af(struct lltable *llt, struct sysctl_req *wr) { - struct llentry *lle; - int i, error; + int error; LLTABLE_LOCK_ASSERT(); @@ -87,13 +119,8 @@ lltable_dump_af(struct lltable *llt, str error = 0; IF_AFDATA_CFG_RLOCK(llt->llt_ifp); - for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) { - LIST_FOREACH(lle, &llt->lle_head[i], lle_next) { - error = llt->llt_dump_entry(llt, lle, wr); - if (error != 0) - break; - } - } + error = lltable_foreach_lle(llt, + (llt_foreach_cb_t *)llt->llt_dump_entry, wr); IF_AFDATA_CFG_RUNLOCK(llt->llt_ifp); return (error); @@ -119,7 +146,7 @@ done: } -void +static void llentry_link(struct lltable *llt, struct llentry *lle) { struct llentries *lleh; @@ -139,7 +166,7 @@ llentry_link(struct lltable *llt, struct LIST_INSERT_HEAD(lleh, lle, lle_next); } -void +static void llentry_unlink(struct llentry *lle) { @@ -152,14 +179,13 @@ llentry_unlink(struct llentry *lle) } } -void -llentries_unlink(struct llentries *head) +static void +llentries_unlink(struct lltable *llt, struct llentries *head) { struct llentry *lle, *next; - LIST_FOREACH_SAFE(lle, head, lle_chain, next) { - llentry_unlink(lle); - } + LIST_FOREACH_SAFE(lle, head, lle_chain, next) + llt->llt_unlink_entry(lle); } /* @@ -236,36 +262,73 @@ llentry_alloc(struct ifnet *ifp, struct /* * Free all entries from given table and free itself. */ + +static int +lltable_free_cb(struct lltable *llt, struct llentry *lle, void *farg) +{ + struct llentries *dchain; + + dchain = (struct llentries *)farg; + + LLE_WLOCK(lle); + LIST_INSERT_HEAD(dchain, lle, lle_chain); + + return (0); +} + +static void +lltable_free_tbl(struct lltable *llt) +{ + + free(llt, M_LLTABLE); +} + void lltable_free(struct lltable *llt) { struct llentry *lle, *next; struct llentries dchain; - int i; KASSERT(llt != NULL, ("%s: llt is NULL", __func__)); - LLTABLE_WLOCK(); - SLIST_REMOVE(&V_lltables, llt, lltable, llt_link); - LLTABLE_WUNLOCK(); + lltable_unlink(llt); LIST_INIT(&dchain); IF_AFDATA_CFG_WLOCK(llt->llt_ifp); - for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) { - LIST_FOREACH_SAFE(lle, &llt->lle_head[i], lle_next, next) { - LLE_WLOCK(lle); - LIST_INSERT_HEAD(&dchain, lle, lle_chain); - } - } + /* Push all lles to @dchain */ + lltable_foreach_lle(llt, lltable_free_cb, &dchain); + IF_AFDATA_RUN_WLOCK(llt->llt_ifp); - llentries_unlink(&dchain); + llentries_unlink(llt, &dchain); IF_AFDATA_RUN_WUNLOCK(llt->llt_ifp); IF_AFDATA_CFG_WUNLOCK(llt->llt_ifp); LIST_FOREACH_SAFE(lle, &dchain, lle_chain, next) llt->llt_clear_entry(llt, lle); - free(llt, M_LLTABLE); + llt->llt_free_tbl(llt); +} + +struct prefix_match_data { + const struct sockaddr *prefix; + const struct sockaddr *mask; + struct llentries *dchain; + u_int flags; +}; + +static int +lltable_prefix_free_cb(struct lltable *llt, struct llentry *lle, void *farg) +{ + struct prefix_match_data *pmd; + + pmd = (struct prefix_match_data *)farg; + + if (llt->llt_match_prefix(pmd->prefix, pmd->mask, pmd->flags, lle)) { + LLE_WLOCK(lle); + LIST_INSERT_HEAD(pmd->dchain, lle, lle_chain); + } + + return (0); } static void @@ -274,20 +337,21 @@ lltable_prefix_free_af(struct lltable *l { struct llentries dchain; struct llentry *lle, *next; - int i; + struct prefix_match_data pmd; LIST_INIT(&dchain); + memset(&pmd, 0, sizeof(pmd)); + pmd.prefix = prefix; + pmd.mask = mask; + pmd.flags = flags; + pmd.dchain = &dchain; + IF_AFDATA_CFG_WLOCK(llt->llt_ifp); - for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) { - LIST_FOREACH_SAFE(lle, &llt->lle_head[i], lle_next, next) { - if (llt->llt_match_prefix(prefix, mask, flags, lle)) { - LLE_WLOCK(lle); - LIST_INSERT_HEAD(&dchain, lle, lle_chain); - } - } - } + /* Push matching lles to chain */ + lltable_foreach_lle(llt, lltable_prefix_free_cb, &pmd); + IF_AFDATA_RUN_WLOCK(llt->llt_ifp); - llentries_unlink(&dchain); + llentries_unlink(llt, &dchain); IF_AFDATA_RUN_WUNLOCK(llt->llt_ifp); IF_AFDATA_CFG_WUNLOCK(llt->llt_ifp); @@ -339,29 +403,36 @@ lltable_prefix_free(int af, struct socka LLTABLE_RUNLOCK(); } - - /* - * Create a new lltable. + * Links lltable to global llt list. */ -struct lltable * -lltable_init(struct ifnet *ifp, int af) +void +lltable_link(struct lltable *llt) { - struct lltable *llt; - register int i; - - llt = malloc(sizeof(struct lltable), M_LLTABLE, M_WAITOK); - llt->llt_af = af; - llt->llt_ifp = ifp; - for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) - LIST_INIT(&llt->lle_head[i]); + /* Provide default verions of hash table methods */ + if (llt->llt_link_entry == NULL) + llt->llt_link_entry = llentry_link; + if (llt->llt_unlink_entry == NULL) + llt->llt_unlink_entry = llentry_unlink; + if (llt->llt_foreach_entry == NULL) + llt->llt_foreach_entry = lltable_foreach_lle; + if (llt->llt_free_tbl == NULL) + llt->llt_free_tbl = lltable_free_tbl; LLTABLE_WLOCK(); SLIST_INSERT_HEAD(&V_lltables, llt, llt_link); LLTABLE_WUNLOCK(); +} + +static void +lltable_unlink(struct lltable *llt) +{ + + LLTABLE_WLOCK(); + SLIST_REMOVE(&V_lltables, llt, lltable, llt_link); + LLTABLE_WUNLOCK(); - return (llt); } /* Modified: projects/routing/sys/net/if_llatbl.h ============================================================================== --- projects/routing/sys/net/if_llatbl.h Sun Dec 7 15:42:46 2014 (r275577) +++ projects/routing/sys/net/if_llatbl.h Sun Dec 7 17:32:06 2014 (r275578) @@ -159,6 +159,13 @@ typedef uint32_t (llt_hash_t)(const stru typedef int (llt_match_prefix_t)(const struct sockaddr *, const struct sockaddr *, u_int, struct llentry *); typedef void (llt_clear_entry_t)(struct lltable *, struct llentry *); +typedef void (llt_free_tbl_t)(struct lltable *); +typedef void (llt_link_entry_t)(struct lltable *, struct llentry *); +typedef void (llt_unlink_entry_t)(struct llentry *); + +typedef int (llt_foreach_cb_t)(struct lltable *, struct llentry *, void *); +typedef int (llt_foreach_entry_t)(struct lltable *, llt_foreach_cb_t *, void *); + struct lltable { SLIST_ENTRY(lltable) llt_link; @@ -173,6 +180,10 @@ struct lltable { llt_hash_t *llt_hash; llt_match_prefix_t *llt_match_prefix; llt_clear_entry_t *llt_clear_entry; + llt_foreach_entry_t *llt_foreach_entry; + llt_link_entry_t *llt_link_entry; + llt_unlink_entry_t *llt_unlink_entry; + llt_free_tbl_t *llt_free_tbl; }; MALLOC_DECLARE(M_LLTABLE); @@ -199,7 +210,7 @@ MALLOC_DECLARE(M_LLTABLE); #define LLATBL_HASH(key, mask) \ (((((((key >> 8) ^ key) >> 8) ^ key) >> 8) ^ key) & mask) -struct lltable *lltable_init(struct ifnet *, int); +void lltable_link(struct lltable *); void lltable_free(struct lltable *); void lltable_prefix_free(int, struct sockaddr *, struct sockaddr *, u_int); @@ -208,9 +219,6 @@ void lltable_drain(int); #endif int lltable_sysctl_dumparp(int, struct sysctl_req *); -void llentry_link(struct lltable *, struct llentry *); -void llentry_unlink(struct llentry *); -void llentries_unlink(struct llentries *); size_t llentry_free(struct llentry *); struct llentry *llentry_alloc(struct ifnet *, struct lltable *, struct sockaddr_storage *); @@ -242,6 +250,19 @@ lltable_delete_lle(struct lltable *llt, return llt->llt_delete(llt, flags, l3addr); } +static __inline void +lltable_link_entry(struct lltable *llt, struct llentry *lle) +{ + + llt->llt_link_entry(llt, lle); +} + +static __inline void +lltable_unlink_entry(struct lltable *llt, struct llentry *lle) +{ + + llt->llt_unlink_entry(lle); +} int lla_rt_output(struct rt_msghdr *, struct rt_addrinfo *); Modified: projects/routing/sys/netinet/if_ether.c ============================================================================== --- projects/routing/sys/netinet/if_ether.c Sun Dec 7 15:42:46 2014 (r275577) +++ projects/routing/sys/netinet/if_ether.c Sun Dec 7 17:32:06 2014 (r275578) @@ -291,7 +291,7 @@ arp_lltable_clear_entry(struct lltable * LLE_REMREF(lle); IF_AFDATA_RUN_WLOCK(ifp); - llentry_unlink(lle); + lltable_unlink_entry(llt, lle); IF_AFDATA_RUN_WUNLOCK(ifp); IF_AFDATA_CFG_WUNLOCK(ifp); @@ -544,7 +544,7 @@ arpresolve_slow(struct ifnet *ifp, int i * No entry has been found. Link new one. */ IF_AFDATA_RUN_WLOCK(ifp); - llentry_link(LLTABLE(ifp), la); + lltable_link_entry(LLTABLE(ifp), la); IF_AFDATA_RUN_WUNLOCK(ifp); } IF_AFDATA_CFG_WUNLOCK(ifp); @@ -1076,7 +1076,7 @@ arp_update_lle_addr(struct arphdr *ah, s la->r_flags |= RLLE_VALID; if ((la->la_flags & LLE_STATIC) == 0) la->la_expire = time_uptime + V_arpt_keep; - llentry_link(LLTABLE(ifp), la); + lltable_link_entry(LLTABLE(ifp), la); IF_AFDATA_RUN_WUNLOCK(ifp); } @@ -1254,7 +1254,7 @@ arp_ifinit(struct ifnet *ifp, struct ifa bcopy(IF_LLADDR(ifp), &lle->ll_addr, ifp->if_addrlen); lle->la_flags |= (LLE_VALID | LLE_STATIC); lle->r_flags |= RLLE_VALID; - llentry_link(LLTABLE(ifp), lle); + lltable_link_entry(LLTABLE(ifp), lle); IF_AFDATA_RUN_WUNLOCK(ifp); IF_AFDATA_CFG_WUNLOCK(ifp); Modified: projects/routing/sys/netinet/in.c ============================================================================== --- projects/routing/sys/netinet/in.c Sun Dec 7 15:42:46 2014 (r275577) +++ projects/routing/sys/netinet/in.c Sun Dec 7 17:32:06 2014 (r275578) @@ -1154,7 +1154,7 @@ in_lltable_delete(struct lltable *llt, u lle->la_flags |= LLE_DELETED; EVENTHANDLER_INVOKE(lle_event, lle, LLENTRY_DELETED); IF_AFDATA_RUN_WLOCK(ifp); - llentry_unlink(lle); + lltable_unlink_entry(llt, lle); IF_AFDATA_RUN_WUNLOCK(ifp); #ifdef DIAGNOSTIC log(LOG_INFO, "ifaddr cache = %p is deleted\n", lle); @@ -1294,21 +1294,25 @@ in_domifattach(struct ifnet *ifp) { struct in_ifinfo *ii; struct lltable *llt; + int i; - ii = malloc(sizeof(struct in_ifinfo), M_IFADDR, M_WAITOK|M_ZERO); + llt = malloc(sizeof(struct lltable), M_LLTABLE, M_WAITOK | M_ZERO); + llt->llt_af = AF_INET; + llt->llt_ifp = ifp; + for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) + LIST_INIT(&llt->lle_head[i]); + + llt->llt_lookup = in_lltable_lookup; + llt->llt_create = in_lltable_create; + llt->llt_delete = in_lltable_delete; + llt->llt_dump_entry = in_lltable_dump_entry; + llt->llt_hash = in_lltable_hash; + llt->llt_clear_entry = arp_lltable_clear_entry; + llt->llt_match_prefix = in_lltable_match_prefix; + lltable_link(llt); - llt = lltable_init(ifp, AF_INET); - if (llt != NULL) { - llt->llt_lookup = in_lltable_lookup; - llt->llt_create = in_lltable_create; - llt->llt_delete = in_lltable_delete; - llt->llt_dump_entry = in_lltable_dump_entry; - llt->llt_hash = in_lltable_hash; - llt->llt_clear_entry = arp_lltable_clear_entry; - llt->llt_match_prefix = in_lltable_match_prefix; - } + ii = malloc(sizeof(struct in_ifinfo), M_IFADDR, M_WAITOK|M_ZERO); ii->ii_llt = llt; - ii->ii_igmp = igmp_domifattach(ifp); return ii; Modified: projects/routing/sys/netinet/toecore.c ============================================================================== --- projects/routing/sys/netinet/toecore.c Sun Dec 7 15:42:46 2014 (r275577) +++ projects/routing/sys/netinet/toecore.c Sun Dec 7 17:32:06 2014 (r275578) @@ -477,7 +477,7 @@ restart: * No entry has been found. Link new one. */ IF_AFDATA_RUN_WLOCK(ifp); - llentry_link(LLTABLE6(ifp), lle); + lltable_link_entry(LLTABLE6(ifp), lle); IF_AFDATA_RUN_WUNLOCK(ifp); } IF_AFDATA_CFG_WUNLOCK(ifp); Modified: projects/routing/sys/netinet6/in6.c ============================================================================== --- projects/routing/sys/netinet6/in6.c Sun Dec 7 15:42:46 2014 (r275577) +++ projects/routing/sys/netinet6/in6.c Sun Dec 7 17:32:06 2014 (r275578) @@ -2188,7 +2188,7 @@ in6_lltable_delete(struct lltable *llt, LLE_WLOCK(lle); lle->la_flags |= LLE_DELETED; IF_AFDATA_RUN_WLOCK(llt->llt_ifp); - llentry_unlink(lle); + lltable_unlink_entry(llt, lle); IF_AFDATA_RUN_WUNLOCK(llt->llt_ifp); #ifdef DIAGNOSTIC log(LOG_INFO, "ifaddr cache = %p is deleted\n", lle); @@ -2330,6 +2330,8 @@ void * in6_domifattach(struct ifnet *ifp) { struct in6_ifextra *ext; + struct lltable *llt; + int i; /* There are not IPv6-capable interfaces. */ switch (ifp->if_type) { @@ -2354,16 +2356,22 @@ in6_domifattach(struct ifnet *ifp) ext->nd_ifinfo = nd6_ifattach(ifp); ext->scope6_id = scope6_ifattach(ifp); - ext->lltable = lltable_init(ifp, AF_INET6); - if (ext->lltable != NULL) { - ext->lltable->llt_lookup = in6_lltable_lookup; - ext->lltable->llt_create = in6_lltable_create; - ext->lltable->llt_delete = in6_lltable_delete; - ext->lltable->llt_dump_entry = in6_lltable_dump_entry; - ext->lltable->llt_hash = in6_lltable_hash; - ext->lltable->llt_clear_entry = nd6_lltable_clear_entry; - ext->lltable->llt_match_prefix = in6_lltable_match_prefix; - } + + llt = malloc(sizeof(struct lltable), M_LLTABLE, M_WAITOK | M_ZERO); + llt->llt_af = AF_INET6; + llt->llt_ifp = ifp; + for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) + LIST_INIT(&llt->lle_head[i]); + + llt->llt_lookup = in6_lltable_lookup; + llt->llt_create = in6_lltable_create; + llt->llt_delete = in6_lltable_delete; + llt->llt_dump_entry = in6_lltable_dump_entry; + llt->llt_hash = in6_lltable_hash; + llt->llt_clear_entry = nd6_lltable_clear_entry; + llt->llt_match_prefix = in6_lltable_match_prefix; + lltable_link(llt); + ext->lltable = llt; ext->mld_ifinfo = mld_domifattach(ifp); Modified: projects/routing/sys/netinet6/nd6.c ============================================================================== --- projects/routing/sys/netinet6/nd6.c Sun Dec 7 15:42:46 2014 (r275577) +++ projects/routing/sys/netinet6/nd6.c Sun Dec 7 17:32:06 2014 (r275578) @@ -1120,7 +1120,7 @@ nd6_lltable_clear_entry(struct lltable * LLE_REMREF(ln); IF_AFDATA_RUN_WLOCK(ifp); - llentry_unlink(ln); + lltable_unlink_entry(llt, ln); IF_AFDATA_RUN_WUNLOCK(ifp); IF_AFDATA_CFG_WUNLOCK(ifp); @@ -1892,7 +1892,7 @@ nd6_cache_lladdr(struct ifnet *ifp, stru if (r_update != 0) { IF_AFDATA_RUN_WLOCK(ifp); if (is_newentry != 0) - llentry_link(LLTABLE6(ifp), ln); + lltable_link_entry(LLTABLE6(ifp), ln); if (lladdr != NULL) { bcopy(lladdr, &ln->ll_addr, ifp->if_addrlen); ln->la_flags |= LLE_VALID; @@ -2197,7 +2197,7 @@ nd6_output_lle(struct ifnet *ifp, struct * Link new one. */ IF_AFDATA_RUN_WLOCK(ifp); - llentry_link(LLTABLE6(ifp), lle); + lltable_link_entry(LLTABLE6(ifp), lle); IF_AFDATA_RUN_WUNLOCK(ifp); } IF_AFDATA_CFG_WUNLOCK(ifp); @@ -2485,7 +2485,7 @@ nd6_add_ifa_lle(struct in6_ifaddr *ia) bcopy(IF_LLADDR(ifp), &ln->ll_addr, ifp->if_addrlen); /* Finally, link our lle to the list */ IF_AFDATA_RUN_WLOCK(ifp); - llentry_link(LLTABLE6(ifp), ln); + lltable_link_entry(LLTABLE6(ifp), ln); IF_AFDATA_RUN_WUNLOCK(ifp); IF_AFDATA_CFG_WUNLOCK(ifp); From owner-svn-src-projects@FreeBSD.ORG Sun Dec 7 23:08:09 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 80C54B16; Sun, 7 Dec 2014 23:08:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 64442FFC; Sun, 7 Dec 2014 23:08:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB7N89MO084522; Sun, 7 Dec 2014 23:08:09 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB7N87wO084516; Sun, 7 Dec 2014 23:08:07 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201412072308.sB7N87wO084516@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Sun, 7 Dec 2014 23:08:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r275586 - in projects/routing/sys: net netinet netinet6 X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Dec 2014 23:08:09 -0000 Author: melifaro Date: Sun Dec 7 23:08:07 2014 New Revision: 275586 URL: https://svnweb.freebsd.org/changeset/base/275586 Log: * Retire abstract llentry_free() in favor of lltable_drop_entry_queue() and explicit calls to RTENTRY_FREE_LOCKED() * Use lltable_prefix_free() in arp_ifscrub to be consistent with nd6. * Rename _delete function to _delete_addr() to note that this function is used to external callers. Make this function maintain its own locking. * Use lookup/unlink/clear call chain from internal callers instead of delete_addr. * Fix LLE_DELETED flag handling Modified: projects/routing/sys/net/if_llatbl.c projects/routing/sys/net/if_llatbl.h projects/routing/sys/netinet/if_ether.c projects/routing/sys/netinet/in.c projects/routing/sys/netinet6/in6.c projects/routing/sys/netinet6/nd6.c Modified: projects/routing/sys/net/if_llatbl.c ============================================================================== --- projects/routing/sys/net/if_llatbl.c Sun Dec 7 22:30:54 2014 (r275585) +++ projects/routing/sys/net/if_llatbl.c Sun Dec 7 23:08:07 2014 (r275586) @@ -189,21 +189,17 @@ llentries_unlink(struct lltable *llt, st } /* - * Deletes an address from the address table. - * This function is called by the timer functions - * such as arptimer() and nd6_llinfo_timer(), and - * the caller does the locking. + * Helper function user to drop all mbufs in hold queue. * * Returns the number of held packets, if any, that were dropped. */ size_t -llentry_free(struct llentry *lle) +lltable_drop_entry_queue(struct llentry *lle) { size_t pkts_dropped; struct mbuf *next; LLE_WLOCK_ASSERT(lle); - KASSERT((lle->la_flags & LLE_LINKED) == 0, ("Freeing linked lle")); pkts_dropped = 0; while ((lle->la_numheld > 0) && (lle->la_hold != NULL)) { @@ -218,8 +214,6 @@ llentry_free(struct llentry *lle) ("%s: la_numheld %d > 0, pkts_droped %zd", __func__, lle->la_numheld, pkts_dropped)); - LLE_FREE_LOCKED(lle); - return (pkts_dropped); } @@ -522,9 +516,7 @@ lla_rt_output(struct rt_msghdr *rtm, str break; case RTM_DELETE: - IF_AFDATA_CFG_WLOCK(ifp); - error = (llt->llt_delete(llt, 0, dst)); - IF_AFDATA_CFG_WUNLOCK(ifp); + error = lltable_delete_addr(llt, 0, dst); return (error == 0 ? 0 : ENOENT); default: Modified: projects/routing/sys/net/if_llatbl.h ============================================================================== --- projects/routing/sys/net/if_llatbl.h Sun Dec 7 22:30:54 2014 (r275585) +++ projects/routing/sys/net/if_llatbl.h Sun Dec 7 23:08:07 2014 (r275586) @@ -151,7 +151,7 @@ typedef struct llentry *(llt_lookup_t)(s const struct sockaddr *l3addr); typedef struct llentry *(llt_create_t)(struct lltable *, u_int flags, const struct sockaddr *l3addr); -typedef int (llt_delete_t)(struct lltable *, u_int flags, +typedef int (llt_delete_addr_t)(struct lltable *, u_int flags, const struct sockaddr *l3addr); typedef int (llt_dump_entry_t)(struct lltable *, struct llentry *, struct sysctl_req *); @@ -175,7 +175,7 @@ struct lltable { llt_lookup_t *llt_lookup; llt_create_t *llt_create; - llt_delete_t *llt_delete; + llt_delete_addr_t *llt_delete_addr; llt_dump_entry_t *llt_dump_entry; llt_hash_t *llt_hash; llt_match_prefix_t *llt_match_prefix; @@ -219,10 +219,12 @@ void lltable_drain(int); #endif int lltable_sysctl_dumparp(int, struct sysctl_req *); -size_t llentry_free(struct llentry *); struct llentry *llentry_alloc(struct ifnet *, struct lltable *, struct sockaddr_storage *); +/* helper functions */ +size_t lltable_drop_entry_queue(struct llentry *); + /* * Generic link layer address lookup function. */ @@ -243,11 +245,11 @@ lltable_create_lle(struct lltable *llt, } static __inline int -lltable_delete_lle(struct lltable *llt, u_int flags, +lltable_delete_addr(struct lltable *llt, u_int flags, const struct sockaddr *l3addr) { - return llt->llt_delete(llt, flags, l3addr); + return llt->llt_delete_addr(llt, flags, l3addr); } static __inline void Modified: projects/routing/sys/netinet/if_ether.c ============================================================================== --- projects/routing/sys/netinet/if_ether.c Sun Dec 7 22:30:54 2014 (r275585) +++ projects/routing/sys/netinet/if_ether.c Sun Dec 7 23:08:07 2014 (r275586) @@ -162,16 +162,19 @@ static const struct netisr_handler arp_n void arp_ifscrub(struct ifnet *ifp, uint32_t addr) { - struct sockaddr_in addr4; + struct sockaddr_in addr4, mask4; bzero((void *)&addr4, sizeof(addr4)); addr4.sin_len = sizeof(addr4); addr4.sin_family = AF_INET; addr4.sin_addr.s_addr = addr; - IF_AFDATA_CFG_WLOCK(ifp); - lltable_delete_lle(LLTABLE(ifp), LLE_IFADDR, - (struct sockaddr *)&addr4); - IF_AFDATA_CFG_WUNLOCK(ifp); + bzero(&mask4, sizeof(mask4)); + mask4.sin_len = sizeof(mask4); + mask4.sin_family = AF_INET; + mask4.sin_addr.s_addr = INADDR_ANY; + + lltable_prefix_free(AF_INET, (struct sockaddr *)&addr4, + (struct sockaddr *)&mask4, LLE_STATIC); } #endif @@ -305,9 +308,14 @@ arp_lltable_clear_entry(struct lltable * } } - /* Finally, free entry */ - pkts_dropped = llentry_free(lle); + lle->la_flags |= LLE_DELETED; + + /* Drop hold queue */ + pkts_dropped = lltable_drop_entry_queue(lle); ARPSTAT_ADD(dropped, pkts_dropped); + + /* Finally, free entry */ + LLE_FREE_LOCKED(lle); } /* @@ -1208,8 +1216,9 @@ arp_update_lle(struct arphdr *ah, struct void arp_ifinit(struct ifnet *ifp, struct ifaddr *ifa) { - struct llentry *lle; + struct llentry *lle, *lle_tmp; struct in_addr addr; + struct lltable *llt; if (ifa->ifa_carp != NULL) return; @@ -1238,6 +1247,7 @@ arp_ifinit(struct ifnet *ifp, struct ifa } IF_AFDATA_CFG_WLOCK(ifp); + llt = LLTABLE(ifp); /* Lock or new shiny lle */ LLE_WLOCK(lle); @@ -1247,18 +1257,26 @@ arp_ifinit(struct ifnet *ifp, struct ifa * Instead of dealing with callouts/flags/etc we simply * delete it and add new one. */ - lltable_delete_lle(LLTABLE(ifp), LLE_IFADDR, + lle_tmp = lltable_lookup_lle(llt, LLE_EXCLUSIVE, (struct sockaddr *)IA_SIN(ifa)); IF_AFDATA_RUN_WLOCK(ifp); + if (lle_tmp != NULL) + lltable_unlink_entry(llt, lle_tmp); bcopy(IF_LLADDR(ifp), &lle->ll_addr, ifp->if_addrlen); lle->la_flags |= (LLE_VALID | LLE_STATIC); lle->r_flags |= RLLE_VALID; - lltable_link_entry(LLTABLE(ifp), lle); + lltable_link_entry(llt, lle); IF_AFDATA_RUN_WUNLOCK(ifp); IF_AFDATA_CFG_WUNLOCK(ifp); + /* XXX: eventhandler */ LLE_WUNLOCK(lle); + + if (lle_tmp != NULL) { + /* XXX: eventhandler */ + llt->llt_clear_entry(llt, lle_tmp); + } } void Modified: projects/routing/sys/netinet/in.c ============================================================================== --- projects/routing/sys/netinet/in.c Sun Dec 7 22:30:54 2014 (r275585) +++ projects/routing/sys/netinet/in.c Sun Dec 7 23:08:07 2014 (r275586) @@ -1137,33 +1137,38 @@ in_lltable_delete(struct lltable *llt, u struct ifnet *ifp = llt->llt_ifp; struct llentry *lle; - IF_AFDATA_CFG_WLOCK_ASSERT(ifp); + IF_AFDATA_CFG_UNLOCK_ASSERT(ifp); KASSERT(l3addr->sa_family == AF_INET, ("sin_family %d", l3addr->sa_family)); + IF_AFDATA_CFG_WLOCK(ifp); lle = in_lltable_find_dst(llt, sin->sin_addr); if (lle == NULL) { + IF_AFDATA_CFG_WUNLOCK(ifp); #ifdef DIAGNOSTIC - log(LOG_INFO, "interface address is missing from cache = %p in delete\n", lle); + log(LOG_INFO, "interface address is missing from cache = %p\n", + lle); #endif return (ENOENT); } - if (!(lle->la_flags & LLE_IFADDR) || (flags & LLE_IFADDR)) { - LLE_WLOCK(lle); - lle->la_flags |= LLE_DELETED; - EVENTHANDLER_INVOKE(lle_event, lle, LLENTRY_DELETED); - IF_AFDATA_RUN_WLOCK(ifp); - lltable_unlink_entry(llt, lle); - IF_AFDATA_RUN_WUNLOCK(ifp); + /* Skipping LLE_IFADDR record */ + if ((lle->la_flags & LLE_IFADDR) != 0 && (flags & LLE_IFADDR) == 0) { + IF_AFDATA_CFG_WUNLOCK(ifp); + return (0); + } + + LLE_WLOCK(lle); + IF_AFDATA_RUN_WLOCK(ifp); + lltable_unlink_entry(llt, lle); + IF_AFDATA_RUN_WUNLOCK(ifp); + IF_AFDATA_CFG_WUNLOCK(ifp); + + EVENTHANDLER_INVOKE(lle_event, lle, LLENTRY_DELETED); #ifdef DIAGNOSTIC log(LOG_INFO, "ifaddr cache = %p is deleted\n", lle); #endif - if ((lle->la_flags & (LLE_STATIC | LLE_IFADDR)) == LLE_STATIC) - llentry_free(lle); - else - LLE_WUNLOCK(lle); - } + llt->llt_clear_entry(llt, lle); return (0); } @@ -1304,7 +1309,7 @@ in_domifattach(struct ifnet *ifp) llt->llt_lookup = in_lltable_lookup; llt->llt_create = in_lltable_create; - llt->llt_delete = in_lltable_delete; + llt->llt_delete_addr = in_lltable_delete; llt->llt_dump_entry = in_lltable_dump_entry; llt->llt_hash = in_lltable_hash; llt->llt_clear_entry = arp_lltable_clear_entry; Modified: projects/routing/sys/netinet6/in6.c ============================================================================== --- projects/routing/sys/netinet6/in6.c Sun Dec 7 22:30:54 2014 (r275585) +++ projects/routing/sys/netinet6/in6.c Sun Dec 7 23:08:07 2014 (r275586) @@ -2173,31 +2173,40 @@ in6_lltable_delete(struct lltable *llt, const struct sockaddr *l3addr) { const struct sockaddr_in6 *sin6 = (const struct sockaddr_in6 *)l3addr; + struct ifnet *ifp; struct llentry *lle; - IF_AFDATA_CFG_WLOCK_ASSERT(llt->llt_ifp); + ifp = llt->llt_ifp; + + IF_AFDATA_CFG_UNLOCK_ASSERT(ifp); KASSERT(l3addr->sa_family == AF_INET6, ("sin_family %d", l3addr->sa_family)); + IF_AFDATA_CFG_WLOCK(ifp); lle = in6_lltable_find_dst(llt, &sin6->sin6_addr); - if (lle == NULL) + if (lle == NULL) { + IF_AFDATA_CFG_WUNLOCK(ifp); return (ENOENT); + } + + /* Skipping LLE_IFADDR record */ + if ((lle->la_flags & LLE_IFADDR) != 0 && (flags & LLE_IFADDR) == 0) { + IF_AFDATA_CFG_WUNLOCK(ifp); + return (0); + } + + LLE_WLOCK(lle); + IF_AFDATA_RUN_WLOCK(ifp); + lltable_unlink_entry(llt, lle); + IF_AFDATA_RUN_WUNLOCK(ifp); + IF_AFDATA_CFG_WUNLOCK(ifp); - if (!(lle->la_flags & LLE_IFADDR) || (flags & LLE_IFADDR)) { - LLE_WLOCK(lle); - lle->la_flags |= LLE_DELETED; - IF_AFDATA_RUN_WLOCK(llt->llt_ifp); - lltable_unlink_entry(llt, lle); - IF_AFDATA_RUN_WUNLOCK(llt->llt_ifp); #ifdef DIAGNOSTIC - log(LOG_INFO, "ifaddr cache = %p is deleted\n", lle); + log(LOG_INFO, "ifaddr cache = %p is deleted\n", lle); #endif - if ((lle->la_flags & (LLE_STATIC | LLE_IFADDR)) == LLE_STATIC) - llentry_free(lle); - else - LLE_WUNLOCK(lle); - } + EVENTHANDLER_INVOKE(lle_event, lle, LLENTRY_DELETED); + llt->llt_clear_entry(llt, lle); return (0); } @@ -2365,7 +2374,7 @@ in6_domifattach(struct ifnet *ifp) llt->llt_lookup = in6_lltable_lookup; llt->llt_create = in6_lltable_create; - llt->llt_delete = in6_lltable_delete; + llt->llt_delete_addr = in6_lltable_delete; llt->llt_dump_entry = in6_lltable_dump_entry; llt->llt_hash = in6_lltable_hash; llt->llt_clear_entry = nd6_lltable_clear_entry; Modified: projects/routing/sys/netinet6/nd6.c ============================================================================== --- projects/routing/sys/netinet6/nd6.c Sun Dec 7 22:30:54 2014 (r275585) +++ projects/routing/sys/netinet6/nd6.c Sun Dec 7 23:08:07 2014 (r275586) @@ -1081,7 +1081,7 @@ nd6_free(struct llentry *ln, int gc) if ((ln->la_flags & LLE_DELETED) != 0) { /* Unlinked entry. Stop timer/callout. */ nd6_llinfo_settimer_locked(ln, -1); - llentry_free(ln); + LLE_FREE_LOCKED(ln); return; } @@ -1132,8 +1132,13 @@ nd6_lltable_clear_entry(struct lltable * /* Check if default router needs to be recalculated */ nd6_check_recalc_defrtr(llt, ln); + /* Drop hold queue */ + lltable_drop_entry_queue(ln); + + ln->la_flags |= LLE_DELETED; + /* Finally, free entry */ - llentry_free(ln); + LLE_FREE_LOCKED(ln); } /* @@ -2460,7 +2465,8 @@ int nd6_add_ifa_lle(struct in6_ifaddr *ia) { struct ifnet *ifp; - struct llentry *ln; + struct llentry *ln, *ln_tmp; + struct lltable *llt; ifp = ia->ia_ifa.ifa_ifp; ia->ia_ifa.ifa_rtrequest = nd6_rtrequest; @@ -2476,20 +2482,36 @@ nd6_add_ifa_lle(struct in6_ifaddr *ia) ln->ln_state = ND6_LLINFO_REACHABLE; IF_AFDATA_CFG_WLOCK(ifp); + llt = LLTABLE6(ifp); /* Lock or new shiny lle */ LLE_WLOCK(ln); - lltable_delete_lle(LLTABLE6(ifp), LLE_IFADDR, + /* + * Check if we already have some corresponding entry. + * Instead of dealing with callouts/flags/etc we simply + * delete it and add new one. + */ + ln_tmp = lltable_lookup_lle(llt, LLE_EXCLUSIVE, (struct sockaddr *)&ia->ia_addr); bcopy(IF_LLADDR(ifp), &ln->ll_addr, ifp->if_addrlen); /* Finally, link our lle to the list */ IF_AFDATA_RUN_WLOCK(ifp); - lltable_link_entry(LLTABLE6(ifp), ln); + if (ln_tmp != NULL) + lltable_unlink_entry(llt, ln_tmp); + lltable_link_entry(llt, ln); IF_AFDATA_RUN_WUNLOCK(ifp); IF_AFDATA_CFG_WUNLOCK(ifp); + /* XXX: event handler? */ LLE_WUNLOCK(ln); + + if (ln_tmp != NULL) { + /* XXX: event handler ? */ + llt->llt_clear_entry(llt, ln_tmp); + } + + in6_newaddrmsg(ia, RTM_ADD); return (0); } From owner-svn-src-projects@FreeBSD.ORG Sun Dec 7 23:59:47 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A29392FE; Sun, 7 Dec 2014 23:59:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 83BDF6D8; Sun, 7 Dec 2014 23:59:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB7NxlLf009351; Sun, 7 Dec 2014 23:59:47 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB7NxjDH009339; Sun, 7 Dec 2014 23:59:45 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201412072359.sB7NxjDH009339@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Sun, 7 Dec 2014 23:59:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r275587 - in projects/routing/sys: net netinet netinet6 X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Dec 2014 23:59:47 -0000 Author: melifaro Date: Sun Dec 7 23:59:44 2014 New Revision: 275587 URL: https://svnweb.freebsd.org/changeset/base/275587 Log: Use llt_prepare_static_entry method to prepare valid per-af static entry. Modified: projects/routing/sys/net/if_llatbl.c projects/routing/sys/net/if_llatbl.h projects/routing/sys/netinet/if_ether.c projects/routing/sys/netinet/if_ether.h projects/routing/sys/netinet/in.c projects/routing/sys/netinet6/in6.c projects/routing/sys/netinet6/nd6.c projects/routing/sys/netinet6/nd6.h Modified: projects/routing/sys/net/if_llatbl.c ============================================================================== --- projects/routing/sys/net/if_llatbl.c Sun Dec 7 23:08:07 2014 (r275586) +++ projects/routing/sys/net/if_llatbl.c Sun Dec 7 23:59:44 2014 (r275587) @@ -440,7 +440,7 @@ lla_rt_output(struct rt_msghdr *rtm, str struct sockaddr *dst = (struct sockaddr *)info->rti_info[RTAX_DST]; struct ifnet *ifp; struct lltable *llt; - struct llentry *lle; + struct llentry *lle, *lle_tmp; u_int laflags = 0; int error; @@ -469,36 +469,37 @@ lla_rt_output(struct rt_msghdr *rtm, str switch (rtm->rtm_type) { case RTM_ADD: /* Add static LLE */ - IF_AFDATA_CFG_WLOCK(ifp); lle = llt->llt_create(llt, 0, dst); - if (lle == NULL) { - IF_AFDATA_CFG_WUNLOCK(ifp); + if (lle == NULL) return (ENOMEM); - } - - IF_AFDATA_RUN_WLOCK(ifp); + /* Save initial info to provide to _prepare hook */ bcopy(LLADDR(dl), &lle->ll_addr, ifp->if_addrlen); if ((rtm->rtm_flags & RTF_ANNOUNCE)) lle->la_flags |= LLE_PUB; - lle->la_flags |= LLE_VALID; -#ifdef INET6 - /* - * ND6 - */ - if (dst->sa_family == AF_INET6) - lle->ln_state = ND6_LLINFO_REACHABLE; -#endif - /* - * NB: arp and ndp always set (RTF_STATIC | RTF_HOST) - */ - - if (rtm->rtm_rmx.rmx_expire == 0) { - lle->la_flags |= LLE_STATIC; - lle->r_flags |= RLLE_VALID; - lle->la_expire = 0; - } else - lle->la_expire = rtm->rtm_rmx.rmx_expire; + lle->la_expire = rtm->rtm_rmx.rmx_expire; + + error = llt->llt_prepare_static_entry(llt, lle, info); + + if (error != 0) { + LLE_FREE(lle); + return (error); + } + + /* Let's try to link new lle to the list */ + IF_AFDATA_CFG_WLOCK(ifp); + LLE_WLOCK(lle); + /* Check if we already have this lle */ + /* XXX: Use LLE_UNLOCKED */ + lle_tmp = llt->llt_lookup(llt, LLE_EXCLUSIVE, dst); + if (lle_tmp != NULL) { + IF_AFDATA_CFG_WUNLOCK(ifp); + LLE_WUNLOCK(lle_tmp); + LLE_FREE_LOCKED(lle); + return (EEXIST); + } + + IF_AFDATA_RUN_WLOCK(ifp); llentry_link(llt, lle); IF_AFDATA_RUN_WUNLOCK(ifp); laflags = lle->la_flags; Modified: projects/routing/sys/net/if_llatbl.h ============================================================================== --- projects/routing/sys/net/if_llatbl.h Sun Dec 7 23:08:07 2014 (r275586) +++ projects/routing/sys/net/if_llatbl.h Sun Dec 7 23:59:44 2014 (r275587) @@ -162,6 +162,8 @@ typedef void (llt_clear_entry_t)(struct typedef void (llt_free_tbl_t)(struct lltable *); typedef void (llt_link_entry_t)(struct lltable *, struct llentry *); typedef void (llt_unlink_entry_t)(struct llentry *); +typedef int (llt_prepare_sentry_t)(struct lltable *, struct llentry *, + struct rt_addrinfo *); typedef int (llt_foreach_cb_t)(struct lltable *, struct llentry *, void *); typedef int (llt_foreach_entry_t)(struct lltable *, llt_foreach_cb_t *, void *); @@ -183,6 +185,7 @@ struct lltable { llt_foreach_entry_t *llt_foreach_entry; llt_link_entry_t *llt_link_entry; llt_unlink_entry_t *llt_unlink_entry; + llt_prepare_sentry_t *llt_prepare_static_entry; llt_free_tbl_t *llt_free_tbl; }; Modified: projects/routing/sys/netinet/if_ether.c ============================================================================== --- projects/routing/sys/netinet/if_ether.c Sun Dec 7 23:08:07 2014 (r275586) +++ projects/routing/sys/netinet/if_ether.c Sun Dec 7 23:59:44 2014 (r275587) @@ -268,6 +268,20 @@ arptimer(void *arg) CURVNET_RESTORE(); } +int +arp_lltable_prepare_static_entry(struct lltable *llt, struct llentry *lle, + struct rt_addrinfo *info) +{ + + lle->la_flags |= LLE_VALID; + lle->r_flags |= RLLE_VALID; + + if (lle->la_expire == 0) + lle->la_flags |= LLE_STATIC; + + return (0); +} + /* * Calback for lltable. */ Modified: projects/routing/sys/netinet/if_ether.h ============================================================================== --- projects/routing/sys/netinet/if_ether.h Sun Dec 7 23:08:07 2014 (r275586) +++ projects/routing/sys/netinet/if_ether.h Sun Dec 7 23:59:44 2014 (r275587) @@ -115,6 +115,7 @@ extern u_char ether_ipmulticast_max[ETHE struct lltable; struct llentry; struct ifaddr; +struct rt_addrinfo; int arpresolve(struct ifnet *ifp, struct rtentry *rt, struct mbuf *m, const struct sockaddr *dst, u_char *desten, struct llentry **lle); @@ -126,6 +127,8 @@ void arp_ifinit(struct ifnet *, struct i void arp_ifinit2(struct ifnet *, struct ifaddr *, u_char *); void arp_ifscrub(struct ifnet *, uint32_t); void arp_lltable_clear_entry(struct lltable *, struct llentry *); +int arp_lltable_prepare_static_entry(struct lltable *, struct llentry *, + struct rt_addrinfo *); #endif #endif Modified: projects/routing/sys/netinet/in.c ============================================================================== --- projects/routing/sys/netinet/in.c Sun Dec 7 23:08:07 2014 (r275586) +++ projects/routing/sys/netinet/in.c Sun Dec 7 23:59:44 2014 (r275587) @@ -1314,6 +1314,7 @@ in_domifattach(struct ifnet *ifp) llt->llt_hash = in_lltable_hash; llt->llt_clear_entry = arp_lltable_clear_entry; llt->llt_match_prefix = in_lltable_match_prefix; + llt->llt_prepare_static_entry = arp_lltable_prepare_static_entry; lltable_link(llt); ii = malloc(sizeof(struct in_ifinfo), M_IFADDR, M_WAITOK|M_ZERO); Modified: projects/routing/sys/netinet6/in6.c ============================================================================== --- projects/routing/sys/netinet6/in6.c Sun Dec 7 23:08:07 2014 (r275586) +++ projects/routing/sys/netinet6/in6.c Sun Dec 7 23:59:44 2014 (r275587) @@ -2379,6 +2379,7 @@ in6_domifattach(struct ifnet *ifp) llt->llt_hash = in6_lltable_hash; llt->llt_clear_entry = nd6_lltable_clear_entry; llt->llt_match_prefix = in6_lltable_match_prefix; + llt->llt_prepare_static_entry = nd6_lltable_prepare_static_entry; lltable_link(llt); ext->lltable = llt; Modified: projects/routing/sys/netinet6/nd6.c ============================================================================== --- projects/routing/sys/netinet6/nd6.c Sun Dec 7 23:08:07 2014 (r275586) +++ projects/routing/sys/netinet6/nd6.c Sun Dec 7 23:59:44 2014 (r275587) @@ -1095,6 +1095,22 @@ nd6_free(struct llentry *ln, int gc) llt->llt_clear_entry(ln->lle_tbl, ln); } +int +nd6_lltable_prepare_static_entry(struct lltable *llt, struct llentry *lle, + struct rt_addrinfo *info) +{ + + lle->la_flags |= LLE_VALID; + lle->r_flags |= RLLE_VALID; + + lle->ln_state = ND6_LLINFO_REACHABLE; + + if (lle->la_expire == 0) + lle->la_flags |= LLE_STATIC; + + return (0); +} + /* * Calback for lltable. */ Modified: projects/routing/sys/netinet6/nd6.h ============================================================================== --- projects/routing/sys/netinet6/nd6.h Sun Dec 7 23:08:07 2014 (r275586) +++ projects/routing/sys/netinet6/nd6.h Sun Dec 7 23:59:44 2014 (r275587) @@ -421,6 +421,8 @@ void nd6_rem_ifa_lle(struct in6_ifaddr * int nd6_storelladdr(struct ifnet *, struct mbuf *, const struct sockaddr *, u_char *, struct llentry **); void nd6_lltable_clear_entry(struct lltable *, struct llentry *); +int nd6_lltable_prepare_static_entry(struct lltable *, struct llentry *, + struct rt_addrinfo *); /* nd6_nbr.c */ void nd6_na_input(struct mbuf *, int, int); From owner-svn-src-projects@FreeBSD.ORG Mon Dec 8 03:36:50 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 810AE32E; Mon, 8 Dec 2014 03:36:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6B212C2C; Mon, 8 Dec 2014 03:36:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB83aoMl016742; Mon, 8 Dec 2014 03:36:50 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB83aiuK016689; Mon, 8 Dec 2014 03:36:44 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201412080336.sB83aiuK016689@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 8 Dec 2014 03:36:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r275590 - in projects/building-blocks: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libnvpair cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/opensolaris/tools/... X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Dec 2014 03:36:50 -0000 Author: ngie Date: Mon Dec 8 03:36:43 2014 New Revision: 275590 URL: https://svnweb.freebsd.org/changeset/base/275590 Log: MFhead @ r275589 Added: projects/building-blocks/cddl/contrib/opensolaris/lib/libnvpair/nvpair_json.c - copied unchanged from r275589, head/cddl/contrib/opensolaris/lib/libnvpair/nvpair_json.c projects/building-blocks/usr.bin/iscsictl/iscsi.conf.5 - copied unchanged from r275589, head/usr.bin/iscsictl/iscsi.conf.5 Deleted: projects/building-blocks/sbin/iscontrol/iscsi.conf.5 projects/building-blocks/sys/cddl/compat/opensolaris/sys/cyclic.h projects/building-blocks/sys/cddl/compat/opensolaris/sys/cyclic_impl.h projects/building-blocks/sys/cddl/dev/cyclic/ projects/building-blocks/sys/modules/cyclic/ Modified: projects/building-blocks/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c projects/building-blocks/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.h projects/building-blocks/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c projects/building-blocks/cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h projects/building-blocks/cddl/lib/libnvpair/Makefile projects/building-blocks/contrib/binutils/gas/config/tc-arm.c projects/building-blocks/lib/msun/src/e_j0.c projects/building-blocks/lib/msun/src/e_j0f.c projects/building-blocks/sbin/iscontrol/Makefile projects/building-blocks/share/misc/committers-ports.dot projects/building-blocks/share/misc/organization.dot projects/building-blocks/share/mk/bsd.compiler.mk projects/building-blocks/sys/arm/arm/cpufunc_asm_arm11x6.S projects/building-blocks/sys/arm/arm/fusu.S projects/building-blocks/sys/arm/arm/stdatomic.c projects/building-blocks/sys/arm/arm/support.S projects/building-blocks/sys/arm/mv/mv_pci.c projects/building-blocks/sys/arm/ti/ti_smc.S projects/building-blocks/sys/arm/xscale/ixp425/ixp425_a4x_io.S projects/building-blocks/sys/arm/xscale/ixp425/ixp425_pci_asm.S projects/building-blocks/sys/boot/kshim/bsd_kernel.h projects/building-blocks/sys/cam/ctl/ctl.c projects/building-blocks/sys/cam/ctl/ctl_backend.h projects/building-blocks/sys/cam/ctl/ctl_backend_block.c projects/building-blocks/sys/cam/ctl/ctl_private.h projects/building-blocks/sys/cam/ctl/ctl_ser_table.c projects/building-blocks/sys/cddl/compat/opensolaris/sys/cpuvar.h projects/building-blocks/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c projects/building-blocks/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c projects/building-blocks/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c projects/building-blocks/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c projects/building-blocks/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c projects/building-blocks/sys/cddl/contrib/opensolaris/uts/common/sys/cpuvar.h projects/building-blocks/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h projects/building-blocks/sys/cddl/contrib/opensolaris/uts/common/sys/isa_defs.h projects/building-blocks/sys/cddl/dev/fbt/fbt.c projects/building-blocks/sys/cddl/dev/profile/profile.c projects/building-blocks/sys/dev/cxgbe/adapter.h projects/building-blocks/sys/dev/cxgbe/t4_sge.c projects/building-blocks/sys/dev/usb/controller/saf1761_otg.c projects/building-blocks/sys/geom/raid/md_nvidia.c projects/building-blocks/sys/geom/raid/md_sii.c projects/building-blocks/sys/kern/kern_clocksource.c projects/building-blocks/sys/libkern/arm/ffs.S projects/building-blocks/sys/modules/Makefile projects/building-blocks/sys/modules/dtrace/Makefile.inc projects/building-blocks/sys/modules/dtrace/dtraceall/dtraceall.c projects/building-blocks/sys/netinet/sctp_input.c projects/building-blocks/sys/netinet/sctp_usrreq.c projects/building-blocks/sys/netinet/sctputil.c projects/building-blocks/sys/netinet/udp_usrreq.c projects/building-blocks/sys/netipsec/key.c projects/building-blocks/sys/sys/dtrace_bsd.h projects/building-blocks/sys/sys/param.h projects/building-blocks/sys/vm/vm_mmap.c projects/building-blocks/sys/vm/vm_object.c projects/building-blocks/usr.bin/iscsictl/Makefile projects/building-blocks/usr.bin/patch/patch.c projects/building-blocks/usr.bin/patch/pch.c projects/building-blocks/usr.sbin/ctladm/ctladm.8 Directory Properties: projects/building-blocks/ (props changed) projects/building-blocks/cddl/ (props changed) projects/building-blocks/cddl/contrib/opensolaris/ (props changed) projects/building-blocks/cddl/contrib/opensolaris/cmd/zfs/ (props changed) projects/building-blocks/cddl/contrib/opensolaris/lib/libzfs/ (props changed) projects/building-blocks/contrib/binutils/ (props changed) projects/building-blocks/sbin/ (props changed) projects/building-blocks/share/ (props changed) projects/building-blocks/sys/ (props changed) projects/building-blocks/sys/boot/ (props changed) projects/building-blocks/sys/cddl/contrib/opensolaris/ (props changed) Modified: projects/building-blocks/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- projects/building-blocks/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Mon Dec 8 03:32:26 2014 (r275589) +++ projects/building-blocks/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Mon Dec 8 03:36:43 2014 (r275590) @@ -68,6 +68,7 @@ #ifdef sun #include #include +#include #endif #include "zfs_iter.h" @@ -2390,10 +2391,9 @@ userspace_cb(void *arg, const char *doma /* SMB */ char sid[ZFS_MAXNAMELEN + 32]; uid_t id; - uint64_t classes; #ifdef sun int err; - directory_error_t e; + int flag = IDMAP_REQ_FLG_USE_CACHE; #endif smbentity = B_TRUE; @@ -2416,10 +2416,13 @@ userspace_cb(void *arg, const char *doma if (err == 0) { rid = id; if (!cb->cb_sid2posix) { - e = directory_name_from_sid(NULL, sid, &name, - &classes); - if (e != NULL) - directory_error_free(e); + if (type == USTYPE_SMB_USR) { + (void) idmap_getwinnamebyuid(rid, flag, + &name, NULL); + } else { + (void) idmap_getwinnamebygid(rid, flag, + &name, NULL); + } if (name == NULL) name = sid; } Modified: projects/building-blocks/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.h ============================================================================== --- projects/building-blocks/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.h Mon Dec 8 03:32:26 2014 (r275589) +++ projects/building-blocks/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.h Mon Dec 8 03:36:43 2014 (r275590) @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, Joyent, Inc. All rights reserved. */ #ifndef _LIBNVPAIR_H @@ -46,6 +47,7 @@ extern int nvpair_value_match_regex(nvpa char **); extern void nvlist_print(FILE *, nvlist_t *); +extern int nvlist_print_json(FILE *, nvlist_t *); extern void dump_nvlist(nvlist_t *, int); /* Copied: projects/building-blocks/cddl/contrib/opensolaris/lib/libnvpair/nvpair_json.c (from r275589, head/cddl/contrib/opensolaris/lib/libnvpair/nvpair_json.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/building-blocks/cddl/contrib/opensolaris/lib/libnvpair/nvpair_json.c Mon Dec 8 03:36:43 2014 (r275590, copy of r275589, head/cddl/contrib/opensolaris/lib/libnvpair/nvpair_json.c) @@ -0,0 +1,403 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ +/* + * Copyright (c) 2014, Joyent, Inc. + */ + +#include +#include +#include +#include +#include + +#include "libnvpair.h" + +#define FPRINTF(fp, ...) \ + do { \ + if (fprintf(fp, __VA_ARGS__) < 0) \ + return (-1); \ + } while (0) + +/* + * When formatting a string for JSON output we must escape certain characters, + * as described in RFC4627. This applies to both member names and + * DATA_TYPE_STRING values. + * + * This function will only operate correctly if the following conditions are + * met: + * + * 1. The input String is encoded in the current locale. + * + * 2. The current locale includes the Basic Multilingual Plane (plane 0) + * as defined in the Unicode standard. + * + * The output will be entirely 7-bit ASCII (as a subset of UTF-8) with all + * representable Unicode characters included in their escaped numeric form. + */ +static int +nvlist_print_json_string(FILE *fp, const char *input) +{ + mbstate_t mbr; + wchar_t c; + size_t sz; + + bzero(&mbr, sizeof (mbr)); + + FPRINTF(fp, "\""); + while ((sz = mbrtowc(&c, input, MB_CUR_MAX, &mbr)) > 0) { + switch (c) { + case '"': + FPRINTF(fp, "\\\""); + break; + case '\n': + FPRINTF(fp, "\\n"); + break; + case '\r': + FPRINTF(fp, "\\r"); + break; + case '\\': + FPRINTF(fp, "\\\\"); + break; + case '\f': + FPRINTF(fp, "\\f"); + break; + case '\t': + FPRINTF(fp, "\\t"); + break; + case '\b': + FPRINTF(fp, "\\b"); + break; + default: + if ((c >= 0x00 && c <= 0x1f) || + (c > 0x7f && c <= 0xffff)) { + /* + * Render both Control Characters and Unicode + * characters in the Basic Multilingual Plane + * as JSON-escaped multibyte characters. + */ + FPRINTF(fp, "\\u%04x", (int)(0xffff & c)); + } else if (c >= 0x20 && c <= 0x7f) { + /* + * Render other 7-bit ASCII characters directly + * and drop other, unrepresentable characters. + */ + FPRINTF(fp, "%c", (int)(0xff & c)); + } + break; + } + input += sz; + } + + if (sz == (size_t)-1 || sz == (size_t)-2) { + /* + * We last read an invalid multibyte character sequence, + * so return an error. + */ + return (-1); + } + + FPRINTF(fp, "\""); + return (0); +} + +/* + * Dump a JSON-formatted representation of an nvlist to the provided FILE *. + * This routine does not output any new-lines or additional whitespace other + * than that contained in strings, nor does it call fflush(3C). + */ +int +nvlist_print_json(FILE *fp, nvlist_t *nvl) +{ + nvpair_t *curr; + boolean_t first = B_TRUE; + + FPRINTF(fp, "{"); + + for (curr = nvlist_next_nvpair(nvl, NULL); curr; + curr = nvlist_next_nvpair(nvl, curr)) { + data_type_t type = nvpair_type(curr); + + if (!first) + FPRINTF(fp, ","); + else + first = B_FALSE; + + if (nvlist_print_json_string(fp, nvpair_name(curr)) == -1) + return (-1); + FPRINTF(fp, ":"); + + switch (type) { + case DATA_TYPE_STRING: { + char *string = fnvpair_value_string(curr); + if (nvlist_print_json_string(fp, string) == -1) + return (-1); + break; + } + + case DATA_TYPE_BOOLEAN: { + FPRINTF(fp, "true"); + break; + } + + case DATA_TYPE_BOOLEAN_VALUE: { + FPRINTF(fp, "%s", fnvpair_value_boolean_value(curr) == + B_TRUE ? "true" : "false"); + break; + } + + case DATA_TYPE_BYTE: { + FPRINTF(fp, "%hhu", fnvpair_value_byte(curr)); + break; + } + + case DATA_TYPE_INT8: { + FPRINTF(fp, "%hhd", fnvpair_value_int8(curr)); + break; + } + + case DATA_TYPE_UINT8: { + FPRINTF(fp, "%hhu", fnvpair_value_uint8_t(curr)); + break; + } + + case DATA_TYPE_INT16: { + FPRINTF(fp, "%hd", fnvpair_value_int16(curr)); + break; + } + + case DATA_TYPE_UINT16: { + FPRINTF(fp, "%hu", fnvpair_value_uint16(curr)); + break; + } + + case DATA_TYPE_INT32: { + FPRINTF(fp, "%d", fnvpair_value_int32(curr)); + break; + } + + case DATA_TYPE_UINT32: { + FPRINTF(fp, "%u", fnvpair_value_uint32(curr)); + break; + } + + case DATA_TYPE_INT64: { + FPRINTF(fp, "%lld", + (long long)fnvpair_value_int64(curr)); + break; + } + + case DATA_TYPE_UINT64: { + FPRINTF(fp, "%llu", + (unsigned long long)fnvpair_value_uint64(curr)); + break; + } + + case DATA_TYPE_HRTIME: { + hrtime_t val; + VERIFY0(nvpair_value_hrtime(curr, &val)); + FPRINTF(fp, "%llu", (unsigned long long)val); + break; + } + + case DATA_TYPE_DOUBLE: { + double val; + VERIFY0(nvpair_value_double(curr, &val)); + FPRINTF(fp, "%f", val); + break; + } + + case DATA_TYPE_NVLIST: { + if (nvlist_print_json(fp, + fnvpair_value_nvlist(curr)) == -1) + return (-1); + break; + } + + case DATA_TYPE_STRING_ARRAY: { + char **val; + uint_t valsz, i; + VERIFY0(nvpair_value_string_array(curr, &val, &valsz)); + FPRINTF(fp, "["); + for (i = 0; i < valsz; i++) { + if (i > 0) + FPRINTF(fp, ","); + if (nvlist_print_json_string(fp, val[i]) == -1) + return (-1); + } + FPRINTF(fp, "]"); + break; + } + + case DATA_TYPE_NVLIST_ARRAY: { + nvlist_t **val; + uint_t valsz, i; + VERIFY0(nvpair_value_nvlist_array(curr, &val, &valsz)); + FPRINTF(fp, "["); + for (i = 0; i < valsz; i++) { + if (i > 0) + FPRINTF(fp, ","); + if (nvlist_print_json(fp, val[i]) == -1) + return (-1); + } + FPRINTF(fp, "]"); + break; + } + + case DATA_TYPE_BOOLEAN_ARRAY: { + boolean_t *val; + uint_t valsz, i; + VERIFY0(nvpair_value_boolean_array(curr, &val, &valsz)); + FPRINTF(fp, "["); + for (i = 0; i < valsz; i++) { + if (i > 0) + FPRINTF(fp, ","); + FPRINTF(fp, val[i] == B_TRUE ? + "true" : "false"); + } + FPRINTF(fp, "]"); + break; + } + + case DATA_TYPE_BYTE_ARRAY: { + uchar_t *val; + uint_t valsz, i; + VERIFY0(nvpair_value_byte_array(curr, &val, &valsz)); + FPRINTF(fp, "["); + for (i = 0; i < valsz; i++) { + if (i > 0) + FPRINTF(fp, ","); + FPRINTF(fp, "%hhu", val[i]); + } + FPRINTF(fp, "]"); + break; + } + + case DATA_TYPE_UINT8_ARRAY: { + uint8_t *val; + uint_t valsz, i; + VERIFY0(nvpair_value_uint8_array(curr, &val, &valsz)); + FPRINTF(fp, "["); + for (i = 0; i < valsz; i++) { + if (i > 0) + FPRINTF(fp, ","); + FPRINTF(fp, "%hhu", val[i]); + } + FPRINTF(fp, "]"); + break; + } + + case DATA_TYPE_INT8_ARRAY: { + int8_t *val; + uint_t valsz, i; + VERIFY0(nvpair_value_int8_array(curr, &val, &valsz)); + FPRINTF(fp, "["); + for (i = 0; i < valsz; i++) { + if (i > 0) + FPRINTF(fp, ","); + FPRINTF(fp, "%hhd", val[i]); + } + FPRINTF(fp, "]"); + break; + } + + case DATA_TYPE_UINT16_ARRAY: { + uint16_t *val; + uint_t valsz, i; + VERIFY0(nvpair_value_uint16_array(curr, &val, &valsz)); + FPRINTF(fp, "["); + for (i = 0; i < valsz; i++) { + if (i > 0) + FPRINTF(fp, ","); + FPRINTF(fp, "%hu", val[i]); + } + FPRINTF(fp, "]"); + break; + } + + case DATA_TYPE_INT16_ARRAY: { + int16_t *val; + uint_t valsz, i; + VERIFY0(nvpair_value_int16_array(curr, &val, &valsz)); + FPRINTF(fp, "["); + for (i = 0; i < valsz; i++) { + if (i > 0) + FPRINTF(fp, ","); + FPRINTF(fp, "%hd", val[i]); + } + FPRINTF(fp, "]"); + break; + } + + case DATA_TYPE_UINT32_ARRAY: { + uint32_t *val; + uint_t valsz, i; + VERIFY0(nvpair_value_uint32_array(curr, &val, &valsz)); + FPRINTF(fp, "["); + for (i = 0; i < valsz; i++) { + if (i > 0) + FPRINTF(fp, ","); + FPRINTF(fp, "%u", val[i]); + } + FPRINTF(fp, "]"); + break; + } + + case DATA_TYPE_INT32_ARRAY: { + int32_t *val; + uint_t valsz, i; + VERIFY0(nvpair_value_int32_array(curr, &val, &valsz)); + FPRINTF(fp, "["); + for (i = 0; i < valsz; i++) { + if (i > 0) + FPRINTF(fp, ","); + FPRINTF(fp, "%d", val[i]); + } + FPRINTF(fp, "]"); + break; + } + + case DATA_TYPE_UINT64_ARRAY: { + uint64_t *val; + uint_t valsz, i; + VERIFY0(nvpair_value_uint64_array(curr, &val, &valsz)); + FPRINTF(fp, "["); + for (i = 0; i < valsz; i++) { + if (i > 0) + FPRINTF(fp, ","); + FPRINTF(fp, "%llu", + (unsigned long long)val[i]); + } + FPRINTF(fp, "]"); + break; + } + + case DATA_TYPE_INT64_ARRAY: { + int64_t *val; + uint_t valsz, i; + VERIFY0(nvpair_value_int64_array(curr, &val, &valsz)); + FPRINTF(fp, "["); + for (i = 0; i < valsz; i++) { + if (i > 0) + FPRINTF(fp, ","); + FPRINTF(fp, "%lld", (long long)val[i]); + } + FPRINTF(fp, "]"); + break; + } + + case DATA_TYPE_UNKNOWN: + return (-1); + } + } + + FPRINTF(fp, "}"); + return (0); +} Modified: projects/building-blocks/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- projects/building-blocks/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Mon Dec 8 03:32:26 2014 (r275589) +++ projects/building-blocks/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Mon Dec 8 03:36:43 2014 (r275590) @@ -2615,7 +2615,7 @@ userquota_propname_decode(const char *pr boolean_t isuser; domain[0] = '\0'; - + *ridp = 0; /* Figure out the property type ({user|group}{quota|space}) */ for (type = 0; type < ZFS_NUM_USERQUOTA_PROPS; type++) { if (strncmp(propname, zfs_userquota_prop_prefixes[type], @@ -2637,23 +2637,46 @@ userquota_propname_decode(const char *pr * It's a SID name (eg "user@domain") that needs to be * turned into S-1-domainID-RID. */ - directory_error_t e; + int flag = 0; + idmap_stat stat, map_stat; + uid_t pid; + idmap_rid_t rid; + idmap_get_handle_t *gh = NULL; + + stat = idmap_get_create(&gh); + if (stat != IDMAP_SUCCESS) { + idmap_get_destroy(gh); + return (ENOMEM); + } if (zoned && getzoneid() == GLOBAL_ZONEID) return (ENOENT); if (isuser) { - e = directory_sid_from_user_name(NULL, - cp, &numericsid); + stat = idmap_getuidbywinname(cp, NULL, flag, &pid); + if (stat < 0) + return (ENOENT); + stat = idmap_get_sidbyuid(gh, pid, flag, &numericsid, + &rid, &map_stat); } else { - e = directory_sid_from_group_name(NULL, - cp, &numericsid); + stat = idmap_getgidbywinname(cp, NULL, flag, &pid); + if (stat < 0) + return (ENOENT); + stat = idmap_get_sidbygid(gh, pid, flag, &numericsid, + &rid, &map_stat); + } + if (stat < 0) { + idmap_get_destroy(gh); + return (ENOENT); } - if (e != NULL) { - directory_error_free(e); + stat = idmap_get_mappings(gh); + idmap_get_destroy(gh); + + if (stat < 0) { return (ENOENT); } if (numericsid == NULL) return (ENOENT); cp = numericsid; + *ridp = rid; /* will be further decoded below */ #else /* !sun */ return (ENOENT); @@ -2663,12 +2686,15 @@ userquota_propname_decode(const char *pr if (strncmp(cp, "S-1-", 4) == 0) { /* It's a numeric SID (eg "S-1-234-567-89") */ (void) strlcpy(domain, cp, domainlen); - cp = strrchr(domain, '-'); - *cp = '\0'; - cp++; - errno = 0; - *ridp = strtoull(cp, &end, 10); + if (*ridp == 0) { + cp = strrchr(domain, '-'); + *cp = '\0'; + cp++; + *ridp = strtoull(cp, &end, 10); + } else { + end = ""; + } if (numericsid) { free(numericsid); numericsid = NULL; Modified: projects/building-blocks/cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h ============================================================================== --- projects/building-blocks/cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h Mon Dec 8 03:32:26 2014 (r275589) +++ projects/building-blocks/cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h Mon Dec 8 03:36:43 2014 (r275590) @@ -26,8 +26,6 @@ #ifndef _CTFTOOLS_H #define _CTFTOOLS_H -#pragma ident "%Z%%M% %I% %E% SMI" - /* * Functions and data structures used in the manipulation of stabs and CTF data */ @@ -39,6 +37,8 @@ #include #include +#include + #ifdef __cplusplus extern "C" { #endif @@ -435,8 +435,8 @@ int streq(const char *, const char *); int findelfsecidx(Elf *, const char *, const char *); size_t elf_ptrsz(Elf *); char *mktmpname(const char *, const char *); -void terminate(const char *, ...); -void aborterr(const char *, ...); +void terminate(const char *, ...) __NORETURN; +void aborterr(const char *, ...) __NORETURN; void set_terminate_cleanup(void (*)(void)); void elfterminate(const char *, const char *, ...); void warning(const char *, ...); Modified: projects/building-blocks/cddl/lib/libnvpair/Makefile ============================================================================== --- projects/building-blocks/cddl/lib/libnvpair/Makefile Mon Dec 8 03:32:26 2014 (r275589) +++ projects/building-blocks/cddl/lib/libnvpair/Makefile Mon Dec 8 03:36:43 2014 (r275590) @@ -9,6 +9,7 @@ SRCS= libnvpair.c \ nvpair_alloc_system.c \ nvpair_alloc_fixed.c \ nvpair.c \ + nvpair_json.c \ fnvpair.c WARNS?= 0 Modified: projects/building-blocks/contrib/binutils/gas/config/tc-arm.c ============================================================================== --- projects/building-blocks/contrib/binutils/gas/config/tc-arm.c Mon Dec 8 03:32:26 2014 (r275589) +++ projects/building-blocks/contrib/binutils/gas/config/tc-arm.c Mon Dec 8 03:36:43 2014 (r275590) @@ -6789,7 +6789,11 @@ do_co_reg (void) { inst.instruction |= inst.operands[0].reg << 8; inst.instruction |= inst.operands[1].imm << 21; - inst.instruction |= inst.operands[2].reg << 12; + /* If this is a vector we are using the APSR_nzcv syntax, encode as r15 */ + if (inst.operands[2].isvec != 0) + inst.instruction |= 15 << 12; + else + inst.instruction |= inst.operands[2].reg << 12; inst.instruction |= inst.operands[3].reg << 16; inst.instruction |= inst.operands[4].reg; inst.instruction |= inst.operands[5].imm << 5; Modified: projects/building-blocks/lib/msun/src/e_j0.c ============================================================================== --- projects/building-blocks/lib/msun/src/e_j0.c Mon Dec 8 03:32:26 2014 (r275589) +++ projects/building-blocks/lib/msun/src/e_j0.c Mon Dec 8 03:36:43 2014 (r275590) @@ -115,7 +115,7 @@ __ieee754_j0(double x) if(ix<0x3f200000) { /* |x| < 2**-13 */ if(huge+x>one) { /* raise inexact if x != 0 */ if(ix<0x3e400000) return one; /* |x|<2**-27 */ - else return one - 0.25*x*x; + else return one - x*x/4; } } z = x*x; Modified: projects/building-blocks/lib/msun/src/e_j0f.c ============================================================================== --- projects/building-blocks/lib/msun/src/e_j0f.c Mon Dec 8 03:32:26 2014 (r275589) +++ projects/building-blocks/lib/msun/src/e_j0f.c Mon Dec 8 03:36:43 2014 (r275590) @@ -69,10 +69,10 @@ __ieee754_j0f(float x) } return z; } - if(ix<0x39000000) { /* |x| < 2**-13 */ + if(ix<0x3c000000) { /* |x| < 2**-7 */ if(huge+x>one) { /* raise inexact if x != 0 */ - if(ix<0x32000000) return one; /* |x|<2**-27 */ - else return one - (float)0.25*x*x; + if(ix<0x39800000) return one; /* |x|<2**-12 */ + else return one - x*x/4; } } z = x*x; Modified: projects/building-blocks/sbin/iscontrol/Makefile ============================================================================== --- projects/building-blocks/sbin/iscontrol/Makefile Mon Dec 8 03:32:26 2014 (r275589) +++ projects/building-blocks/sbin/iscontrol/Makefile Mon Dec 8 03:36:43 2014 (r275590) @@ -8,6 +8,6 @@ S= ${.CURDIR}/../../sys WARNS?= 3 CFLAGS+= -I$S -MAN= iscsi.conf.5 iscontrol.8 +MAN= iscontrol.8 .include Modified: projects/building-blocks/share/misc/committers-ports.dot ============================================================================== --- projects/building-blocks/share/misc/committers-ports.dot Mon Dec 8 03:32:26 2014 (r275589) +++ projects/building-blocks/share/misc/committers-ports.dot Mon Dec 8 03:36:43 2014 (r275590) @@ -126,6 +126,7 @@ josef [label="Josef El-Rayes\njosef@Free jpaetzel [label="Josh Paetzel\njpaetzel@FreeBSD.org\n2008/09/05"] jsa [label="Joseph S. Atkinson\njsa@FreeBSD.org\n2010/07/15"] jylefort [label="Jean-Yves Lefort\njylefort@FreeBSD.org\n2005/04/12"] +kami [label="Dominic Fandrey\nkami@FreeBSD.org\n2014/09/09"] kevlo [label="Kevin Lo\nkevlo@FreeBSD.org\n2003/02/21"] kmoore [label="Kris Moore\nkmoore@FreeBSD.org\n2009/04/14"] knu [label="Akinori Musha\nknu@FreeBSD.org\n2000/03/22"] @@ -190,6 +191,7 @@ rodrigo [label="Rodrigo Osorio\nrodrigo@ romain [label="Romain Tartiere\nromain@FreeBSD.org\n2010/01/24"] sahil [label="Sahil Tandon\nsahil@FreeBSD.org\n2010/04/11"] sat [label="Andrew Pantyukhin\nsat@FreeBSD.org\n2006/05/06"] +sbruno [label="Sean Bruno\nsbruno@FreeBSD.org\n2014/09/14"] sbz [label="Sofian Brabez\nsbz@FreeBSD.org\n2011/03/14"] scheidell [label="Michael Scheidell\nscheidell@FreeBSD.org\n2011/11/06"] sem [label="Sergey Matveychuk\nsem@FreeBSD.org\n2004/07/07"] @@ -256,14 +258,17 @@ avilla -> jhale avilla -> rakuco bdrewery -> dbn +bdrewery -> sbruno bdrewery -> trociny bapt -> bdrewery bapt -> eadler +bapt -> grembo bapt -> jlaffaye bapt -> marius bapt -> marino bapt -> rodrigo +bapt -> sbruno beat -> decke beat -> marius @@ -291,6 +296,8 @@ crees -> madpilot crees -> gblach crees -> tijl +cs -> kami + culot -> danilo culot -> jase culot -> marino @@ -339,6 +346,7 @@ fjoe -> osa flo -> bar flo -> jase +flo -> grembo flz -> garga flz -> johans @@ -389,6 +397,7 @@ knu -> maho knu -> nobutaka knu -> nork +koobs -> kami koobs -> xmj krion -> brooks Modified: projects/building-blocks/share/misc/organization.dot ============================================================================== --- projects/building-blocks/share/misc/organization.dot Mon Dec 8 03:32:26 2014 (r275589) +++ projects/building-blocks/share/misc/organization.dot Mon Dec 8 03:36:43 2014 (r275590) @@ -30,7 +30,7 @@ coresecretary [label="Core Team Secretar doccommitters [label="Doc/www Committers\ndoc-committers@FreeBSD.org"] doceng [label="Documentation Engineering Team\ndoceng@FreeBSD.org\ngjb, blackend,\ngabor, hrs"] portscommitters [label="Ports Committers\nports-committers@FreeBSD.org"] -portmgr [label="Port Management Team\nportmgr@FreeBSD.org\nantoine, bapt, bdrewery,\ndecke, erwin, mat,\nmiwi, swills, tabthorpe"] +portmgr [label="Port Management Team\nportmgr@FreeBSD.org\nantoine, bapt, bdrewery,\ndecke, erwin, mat, swills"] portmgrsecretary [label="Port Management Team Secretary\nportmgr-secretary@FreeBSD.org\nculot"] re [label="Primary Release Engineering Team\nre@FreeBSD.org\nkib, blackend, jpaetzel, hrs, kensmith"] secteam [label="Security Team\nsecteam@FreeBSD.org\nsimon, qingli, delphij,\nremko, philip, stas, cperciva,\ncsjp, rwatson, miwi, bz"] Modified: projects/building-blocks/share/mk/bsd.compiler.mk ============================================================================== --- projects/building-blocks/share/mk/bsd.compiler.mk Mon Dec 8 03:32:26 2014 (r275589) +++ projects/building-blocks/share/mk/bsd.compiler.mk Mon Dec 8 03:36:43 2014 (r275590) @@ -25,7 +25,7 @@ .if !target(____) ____: -.if !defined(COMPILER_TYPE) && !defined(COMPILER_VERSION) +.if !defined(COMPILER_TYPE) || !defined(COMPILER_VERSION) _v!= ${CC} --version 2>/dev/null || echo 0.0.0 .if !defined(COMPILER_TYPE) . if ${CC:T:M*gcc*} Modified: projects/building-blocks/sys/arm/arm/cpufunc_asm_arm11x6.S ============================================================================== --- projects/building-blocks/sys/arm/arm/cpufunc_asm_arm11x6.S Mon Dec 8 03:32:26 2014 (r275589) +++ projects/building-blocks/sys/arm/arm/cpufunc_asm_arm11x6.S Mon Dec 8 03:36:43 2014 (r275590) @@ -62,7 +62,7 @@ #include __FBSDID("$FreeBSD$"); - .cpu arm1136js + .cpu arm1176jz-s #if 0 #define Invalidate_I_cache(Rtmp1, Rtmp2) \ Modified: projects/building-blocks/sys/arm/arm/fusu.S ============================================================================== --- projects/building-blocks/sys/arm/arm/fusu.S Mon Dec 8 03:32:26 2014 (r275589) +++ projects/building-blocks/sys/arm/arm/fusu.S Mon Dec 8 03:36:43 2014 (r275590) @@ -38,6 +38,8 @@ #include "assym.s" __FBSDID("$FreeBSD$"); + .syntax unified + #ifdef _ARM_ARCH_6 #define GET_PCB(tmp) \ mrc p15, 0, tmp, c13, c0, 4; \ @@ -83,7 +85,7 @@ EENTRY_NP(casuword32) ldrt r5, [r0] cmp r5, r1 movne r0, r5 - streqt r2, [r0] + strteq r2, [r0] #endif moveq r0, r1 2: @@ -269,7 +271,7 @@ _C_LABEL(fusubailout): fusupcbfaulttext: .asciz "Yikes - no valid PCB during fusuxxx() addr=%08x\n" - .align 0 + .align 2 #endif /* Modified: projects/building-blocks/sys/arm/arm/stdatomic.c ============================================================================== --- projects/building-blocks/sys/arm/arm/stdatomic.c Mon Dec 8 03:32:26 2014 (r275589) +++ projects/building-blocks/sys/arm/arm/stdatomic.c Mon Dec 8 03:36:43 2014 (r275590) @@ -850,8 +850,13 @@ EMIT_FETCH_AND_OP_N(N, uintN_t, ldr, str EMIT_FETCH_AND_OP_N(N, uintN_t, ldr, str, fetch_and_sub, "sub") \ EMIT_FETCH_AND_OP_N(N, uintN_t, ldr, str, fetch_and_xor, "eor") +#ifdef __clang__ +EMIT_ALL_OPS_N(1, uint8_t, "ldrb", "strb", "strbeq") +EMIT_ALL_OPS_N(2, uint16_t, "ldrh", "strh", "strheq") +#else EMIT_ALL_OPS_N(1, uint8_t, "ldrb", "strb", "streqb") EMIT_ALL_OPS_N(2, uint16_t, "ldrh", "strh", "streqh") +#endif EMIT_ALL_OPS_N(4, uint32_t, "ldr", "str", "streq") #ifndef __clang__ Modified: projects/building-blocks/sys/arm/arm/support.S ============================================================================== --- projects/building-blocks/sys/arm/arm/support.S Mon Dec 8 03:32:26 2014 (r275589) +++ projects/building-blocks/sys/arm/arm/support.S Mon Dec 8 03:36:43 2014 (r275590) @@ -1364,6 +1364,8 @@ ENTRY(memcpy) strbge r2, [r3], #0x01 strbgt ip, [r3] RET +/* Place a literal pool here for the above ldr instructions to use */ +.ltorg /* Modified: projects/building-blocks/sys/arm/mv/mv_pci.c ============================================================================== --- projects/building-blocks/sys/arm/mv/mv_pci.c Mon Dec 8 03:32:26 2014 (r275589) +++ projects/building-blocks/sys/arm/mv/mv_pci.c Mon Dec 8 03:36:43 2014 (r275590) @@ -1171,7 +1171,7 @@ mv_pcib_alloc_msi(device_t dev, device_t for (i = start; i < start + count; i++) { setbit(&sc->sc_msi_bitmap, i); - irqs[i] = MSI_IRQ + i; + *irqs++ = MSI_IRQ + i; } debugf("%s: start: %x count: %x\n", __func__, start, count); Modified: projects/building-blocks/sys/arm/ti/ti_smc.S ============================================================================== --- projects/building-blocks/sys/arm/ti/ti_smc.S Mon Dec 8 03:32:26 2014 (r275589) +++ projects/building-blocks/sys/arm/ti/ti_smc.S Mon Dec 8 03:36:43 2014 (r275590) @@ -26,7 +26,7 @@ #include __FBSDID("$FreeBSD$"); - .arch armv7a + .cpu cortex-a8 .arch_extension sec /* Issue a smc #0 call */ Modified: projects/building-blocks/sys/arm/xscale/ixp425/ixp425_a4x_io.S ============================================================================== --- projects/building-blocks/sys/arm/xscale/ixp425/ixp425_a4x_io.S Mon Dec 8 03:32:26 2014 (r275589) +++ projects/building-blocks/sys/arm/xscale/ixp425/ixp425_a4x_io.S Mon Dec 8 03:36:43 2014 (r275590) @@ -56,6 +56,7 @@ ENTRY(a4x_bs_r_1) ldr r0, [r1, r2, LSL #2] and r0, r0, #0xff mov pc, lr +END(a4x_bs_r_1) ENTRY(a4x_bs_r_2) ldr r0, [r1, r2, LSL #2] @@ -63,10 +64,12 @@ ENTRY(a4x_bs_r_2) orr r1, r1, r1, lsl #8 and r0, r0, r1 mov pc, lr +END(a4x_bs_r_2) ENTRY(a4x_bs_r_4) ldr r0, [r1, r2, LSL #2] mov pc, lr +END(a4x_bs_r_4) /* * Write single @@ -75,6 +78,7 @@ ENTRY(a4x_bs_w_1) and r3, r3, #0xff str r3, [r1, r2, LSL #2] mov pc, lr +END(a4x_bs_w_1) ENTRY(a4x_bs_w_2) mov r0, #0xff @@ -82,10 +86,12 @@ ENTRY(a4x_bs_w_2) and r3, r3, r0 str r3, [r1, r2, LSL #2] mov pc, lr +END(a4x_bs_w_2) ENTRY(a4x_bs_w_4) str r3, [r1, r2, LSL #2] mov pc, lr +END(a4x_bs_w_4) /* * Read multiple @@ -101,6 +107,7 @@ ENTRY(a4x_bs_rm_1) strb r3, [r1], #1 bne 1b mov pc, lr +END(a4x_bs_rm_1) ENTRY(a4x_bs_rm_2) add r0, r1, r2, lsl #2 @@ -113,6 +120,7 @@ ENTRY(a4x_bs_rm_2) strh r3, [r1], #2 bne 1b mov pc, lr +END(a4x_bs_rm_2) /* * Write multiple @@ -128,6 +136,7 @@ ENTRY(a4x_bs_wm_1) str r3, [r0] bne 1b mov pc, lr +END(a4x_bs_wm_1) ENTRY(a4x_bs_wm_2) add r0, r1, r2, lsl #2 @@ -140,3 +149,4 @@ ENTRY(a4x_bs_wm_2) str r3, [r0] bne 1b mov pc, lr +END(a4x_bs_wm_2) Modified: projects/building-blocks/sys/arm/xscale/ixp425/ixp425_pci_asm.S ============================================================================== --- projects/building-blocks/sys/arm/xscale/ixp425/ixp425_pci_asm.S Mon Dec 8 03:32:26 2014 (r275589) +++ projects/building-blocks/sys/arm/xscale/ixp425/ixp425_pci_asm.S Mon Dec 8 03:36:43 2014 (r275590) @@ -58,6 +58,7 @@ ENTRY(ixp425_pci_mem_bs_r_1) ldrb r0, [r1, r2] #endif /* __ARMEB__ */ mov pc, lr +END(ixp425_pci_mem_bs_r_1) ENTRY(ixp425_pci_mem_bs_r_2) #ifdef __ARMEB__ @@ -68,10 +69,12 @@ ENTRY(ixp425_pci_mem_bs_r_2) ldrh r0, [r1, r2] #endif /* __ARMEB__ */ mov pc, lr +END(ixp425_pci_mem_bs_r_2) ENTRY(ixp425_pci_mem_bs_r_4) ldr r0, [r1, r2] mov pc, lr +END(ixp425_pci_mem_bs_r_4) /* * write single @@ -86,6 +89,7 @@ ENTRY(ixp425_pci_mem_bs_w_1) strb r3, [r1, r2] #endif /* __ARMEB__ */ mov pc, lr +END(ixp425_pci_mem_bs_w_1) ENTRY(ixp425_pci_mem_bs_w_2) #ifdef __ARMEB__ @@ -96,7 +100,9 @@ ENTRY(ixp425_pci_mem_bs_w_2) strh r3, [r1, r2] #endif /* __ARMEB__ */ mov pc, lr +END(ixp425_pci_mem_bs_w_2) ENTRY(ixp425_pci_mem_bs_w_4) str r3, [r1, r2] mov pc, lr +END(ixp425_pci_mem_bs_w_4) Modified: projects/building-blocks/sys/boot/kshim/bsd_kernel.h ============================================================================== --- projects/building-blocks/sys/boot/kshim/bsd_kernel.h Mon Dec 8 03:32:26 2014 (r275589) +++ projects/building-blocks/sys/boot/kshim/bsd_kernel.h Mon Dec 8 03:36:43 2014 (r275590) @@ -109,6 +109,8 @@ SYSINIT_ENTRY(uniq##_entry, "sysuninit", #define cold 0 #define BUS_PROBE_GENERIC 0 #define CALLOUT_RETURNUNLOCKED 0x1 +#undef ffs +#define ffs(x) __builtin_ffs(x) #undef va_list #define va_list __builtin_va_list #undef va_size Modified: projects/building-blocks/sys/cam/ctl/ctl.c ============================================================================== --- projects/building-blocks/sys/cam/ctl/ctl.c Mon Dec 8 03:32:26 2014 (r275589) +++ projects/building-blocks/sys/cam/ctl/ctl.c Mon Dec 8 03:36:43 2014 (r275590) @@ -433,7 +433,9 @@ static int ctl_inquiry_evpd_lbp(struct c static int ctl_inquiry_evpd(struct ctl_scsiio *ctsio); static int ctl_inquiry_std(struct ctl_scsiio *ctsio); static int ctl_get_lba_len(union ctl_io *io, uint64_t *lba, uint64_t *len); -static ctl_action ctl_extent_check(union ctl_io *io1, union ctl_io *io2); +static ctl_action ctl_extent_check(union ctl_io *io1, union ctl_io *io2, + bool seq); +static ctl_action ctl_extent_check_seq(union ctl_io *io1, union ctl_io *io2); static ctl_action ctl_check_for_blockage(struct ctl_lun *lun, union ctl_io *pending_io, union ctl_io *ooa_io); static ctl_action ctl_check_ooa(struct ctl_lun *lun, union ctl_io *pending_io, @@ -4347,8 +4349,7 @@ ctl_init_log_page_index(struct ctl_lun * continue; if (page_index->page_code == SLS_LOGICAL_BLOCK_PROVISIONING && - ((lun->be_lun->flags & CTL_LUN_FLAG_UNMAP) == 0 || - lun->backend->lun_attr == NULL)) + lun->backend->lun_attr == NULL) continue; if (page_index->page_code != prev) { @@ -4591,6 +4592,17 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft if (value != NULL && strcmp(value, "on") == 0) lun->flags |= CTL_LUN_READONLY; + lun->serseq = CTL_LUN_SERSEQ_OFF; + if (be_lun->flags & CTL_LUN_FLAG_SERSEQ_READ) + lun->serseq = CTL_LUN_SERSEQ_READ; + value = ctl_get_opt(&be_lun->options, "serseq"); + if (value != NULL && strcmp(value, "on") == 0) + lun->serseq = CTL_LUN_SERSEQ_ON; + else if (value != NULL && strcmp(value, "read") == 0) + lun->serseq = CTL_LUN_SERSEQ_READ; + else if (value != NULL && strcmp(value, "off") == 0) + lun->serseq = CTL_LUN_SERSEQ_OFF; + lun->ctl_softc = ctl_softc; TAILQ_INIT(&lun->ooa_queue); TAILQ_INIT(&lun->blocked_queue); @@ -10253,8 +10265,8 @@ ctl_inquiry_evpd_lbp(struct ctl_scsiio * lbp_ptr->page_code = SVPD_LBP; scsi_ulto2b(sizeof(*lbp_ptr) - 4, lbp_ptr->page_length); + lbp_ptr->threshold_exponent = CTL_LBP_EXPONENT; if (lun != NULL && lun->be_lun->flags & CTL_LUN_FLAG_UNMAP) { - lbp_ptr->threshold_exponent = CTL_LBP_EXPONENT; lbp_ptr->flags = SVPD_LBP_UNMAP | SVPD_LBP_WS16 | SVPD_LBP_WS10 | SVPD_LBP_RZ | SVPD_LBP_ANC_SUP; lbp_ptr->prov_type = SVPD_LBP_THIN; @@ -10753,15 +10765,15 @@ ctl_get_lba_len(union ctl_io *io, uint64 } static ctl_action -ctl_extent_check_lba(uint64_t lba1, uint64_t len1, uint64_t lba2, uint64_t len2) +ctl_extent_check_lba(uint64_t lba1, uint64_t len1, uint64_t lba2, uint64_t len2, + bool seq) { uint64_t endlba1, endlba2; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Mon Dec 8 06:33:50 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DAFE8258; Mon, 8 Dec 2014 06:33:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ADBBFE4E; Mon, 8 Dec 2014 06:33:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB86XopW010824; Mon, 8 Dec 2014 06:33:50 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB86XorQ010822; Mon, 8 Dec 2014 06:33:50 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201412080633.sB86XorQ010822@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 8 Dec 2014 06:33:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r275596 - in projects/building-blocks: . usr.bin/vi X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Dec 2014 06:33:51 -0000 Author: ngie Date: Mon Dec 8 06:33:49 2014 New Revision: 275596 URL: https://svnweb.freebsd.org/changeset/base/275596 Log: Push the build-tools logic down into Makefile.inc1 so it's localized all in one spot, and the potential for installing to the wrong DESTDIR is lower Modified: projects/building-blocks/Makefile.inc1 projects/building-blocks/usr.bin/vi/Makefile Modified: projects/building-blocks/Makefile.inc1 ============================================================================== --- projects/building-blocks/Makefile.inc1 Mon Dec 8 06:10:47 2014 (r275595) +++ projects/building-blocks/Makefile.inc1 Mon Dec 8 06:33:49 2014 (r275596) @@ -1390,11 +1390,12 @@ build-tools: .MAKE .endfor .for _tool in \ usr.bin/vi - ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools,install)"; \ + ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ cd ${.CURDIR}/${_tool} && \ ${MAKE} DIRPRFX=${_tool}/ obj && \ - ${MAKE} DIRPRFX=${_tool}/ build-tools DESTDIR=${WORLDTMP}/ \ - MK_MAN=no + ${MAKE} DIRPRFX=${_tool}/ depend MK_MAN=no SUBDIR= && \ + ${MAKE} DIRPRFX=${_tool}/ all MK_MAN=no SUBDIR= && \ + ${MAKE} DIRPRFX=${_tool}/ install MK_MAN=no SUBDIR= DESTDIR=${WORLDTMP}/ .endfor # @@ -2011,6 +2012,7 @@ XDEV_CPUTYPE?=${TARGET_CPUTYPE} NOFUN=-DNO_FSCHG MK_HTML=no MK_INFO=no -DNO_LINT \ MK_MAN=no MK_NLS=no MK_PROFILE=no \ MK_KERBEROS=no MK_RESCUE=no MK_TESTS=no MK_WARNS=no \ + MK_VI=no \ TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ CPUTYPE=${XDEV_CPUTYPE} Modified: projects/building-blocks/usr.bin/vi/Makefile ============================================================================== --- projects/building-blocks/usr.bin/vi/Makefile Mon Dec 8 06:10:47 2014 (r275595) +++ projects/building-blocks/usr.bin/vi/Makefile Mon Dec 8 06:33:49 2014 (r275596) @@ -73,9 +73,4 @@ SRCS+= vs_line.c vs_msg.c vs_refresh.c v # Wide char regex SRCS+= regcomp.c regerror.c regexec.c regfree.c -build-tools: -.for t in obj depend all install - cd ${.CURDIR} && ${MAKE} $t SUBDIR= -.endfor - .include From owner-svn-src-projects@FreeBSD.ORG Mon Dec 8 07:13:41 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E849472C; Mon, 8 Dec 2014 07:13:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D51252F1; Mon, 8 Dec 2014 07:13:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB87DfYq029898; Mon, 8 Dec 2014 07:13:41 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB87Df0A029897; Mon, 8 Dec 2014 07:13:41 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201412080713.sB87Df0A029897@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 8 Dec 2014 07:13:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r275597 - projects/building-blocks/share/mk X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Dec 2014 07:13:42 -0000 Author: ngie Date: Mon Dec 8 07:13:41 2014 New Revision: 275597 URL: https://svnweb.freebsd.org/changeset/base/275597 Log: MK_CLANG == no should really imply MK_CLANG_IS_CC == no Modified: projects/building-blocks/share/mk/src.opts.mk Modified: projects/building-blocks/share/mk/src.opts.mk ============================================================================== --- projects/building-blocks/share/mk/src.opts.mk Mon Dec 8 06:33:49 2014 (r275596) +++ projects/building-blocks/share/mk/src.opts.mk Mon Dec 8 07:13:41 2014 (r275597) @@ -357,6 +357,7 @@ MK_INCLUDES:= no .endif .if ${MK_CLANG} == "no" +MK_CLANG_IS_CC:=no MK_CLANG_EXTRAS:= no MK_CLANG_FULL:= no .endif From owner-svn-src-projects@FreeBSD.ORG Mon Dec 8 07:14:26 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4226B841; Mon, 8 Dec 2014 07:14:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2EFB830A; Mon, 8 Dec 2014 07:14:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB87EQIj030059; Mon, 8 Dec 2014 07:14:26 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB87EQgh030058; Mon, 8 Dec 2014 07:14:26 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201412080714.sB87EQgh030058@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 8 Dec 2014 07:14:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r275598 - projects/building-blocks/share/mk X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Dec 2014 07:14:26 -0000 Author: ngie Date: Mon Dec 8 07:14:25 2014 New Revision: 275598 URL: https://svnweb.freebsd.org/changeset/base/275598 Log: Sort the MK_CLANG* options (should have done this in the previous commit) Modified: projects/building-blocks/share/mk/src.opts.mk Modified: projects/building-blocks/share/mk/src.opts.mk ============================================================================== --- projects/building-blocks/share/mk/src.opts.mk Mon Dec 8 07:13:41 2014 (r275597) +++ projects/building-blocks/share/mk/src.opts.mk Mon Dec 8 07:14:25 2014 (r275598) @@ -357,9 +357,9 @@ MK_INCLUDES:= no .endif .if ${MK_CLANG} == "no" -MK_CLANG_IS_CC:=no MK_CLANG_EXTRAS:= no MK_CLANG_FULL:= no +MK_CLANG_IS_CC:=no .endif # From owner-svn-src-projects@FreeBSD.ORG Mon Dec 8 07:33:12 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9D9E7E66; Mon, 8 Dec 2014 07:33:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8A64976C; Mon, 8 Dec 2014 07:33:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB87XCYq039310; Mon, 8 Dec 2014 07:33:12 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB87XCui039309; Mon, 8 Dec 2014 07:33:12 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201412080733.sB87XCui039309@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 8 Dec 2014 07:33:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r275600 - projects/building-blocks X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Dec 2014 07:33:12 -0000 Author: ngie Date: Mon Dec 8 07:33:11 2014 New Revision: 275600 URL: https://svnweb.freebsd.org/changeset/base/275600 Log: Build gperf with xdev as part of _xb-bootstrap-tools to unbreak the build if/when MK_CXX == no and make delete-old has been run on the build host, post-r272849 Tested with the following command: % sudo env MK_CLANG=no MK_CLANG_BOOTSTRAP=no MK_GCC=yes MK_GCC_BOOTSTRAP=yes \ MK_GNUCXX=yes make xdev Modified: projects/building-blocks/Makefile.inc1 Modified: projects/building-blocks/Makefile.inc1 ============================================================================== --- projects/building-blocks/Makefile.inc1 Mon Dec 8 07:25:59 2014 (r275599) +++ projects/building-blocks/Makefile.inc1 Mon Dec 8 07:33:11 2014 (r275600) @@ -2055,7 +2055,8 @@ _xb-worldtmp: _xb-bootstrap-tools: .for _tool in \ - ${_clang_tblgen} + ${_clang_tblgen} \ + ${_gperf} ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ cd ${.CURDIR}/${_tool} && \ ${CDMAKE} DIRPRFX=${_tool}/ obj && \ From owner-svn-src-projects@FreeBSD.ORG Mon Dec 8 07:43:03 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7BFD621B; Mon, 8 Dec 2014 07:43:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5015284F; Mon, 8 Dec 2014 07:43:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB87h3bl044020; Mon, 8 Dec 2014 07:43:03 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB87h3j9044019; Mon, 8 Dec 2014 07:43:03 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201412080743.sB87h3j9044019@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 8 Dec 2014 07:43:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r275601 - projects/building-blocks X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Dec 2014 07:43:03 -0000 Author: ngie Date: Mon Dec 8 07:43:02 2014 New Revision: 275601 URL: https://svnweb.freebsd.org/changeset/base/275601 Log: - Document why usr.bin/vi needs to be built as part of bootstrap-tools - Do not build usr.bin/vi as part of bootstrap-tools if NO_SHARE is defined as share/termcap will be skipped if NO_SHARE is defined; that being said, something needs to be done for dealing with make distribute as it will be built via make distribute if not done during make buildworld. - Add -DNO_SHARE to NOFUN to deal with make xdev because of the fact that it implements a partial make buildworld/make installworld, but because it doesn't define everything, not all install paths exist in expected stages, which results in build failures with usr.bin/vi in bootstrap-tools because "WORLDTMP" is not fully populated when _xb-bootstrap-tools is run. tl;dr: this is enough to just make sure that make xdev isn't broken on this branch when MK_VI == no and make delete-old has been run on the build host Modified: projects/building-blocks/Makefile.inc1 Modified: projects/building-blocks/Makefile.inc1 ============================================================================== --- projects/building-blocks/Makefile.inc1 Mon Dec 8 07:33:11 2014 (r275600) +++ projects/building-blocks/Makefile.inc1 Mon Dec 8 07:43:02 2014 (r275601) @@ -1388,6 +1388,8 @@ build-tools: .MAKE ${MAKE} DIRPRFX=${_tool}/ depend && \ ${MAKE} DIRPRFX=${_tool}/ all .endfor + # usr.bin/vi is required to process files in share/termcap +.if !defined(NO_SHARE) .for _tool in \ usr.bin/vi ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ @@ -1397,6 +1399,7 @@ build-tools: .MAKE ${MAKE} DIRPRFX=${_tool}/ all MK_MAN=no SUBDIR= && \ ${MAKE} DIRPRFX=${_tool}/ install MK_MAN=no SUBDIR= DESTDIR=${WORLDTMP}/ .endfor +.endif # # kernel-tools: Build kernel-building tools @@ -2014,7 +2017,7 @@ NOFUN=-DNO_FSCHG MK_HTML=no MK_INFO=no - MK_KERBEROS=no MK_RESCUE=no MK_TESTS=no MK_WARNS=no \ MK_VI=no \ TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ - CPUTYPE=${XDEV_CPUTYPE} + CPUTYPE=${XDEV_CPUTYPE} -DNO_SHARE XDDIR=${TARGET_ARCH}-freebsd XDTP?=/usr/${XDDIR} From owner-svn-src-projects@FreeBSD.ORG Mon Dec 8 15:54:58 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3180461E; Mon, 8 Dec 2014 15:54:58 +0000 (UTC) Received: from mho-02-ewr.mailhop.org (mho-02-ewr.mailhop.org [204.13.248.72]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0577F3E1; Mon, 8 Dec 2014 15:54:57 +0000 (UTC) Received: from [73.34.117.227] (helo=ilsoft.org) by mho-02-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1Xy0eF-000Ah3-Qv; Mon, 08 Dec 2014 15:54:56 +0000 Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id sB8FssvX003270; Mon, 8 Dec 2014 08:54:54 -0700 (MST) (envelope-from ian@FreeBSD.org) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Originating-IP: 73.34.117.227 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX1+yVVCjlf/C8zb/DZfrxs1C X-Authentication-Warning: paranoia.hippie.lan: Host revolution.hippie.lan [172.22.42.240] claimed to be [172.22.42.240] Subject: Re: svn commit: r275601 - projects/building-blocks From: Ian Lepore To: Garrett Cooper In-Reply-To: <201412080743.sB87h3j9044019@svn.freebsd.org> References: <201412080743.sB87h3j9044019@svn.freebsd.org> Content-Type: text/plain; charset="us-ascii" Date: Mon, 08 Dec 2014 08:54:54 -0700 Message-ID: <1418054094.1064.147.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Dec 2014 15:54:58 -0000 On Mon, 2014-12-08 at 07:43 +0000, Garrett Cooper wrote: > Author: ngie > Date: Mon Dec 8 07:43:02 2014 > New Revision: 275601 > URL: https://svnweb.freebsd.org/changeset/base/275601 > > Log: > - Document why usr.bin/vi needs to be built as part of bootstrap-tools > - Do not build usr.bin/vi as part of bootstrap-tools if NO_SHARE is defined > as share/termcap will be skipped if NO_SHARE is defined; that being said, > something needs to be done for dealing with make distribute as it will be > built via make distribute if not done during make buildworld. > - Add -DNO_SHARE to NOFUN to deal with make xdev because of the fact that it > implements a partial make buildworld/make installworld, but because it > doesn't define everything, not all install paths exist in expected stages, > which results in build failures with usr.bin/vi in bootstrap-tools because > "WORLDTMP" is not fully populated when _xb-bootstrap-tools is run. > > tl;dr: this is enough to just make sure that make xdev isn't broken on this > branch when MK_VI == no and make delete-old has been run on the build host > > Modified: > projects/building-blocks/Makefile.inc1 > > Modified: projects/building-blocks/Makefile.inc1 > ============================================================================== > --- projects/building-blocks/Makefile.inc1 Mon Dec 8 07:33:11 2014 (r275600) > +++ projects/building-blocks/Makefile.inc1 Mon Dec 8 07:43:02 2014 (r275601) > @@ -1388,6 +1388,8 @@ build-tools: .MAKE > ${MAKE} DIRPRFX=${_tool}/ depend && \ > ${MAKE} DIRPRFX=${_tool}/ all > .endfor > + # usr.bin/vi is required to process files in share/termcap > +.if !defined(NO_SHARE) > .for _tool in \ > usr.bin/vi > ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ > @@ -1397,6 +1399,7 @@ build-tools: .MAKE > ${MAKE} DIRPRFX=${_tool}/ all MK_MAN=no SUBDIR= && \ > ${MAKE} DIRPRFX=${_tool}/ install MK_MAN=no SUBDIR= DESTDIR=${WORLDTMP}/ > .endfor > +.endif > > # > # kernel-tools: Build kernel-building tools > @@ -2014,7 +2017,7 @@ NOFUN=-DNO_FSCHG MK_HTML=no MK_INFO=no - > MK_KERBEROS=no MK_RESCUE=no MK_TESTS=no MK_WARNS=no \ > MK_VI=no \ > TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ > - CPUTYPE=${XDEV_CPUTYPE} > + CPUTYPE=${XDEV_CPUTYPE} -DNO_SHARE > > XDDIR=${TARGET_ARCH}-freebsd > XDTP?=/usr/${XDDIR} > Is there any chance someone who understands vi could evaluate what it's being used for and perhaps eliminate it? I know just enough about vi to get out of it if I accidentally get in. When I looked into this a few days ago it appears to be using it to sort the data before compiling (an optimization that problably hasn't been important to do since the 90s). Could another existing build tool such as awk do the job? -- Ian From owner-svn-src-projects@FreeBSD.ORG Mon Dec 8 16:58:22 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 17AD2491 for ; Mon, 8 Dec 2014 16:58:22 +0000 (UTC) Received: from relay00.pair.com (relay00.pair.com [209.68.5.9]) by mx1.freebsd.org (Postfix) with SMTP id A7D07D6B for ; Mon, 8 Dec 2014 16:58:21 +0000 (UTC) Received: (qmail 45818 invoked by uid 0); 8 Dec 2014 16:58:14 -0000 Received: from 70.35.46.82 (HELO ?192.168.128.65?) (70.35.46.82) by relay00.pair.com with SMTP; 8 Dec 2014 16:58:14 -0000 X-pair-Authenticated: 70.35.46.82 Message-ID: <5485D8B5.90604@FreeBSD.org> Date: Mon, 08 Dec 2014 08:58:29 -0800 From: Mark Peek User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Ian Lepore , Garrett Cooper Subject: Re: svn commit: r275601 - projects/building-blocks References: <201412080743.sB87h3j9044019@svn.freebsd.org> <1418054094.1064.147.camel@revolution.hippie.lan> In-Reply-To: <1418054094.1064.147.camel@revolution.hippie.lan> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Dec 2014 16:58:22 -0000 On 12/8/14 7:54 AM, Ian Lepore wrote: > On Mon, 2014-12-08 at 07:43 +0000, Garrett Cooper wrote: >> Author: ngie >> Date: Mon Dec 8 07:43:02 2014 >> New Revision: 275601 >> URL: https://svnweb.freebsd.org/changeset/base/275601 >> >> Log: >> - Document why usr.bin/vi needs to be built as part of bootstrap-tools >> ...snip... > > Is there any chance someone who understands vi could evaluate what it's > being used for and perhaps eliminate it? I know just enough about vi to > get out of it if I accidentally get in. > > When I looked into this a few days ago it appears to be using it to sort > the data before compiling (an optimization that problably hasn't been > important to do since the 90s). Could another existing build tool such > as awk do the job? My reading of that code agrees with yours in that it is using 'ex' to prioritize some terminal entries in the termcap file. However, it is then hashed into a berkeleydb via cap_mkdb which should render the initial prioritization useless. Rather than rewriting it I would suggest completely removing the reordering and the ex dependency. Mark From owner-svn-src-projects@FreeBSD.ORG Mon Dec 8 18:21:34 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 07E8E901; Mon, 8 Dec 2014 18:21:34 +0000 (UTC) Received: from mail-pd0-x22e.google.com (mail-pd0-x22e.google.com [IPv6:2607:f8b0:400e:c02::22e]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C2229C8D; Mon, 8 Dec 2014 18:21:33 +0000 (UTC) Received: by mail-pd0-f174.google.com with SMTP id fp1so5261969pdb.5 for ; Mon, 08 Dec 2014 10:21:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :message-id:references:to; bh=GrmgWX5T9YTx/uLLuMnO4HJ4DAFIHkgg4itQXUnkZKA=; b=FwmN6JEtGdZrEX0tdE0+6KZ4iCxHAnybur3qLyC0nKGJm02cO4caldH6pYdGTHbZnz Ye0CONRvFRT9b/PGh7+N27Ryedk98fkUxF06ZhVpfGsCpr+rEWysOG9NlI2NDREGVdf2 vUE72fiL7TBsPqGrHRJ9VIZSN1hSpWFNIviTCs3s7Em/JuOytH81TXIirLGCI7X9G+u3 wptP3baULSu9OKrnaTIMJ0PMns1UqEKAcLz6BzYTDjW1qsfyaBtV42xahEQ//VW40WYC 5bmT/MQLdEYYQBD+Fg58CVWvt0LRZmMz1lipIo3eqMArKG1pfYjDYbNnnDZVIl/wi2BE 7TUw== X-Received: by 10.70.52.98 with SMTP id s2mr23101120pdo.5.1418062893297; Mon, 08 Dec 2014 10:21:33 -0800 (PST) Received: from ?IPv6:2601:8:ab80:7d6:819d:7b8f:c98b:9d2c? ([2601:8:ab80:7d6:819d:7b8f:c98b:9d2c]) by mx.google.com with ESMTPSA id vy1sm37294007pac.20.2014.12.08.10.21.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 08 Dec 2014 10:21:32 -0800 (PST) Content-Type: multipart/signed; boundary="Apple-Mail=_BC656DAA-FE5F-4069-8615-01AB0BB3B243"; protocol="application/pgp-signature"; micalg=pgp-sha512 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r275601 - projects/building-blocks From: Garrett Cooper In-Reply-To: <5485D8B5.90604@FreeBSD.org> Date: Mon, 8 Dec 2014 10:21:31 -0800 Message-Id: References: <201412080743.sB87h3j9044019@svn.freebsd.org> <1418054094.1064.147.camel@revolution.hippie.lan> <5485D8B5.90604@FreeBSD.org> To: Mark Peek X-Mailer: Apple Mail (2.1878.6) Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org, Garrett Cooper , Ian Lepore X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Dec 2014 18:21:34 -0000 --Apple-Mail=_BC656DAA-FE5F-4069-8615-01AB0BB3B243 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 On Dec 8, 2014, at 8:58, Mark Peek wrote: > On 12/8/14 7:54 AM, Ian Lepore wrote: >> On Mon, 2014-12-08 at 07:43 +0000, Garrett Cooper wrote: >>> Author: ngie >>> Date: Mon Dec 8 07:43:02 2014 >>> New Revision: 275601 >>> URL: https://svnweb.freebsd.org/changeset/base/275601 >>>=20 >>> Log: >>> - Document why usr.bin/vi needs to be built as part of = bootstrap-tools > >> ...snip... >>=20 >> Is there any chance someone who understands vi could evaluate what = it's >> being used for and perhaps eliminate it? I know just enough about vi = to >> get out of it if I accidentally get in. >>=20 >> When I looked into this a few days ago it appears to be using it to = sort >> the data before compiling (an optimization that problably hasn't been >> important to do since the 90s). Could another existing build tool = such >> as awk do the job? >=20 > My reading of that code agrees with yours in that it is using 'ex' to = prioritize some terminal entries in the termcap file. However, it is = then hashed into a berkeleydb via cap_mkdb which should render the = initial prioritization useless. Rather than rewriting it I would suggest = completely removing the reordering and the ex dependency. That=92s what Erik and Kirk said in this hackers thread I just posted: = https://lists.freebsd.org/pipermail/freebsd-hackers/2014-December/046657.h= tml . I=92ll continue the discussion there. Thanks! --Apple-Mail=_BC656DAA-FE5F-4069-8615-01AB0BB3B243 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQEcBAEBCgAGBQJUhewrAAoJEMZr5QU6S73eP8AIAJvnEZV1AcNuDrTGT3HdbN3w nIzl7UnClCC/n9CTC1MnBBLTBuDoFEdtOCqJO7G+Rb3V+PXgBDkTJx5JF/+zEqQU QCV0OEif+cP4Io5XiKA2Na+tY8mlPiAWmyLbj+8X5zvlzL2eWzIsYUUDtKPqtt0X 68MIfjZwmQyq93O/A8rXyWLoathc/D+hWsMLDdIMQVOrwHAw8JaVXghZ0cg+Upwg fiF/C7w+Ww05i+Ymkm9UuObzPVQtyGWELhezzcEBRD+8KKL3/qjPCorngGUhFCvS ug7JMPqi53xyl2VMs2uMUtFPHzOYJpLmrQKuKiXNwpPN3yAOWZQL3MlfZJsoyJw= =Qmw+ -----END PGP SIGNATURE----- --Apple-Mail=_BC656DAA-FE5F-4069-8615-01AB0BB3B243-- From owner-svn-src-projects@FreeBSD.ORG Mon Dec 8 19:56:36 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 92CC9145; Mon, 8 Dec 2014 19:56:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7B80C882; Mon, 8 Dec 2014 19:56:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB8JuaZm012324; Mon, 8 Dec 2014 19:56:36 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB8JuZDQ012318; Mon, 8 Dec 2014 19:56:35 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201412081956.sB8JuZDQ012318@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 8 Dec 2014 19:56:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r275623 - in projects/clang350-import: . cddl/compat/opensolaris/misc cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libctf/common cddl/contrib/opensolaris/lib/libnvpair ... X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Dec 2014 19:56:36 -0000 Author: dim Date: Mon Dec 8 19:56:34 2014 New Revision: 275623 URL: https://svnweb.freebsd.org/changeset/base/275623 Log: Merge ^/head r275478 through r275622. Added: projects/clang350-import/cddl/contrib/opensolaris/lib/libctf/common/ctf.5 - copied unchanged from r275622, head/cddl/contrib/opensolaris/lib/libctf/common/ctf.5 projects/clang350-import/cddl/contrib/opensolaris/lib/libnvpair/nvpair_json.c - copied unchanged from r275622, head/cddl/contrib/opensolaris/lib/libnvpair/nvpair_json.c projects/clang350-import/usr.bin/iscsictl/iscsi.conf.5 - copied unchanged from r275622, head/usr.bin/iscsictl/iscsi.conf.5 Deleted: projects/clang350-import/sbin/iscontrol/iscsi.conf.5 projects/clang350-import/sys/cddl/compat/opensolaris/sys/cyclic.h projects/clang350-import/sys/cddl/compat/opensolaris/sys/cyclic_impl.h projects/clang350-import/sys/cddl/dev/cyclic/ projects/clang350-import/sys/modules/cyclic/ Modified: projects/clang350-import/Makefile.inc1 projects/clang350-import/cddl/compat/opensolaris/misc/thread_pool.c projects/clang350-import/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c projects/clang350-import/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.h projects/clang350-import/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c projects/clang350-import/cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h projects/clang350-import/cddl/lib/libctf/Makefile projects/clang350-import/cddl/lib/libnvpair/Makefile projects/clang350-import/contrib/binutils/gas/config/tc-arm.c projects/clang350-import/lib/libxo/Makefile projects/clang350-import/lib/msun/src/e_j0.c projects/clang350-import/lib/msun/src/e_j0f.c projects/clang350-import/release/scripts/relnotes-search.sh projects/clang350-import/sbin/iscontrol/Makefile projects/clang350-import/share/man/man4/upgt.4 projects/clang350-import/share/misc/committers-ports.dot projects/clang350-import/share/misc/organization.dot projects/clang350-import/share/mk/bsd.compiler.mk projects/clang350-import/sys/arm/arm/cpufunc_asm_arm11x6.S projects/clang350-import/sys/arm/arm/fusu.S projects/clang350-import/sys/arm/arm/stdatomic.c projects/clang350-import/sys/arm/arm/support.S projects/clang350-import/sys/arm/mv/mv_pci.c projects/clang350-import/sys/arm/ti/ti_smc.S projects/clang350-import/sys/arm/xscale/ixp425/ixp425_a4x_io.S projects/clang350-import/sys/arm/xscale/ixp425/ixp425_pci_asm.S projects/clang350-import/sys/boot/kshim/bsd_kernel.h projects/clang350-import/sys/cam/ctl/ctl.c projects/clang350-import/sys/cam/ctl/ctl_backend.h projects/clang350-import/sys/cam/ctl/ctl_backend_block.c projects/clang350-import/sys/cam/ctl/ctl_private.h projects/clang350-import/sys/cam/ctl/ctl_ser_table.c projects/clang350-import/sys/cddl/compat/opensolaris/sys/cpuvar.h projects/clang350-import/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c projects/clang350-import/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c projects/clang350-import/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c projects/clang350-import/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c projects/clang350-import/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c projects/clang350-import/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h projects/clang350-import/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c projects/clang350-import/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c projects/clang350-import/sys/cddl/contrib/opensolaris/uts/common/sys/cpuvar.h projects/clang350-import/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h projects/clang350-import/sys/cddl/dev/fbt/fbt.c projects/clang350-import/sys/cddl/dev/profile/profile.c projects/clang350-import/sys/dev/cxgbe/adapter.h projects/clang350-import/sys/dev/cxgbe/t4_sge.c projects/clang350-import/sys/dev/usb/controller/saf1761_otg.c projects/clang350-import/sys/dev/usb/quirk/usb_quirk.c projects/clang350-import/sys/dev/usb/serial/u3g.c projects/clang350-import/sys/dev/usb/usbdevs projects/clang350-import/sys/geom/raid/md_nvidia.c projects/clang350-import/sys/geom/raid/md_sii.c projects/clang350-import/sys/kern/kern_clocksource.c projects/clang350-import/sys/kern/kern_exit.c projects/clang350-import/sys/kern/kern_thread.c projects/clang350-import/sys/kern/subr_syscall.c projects/clang350-import/sys/kern/vfs_bio.c projects/clang350-import/sys/kern/vfs_subr.c projects/clang350-import/sys/libkern/arm/ffs.S projects/clang350-import/sys/modules/Makefile projects/clang350-import/sys/modules/dtrace/Makefile.inc projects/clang350-import/sys/modules/dtrace/dtraceall/dtraceall.c projects/clang350-import/sys/netinet/sctp_indata.c projects/clang350-import/sys/netinet/sctp_input.c projects/clang350-import/sys/netinet/sctp_output.c projects/clang350-import/sys/netinet/sctp_pcb.c projects/clang350-import/sys/netinet/sctp_structs.h projects/clang350-import/sys/netinet/sctp_usrreq.c projects/clang350-import/sys/netinet/sctputil.c projects/clang350-import/sys/netinet/udp_usrreq.c projects/clang350-import/sys/netinet6/nd6.c projects/clang350-import/sys/netinet6/nd6.h projects/clang350-import/sys/netinet6/nd6_nbr.c projects/clang350-import/sys/netinet6/sctp6_usrreq.c projects/clang350-import/sys/netipsec/key.c projects/clang350-import/sys/ofed/include/linux/list.h projects/clang350-import/sys/ofed/include/net/ip.h projects/clang350-import/sys/rpc/svc.c projects/clang350-import/sys/sys/dtrace_bsd.h projects/clang350-import/sys/sys/mount.h projects/clang350-import/sys/sys/param.h projects/clang350-import/sys/sys/proc.h projects/clang350-import/sys/vm/vm_mmap.c projects/clang350-import/sys/vm/vm_object.c projects/clang350-import/tools/bsdbox/Makefile projects/clang350-import/usr.bin/iscsictl/Makefile projects/clang350-import/usr.bin/patch/common.h projects/clang350-import/usr.bin/patch/patch.c projects/clang350-import/usr.bin/patch/pch.c projects/clang350-import/usr.sbin/ctladm/ctladm.8 Directory Properties: projects/clang350-import/ (props changed) projects/clang350-import/cddl/ (props changed) projects/clang350-import/cddl/contrib/opensolaris/ (props changed) projects/clang350-import/cddl/contrib/opensolaris/cmd/zfs/ (props changed) projects/clang350-import/cddl/contrib/opensolaris/lib/libzfs/ (props changed) projects/clang350-import/contrib/binutils/ (props changed) projects/clang350-import/sbin/ (props changed) projects/clang350-import/share/ (props changed) projects/clang350-import/share/man/man4/ (props changed) projects/clang350-import/sys/ (props changed) projects/clang350-import/sys/boot/ (props changed) projects/clang350-import/sys/cddl/contrib/opensolaris/ (props changed) Modified: projects/clang350-import/Makefile.inc1 ============================================================================== --- projects/clang350-import/Makefile.inc1 Mon Dec 8 18:29:20 2014 (r275622) +++ projects/clang350-import/Makefile.inc1 Mon Dec 8 19:56:34 2014 (r275623) @@ -791,6 +791,11 @@ ITOOLS= [ awk cap_mkdb cat chflags chmod rm sed services_mkdb sh sysctl test true uname wc ${_zoneinfo} \ ${LOCAL_ITOOLS} +# Needed for share/man +.if ${MK_MAN} != "no" +ITOOLS+=makewhatis +.endif + # # distributeworld # @@ -2039,7 +2044,8 @@ _xb-worldtmp: _xb-bootstrap-tools: .for _tool in \ - ${_clang_tblgen} + ${_clang_tblgen} \ + ${_gperf} ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ cd ${.CURDIR}/${_tool} && \ ${CDMAKE} DIRPRFX=${_tool}/ obj && \ Modified: projects/clang350-import/cddl/compat/opensolaris/misc/thread_pool.c ============================================================================== --- projects/clang350-import/cddl/compat/opensolaris/misc/thread_pool.c Mon Dec 8 18:29:20 2014 (r275622) +++ projects/clang350-import/cddl/compat/opensolaris/misc/thread_pool.c Mon Dec 8 19:56:34 2014 (r275623) @@ -233,12 +233,11 @@ tpool_create(uint_t min_threads, uint_t return (NULL); } - tpool = malloc(sizeof (*tpool)); + tpool = calloc(1, sizeof (*tpool)); if (tpool == NULL) { errno = ENOMEM; return (NULL); } - bzero(tpool, sizeof(*tpool)); (void) pthread_mutex_init(&tpool->tp_mutex, NULL); (void) pthread_cond_init(&tpool->tp_busycv, NULL); (void) pthread_cond_init(&tpool->tp_workcv, NULL); @@ -267,9 +266,8 @@ tpool_dispatch(tpool_t *tpool, void (*fu { tpool_job_t *job; - if ((job = malloc(sizeof (*job))) == NULL) + if ((job = calloc(1, sizeof (*job))) == NULL) return (-1); - bzero(job, sizeof(*job)); job->tpj_next = NULL; job->tpj_func = func; job->tpj_arg = arg; Modified: projects/clang350-import/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- projects/clang350-import/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Mon Dec 8 18:29:20 2014 (r275622) +++ projects/clang350-import/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Mon Dec 8 19:56:34 2014 (r275623) @@ -68,6 +68,7 @@ #ifdef sun #include #include +#include #endif #include "zfs_iter.h" @@ -2390,10 +2391,9 @@ userspace_cb(void *arg, const char *doma /* SMB */ char sid[ZFS_MAXNAMELEN + 32]; uid_t id; - uint64_t classes; #ifdef sun int err; - directory_error_t e; + int flag = IDMAP_REQ_FLG_USE_CACHE; #endif smbentity = B_TRUE; @@ -2416,10 +2416,13 @@ userspace_cb(void *arg, const char *doma if (err == 0) { rid = id; if (!cb->cb_sid2posix) { - e = directory_name_from_sid(NULL, sid, &name, - &classes); - if (e != NULL) - directory_error_free(e); + if (type == USTYPE_SMB_USR) { + (void) idmap_getwinnamebyuid(rid, flag, + &name, NULL); + } else { + (void) idmap_getwinnamebygid(rid, flag, + &name, NULL); + } if (name == NULL) name = sid; } Copied: projects/clang350-import/cddl/contrib/opensolaris/lib/libctf/common/ctf.5 (from r275622, head/cddl/contrib/opensolaris/lib/libctf/common/ctf.5) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/clang350-import/cddl/contrib/opensolaris/lib/libctf/common/ctf.5 Mon Dec 8 19:56:34 2014 (r275623, copy of r275622, head/cddl/contrib/opensolaris/lib/libctf/common/ctf.5) @@ -0,0 +1,1140 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright (c) 2014 Joyent, Inc. +.\" +.Dd Sep 26, 2014 +.Dt CTF 5 +.Os +.Sh NAME +.Nm ctf +.Nd Compact C Type Format +.Sh SYNOPSIS +.In sys/ctf.h +.Sh DESCRIPTION +.Nm +is designed to be a compact representation of the C programming +language's type information focused on serving the needs of dynamic +tracing, debuggers, and other in-situ and post-mortem introspection +tools. +.Nm +data is generally included in +.Sy ELF +objects and is tagged as +.Sy SHT_PROGBITS +to ensure that the data is accessible in a running process and in subsequent +core dumps, if generated. +.Lp +The +.Nm +data contained in each file has information about the layout and +sizes of C types, including intrinsic types, enumerations, structures, +typedefs, and unions, that are used by the corresponding +.Sy ELF +object. The +.Nm +data may also include information about the types of global objects and +the return type and arguments of functions in the symbol table. +.Lp +Because a +.Nm +file is often embedded inside a file, rather than being a standalone +file itself, it may also be referred to as a +.Nm +.Sy container . +.Lp +On illumos systems, +.Nm +data is consumed by multiple programs. It can be used by the modular +debugger, +.Xr mdb 1 , +as well as by +.Xr dtrace 1M . +Programmatic access to +.Nm +data can be obtained through +.Xr libctf 3LIB . +.Lp +The +.Nm +file format is broken down into seven different sections. The first +section is the +.Sy preamble +and +.Sy header , +which describes the version of the +.Nm +file, links it has to other +.Nm +files, and the sizes of the other sections. The next section is the +.Sy label +section, +which provides a way of identifying similar groups of +.Nm +data across multiple files. This is followed by the +.Sy object +information section, which describes the type of global +symbols. The subsequent section is the +.Sy function +information section, which describes the return +types and arguments of functions. The next section is the +.Sy type +information section, which describes +the format and layout of the C types themselves, and finally the last +section is the +.Sy string +section, which contains the names of types, enumerations, members, and +labels. +.Lp +While strictly speaking, only the +.Sy preamble +and +.Sy header +are required, to be actually useful, both the type and string +sections are necessary. +.Lp +A +.Nm +file may contain all of the type information that it requires, or it +may optionally refer to another +.Nm +file which holds the remaining types. When a +.Nm +file refers to another file, it is called the +.Sy child +and the file it refers to is called the +.Sy parent . +A given file may only refer to one parent. This process is called +.Em uniquification +because it ensures each child only has type information that is +unique to it. A common example of this is that most kernel modules in +illumos are uniquified against the kernel module +.Sy genunix +and the type information that comes from the +.Sy IP +module. This means that a module only has types that are unique to +itself and the most common types in the kernel are not duplicated. +.Sh FILE FORMAT +This documents version +.Em two +of the +.Nm +file format. All applications and tools currently produce and operate on +this version. +.Lp +The file format can be summarized with the following image, the +following sections will cover this in more detail. +.Bd -literal + + +-------------+ 0t0 ++--------| Preamble | +| +-------------+ 0t4 +|+-------| Header | +|| +-------------+ 0t36 + cth_lbloff +||+------| Labels | +||| +-------------+ 0t36 + cth_objtoff +|||+-----| Objects | +|||| +-------------+ 0t36 + cth_funcoff +||||+----| Functions | +||||| +-------------+ 0t36 + cth_typeoff +|||||+---| Types | +|||||| +-------------+ 0t36 + cth_stroff +||||||+--| Strings | +||||||| +-------------+ 0t36 + cth_stroff + cth_strlen +||||||| +||||||| +||||||| +||||||| +-- magic - vers flags +||||||| | | | | +||||||| +------+------+------+------+ ++---------| 0xcf | 0xf1 | 0x02 | 0x00 | + |||||| +------+------+------+------+ + |||||| 0 1 2 3 4 + |||||| + |||||| + parent label + objects + |||||| | + parent name | + functions + strings + |||||| | | + label | | + types | + strlen + |||||| | | | | | | | | + |||||| +------+------+------+------+------+-------+-------+-------+ + +--------| 0x00 | 0x00 | 0x00 | 0x08 | 0x36 | 0x110 | 0x5f4 | 0x611 | + ||||| +------+------+------+------+------+-------+-------+-------+ + ||||| 0x04 0x08 0x0c 0x10 0x14 0x18 0x1c 0x20 0x24 + ||||| + ||||| + Label name + ||||| | + Label type + ||||| | | + Next label + ||||| | | | + ||||| +-------+------+-----+ + +-----------| 0x01 | 0x42 | ... | + |||| +-------+------+-----+ + |||| cth_lbloff +0x4 +0x8 cth_objtoff + |||| + |||| + |||| Symidx 0t15 0t43 0t44 + |||| +------+------+------+-----+ + +----------| 0x00 | 0x42 | 0x36 | ... | + ||| +------+------+------+-----+ + ||| cth_objtoff +0x2 +0x4 +0x6 cth_funcoff + ||| + ||| + CTF_TYPE_INFO + CTF_TYPE_INFO + ||| | + Return type | + ||| | | + arg0 | + ||| +--------+------+------+-----+ + +---------| 0x2c10 | 0x08 | 0x0c | ... | + || +--------+------+------+-----+ + || cth_funcff +0x2 +0x4 +0x6 cth_typeoff + || + || + ctf_stype_t for type 1 + || | integer + integer encoding + || | | + ctf_stype_t for type 2 + || | | | + || +--------------------+-----------+-----+ + +--------| 0x19 * 0xc01 * 0x0 | 0x1000000 | ... | + | +--------------------+-----------+-----+ + | cth_typeoff +0x08 +0x0c cth_stroff + | + | +--- str 0 + | | +--- str 1 + str 2 + | | | | + | v v v + | +----+---+---+---+----+---+---+---+---+---+----+ + +---| \\0 | i | n | t | \\0 | f | o | o | _ | t | \\0 | + +----+---+---+---+----+---+---+---+---+---+----+ + 0 1 2 3 4 5 6 7 8 9 10 11 +.Ed +.Lp +Every +.Nm +file begins with a +.Sy preamble , +followed by a +.Sy header . +The +.Sy preamble +is defined as follows: +.Bd -literal +typedef struct ctf_preamble { + ushort_t ctp_magic; /* magic number (CTF_MAGIC) */ + uchar_t ctp_version; /* data format version number (CTF_VERSION) */ + uchar_t ctp_flags; /* flags (see below) */ +} ctf_preamble_t; +.Ed +.Pp +The +.Sy preamble +is four bytes long and must be four byte aligned. +This +.Sy preamble +defines the version of the +.Nm +file which defines the format of the rest of the header. While the +header may change in subsequent versions, the preamble will not change +across versions, though the interpretation of its flags may change from +version to version. The +.Em ctp_magic +member defines the magic number for the +.Nm +file format. This must always be +.Li 0xcff1 . +If another value is encountered, then the file should not be treated as +a +.Nm +file. The +.Em ctp_version +member defines the version of the +.Nm +file. The current version is +.Li 2 . +It is possible to encounter an unsupported version. In that case, +software should not try to parse the format, as it may have changed. +Finally, the +.Em ctp_flags +member describes aspects of the file which modify its interpretation. +The following flags are currently defined: +.Bd -literal +#define CTF_F_COMPRESS 0x01 +.Ed +.Pp +The flag +.Sy CTF_F_COMPRESS +indicates that the body of the +.Nm +file, all the data following the +.Sy header , +has been compressed through the +.Sy zlib +library and its +.Sy deflate +algorithm. If this flag is not present, then the body has not been +compressed and no special action is needed to interpret it. All offsets +into the data as described by +.Sy header , +always refer to the +.Sy uncompressed +data. +.Lp +In version two of the +.Nm +file format, the +.Sy header +denotes whether whether or not this +.Nm +file is the child of another +.Nm +file and also indicates the size of the remaining sections. The +structure for the +.Sy header , +logically contains a copy of the +.Sy preamble +and the two have a combined size of 36 bytes. +.Bd -literal +typedef struct ctf_header { + ctf_preamble_t cth_preamble; + uint_t cth_parlabel; /* ref to name of parent lbl uniq'd against */ + uint_t cth_parname; /* ref to basename of parent */ + uint_t cth_lbloff; /* offset of label section */ + uint_t cth_objtoff; /* offset of object section */ + uint_t cth_funcoff; /* offset of function section */ + uint_t cth_typeoff; /* offset of type section */ + uint_t cth_stroff; /* offset of string section */ + uint_t cth_strlen; /* length of string section in bytes */ +} ctf_header_t; +.Ed +.Pp +After the +.Sy preamble , +the next two members +.Em cth_parlablel +and +.Em cth_parname , +are used to identify the parent. The value of both members are offsets +into the +.Sy string +section which point to the start of a null-terminated string. For more +information on the encoding of strings, see the subsection on +.Sx String Identifiers . +If the value of either is zero, then there is no entry for that +member. If the member +.Em cth_parlabel +is set, then the +.Em ctf_parname +member must be set, otherwise it will not be possible to find the +parent. If +.Em ctf_parname +is set, it is not necessary to define +.Em cth_parlabel , +as the parent may not have a label. For more information on labels +and their interpretation, see +.Sx The Label Section . +.Lp +The remaining members (excepting +.Em cth_strlen ) +describe the beginning of the corresponding sections. These offsets are +relative to the end of the +.Sy header . +Therefore, something with an offset of 0 is at an offset of thirty-six +bytes relative to the start of the +.Nm +file. The difference between members +indicates the size of the section itself. Different offsets have +different alignment requirements. The start of the +.Em cth_objotoff +and +.Em cth_funcoff +must be two byte aligned, while the sections +.Em cth_lbloff +and +.Em cth_typeoff +must be four-byte aligned. The section +.Em cth_stroff +has no alignment requirements. To calculate the size of a given section, +excepting the +.Sy string +section, one should subtract the offset of the section from the following one. For +example, the size of the +.Sy types +section can be calculated by subtracting +.Em cth_stroff +from +.Em cth_typeoff . +.Lp +Finally, the member +.Em cth_strlen +describes the length of the string section itself. From it, you can also +calculate the size of the entire +.Nm +file by adding together the size of the +.Sy ctf_header_t , +the offset of the string section in +.Em cth_stroff , +and the size of the string section in +.Em cth_srlen . +.Ss Type Identifiers +Through the +.Nm ctf +data, types are referred to by identifiers. A given +.Nm +file supports up to 32767 (0x7fff) types. The first valid type identifier is 0x1. +When a given +.Nm +file is a child, indicated by a non-zero entry for the +.Sy header Ns 's +.Em cth_parname , +then the first valid type identifier is 0x8000 and the last is 0xffff. +In this case, type identifiers 0x1 through 0x7fff are references to the +parent. +.Lp +The type identifier zero is a sentinel value used to indicate that there +is no type information available or it is an unknown type. +.Lp +Throughout the file format, the identifier is stored in different sized +values; however, the minimum size to represent a given identifier is a +.Sy uint16_t . +Other consumers of +.Nm +information may use larger or opaque identifiers. +.Ss String Identifiers +String identifiers are always encoded as four byte unsigned integers +which are an offset into a string table. The +.Nm +format supports two different string tables which have an identifier of +zero or one. This identifier is stored in the high-order bit of the +unsigned four byte offset. Therefore, the maximum supported offset into +one of these tables is 0x7ffffffff. +.Lp +Table identifier zero, always refers to the +.Sy string +section in the CTF file itself. String table identifier one refers to an +external string table which is the ELF string table for the ELF symbol +table associated with the +.Nm +container. +.Ss Type Encoding +Every +.Nm +type begins with metadata encoded into a +.Sy uint16_t . +This encoded information tells us three different pieces of information: +.Bl -bullet -offset indent -compact +.It +The kind of the type +.It +Whether this type is a root type or not +.It +The length of the variable data +.El +.Lp +The 16 bits that make up the encoding are broken down such that you have +five bits for the kind, one bit for indicating whether or not it is a +root type, and 10 bits for the variable length. This is laid out as +follows: +.Bd -literal -offset indent ++--------------------+ +| kind | root | vlen | ++--------------------+ +15 11 10 9 0 +.Ed +.Lp +The current version of the file format defines 14 different kinds. The +interpretation of these different kinds will be discussed in the section +.Sx The Type Section . +If a kind is encountered that is not listed below, then it is not a valid +.Nm +file. The kinds are defined as follows: +.Bd -literal -offset indent +#define CTF_K_UNKNOWN 0 +#define CTF_K_INTEGER 1 +#define CTF_K_FLOAT 2 +#define CTF_K_POINTER 3 +#define CTF_K_ARRAY 4 +#define CTF_K_FUNCTION 5 +#define CTF_K_STRUCT 6 +#define CTF_K_UNION 7 +#define CTF_K_ENUM 8 +#define CTF_K_FORWARD 9 +#define CTF_K_TYPEDEF 10 +#define CTF_K_VOLATILE 11 +#define CTF_K_CONST 12 +#define CTF_K_RESTRICT 13 +.Ed +.Lp +Programs directly reference many types; however, other types are referenced +indirectly because they are part of some other structure. These types that are +referenced directly and used are called +.Sy root +types. Other types may be used indirectly, for example, a program may reference +a structure directly, but not one of its members which has a type. That type is +not considered a +.Sy root +type. If a type is a +.Sy root +type, then it will have bit 10 set. +.Lp +The variable length section is specific to each kind and is discussed in the +section +.Sx The Type Section . +.Lp +The following macros are useful for constructing and deconstructing the encoded +type information: +.Bd -literal -offset indent + +#define CTF_MAX_VLEN 0x3ff +#define CTF_INFO_KIND(info) (((info) & 0xf800) >> 11) +#define CTF_INFO_ISROOT(info) (((info) & 0x0400) >> 10) +#define CTF_INFO_VLEN(info) (((info) & CTF_MAX_VLEN)) + +#define CTF_TYPE_INFO(kind, isroot, vlen) \\ + (((kind) << 11) | (((isroot) ? 1 : 0) << 10) | ((vlen) & CTF_MAX_VLEN)) +.Ed +.Ss The Label Section +When consuming +.Nm +data, it is often useful to know whether two different +.Nm +containers come from the same source base and version. For example, when +building illumos, there are many kernel modules that are built against a +single collection of source code. A label is encoded into the +.Nm +files that corresponds with the particular build. This ensures that if +files on the system were to become mixed up from multiple releases, that +they are not used together by tools, particularly when a child needs to +refer to a type in the parent. Because they are linked used the type +identifiers, if the wrong parent is used then the wrong type will be +encountered. +.Lp +Each label is encoded in the file format using the following eight byte +structure: +.Bd -literal +typedef struct ctf_lblent { + uint_t ctl_label; /* ref to name of label */ + uint_t ctl_typeidx; /* last type associated with this label */ +} ctf_lblent_t; +.Ed +.Lp +Each label has two different components, a name and a type identifier. +The name is encoded in the +.Em ctl_label +member which is in the format defined in the section +.Sx String Identifiers . +Generally, the names of all labels are found in the internal string +section. +.Lp +The type identifier encoded in the member +.Em ctl_typeidx +refers to the last type identifier that a label refers to in the current +file. Labels only refer to types in the current file, if the +.Nm +file is a child, then it will have the same label as its parent; +however, its label will only refer to its types, not its parents. +.Lp +It is also possible, though rather uncommon, for a +.Nm +file to have multiple labels. Labels are placed one after another, every +eight bytes. When multiple labels are present, types may only belong to +a single label. +.Ss The Object Section +The object section provides a mapping from ELF symbols of type +.Sy STT_OBJECT +in the symbol table to a type identifier. Every entry in this section is +a +.Sy uint16_t +which contains a type identifier as described in the section +.Sx Type Identifiers . +If there is no information for an object, then the type identifier 0x0 +is stored for that entry. +.Lp +To walk the object section, you need to have a corresponding +.Sy symbol table +in the ELF object that contains the +.Nm +data. Not every object is included in this section. Specifically, when +walking the symbol table. An entry is skipped if it matches any of the +following conditions: +.Lp +.Bl -bullet -offset indent -compact +.It +The symbol type is not +.Sy STT_OBJECT +.It +The symbol's section index is +.Sy SHN_UNDEF +.It +The symbol's name offset is zero +.It +The symbol's section index is +.Sy SHN_ABS +and the value of the symbol is zero. +.It +The symbol's name is +.Li _START_ +or +.Li _END_ . +These are skipped because they are used for scoping local symbols in +ELF. +.El +.Lp +The following sample code shows an example of iterating the object +section and skipping the correct symbols: +.Bd -literal +#include +#include + +/* + * Given the start of the object section in the CTF file, the number of symbols, + * and the ELF Data sections for the symbol table and the string table, this + * prints the type identifiers that correspond to objects. Note, a more robust + * implementation should ensure that they don't walk beyond the end of the CTF + * object section. + */ +static int +walk_symbols(uint16_t *objtoff, Elf_Data *symdata, Elf_Data *strdata, + long nsyms) +{ + long i; + uintptr_t strbase = strdata->d_buf; + + for (i = 1; i < nsyms; i++, objftoff++) { + const char *name; + GElf_Sym sym; + + if (gelf_getsym(symdata, i, &sym) == NULL) + return (1); + + if (GELF_ST_TYPE(sym.st_info) != STT_OBJECT) + continue; + if (sym.st_shndx == SHN_UNDEF || sym.st_name == 0) + continue; + if (sym.st_shndx == SHN_ABS && sym.st_value == 0) + continue; + name = (const char *)(strbase + sym.st_name); + if (strcmp(name, "_START_") == 0 || strcmp(name, "_END_") == 0) + continue; + + (void) printf("Symbol %d has type %d\n", i, *objtoff); + } + + return (0); +} +.Ed +.Ss The Function Section +The function section of the +.Nm +file encodes the types of both the function's arguments and the function's +return type. Similar to +.Sx The Object Section , +the function section encodes information for all symbols of type +.Sy STT_FUNCTION , +excepting those that fit specific criteria. Unlike with objects, because +functions have a variable number of arguments, they start with a type encoding +as defined in +.Sx Type Encoding , +which is the size of a +.Sy uint16_t . +For functions which have no type information available, they are encoded as +.Li CTF_TYPE_INFO(CTF_K_UNKNOWN, 0, 0) . +Functions with arguments are encoded differently. Here, the variable length is +turned into the number of arguments in the function. If a function is a +.Sy varargs +type function, then the number of arguments is increased by one. Functions with +type information are encoded as: +.Li CTF_TYPE_INFO(CTF_K_FUNCTION, 0, nargs) . +.Lp +For functions that have no type information, nothing else is encoded, and the +next function is encoded. For functions with type information, the next +.Sy uint16_t +is encoded with the type identifier of the return type of the function. It is +followed by each of the type identifiers of the arguments, if any exist, in the +order that they appear in the function. Therefore, argument 0 is the first type +identifier and so on. When a function has a final varargs argument, that is +encoded with the type identifier of zero. +.Lp +Like +.Sx The Object Section , +the function section is encoded in the order of the symbol table. It has +similar, but slightly different considerations from objects. While iterating the +symbol table, if any of the following conditions are true, then the entry is +skipped and no corresponding entry is written: +.Lp +.Bl -bullet -offset indent -compact +.It +The symbol type is not +.Sy STT_FUNCTION +.It +The symbol's section index is +.Sy SHN_UNDEF +.It +The symbol's name offset is zero +.It +The symbol's name is +.Li _START_ +or +.Li _END_ . +These are skipped because they are used for scoping local symbols in +ELF. +.El +.Ss The Type Section +The type section is the heart of the +.Nm +data. It encodes all of the information about the types themselves. The base of +the type information comes in two forms, a short form and a long form, each of +which may be followed by a variable number of arguments. The following +definitions describe the short and long forms: +.Bd -literal +#define CTF_MAX_SIZE 0xfffe /* max size of a type in bytes */ +#define CTF_LSIZE_SENT 0xffff /* sentinel for ctt_size */ +#define CTF_MAX_LSIZE UINT64_MAX + +typedef struct ctf_stype { + uint_t ctt_name; /* reference to name in string table */ + ushort_t ctt_info; /* encoded kind, variant length */ + union { + ushort_t _size; /* size of entire type in bytes */ + ushort_t _type; /* reference to another type */ + } _u; +} ctf_stype_t; + +typedef struct ctf_type { + uint_t ctt_name; /* reference to name in string table */ + ushort_t ctt_info; /* encoded kind, variant length */ + union { + ushort_t _size; /* always CTF_LSIZE_SENT */ + ushort_t _type; /* do not use */ + } _u; + uint_t ctt_lsizehi; /* high 32 bits of type size in bytes */ + uint_t ctt_lsizelo; /* low 32 bits of type size in bytes */ +} ctf_type_t; + +#define ctt_size _u._size /* for fundamental types that have a size */ +#define ctt_type _u._type /* for types that reference another type */ +.Ed +.Pp +Type sizes are stored in +.Sy bytes . +The basic small form uses a +.Sy ushort_t +to store the number of bytes. If the number of bytes in a structure would exceed +0xfffe, then the alternate form, the +.Sy ctf_type_t , +is used instead. To indicate that the larger form is being used, the member +.Em ctt_size +is set to value of +.Sy CTF_LSIZE_SENT +(0xffff). In general, when going through the type section, consumers use the +.Sy ctf_type_t +structure, but pay attention to the value of the member +.Em ctt_size +to determine whether they should increment their scan by the size of the +.Sy ctf_stype_t +or +.Sy ctf_type_t . +Not all kinds of types use +.Sy ctt_size . +Those which do not, will always use the +.Sy ctf_stype_t +structure. The individual sections for each kind have more information. +.Lp +Types are written out in order. Therefore the first entry encountered has a type +id of 0x1, or 0x8000 if a child. The member +.Em ctt_name +is encoded as described in the section +.Sx String Identifiers . +The string that it points to is the name of the type. If the identifier points +to an empty string (one that consists solely of a null terminator) then the type +does not have a name, this is common with anonymous structures and unions that +only have a typedef to name them, as well as, pointers and qualifiers. +.Lp +The next member, the +.Em ctt_info , +is encoded as described in the section +.Sx Type Encoding . +The types kind tells us how to interpret the remaining data in the +.Sy ctf_type_t +and any variable length data that may exist. The rest of this section will be +broken down into the interpretation of the various kinds. +.Ss Encoding of Integers +Integers, which are of type +.Sy CTF_K_INTEGER , +have no variable length arguments. Instead, they are followed by a four byte +.Sy uint_t +which describes their encoding. All integers must be encoded with a variable +length of zero. The +.Em ctt_size +member describes the length of the integer in bytes. In general, integer sizes +will be rounded up to the closest power of two. +.Lp +The integer encoding contains three different pieces of information: +.Bl -bullet -offset indent -compact +.It +The encoding of the integer +.It +The offset in +.Sy bits +of the type +.It +The size in +.Sy bits +of the type +.El +.Pp +This encoding can be expressed through the following macros: +.Bd -literal -offset indent +#define CTF_INT_ENCODING(data) (((data) & 0xff000000) >> 24) +#define CTF_INT_OFFSET(data) (((data) & 0x00ff0000) >> 16) +#define CTF_INT_BITS(data) (((data) & 0x0000ffff)) + +#define CTF_INT_DATA(encoding, offset, bits) \\ + (((encoding) << 24) | ((offset) << 16) | (bits)) +.Ed +.Pp +The following flags are defined for the encoding at this time: +.Bd -literal -offset indent +#define CTF_INT_SIGNED 0x01 +#define CTF_INT_CHAR 0x02 +#define CTF_INT_BOOL 0x04 +#define CTF_INT_VARARGS 0x08 +.Ed +.Lp +By default, an integer is considered to be unsigned, unless it has the +.Sy CTF_INT_SIGNED +flag set. If the flag +.Sy CTF_INT_CHAR +is set, that indicates that the integer is of a type that stores character +data, for example the intrinsic C type +.Sy char +would have the +.Sy CTF_INT_CHAR +flag set. If the flag +.Sy CTF_INT_BOOL +is set, that indicates that the integer represents a boolean type. For example, +the intrinsic C type +.Sy _Bool +would have the +.Sy CTF_INT_BOOL +flag set. Finally, the flag +.Sy CTF_INT_VARARGS +indicates that the integer is used as part of a variable number of arguments. +This encoding is rather uncommon. +.Ss Encoding of Floats +Floats, which are of type +.Sy CTF_K_FLOAT , +are similar to their integer counterparts. They have no variable length +arguments and are followed by a four byte encoding which describes the kind of +float that exists. The +.Em ctt_size +member is the size, in bytes, of the float. The float encoding has three +different pieces of information inside of it: +.Lp +.Bl -bullet -offset indent -compact +.It +The specific kind of float that exists +.It +The offset in +.Sy bits +of the float +.It +The size in +.Sy bits +of the float +.El +.Lp +This encoding can be expressed through the following macros: +.Bd -literal -offset indent +#define CTF_FP_ENCODING(data) (((data) & 0xff000000) >> 24) +#define CTF_FP_OFFSET(data) (((data) & 0x00ff0000) >> 16) +#define CTF_FP_BITS(data) (((data) & 0x0000ffff)) + +#define CTF_FP_DATA(encoding, offset, bits) \\ + (((encoding) << 24) | ((offset) << 16) | (bits)) +.Ed +.Lp +Where as the encoding for integers was a series of flags, the encoding for +floats maps to a specific kind of float. It is not a flag-based value. The kinds of floats +correspond to both their size, and the encoding. This covers all of the basic C +intrinsic floating point types. The following are the different kinds of floats +represented in the encoding: +.Bd -literal -offset indent +#define CTF_FP_SINGLE 1 /* IEEE 32-bit float encoding */ +#define CTF_FP_DOUBLE 2 /* IEEE 64-bit float encoding */ +#define CTF_FP_CPLX 3 /* Complex encoding */ +#define CTF_FP_DCPLX 4 /* Double complex encoding */ +#define CTF_FP_LDCPLX 5 /* Long double complex encoding */ +#define CTF_FP_LDOUBLE 6 /* Long double encoding */ +#define CTF_FP_INTRVL 7 /* Interval (2x32-bit) encoding */ +#define CTF_FP_DINTRVL 8 /* Double interval (2x64-bit) encoding */ +#define CTF_FP_LDINTRVL 9 /* Long double interval (2x128-bit) encoding */ +#define CTF_FP_IMAGRY 10 /* Imaginary (32-bit) encoding */ +#define CTF_FP_DIMAGRY 11 /* Long imaginary (64-bit) encoding */ +#define CTF_FP_LDIMAGRY 12 /* Long double imaginary (128-bit) encoding */ +.Ed +.Ss Encoding of Arrays +Arrays, which are of type +.Sy CTF_K_ARRAY , +have no variable length arguments. They are followed by a structure which +describes the number of elements in the array, the type identifier of the +elements in the array, and the type identifier of the index of the array. With +arrays, the +.Em ctt_size +member is set to zero. The structure that follows an array is defined as: +.Bd -literal +typedef struct ctf_array { + ushort_t cta_contents; /* reference to type of array contents */ + ushort_t cta_index; /* reference to type of array index */ + uint_t cta_nelems; /* number of elements */ +} ctf_array_t; +.Ed +.Lp +The +.Em cta_contents +and +.Em cta_index +members of the +.Sy ctf_array_t +are type identifiers which are encoded as per the section +.Sx Type Identifiers . +The member +.Em cta_nelems +is a simple four byte unsigned count of the number of elements. This count may +be zero when encountering C99's flexible array members. +.Ss Encoding of Functions *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Mon Dec 8 23:23:57 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 78994BF4; Mon, 8 Dec 2014 23:23:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 639AFFDC; Mon, 8 Dec 2014 23:23:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB8NNv9j022359; Mon, 8 Dec 2014 23:23:57 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB8NNsch022336; Mon, 8 Dec 2014 23:23:54 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201412082323.sB8NNsch022336@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Mon, 8 Dec 2014 23:23:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r275625 - in projects/routing/sys: net netinet netinet6 X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Dec 2014 23:23:57 -0000 Author: melifaro Date: Mon Dec 8 23:23:53 2014 New Revision: 275625 URL: https://svnweb.freebsd.org/changeset/base/275625 Log: Simplify lle lookup/create api by using addresses instead of sockaddrs. Modified: projects/routing/sys/net/if_llatbl.c projects/routing/sys/net/if_llatbl.h projects/routing/sys/net/rt_nhops.c projects/routing/sys/netinet/if_ether.c projects/routing/sys/netinet/if_ether.h projects/routing/sys/netinet/in.c projects/routing/sys/netinet/in_var.h projects/routing/sys/netinet/toecore.c projects/routing/sys/netinet6/in6.c projects/routing/sys/netinet6/in6_var.h projects/routing/sys/netinet6/nd6.c projects/routing/sys/netinet6/nd6.h Modified: projects/routing/sys/net/if_llatbl.c ============================================================================== --- projects/routing/sys/net/if_llatbl.c Mon Dec 8 21:14:13 2014 (r275624) +++ projects/routing/sys/net/if_llatbl.c Mon Dec 8 23:23:53 2014 (r275625) @@ -229,9 +229,12 @@ llentry_alloc(struct ifnet *ifp, struct struct sockaddr_storage *dst) { struct llentry *la; + const void *l3addr; + + l3addr = lt->llt_get_sa_addr((struct sockaddr *)dst); IF_AFDATA_RLOCK(ifp); - la = lt->llt_lookup(lt, LLE_EXCLUSIVE, (struct sockaddr *)dst); + la = lt->llt_lookup(lt, LLE_EXCLUSIVE, l3addr); IF_AFDATA_RUNLOCK(ifp); if ((la == NULL) && (ifp->if_flags & (IFF_NOARP | IFF_STATICARP)) == 0) { @@ -441,6 +444,7 @@ lla_rt_output(struct rt_msghdr *rtm, str struct ifnet *ifp; struct lltable *llt; struct llentry *lle, *lle_tmp; + const void *l3addr; u_int laflags = 0; int error; @@ -469,6 +473,7 @@ lla_rt_output(struct rt_msghdr *rtm, str switch (rtm->rtm_type) { case RTM_ADD: /* Add static LLE */ + l3addr = llt->llt_get_sa_addr(dst); lle = llt->llt_create(llt, 0, dst); if (lle == NULL) return (ENOMEM); @@ -491,7 +496,7 @@ lla_rt_output(struct rt_msghdr *rtm, str LLE_WLOCK(lle); /* Check if we already have this lle */ /* XXX: Use LLE_UNLOCKED */ - lle_tmp = llt->llt_lookup(llt, LLE_EXCLUSIVE, dst); + lle_tmp = llt->llt_lookup(llt, LLE_EXCLUSIVE, l3addr); if (lle_tmp != NULL) { IF_AFDATA_CFG_WUNLOCK(ifp); LLE_WUNLOCK(lle_tmp); Modified: projects/routing/sys/net/if_llatbl.h ============================================================================== --- projects/routing/sys/net/if_llatbl.h Mon Dec 8 21:14:13 2014 (r275624) +++ projects/routing/sys/net/if_llatbl.h Mon Dec 8 23:23:53 2014 (r275625) @@ -148,9 +148,9 @@ struct llentry { #endif typedef struct llentry *(llt_lookup_t)(struct lltable *, u_int flags, - const struct sockaddr *l3addr); + const void *paddr); typedef struct llentry *(llt_create_t)(struct lltable *, u_int flags, - const struct sockaddr *l3addr); + const void *paddr); typedef int (llt_delete_addr_t)(struct lltable *, u_int flags, const struct sockaddr *l3addr); typedef int (llt_dump_entry_t)(struct lltable *, struct llentry *, @@ -164,6 +164,7 @@ typedef void (llt_link_entry_t)(struct l typedef void (llt_unlink_entry_t)(struct llentry *); typedef int (llt_prepare_sentry_t)(struct lltable *, struct llentry *, struct rt_addrinfo *); +typedef const void *(llt_get_sa_addr_t)(const struct sockaddr *l3addr); typedef int (llt_foreach_cb_t)(struct lltable *, struct llentry *, void *); typedef int (llt_foreach_entry_t)(struct lltable *, llt_foreach_cb_t *, void *); @@ -186,6 +187,7 @@ struct lltable { llt_link_entry_t *llt_link_entry; llt_unlink_entry_t *llt_unlink_entry; llt_prepare_sentry_t *llt_prepare_static_entry; + llt_get_sa_addr_t *llt_get_sa_addr; llt_free_tbl_t *llt_free_tbl; }; @@ -233,18 +235,18 @@ size_t lltable_drop_entry_queue(struct */ static __inline struct llentry * lltable_lookup_lle(struct lltable *llt, u_int flags, - const struct sockaddr *l3addr) + const void *paddr) { - return llt->llt_lookup(llt, flags, l3addr); + return (llt->llt_lookup(llt, flags, paddr)); } static __inline struct llentry * lltable_create_lle(struct lltable *llt, u_int flags, - const struct sockaddr *l3addr) + const void *paddr) { - return llt->llt_create(llt, flags, l3addr); + return (llt->llt_create(llt, flags, paddr)); } static __inline int Modified: projects/routing/sys/net/rt_nhops.c ============================================================================== --- projects/routing/sys/net/rt_nhops.c Mon Dec 8 21:14:13 2014 (r275624) +++ projects/routing/sys/net/rt_nhops.c Mon Dec 8 23:23:53 2014 (r275625) @@ -680,7 +680,6 @@ fib6_storelladdr(struct ifnet *ifp, stru u_char *desten) { struct llentry *ln; - struct sockaddr_in6 dst_sa; IF_AFDATA_RUN_TRACKER; if (mm_flags & M_MCAST) { @@ -688,19 +687,11 @@ fib6_storelladdr(struct ifnet *ifp, stru return (0); } - memset(&dst_sa, 0, sizeof(dst_sa)); - dst_sa.sin6_family = AF_INET6; - dst_sa.sin6_len = sizeof(dst_sa); - dst_sa.sin6_addr = *dst; - dst_sa.sin6_scope_id = ifp->if_index; - - /* * the entry should have been created in nd6_store_lladdr */ IF_AFDATA_RUN_RLOCK(ifp); - ln = lltable_lookup_lle(LLTABLE6(ifp), LLE_UNLOCKED, - (struct sockaddr *)&dst_sa); + ln = lltable_lookup_lle6(ifp, LLE_UNLOCKED, dst); /* * Perform fast path for the following cases: Modified: projects/routing/sys/netinet/if_ether.c ============================================================================== --- projects/routing/sys/netinet/if_ether.c Mon Dec 8 21:14:13 2014 (r275624) +++ projects/routing/sys/netinet/if_ether.c Mon Dec 8 23:23:53 2014 (r275625) @@ -417,8 +417,6 @@ arpresolve_fast(struct ifnet *ifp, struc u_char *dst_addr) { struct llentry *la; - struct sockaddr_in sin; - const struct sockaddr *sa_dst; IF_AFDATA_RUN_TRACKER; if (mflags & M_BCAST) { @@ -430,14 +428,8 @@ arpresolve_fast(struct ifnet *ifp, struc return (0); } - memset(&sin, 0, sizeof(sin)); - sin.sin_addr = dst; - sin.sin_family = AF_INET; - sin.sin_len = sizeof(sin); - sa_dst = (const struct sockaddr *)&sin; - IF_AFDATA_RUN_RLOCK(ifp); - la = lltable_lookup_lle(LLTABLE(ifp), LLE_UNLOCKED, sa_dst); + la = lltable_lookup_lle4(ifp, LLE_UNLOCKED, &dst); if (la != NULL && (la->r_flags & RLLE_VALID) != 0) { /* Entry found, let's copy lle info */ bcopy(&la->ll_addr, dst_addr, ifp->if_addrlen); @@ -503,9 +495,12 @@ arpresolve(struct ifnet *ifp, struct rte const struct sockaddr *dst, u_char *desten, struct llentry **lle) { struct llentry *la = NULL; + struct in_addr dst4; int is_gw; IF_AFDATA_RUN_TRACKER; + dst4 = SIN(dst)->sin_addr; + *lle = NULL; if (m != NULL) { if (m->m_flags & M_BCAST) { @@ -516,13 +511,13 @@ arpresolve(struct ifnet *ifp, struct rte } if (m->m_flags & M_MCAST && ifp->if_type != IFT_ARCNET) { /* multicast */ - ETHER_MAP_IP_MULTICAST(&SIN(dst)->sin_addr, desten); + ETHER_MAP_IP_MULTICAST(&dst4, desten); return (0); } } IF_AFDATA_RUN_RLOCK(ifp); - la = lltable_lookup_lle(LLTABLE(ifp), LLE_UNLOCKED, dst); + la = lltable_lookup_lle4(ifp, LLE_UNLOCKED, &dst4); if (la != NULL && (la->r_flags & RLLE_VALID) != 0) { /* Entry found, let's copy lle info */ bcopy(&la->ll_addr, desten, ifp->if_addrlen); @@ -545,22 +540,23 @@ arpresolve_slow(struct ifnet *ifp, int i struct llentry *la, *la_tmp; struct mbuf *curr = NULL; struct mbuf *next = NULL; + struct in_addr dst4; int create, error; create = 0; *lle = NULL; + dst4 = SIN(dst)->sin_addr; IF_AFDATA_RLOCK(ifp); - la = lltable_lookup_lle(LLTABLE(ifp), LLE_EXCLUSIVE, dst); + la = lltable_lookup_lle4(ifp, LLE_EXCLUSIVE, &dst4); IF_AFDATA_RUNLOCK(ifp); if (la == NULL && (ifp->if_flags & (IFF_NOARP | IFF_STATICARP)) == 0) { create = 1; - la = lltable_create_lle(LLTABLE(ifp), 0, dst); + la = lltable_create_lle4(ifp, 0, &dst4); if (la != NULL) { IF_AFDATA_CFG_WLOCK(ifp); LLE_WLOCK(la); - la_tmp = lltable_lookup_lle(LLTABLE(ifp), LLE_EXCLUSIVE, - dst); + la_tmp = lltable_lookup_lle4(ifp, LLE_EXCLUSIVE, &dst4); if (la_tmp == NULL) { /* * No entry has been found. Link new one. @@ -582,7 +578,7 @@ arpresolve_slow(struct ifnet *ifp, int i if (create != 0) log(LOG_DEBUG, "arpresolve: can't allocate llinfo for %s on %s\n", - inet_ntoa(SIN(dst)->sin_addr), ifp->if_xname); + inet_ntoa(dst4), ifp->if_xname); m_freem(m); return (EINVAL); } @@ -781,13 +777,8 @@ in_arpinput(struct mbuf *m) int bridged = 0, is_bridge = 0; int carped; struct nhop4_extended nh_ext; - struct sockaddr_in sin; struct llentry *la_tmp; - sin.sin_len = sizeof(struct sockaddr_in); - sin.sin_family = AF_INET; - sin.sin_addr.s_addr = 0; - if (ifp->if_bridge) bridged = 1; if (ifp->if_type == IFT_BRIDGE) @@ -938,14 +929,8 @@ match: if (ifp->if_flags & IFF_STATICARP) goto reply; - bzero(&sin, sizeof(sin)); - sin.sin_len = sizeof(struct sockaddr_in); - sin.sin_family = AF_INET; - sin.sin_addr = isaddr; - IF_AFDATA_CFG_RLOCK(ifp); - la = lltable_lookup_lle(LLTABLE(ifp), LLE_EXCLUSIVE, - (struct sockaddr *)&sin); + la = lltable_lookup_lle4(ifp, LLE_EXCLUSIVE, &isaddr); IF_AFDATA_CFG_RUNLOCK(ifp); if (la != NULL) arp_update_lle(ah, isaddr, ifp, bridged, la); @@ -955,14 +940,12 @@ match: * Reply to our address, but no lle exists yet. * do we really have to create an entry? */ - la = lltable_create_lle(LLTABLE(ifp), 0, - (struct sockaddr *)&sin); + la = lltable_create_lle4(ifp, 0, &isaddr); if (la != NULL) { IF_AFDATA_CFG_WLOCK(ifp); LLE_WLOCK(la); /* Let's try to search another time */ - la_tmp = lltable_lookup_lle(LLTABLE(ifp), LLE_EXCLUSIVE, - (struct sockaddr *)&sin); + la_tmp = lltable_lookup_lle4(ifp, LLE_EXCLUSIVE, &isaddr); if (la_tmp != NULL) { /* * Someone has already inserted another entry. @@ -995,10 +978,8 @@ reply: } else { struct llentry *lle = NULL; - sin.sin_addr = itaddr; IF_AFDATA_RLOCK(ifp); - lle = lltable_lookup_lle(LLTABLE(ifp), 0, - (struct sockaddr *)&sin); + lle = lltable_lookup_lle4(ifp, 0, &itaddr); IF_AFDATA_RUNLOCK(ifp); if ((lle != NULL) && (lle->la_flags & LLE_PUB)) { @@ -1013,7 +994,6 @@ reply: if (!V_arp_proxyall) goto drop; - sin.sin_addr = itaddr; /* XXX MRT use table 0 for arp reply */ if (fib4_lookup_nh_ext(0, itaddr, 0, 0, &nh_ext) != 0) goto drop; @@ -1035,7 +1015,6 @@ reply: * avoids ARP chaos if an interface is connected to the * wrong network. */ - sin.sin_addr = isaddr; /* XXX MRT use table 0 for arp checks */ if (fib4_lookup_nh_ext(0, isaddr, 0, 0, &nh_ext) != 0) @@ -1252,8 +1231,7 @@ arp_ifinit(struct ifnet *ifp, struct ifa * because the output of the arp utility shows * that L2 entry as permanent */ - lle = lltable_create_lle(LLTABLE(ifp), LLE_IFADDR | LLE_STATIC, - (struct sockaddr *)IA_SIN(ifa)); + lle = lltable_create_lle4(ifp, LLE_IFADDR | LLE_STATIC, &addr); if (lle == NULL) { log(LOG_INFO, "arp_ifinit: cannot create arp " "entry for interface address\n"); @@ -1271,8 +1249,7 @@ arp_ifinit(struct ifnet *ifp, struct ifa * Instead of dealing with callouts/flags/etc we simply * delete it and add new one. */ - lle_tmp = lltable_lookup_lle(llt, LLE_EXCLUSIVE, - (struct sockaddr *)IA_SIN(ifa)); + lle_tmp = lltable_lookup_lle4(ifp, LLE_EXCLUSIVE, &addr); IF_AFDATA_RUN_WLOCK(ifp); if (lle_tmp != NULL) Modified: projects/routing/sys/netinet/if_ether.h ============================================================================== --- projects/routing/sys/netinet/if_ether.h Mon Dec 8 21:14:13 2014 (r275624) +++ projects/routing/sys/netinet/if_ether.h Mon Dec 8 23:23:53 2014 (r275625) @@ -117,6 +117,21 @@ struct llentry; struct ifaddr; struct rt_addrinfo; +#define LLTABLE(ifp) \ + ((struct in_ifinfo *)(ifp)->if_afdata[AF_INET])->ii_llt + +static __inline const void * +_check_in_addr_typecast(const struct in_addr *paddr) +{ + + return ((const void *)paddr); +} + +#define lltable_lookup_lle4(i, f, a) \ + lltable_lookup_lle(LLTABLE(i), (f), _check_in_addr_typecast(a)) +#define lltable_create_lle4(i, f, a) \ + lltable_create_lle(LLTABLE(i), (f), _check_in_addr_typecast(a)) + int arpresolve(struct ifnet *ifp, struct rtentry *rt, struct mbuf *m, const struct sockaddr *dst, u_char *desten, struct llentry **lle); int arpresolve_fast(struct ifnet *ifp, struct in_addr dst, u_int mflags, Modified: projects/routing/sys/netinet/in.c ============================================================================== --- projects/routing/sys/netinet/in.c Mon Dec 8 21:14:13 2014 (r275624) +++ projects/routing/sys/netinet/in.c Mon Dec 8 23:23:53 2014 (r275625) @@ -1009,18 +1009,19 @@ in_lltable_free(struct llentry *lle) } static struct llentry * -in_lltable_new(const struct sockaddr *l3addr, u_int flags) +in_lltable_new(struct in_addr addr4, u_int flags) { struct in_llentry *lle; - const struct sockaddr_in *l3addr_sin; lle = malloc(sizeof(struct in_llentry), M_LLTABLE, M_NOWAIT | M_ZERO); if (lle == NULL) /* NB: caller generates msg */ return NULL; - l3addr_sin = (const struct sockaddr_in *)l3addr; - lle->base.r_l3addr.addr4 = l3addr_sin->sin_addr; - lle->l3_addr4 = *l3addr_sin; + lle->base.r_l3addr.addr4 = addr4; + /* XXX: Legacy */ + lle->l3_addr4.sin_len = sizeof(lle->l3_addr4); + lle->l3_addr4.sin_family = AF_INET; + lle->l3_addr4.sin_addr = addr4; /* * For IPv4 this will trigger "arpresolve" to generate @@ -1058,15 +1059,10 @@ in_lltable_match_prefix(const struct soc } static int -in_lltable_rtcheck(struct ifnet *ifp, u_int flags, const struct sockaddr *l3addr) +in_lltable_rtcheck(struct ifnet *ifp, u_int flags, struct in_addr dst) { struct nhop4_basic nh4; - struct in_addr dst; - - KASSERT(l3addr->sa_family == AF_INET, - ("sin_family %d", l3addr->sa_family)); - dst = ((struct sockaddr_in *)l3addr)->sin_addr; if (fib4_lookup_nh(ifp->if_fib, dst, 0, 0, &nh4) != 0) return (EINVAL); @@ -1112,6 +1108,16 @@ in_lltable_hash(const struct llentry *ll return (in_lltable_hash_dst(lle->r_l3addr.addr4)); } +static const void * +in_lltable_get_sa_addr(const struct sockaddr *l3addr) +{ + const struct sockaddr_in *sin; + + sin = (const struct sockaddr_in *)l3addr; + + return ((const void *)&sin->sin_addr); +} + static inline struct llentry * in_lltable_find_dst(struct lltable *llt, struct in_addr dst) { @@ -1174,13 +1180,13 @@ in_lltable_delete(struct lltable *llt, u } static struct llentry * -in_lltable_create(struct lltable *llt, u_int flags, const struct sockaddr *l3addr) +in_lltable_create(struct lltable *llt, u_int flags, const void *paddr) { struct ifnet *ifp = llt->llt_ifp; struct llentry *lle; + struct in_addr addr4; - KASSERT(l3addr->sa_family == AF_INET, - ("sin_family %d", l3addr->sa_family)); + addr4 = *((const struct in_addr *)paddr); /* * A route that covers the given address must have @@ -1188,10 +1194,10 @@ in_lltable_create(struct lltable *llt, u * verify this. */ if (!(flags & LLE_IFADDR) && - in_lltable_rtcheck(ifp, flags, l3addr) != 0) + in_lltable_rtcheck(ifp, flags, addr4) != 0) return (NULL); - lle = in_lltable_new(l3addr, flags); + lle = in_lltable_new(addr4, flags); if (lle == NULL) { log(LOG_INFO, "lla_lookup: new lle malloc failed\n"); return (NULL); @@ -1206,7 +1212,7 @@ in_lltable_create(struct lltable *llt, u * If found return lle read locked. */ static struct llentry * -in_lltable_lookup(struct lltable *llt, u_int flags, const struct sockaddr *l3addr) +in_lltable_lookup(struct lltable *llt, u_int flags, const void *paddr) { struct llentry *lle; struct in_addr dst; @@ -1216,10 +1222,8 @@ in_lltable_lookup(struct lltable *llt, u * by different locks. * IF_AFDATA_LOCK_ASSERT(llt->llt_ifp); */ - KASSERT(l3addr->sa_family == AF_INET, - ("sin_family %d", l3addr->sa_family)); - dst = ((const struct sockaddr_in *)l3addr)->sin_addr; + dst = *((const struct in_addr *)paddr); lle = in_lltable_find_dst(llt, dst); if (lle == NULL) @@ -1312,6 +1316,7 @@ in_domifattach(struct ifnet *ifp) llt->llt_delete_addr = in_lltable_delete; llt->llt_dump_entry = in_lltable_dump_entry; llt->llt_hash = in_lltable_hash; + llt->llt_get_sa_addr = in_lltable_get_sa_addr; llt->llt_clear_entry = arp_lltable_clear_entry; llt->llt_match_prefix = in_lltable_match_prefix; llt->llt_prepare_static_entry = arp_lltable_prepare_static_entry; Modified: projects/routing/sys/netinet/in_var.h ============================================================================== --- projects/routing/sys/netinet/in_var.h Mon Dec 8 21:14:13 2014 (r275624) +++ projects/routing/sys/netinet/in_var.h Mon Dec 8 23:23:53 2014 (r275625) @@ -96,8 +96,6 @@ struct in_aliasreq { #ifdef _KERNEL extern u_char inetctlerrmap[]; -#define LLTABLE(ifp) \ - ((struct in_ifinfo *)(ifp)->if_afdata[AF_INET])->ii_llt /* * Hash table for IP addresses. */ Modified: projects/routing/sys/netinet/toecore.c ============================================================================== --- projects/routing/sys/netinet/toecore.c Mon Dec 8 21:14:13 2014 (r275624) +++ projects/routing/sys/netinet/toecore.c Mon Dec 8 23:23:53 2014 (r275625) @@ -456,22 +456,24 @@ static int toe_nd6_resolve(struct ifnet *ifp, struct sockaddr *sa, uint8_t *lladdr) { struct llentry *lle, *lle_tmp; - struct sockaddr_in6 *sin6 = (void *)sa; + struct in6_addr *dst; int rc, flags = 0; + dst = &((struct sockaddr_in6 *)sa)->sin6_addr; + restart: IF_AFDATA_RLOCK(ifp); - lle = lltable_lookup_lle(LLTABLE6(ifp), flags, sa); + lle = lltable_lookup_lle6(ifp, flags, dst); IF_AFDATA_RUNLOCK(ifp); if (lle == NULL) { - lle = nd6_create(&sin6->sin6_addr, 0, ifp); + lle = lltable_create_lle6(ifp, 0, dst); if (lle == NULL) return (ENOMEM); /* Couldn't create entry in cache. */ lle->ln_state = ND6_LLINFO_INCOMPLETE; IF_AFDATA_CFG_WLOCK(ifp); LLE_WLOCK(lle); /* Check if the same record was addded */ - lle_tmp = lltable_lookup_lle(LLTABLE6(ifp), LLE_EXCLUSIVE, sa); + lle_tmp = lltable_lookup_lle6(ifp, LLE_EXCLUSIVE, dst); if (lle_tmp == NULL) { /* * No entry has been found. Link new one. @@ -487,7 +489,7 @@ restart: (long)ND_IFINFO(ifp)->retrans * hz / 1000); LLE_WUNLOCK(lle); - nd6_ns_output(ifp, NULL, &sin6->sin6_addr, NULL, 0); + nd6_ns_output(ifp, NULL, dst, NULL, 0); return (EWOULDBLOCK); } Modified: projects/routing/sys/netinet6/in6.c ============================================================================== --- projects/routing/sys/netinet6/in6.c Mon Dec 8 21:14:13 2014 (r275624) +++ projects/routing/sys/netinet6/in6.c Mon Dec 8 23:23:53 2014 (r275625) @@ -2064,18 +2064,19 @@ in6_lltable_free(struct llentry *lle) } static struct llentry * -in6_lltable_new(const struct sockaddr *l3addr, u_int flags) +in6_lltable_new(const struct in6_addr *addr6, u_int flags) { struct in6_llentry *lle; - const struct sockaddr_in6 *l3addr_sin6; lle = malloc(sizeof(struct in6_llentry), M_LLTABLE, M_NOWAIT | M_ZERO); if (lle == NULL) /* NB: caller generates msg */ return NULL; - l3addr_sin6 = (const struct sockaddr_in6 *)l3addr; - lle->l3_addr6 = *l3addr_sin6; - lle->base.r_l3addr.addr6 = l3addr_sin6->sin6_addr; + lle->base.r_l3addr.addr6 = *addr6; + /* XXX: legacy */ + lle->l3_addr6.sin6_family = AF_INET6; + lle->l3_addr6.sin6_len = sizeof(lle->l3_addr6); + lle->l3_addr6.sin6_addr = *addr6; lle->base.lle_refcnt = 1; lle->base.lle_free = in6_lltable_free; LLE_LOCK_INIT(&lle->base); @@ -2103,20 +2104,18 @@ in6_lltable_match_prefix(const struct so static int in6_lltable_rtcheck(struct ifnet *ifp, u_int flags, - const struct sockaddr *l3addr) + const struct in6_addr *addr6) { struct nhop6_basic nh6; + struct sockaddr_in6 sin6; struct in6_addr dst; uint32_t scopeid; int error; char ip6buf[INET6_ADDRSTRLEN]; - KASSERT(l3addr->sa_family == AF_INET6, - ("sin_family %d", l3addr->sa_family)); - /* Our local addresses are always only installed on the default FIB. */ - in6_splitscope(&((struct sockaddr_in6 *)l3addr)->sin6_addr, &dst, &scopeid); + in6_splitscope(addr6, &dst, &scopeid); error = fib6_lookup_nh(RT_DEFAULT_FIB, &dst, scopeid, 0, 0, &nh6); if (error != 0 || ((nh6.nh_flags & NHF_GATEWAY) != 0) || nh6.nh_ifp != ifp) { struct ifaddr *ifa; @@ -2125,13 +2124,17 @@ in6_lltable_rtcheck(struct ifnet *ifp, * that is not covered by our own prefix. */ /* XXX ifaof_ifpforaddr should take a const param */ - ifa = ifaof_ifpforaddr(__DECONST(struct sockaddr *, l3addr), ifp); + bzero(&sin6, sizeof(sin6)); + sin6.sin6_family = AF_INET6; + sin6.sin6_len = sizeof(sin6); + sin6.sin6_addr = *addr6; + ifa = ifaof_ifpforaddr(__DECONST(struct sockaddr *, &sin6), ifp); if (ifa != NULL) { ifa_free(ifa); return 0; } log(LOG_INFO, "IPv6 address: \"%s\" is not on the network\n", - ip6_sprintf(ip6buf, &((const struct sockaddr_in6 *)l3addr)->sin6_addr)); + ip6_sprintf(ip6buf, addr6)); return EINVAL; } return 0; @@ -2151,6 +2154,16 @@ in6_lltable_hash(const struct llentry *l return (in6_lltable_hash_dst(&lle->r_l3addr.addr6)); } +static const void * +in6_lltable_get_sa_addr(const struct sockaddr *l3addr) +{ + const struct sockaddr_in6 *sin6; + + sin6 = (const struct sockaddr_in6 *)l3addr; + + return ((const void *)&sin6->sin6_addr); +} + static inline struct llentry * in6_lltable_find_dst(struct lltable *llt, const struct in6_addr *dst) { @@ -2213,26 +2226,25 @@ in6_lltable_delete(struct lltable *llt, static struct llentry * in6_lltable_create(struct lltable *llt, u_int flags, - const struct sockaddr *l3addr) + const void *paddr) { struct ifnet *ifp = llt->llt_ifp; struct llentry *lle; - - KASSERT(l3addr->sa_family == AF_INET6, - ("sin_family %d", l3addr->sa_family)); + const struct in6_addr *addr6; IF_AFDATA_CFG_UNLOCK_ASSERT(ifp); + addr6 = (const struct in6_addr *)paddr; /* * A route that covers the given address must have * been installed 1st because we are doing a resolution, * verify this. */ if (!(flags & LLE_IFADDR) && - in6_lltable_rtcheck(ifp, flags, l3addr) != 0) + in6_lltable_rtcheck(ifp, flags, addr6) != 0) return NULL; - lle = in6_lltable_new(l3addr, flags); + lle = in6_lltable_new(addr6, flags); if (lle == NULL) { log(LOG_INFO, "lla_lookup: new lle malloc failed\n"); return NULL; @@ -2244,9 +2256,9 @@ in6_lltable_create(struct lltable *llt, static struct llentry * in6_lltable_lookup(struct lltable *llt, u_int flags, - const struct sockaddr *l3addr) + const void *l3addr) { - const struct sockaddr_in6 *sin6 = (const struct sockaddr_in6 *)l3addr; + const struct in6_addr *dst6; struct llentry *lle; /* @@ -2254,10 +2266,9 @@ in6_lltable_lookup(struct lltable *llt, * by different locks. * IF_AFDATA_LOCK_ASSERT(llt->llt_ifp); */ - KASSERT(l3addr->sa_family == AF_INET6, - ("sin_family %d", l3addr->sa_family)); + dst6 = (const struct in6_addr *)l3addr; - lle = in6_lltable_find_dst(llt, &sin6->sin6_addr); + lle = in6_lltable_find_dst(llt, dst6); if (lle == NULL) return (NULL); @@ -2377,6 +2388,7 @@ in6_domifattach(struct ifnet *ifp) llt->llt_delete_addr = in6_lltable_delete; llt->llt_dump_entry = in6_lltable_dump_entry; llt->llt_hash = in6_lltable_hash; + llt->llt_get_sa_addr = in6_lltable_get_sa_addr; llt->llt_clear_entry = nd6_lltable_clear_entry; llt->llt_match_prefix = in6_lltable_match_prefix; llt->llt_prepare_static_entry = nd6_lltable_prepare_static_entry; Modified: projects/routing/sys/netinet6/in6_var.h ============================================================================== --- projects/routing/sys/netinet6/in6_var.h Mon Dec 8 21:14:13 2014 (r275624) +++ projects/routing/sys/netinet6/in6_var.h Mon Dec 8 23:23:53 2014 (r275625) @@ -108,8 +108,6 @@ struct in6_ifextra { struct mld_ifinfo *mld_ifinfo; }; -#define LLTABLE6(ifp) (((struct in6_ifextra *)(ifp)->if_afdata[AF_INET6])->lltable) - #if defined(_KERNEL) || defined(_WANT_IFADDR) struct in6_ifaddr { struct ifaddr ia_ifa; /* protocol-independent info */ Modified: projects/routing/sys/netinet6/nd6.c ============================================================================== --- projects/routing/sys/netinet6/nd6.c Mon Dec 8 21:14:13 2014 (r275624) +++ projects/routing/sys/netinet6/nd6.c Mon Dec 8 23:23:53 2014 (r275625) @@ -889,55 +889,6 @@ nd6_purge(struct ifnet *ifp) */ } -/* - * the caller acquires and releases the lock on the lltbls - * Returns the llentry locked - */ -struct llentry * -nd6_lookup(struct in6_addr *addr6, int flags, struct ifnet *ifp) -{ - struct sockaddr_in6 sin6; - struct llentry *ln; - int llflags; - - bzero(&sin6, sizeof(sin6)); - sin6.sin6_len = sizeof(struct sockaddr_in6); - sin6.sin6_family = AF_INET6; - sin6.sin6_addr = *addr6; - - /* - * IF_AFDATA_LOCK_ASSERT(ifp); - */ - - llflags = (flags & ND6_EXCLUSIVE) ? LLE_EXCLUSIVE : 0; - ln = lltable_lookup_lle(LLTABLE6(ifp), llflags, - (struct sockaddr *)&sin6); - - return (ln); -} - -/* - * Creates and returns new, unlinked and unlocked lle. - */ -struct llentry * -nd6_create(struct in6_addr *addr6, int flags, struct ifnet *ifp) -{ - struct sockaddr_in6 sin6; - struct llentry *ln; - - bzero(&sin6, sizeof(sin6)); - sin6.sin6_len = sizeof(struct sockaddr_in6); - sin6.sin6_family = AF_INET6; - sin6.sin6_addr = *addr6; - - IF_AFDATA_CFG_UNLOCK_ASSERT(ifp); - - ln = lltable_create_lle(LLTABLE6(ifp), 0, (struct sockaddr *)&sin6); - ln->ln_state = ND6_LLINFO_NOSTATE; - - return (ln); -} - /* * Test whether a given IPv6 address is a neighbor or not, ignoring * the actual neighbor cache. The neighbor cache is ignored in order @@ -1295,7 +1246,7 @@ nd6_nud_hint(struct rtentry *rt, struct ifp = rt->rt_ifp; IF_AFDATA_RLOCK(ifp); - ln = nd6_lookup(dst6, ND6_EXCLUSIVE, NULL); + ln = nd6_lookup(dst6, ND6_EXCLUSIVE, ifp); IF_AFDATA_RUNLOCK(ifp); if (ln == NULL) return; @@ -1798,9 +1749,11 @@ nd6_cache_lladdr(struct ifnet *ifp, stru ln = nd6_lookup(from, ND6_EXCLUSIVE, ifp); IF_AFDATA_CFG_RUNLOCK(ifp); if (ln == NULL) { - ln = nd6_create(from, 0, ifp); - if (ln != NULL) + ln = lltable_create_lle6(ifp, 0, from); + if (ln != NULL) { LLE_WLOCK(ln); + ln->ln_state = ND6_LLINFO_NOSTATE; + } is_newentry = 1; } else { /* do nothing if record is static */ @@ -2204,8 +2157,9 @@ nd6_output_lle(struct ifnet *ifp, struct * the condition below is not very efficient. But we believe * it is tolerable, because this should be a rare case. */ - lle = nd6_create(&dst->sin6_addr, 0, ifp); + lle = lltable_create_lle6(ifp, 0, &dst->sin6_addr); if (lle != NULL) { + lle->ln_state = ND6_LLINFO_NOSTATE; IF_AFDATA_CFG_WLOCK(ifp); LLE_WLOCK(lle); /* Check if the same record was addded */ @@ -2483,12 +2437,13 @@ nd6_add_ifa_lle(struct in6_ifaddr *ia) struct ifnet *ifp; struct llentry *ln, *ln_tmp; struct lltable *llt; + struct in6_addr *addr6; ifp = ia->ia_ifa.ifa_ifp; + addr6 = &ia->ia_addr.sin6_addr; ia->ia_ifa.ifa_rtrequest = nd6_rtrequest; - ln = lltable_create_lle(LLTABLE6(ifp), LLE_IFADDR, - (struct sockaddr *)&ia->ia_addr); + ln = lltable_create_lle6(ifp, LLE_IFADDR, addr6); if (ln == NULL) return (ENOBUFS); @@ -2507,8 +2462,7 @@ nd6_add_ifa_lle(struct in6_ifaddr *ia) * Instead of dealing with callouts/flags/etc we simply * delete it and add new one. */ - ln_tmp = lltable_lookup_lle(llt, LLE_EXCLUSIVE, - (struct sockaddr *)&ia->ia_addr); + ln_tmp = lltable_lookup_lle6(ifp, LLE_EXCLUSIVE, addr6); bcopy(IF_LLADDR(ifp), &ln->ll_addr, ifp->if_addrlen); /* Finally, link our lle to the list */ @@ -2563,8 +2517,10 @@ nd6_storelladdr(struct ifnet *ifp, struc const struct sockaddr *dst, u_char *desten, struct llentry **lle) { struct llentry *ln; + const struct in6_addr *addr6; *lle = NULL; + addr6 = &SIN6(dst)->sin6_addr; IF_AFDATA_CFG_UNLOCK_ASSERT(ifp); if (m != NULL && m->m_flags & M_MCAST) { int i; @@ -2580,8 +2536,7 @@ nd6_storelladdr(struct ifnet *ifp, struc #endif case IFT_BRIDGE: case IFT_ISO88025: - ETHER_MAP_IPV6_MULTICAST(&SIN6(dst)->sin6_addr, - desten); + ETHER_MAP_IPV6_MULTICAST(addr6, desten); return (0); case IFT_IEEE1394: /* @@ -2605,7 +2560,7 @@ nd6_storelladdr(struct ifnet *ifp, struc * the entry should have been created in nd6_store_lladdr */ IF_AFDATA_RLOCK(ifp); - ln = lltable_lookup_lle(LLTABLE6(ifp), 0, dst); + ln = lltable_lookup_lle6(ifp, 0, addr6); IF_AFDATA_RUNLOCK(ifp); if ((ln == NULL) || !(ln->la_flags & LLE_VALID)) { if (ln != NULL) Modified: projects/routing/sys/netinet6/nd6.h ============================================================================== --- projects/routing/sys/netinet6/nd6.h Mon Dec 8 21:14:13 2014 (r275624) +++ projects/routing/sys/netinet6/nd6.h Mon Dec 8 23:23:53 2014 (r275625) @@ -89,8 +89,6 @@ struct nd_ifinfo { #define ND6_IFF_NO_RADR 0x40 #define ND6_IFF_NO_PREFER_IFACE 0x80 /* XXX: not related to ND. */ -#define ND6_EXCLUSIVE LLE_EXCLUSIVE - #ifdef _KERNEL #define ND_IFINFO(ifp) \ (((struct in6_ifextra *)(ifp)->if_afdata[AF_INET6])->nd_ifinfo) @@ -389,14 +387,33 @@ void nd6_init(void); #ifdef VIMAGE void nd6_destroy(void); #endif + +#define LLTABLE6(ifp) \ + (((struct in6_ifextra *)(ifp)->if_afdata[AF_INET6])->lltable) + +static __inline const void * +_check_in6_addr_typecast(const struct in6_addr *paddr) +{ + + return ((const void *)paddr); +} + +#define lltable_lookup_lle6(i, f, a) \ + lltable_lookup_lle(LLTABLE6(i), (f), _check_in6_addr_typecast(a)) +#define lltable_create_lle6(i, f, a) \ + lltable_create_lle(LLTABLE6(i), (f), _check_in6_addr_typecast(a)) + +#define nd6_lookup(a, f, i) lltable_lookup_lle6((i), (f), (a)) +#define ND6_EXCLUSIVE LLE_EXCLUSIVE + + + struct nd_ifinfo *nd6_ifattach(struct ifnet *); void nd6_ifdetach(struct nd_ifinfo *); int nd6_is_addr_neighbor(struct sockaddr_in6 *, struct ifnet *); void nd6_option_init(void *, int, union nd_opts *); struct nd_opt_hdr *nd6_option(union nd_opts *); int nd6_options(union nd_opts *); -struct llentry *nd6_lookup(struct in6_addr *, int, struct ifnet *); -struct llentry *nd6_create(struct in6_addr *, int, struct ifnet *); void nd6_setmtu(struct ifnet *); void nd6_llinfo_settimer(struct llentry *, long); void nd6_llinfo_settimer_locked(struct llentry *, long); From owner-svn-src-projects@FreeBSD.ORG Tue Dec 9 00:48:10 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BC959A9D; Tue, 9 Dec 2014 00:48:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A7D30BF4; Tue, 9 Dec 2014 00:48:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB90mAjg065626; Tue, 9 Dec 2014 00:48:10 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB90m8tC065610; Tue, 9 Dec 2014 00:48:09 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201412090048.sB90m8tC065610@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Tue, 9 Dec 2014 00:48:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r275628 - in projects/routing/sys: net netinet netinet6 X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Dec 2014 00:48:10 -0000 Author: melifaro Date: Tue Dec 9 00:48:08 2014 New Revision: 275628 URL: https://svnweb.freebsd.org/changeset/base/275628 Log: * Do not assume lle has sockaddr key after struct lle: use llt_fill_sa_entry() llt method to store lle address in sa. * Eliminate L3_ADDR macro and either reference IPv4/IPv6 address directly from lle or use newly-created llt_fill_sa_entry(). * Do not store sockaddr inside arp/ndp lle anymore. Modified: projects/routing/sys/net/if_llatbl.h projects/routing/sys/netinet/if_ether.c projects/routing/sys/netinet/in.c projects/routing/sys/netinet/toecore.c projects/routing/sys/netinet6/in6.c projects/routing/sys/netinet6/nd6.c projects/routing/sys/netinet6/nd6_nbr.c Modified: projects/routing/sys/net/if_llatbl.h ============================================================================== --- projects/routing/sys/net/if_llatbl.h Tue Dec 9 00:47:46 2014 (r275627) +++ projects/routing/sys/net/if_llatbl.h Tue Dec 9 00:48:08 2014 (r275628) @@ -135,10 +135,6 @@ struct llentry { #define ln_timer_ch lle_timer.ln_timer_ch #define la_timer lle_timer.la_timer -/* XXX bad name */ -#define L3_ADDR(lle) ((struct sockaddr *)(&lle[1])) -#define L3_ADDR_LEN(lle) (((struct sockaddr *)(&lle[1]))->sa_len) - #ifndef LLTBL_HASHTBL_SIZE #define LLTBL_HASHTBL_SIZE 32 /* default 32 ? */ #endif @@ -165,6 +161,7 @@ typedef void (llt_unlink_entry_t)(struct typedef int (llt_prepare_sentry_t)(struct lltable *, struct llentry *, struct rt_addrinfo *); typedef const void *(llt_get_sa_addr_t)(const struct sockaddr *l3addr); +typedef void (llt_fill_sa_entry_t)(const struct llentry *, struct sockaddr *); typedef int (llt_foreach_cb_t)(struct lltable *, struct llentry *, void *); typedef int (llt_foreach_entry_t)(struct lltable *, llt_foreach_cb_t *, void *); @@ -188,6 +185,7 @@ struct lltable { llt_unlink_entry_t *llt_unlink_entry; llt_prepare_sentry_t *llt_prepare_static_entry; llt_get_sa_addr_t *llt_get_sa_addr; + llt_fill_sa_entry_t *llt_fill_sa_entry; llt_free_tbl_t *llt_free_tbl; }; @@ -271,6 +269,16 @@ lltable_unlink_entry(struct lltable *llt llt->llt_unlink_entry(lle); } +static __inline void +lltable_fill_sa_entry(const struct llentry *lle, struct sockaddr *sa) +{ + struct lltable *llt; + + llt = lle->lle_tbl; + + llt->llt_fill_sa_entry(lle, sa); +} + int lla_rt_output(struct rt_msghdr *, struct rt_addrinfo *); #include Modified: projects/routing/sys/netinet/if_ether.c ============================================================================== --- projects/routing/sys/netinet/if_ether.c Tue Dec 9 00:47:46 2014 (r275627) +++ projects/routing/sys/netinet/if_ether.c Tue Dec 9 00:48:08 2014 (r275628) @@ -232,9 +232,7 @@ arptimer(void *arg) case ARP_LLINFO_VERIFY: if (lle->r_kick == 0 && lle->la_preempt > 0) { /* Entry was used, issue refresh request */ - struct sockaddr_in *dst; - dst = (struct sockaddr_in *)L3_ADDR(lle); - arprequest(ifp, NULL, &dst->sin_addr, NULL); + arprequest(ifp, NULL, &lle->r_l3addr.addr4, NULL); lle->la_preempt--; lle->r_kick = 1; callout_schedule(&lle->la_timer, hz * V_arpt_rexmit); @@ -1193,7 +1191,7 @@ arp_update_lle(struct arphdr *ah, struct m_hold = la->la_hold; la->la_hold = NULL; la->la_numheld = 0; - memcpy(&sin, L3_ADDR(la), sizeof(sin)); + lltable_fill_sa_entry(la, (struct sockaddr *)&sin); LLE_WUNLOCK(la); for (; m_hold != NULL; m_hold = m_hold_next) { m_hold_next = m_hold->m_nextpkt; Modified: projects/routing/sys/netinet/in.c ============================================================================== --- projects/routing/sys/netinet/in.c Tue Dec 9 00:47:46 2014 (r275627) +++ projects/routing/sys/netinet/in.c Tue Dec 9 00:48:08 2014 (r275628) @@ -988,11 +988,6 @@ in_purgemaddrs(struct ifnet *ifp) IN_MULTI_UNLOCK(); } -struct in_llentry { - struct llentry base; - struct sockaddr_in l3_addr4; -}; - /* * Frees unlinked record. * This function is called by the timer functions @@ -1011,17 +1006,13 @@ in_lltable_free(struct llentry *lle) static struct llentry * in_lltable_new(struct in_addr addr4, u_int flags) { - struct in_llentry *lle; + struct llentry *lle; - lle = malloc(sizeof(struct in_llentry), M_LLTABLE, M_NOWAIT | M_ZERO); + lle = malloc(sizeof(struct llentry), M_LLTABLE, M_NOWAIT | M_ZERO); if (lle == NULL) /* NB: caller generates msg */ return NULL; lle->base.r_l3addr.addr4 = addr4; - /* XXX: Legacy */ - lle->l3_addr4.sin_len = sizeof(lle->l3_addr4); - lle->l3_addr4.sin_family = AF_INET; - lle->l3_addr4.sin_addr = addr4; /* * For IPv4 this will trigger "arpresolve" to generate @@ -1038,7 +1029,7 @@ in_lltable_new(struct in_addr addr4, u_i } #define IN_ARE_MASKED_ADDR_EQUAL(d, a, m) ( \ - (((ntohl((d)->sin_addr.s_addr) ^ (a)->sin_addr.s_addr) & (m)->sin_addr.s_addr)) == 0 ) + (((ntohl((d).s_addr) ^ (a)->sin_addr.s_addr) & (m)->sin_addr.s_addr)) == 0 ) static int in_lltable_match_prefix(const struct sockaddr *prefix, @@ -1051,7 +1042,7 @@ in_lltable_match_prefix(const struct soc * (flags & LLE_STATIC) means deleting all entries * including static ARP entries. */ - if (IN_ARE_MASKED_ADDR_EQUAL(satosin(L3_ADDR(lle)), pfx, msk) && + if (IN_ARE_MASKED_ADDR_EQUAL(lle->r_l3addr.addr4, pfx, msk) && ((flags & LLE_STATIC) || !(lle->la_flags & LLE_STATIC))) return (1); @@ -1118,6 +1109,18 @@ in_lltable_get_sa_addr(const struct sock return ((const void *)&sin->sin_addr); } +static void +in_lltable_fill_sa_entry(const struct llentry *lle, struct sockaddr *sa) +{ + struct sockaddr_in *sin; + + sin = (struct sockaddr_in *)sa; + bzero(sin, sizeof(*sin)); + sin->sin_family = AF_INET; + sin->sin_len = sizeof(*sin); + sin->sin_addr = lle->r_l3addr.addr4; +} + static inline struct llentry * in_lltable_find_dst(struct lltable *llt, struct in_addr dst) { @@ -1251,8 +1254,11 @@ in_lltable_dump_entry(struct lltable *ll struct sockaddr_dl *sdl; int error; + bzero(&arpc, sizeof(arpc)); /* Skip if jailed and not a valid IP of the prison. */ - if (prison_if(wr->td->td_ucred, L3_ADDR(lle)) != 0) + lltable_fill_sa_entry(lle,(struct sockaddr *)&arpc.sin); + if (prison_if(wr->td->td_ucred, + (struct sockaddr *)&arpc.sin) != 0) return (0); /* * produce a msg made of: @@ -1260,15 +1266,11 @@ in_lltable_dump_entry(struct lltable *ll * struct sockaddr_in; (IPv4) * struct sockaddr_dl; */ - bzero(&arpc, sizeof(arpc)); arpc.rtm.rtm_msglen = sizeof(arpc); arpc.rtm.rtm_version = RTM_VERSION; arpc.rtm.rtm_type = RTM_GET; arpc.rtm.rtm_flags = RTF_UP; arpc.rtm.rtm_addrs = RTA_DST | RTA_GATEWAY; - arpc.sin.sin_family = AF_INET; - arpc.sin.sin_len = sizeof(arpc.sin); - arpc.sin.sin_addr.s_addr = lle->r_l3addr.addr4.s_addr; /* publish */ if (lle->la_flags & LLE_PUB) @@ -1317,6 +1319,7 @@ in_domifattach(struct ifnet *ifp) llt->llt_dump_entry = in_lltable_dump_entry; llt->llt_hash = in_lltable_hash; llt->llt_get_sa_addr = in_lltable_get_sa_addr; + llt->llt_fill_sa_entry = in_lltable_fill_sa_entry; llt->llt_clear_entry = arp_lltable_clear_entry; llt->llt_match_prefix = in_lltable_match_prefix; llt->llt_prepare_static_entry = arp_lltable_prepare_static_entry; Modified: projects/routing/sys/netinet/toecore.c ============================================================================== --- projects/routing/sys/netinet/toecore.c Tue Dec 9 00:47:46 2014 (r275627) +++ projects/routing/sys/netinet/toecore.c Tue Dec 9 00:48:08 2014 (r275628) @@ -392,21 +392,26 @@ toe_lle_event(void *arg __unused, struct struct sockaddr *sa; uint8_t *lladdr; uint16_t vtag; + int sa_family; + struct sockaddr_storage ss; LLE_WLOCK_ASSERT(lle); ifp = lle->lle_tbl->llt_ifp; - sa = L3_ADDR(lle); + sa_family = lle->lle_tbl->llt_af; +#if 0 + /* XXX: Do not panic, ignore event instead */ KASSERT(sa->sa_family == AF_INET || sa->sa_family == AF_INET6, ("%s: lle_event %d for lle %p but sa %p !INET && !INET6", __func__, evt, lle, sa)); +#endif /* * Not interested if the interface's TOE capability is not enabled. */ - if ((sa->sa_family == AF_INET && !(ifp->if_capenable & IFCAP_TOE4)) || - (sa->sa_family == AF_INET6 && !(ifp->if_capenable & IFCAP_TOE6))) + if ((sa_family == AF_INET && !(ifp->if_capenable & IFCAP_TOE4)) || + (sa_family == AF_INET6 && !(ifp->if_capenable & IFCAP_TOE6))) return; tod = TOEDEV(ifp); @@ -433,6 +438,8 @@ toe_lle_event(void *arg __unused, struct #endif } + sa = (struct sockaddr *)&ss; + lltable_fill_sa_entry(lle, sa); tod->tod_l2_update(tod, ifp, sa, lladdr, vtag); } Modified: projects/routing/sys/netinet6/in6.c ============================================================================== --- projects/routing/sys/netinet6/in6.c Tue Dec 9 00:47:46 2014 (r275627) +++ projects/routing/sys/netinet6/in6.c Tue Dec 9 00:48:08 2014 (r275628) @@ -2046,11 +2046,6 @@ in6_if2idlen(struct ifnet *ifp) #include -struct in6_llentry { - struct llentry base; - struct sockaddr_in6 l3_addr6; -}; - /* * Frees already unlinked @lle. */ @@ -2066,17 +2061,13 @@ in6_lltable_free(struct llentry *lle) static struct llentry * in6_lltable_new(const struct in6_addr *addr6, u_int flags) { - struct in6_llentry *lle; + struct llentry *lle; - lle = malloc(sizeof(struct in6_llentry), M_LLTABLE, M_NOWAIT | M_ZERO); + lle = malloc(sizeof(struct llentry), M_LLTABLE, M_NOWAIT | M_ZERO); if (lle == NULL) /* NB: caller generates msg */ return NULL; lle->base.r_l3addr.addr6 = *addr6; - /* XXX: legacy */ - lle->l3_addr6.sin6_family = AF_INET6; - lle->l3_addr6.sin6_len = sizeof(lle->l3_addr6); - lle->l3_addr6.sin6_addr = *addr6; lle->base.lle_refcnt = 1; lle->base.lle_free = in6_lltable_free; LLE_LOCK_INIT(&lle->base); @@ -2093,7 +2084,7 @@ in6_lltable_match_prefix(const struct so const struct sockaddr_in6 *pfx = (const struct sockaddr_in6 *)prefix; const struct sockaddr_in6 *msk = (const struct sockaddr_in6 *)mask; - if (IN6_ARE_MASKED_ADDR_EQUAL(&satosin6(L3_ADDR(lle))->sin6_addr, + if (IN6_ARE_MASKED_ADDR_EQUAL(&lle->r_l3addr.addr6, &pfx->sin6_addr, &msk->sin6_addr) && ((flags & LLE_STATIC) || !(lle->la_flags & LLE_STATIC))) return (1); @@ -2164,6 +2155,18 @@ in6_lltable_get_sa_addr(const struct soc return ((const void *)&sin6->sin6_addr); } +static void +in6_lltable_fill_sa_entry(const struct llentry *lle, struct sockaddr *sa) +{ + struct sockaddr_in6 *sin6; + + sin6 = (struct sockaddr_in6 *)sa; + bzero(sin6, sizeof(*sin6)); + sin6->sin6_family = AF_INET6; + sin6->sin6_len = sizeof(*sin6); + sin6->sin6_addr = lle->r_l3addr.addr6; +} + static inline struct llentry * in6_lltable_find_dst(struct lltable *llt, const struct in6_addr *dst) { @@ -2300,11 +2303,15 @@ in6_lltable_dump_entry(struct lltable *l struct sockaddr_dl *sdl; int error; + bzero(&ndpc, sizeof(ndpc)); /* skip invalid entries */ if ((lle->la_flags & LLE_VALID) == 0) return (0); /* Skip if jailed and not a valid IP of the prison. */ - if (prison_if(wr->td->td_ucred, L3_ADDR(lle)) != 0) + lltable_fill_sa_entry(lle, + (struct sockaddr *)&ndpc.sin6); + if (prison_if(wr->td->td_ucred, + (struct sockaddr *)&ndpc.sin6) != 0) return (0); /* * produce a msg made of: @@ -2312,15 +2319,11 @@ in6_lltable_dump_entry(struct lltable *l * struct sockaddr_in6 (IPv6) * struct sockaddr_dl; */ - bzero(&ndpc, sizeof(ndpc)); ndpc.rtm.rtm_msglen = sizeof(ndpc); ndpc.rtm.rtm_version = RTM_VERSION; ndpc.rtm.rtm_type = RTM_GET; ndpc.rtm.rtm_flags = RTF_UP; ndpc.rtm.rtm_addrs = RTA_DST | RTA_GATEWAY; - ndpc.sin6.sin6_family = AF_INET6; - ndpc.sin6.sin6_len = sizeof(ndpc.sin6); - bcopy(L3_ADDR(lle), &ndpc.sin6, L3_ADDR_LEN(lle)); if (V_deembed_scopeid) sa6_recoverscope(&ndpc.sin6); @@ -2389,6 +2392,7 @@ in6_domifattach(struct ifnet *ifp) llt->llt_dump_entry = in6_lltable_dump_entry; llt->llt_hash = in6_lltable_hash; llt->llt_get_sa_addr = in6_lltable_get_sa_addr; + llt->llt_fill_sa_entry = in6_lltable_fill_sa_entry; llt->llt_clear_entry = nd6_lltable_clear_entry; llt->llt_match_prefix = in6_lltable_match_prefix; llt->llt_prepare_static_entry = nd6_lltable_prepare_static_entry; Modified: projects/routing/sys/netinet6/nd6.c ============================================================================== --- projects/routing/sys/netinet6/nd6.c Tue Dec 9 00:47:46 2014 (r275627) +++ projects/routing/sys/netinet6/nd6.c Tue Dec 9 00:48:08 2014 (r275628) @@ -68,7 +68,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#define L3_ADDR_SIN6(le) ((struct sockaddr_in6 *) L3_ADDR(le)) #include #include #include @@ -543,7 +542,7 @@ nd6_llinfo_timer(void *arg) CURVNET_SET(ifp->if_vnet); ndi = ND_IFINFO(ifp); - dst = &L3_ADDR_SIN6(ln)->sin6_addr; + dst = &ln->r_l3addr.addr6; /* * Each case statement needs to unlock @ln before break/return. @@ -1122,7 +1121,7 @@ nd6_check_del_defrtr(struct lltable *llt struct in6_addr dst; ifp = llt->llt_ifp; - dst = L3_ADDR_SIN6(ln)->sin6_addr; + dst = ln->r_l3addr.addr6; LLE_WLOCK_ASSERT(ln); @@ -1165,7 +1164,7 @@ nd6_check_recalc_defrtr(struct lltable * struct in6_addr dst; ifp = llt->llt_ifp; - dst = L3_ADDR_SIN6(ln)->sin6_addr; + dst = ln->r_l3addr.addr6; LLE_WLOCK_ASSERT(ln); @@ -1909,6 +1908,8 @@ nd6_cache_lladdr(struct ifnet *ifp, stru if (ln->la_hold) { struct mbuf *m_hold, *m_hold_next; + lltable_fill_sa_entry(ln, (struct sockaddr *)&sin6); + /* * reset the la_hold in advance, to explicitly * prevent a la_hold lookup in nd6_output() @@ -1924,15 +1925,12 @@ nd6_cache_lladdr(struct ifnet *ifp, stru * just set the 2nd argument as the * 1st one. */ - nd6_output_lle(ifp, ifp, m_hold, L3_ADDR_SIN6(ln), NULL, ln, &chain); + nd6_output_lle(ifp, ifp, m_hold, &sin6, NULL, ln, &chain); } /* * If we have mbufs in the chain we need to do - * deferred transmit. Copy the address from the - * llentry before dropping the lock down below. + * deferred transmit. */ - if (chain != NULL) - memcpy(&sin6, L3_ADDR_SIN6(ln), sizeof(sin6)); } } else if (ln->ln_state == ND6_LLINFO_INCOMPLETE) { /* probe right away */ Modified: projects/routing/sys/netinet6/nd6_nbr.c ============================================================================== --- projects/routing/sys/netinet6/nd6_nbr.c Tue Dec 9 00:47:46 2014 (r275627) +++ projects/routing/sys/netinet6/nd6_nbr.c Tue Dec 9 00:48:08 2014 (r275628) @@ -65,7 +65,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#define L3_ADDR_SIN6(le) ((struct sockaddr_in6 *) L3_ADDR(le)) #include #include #include @@ -824,7 +823,7 @@ nd6_na_input(struct mbuf *m, int off, in struct nd_defrouter *dr; struct in6_addr *in6; - in6 = &L3_ADDR_SIN6(ln)->sin6_addr; + in6 = &ln->r_l3addr.addr6; /* * Lock to protect the default router list. @@ -879,13 +878,15 @@ nd6_na_input(struct mbuf *m, int off, in m_tag_prepend(m, mtag); } - nd6_output_lle(ifp, ifp, m_hold, L3_ADDR_SIN6(ln), NULL, ln, &chain); + lltable_fill_sa_entry(ln, (struct sockaddr *)&sin6); + nd6_output_lle(ifp, ifp, m_hold, &sin6, NULL, ln, + &chain); } } freeit: if (ln != NULL) { if (chain) - memcpy(&sin6, L3_ADDR_SIN6(ln), sizeof(sin6)); + lltable_fill_sa_entry(ln, (struct sockaddr *)&sin6); LLE_WUNLOCK(ln); if (chain) From owner-svn-src-projects@FreeBSD.ORG Tue Dec 9 07:48:26 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C5A90A5A; Tue, 9 Dec 2014 07:48:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 98436B19; Tue, 9 Dec 2014 07:48:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB97mQvS087198; Tue, 9 Dec 2014 07:48:26 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB97mQub087197; Tue, 9 Dec 2014 07:48:26 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201412090748.sB97mQub087197@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 9 Dec 2014 07:48:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r275634 - projects/clang350-import/contrib/llvm/lib/Transforms/Vectorize X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Dec 2014 07:48:26 -0000 Author: dim Date: Tue Dec 9 07:48:25 2014 New Revision: 275634 URL: https://svnweb.freebsd.org/changeset/base/275634 Log: Pull in r223171 from upstream llvm trunk (by Michael Zolotukhin): PR21302. Vectorize only bottom-tested loops. rdar://problem/18886083 This fixes a bug in the llvm vectorizer, which could sometimes cause vectorized loops to perform an additional iteration, leading to possible buffer overruns. Symptoms of this, which are usually segfaults, were first noticed when building gcc ports, here: https://lists.freebsd.org/pipermail/freebsd-ports/2014-September/095466.html https://lists.freebsd.org/pipermail/freebsd-toolchain/2014-September/001211.html Note: because this is applied on top of llvm/clang 3.5.0, this fix is slightly different from the one just checked into head in r275633. Modified: projects/clang350-import/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp Modified: projects/clang350-import/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp ============================================================================== --- projects/clang350-import/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp Tue Dec 9 07:34:28 2014 (r275633) +++ projects/clang350-import/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp Tue Dec 9 07:48:25 2014 (r275634) @@ -3466,6 +3466,15 @@ bool LoopVectorizationLegality::canVecto return false; } + // We only handle bottom-tested loops, i.e. loop in which the condition is + // checked at the end of each iteration. With that we can assume that all + // instructions in the loop are executed the same number of times. + if (TheLoop->getExitingBlock() != TheLoop->getLoopLatch()) { + emitAnalysis( + Report() << "loop control flow is not understood by vectorizer"); + return false; + } + // We need to have a loop header. DEBUG(dbgs() << "LV: Found a loop: " << TheLoop->getHeader()->getName() << '\n'); From owner-svn-src-projects@FreeBSD.ORG Tue Dec 9 07:55:38 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 87CE5BE1; Tue, 9 Dec 2014 07:55:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 74E54BFE; Tue, 9 Dec 2014 07:55:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB97tcXp091777; Tue, 9 Dec 2014 07:55:38 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB97tc9A091775; Tue, 9 Dec 2014 07:55:38 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201412090755.sB97tc9A091775@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 9 Dec 2014 07:55:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r275635 - in projects/clang350-import/sys: dev/usb/controller sys X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Dec 2014 07:55:38 -0000 Author: dim Date: Tue Dec 9 07:55:37 2014 New Revision: 275635 URL: https://svnweb.freebsd.org/changeset/base/275635 Log: Merge ^/head r275623 through 275634. Modified: projects/clang350-import/sys/dev/usb/controller/xhci_pci.c projects/clang350-import/sys/sys/param.h Directory Properties: projects/clang350-import/ (props changed) projects/clang350-import/contrib/llvm/ (props changed) projects/clang350-import/sys/ (props changed) Modified: projects/clang350-import/sys/dev/usb/controller/xhci_pci.c ============================================================================== --- projects/clang350-import/sys/dev/usb/controller/xhci_pci.c Tue Dec 9 07:48:25 2014 (r275634) +++ projects/clang350-import/sys/dev/usb/controller/xhci_pci.c Tue Dec 9 07:55:37 2014 (r275635) @@ -252,6 +252,7 @@ xhci_pci_attach(device_t self) case 0x9c318086: /* Panther Point */ case 0x1e318086: /* Panther Point */ case 0x8c318086: /* Lynx Point */ + case 0x8cb18086: /* Wildcat Point */ sc->sc_port_route = &xhci_pci_port_route; sc->sc_imod_default = XHCI_IMOD_DEFAULT_LP; break; Modified: projects/clang350-import/sys/sys/param.h ============================================================================== --- projects/clang350-import/sys/sys/param.h Tue Dec 9 07:48:25 2014 (r275634) +++ projects/clang350-import/sys/sys/param.h Tue Dec 9 07:55:37 2014 (r275635) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1100048 /* Master, propagated to newvers */ +#define __FreeBSD_version 1100050 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-projects@FreeBSD.ORG Tue Dec 9 20:05:06 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 24A6A6E1; Tue, 9 Dec 2014 20:05:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 11023CC5; Tue, 9 Dec 2014 20:05:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB9K55Bh066879; Tue, 9 Dec 2014 20:05:05 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB9K55D4066878; Tue, 9 Dec 2014 20:05:05 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201412092005.sB9K55D4066878@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 9 Dec 2014 20:05:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r275652 - projects/clang350-import/contrib/llvm/patches X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Dec 2014 20:05:06 -0000 Author: dim Date: Tue Dec 9 20:05:05 2014 New Revision: 275652 URL: https://svnweb.freebsd.org/changeset/base/275652 Log: Add llvm patch corresponding to r275635. Added: projects/clang350-import/contrib/llvm/patches/patch-21-llvm-r223171-fix-vectorizer.diff Added: projects/clang350-import/contrib/llvm/patches/patch-21-llvm-r223171-fix-vectorizer.diff ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/clang350-import/contrib/llvm/patches/patch-21-llvm-r223171-fix-vectorizer.diff Tue Dec 9 20:05:05 2014 (r275652) @@ -0,0 +1,75 @@ +Pull in r223171 from upstream llvm trunk (by Michael Zolotukhin): + + PR21302. Vectorize only bottom-tested loops. + + rdar://problem/18886083 + +This fixes a bug in the llvm vectorizer, which could sometimes cause +vectorized loops to perform an additional iteration, leading to possible +buffer overruns. Symptoms of this, which are usually segfaults, were +first noticed when building gcc ports, here: + +https://lists.freebsd.org/pipermail/freebsd-ports/2014-September/095466.html +https://lists.freebsd.org/pipermail/freebsd-toolchain/2014-September/001211.html + +Note: because this is applied on top of llvm/clang 3.5.0, this fix is +slightly different from the one just checked into head in r275633. + +Introduced here: http://svnweb.freebsd.org/changeset/base/275635 + +Index: lib/Transforms/Vectorize/LoopVectorize.cpp +=================================================================== +--- lib/Transforms/Vectorize/LoopVectorize.cpp (revision 21) ++++ lib/Transforms/Vectorize/LoopVectorize.cpp (revision 22) +@@ -3466,6 +3466,15 @@ bool LoopVectorizationLegality::canVectorize() { + return false; + } + ++ // We only handle bottom-tested loops, i.e. loop in which the condition is ++ // checked at the end of each iteration. With that we can assume that all ++ // instructions in the loop are executed the same number of times. ++ if (TheLoop->getExitingBlock() != TheLoop->getLoopLatch()) { ++ emitAnalysis( ++ Report() << "loop control flow is not understood by vectorizer"); ++ return false; ++ } ++ + // We need to have a loop header. + DEBUG(dbgs() << "LV: Found a loop: " << + TheLoop->getHeader()->getName() << '\n'); +Index: test/Transforms/LoopVectorize/loop-form.ll +=================================================================== +--- test/Transforms/LoopVectorize/loop-form.ll (revision 0) ++++ test/Transforms/LoopVectorize/loop-form.ll (revision 22) +@@ -0,0 +1,31 @@ ++; RUN: opt -S -loop-vectorize < %s | FileCheck %s ++target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" ++ ++; Check that we vectorize only bottom-tested loops. ++; This is a reduced testcase from PR21302. ++; ++; rdar://problem/18886083 ++ ++%struct.X = type { i32, i16 } ++; CHECK-LABEL: @foo( ++; CHECK-NOT: vector.body ++ ++define void @foo(i32 %n) { ++entry: ++ br label %for.cond ++ ++for.cond: ++ %i = phi i32 [ 0, %entry ], [ %inc, %for.body ] ++ %cmp = icmp slt i32 %i, %n ++ br i1 %cmp, label %for.body, label %if.end ++ ++for.body: ++ %iprom = sext i32 %i to i64 ++ %b = getelementptr inbounds %struct.X* undef, i64 %iprom, i32 1 ++ store i16 0, i16* %b, align 4 ++ %inc = add nsw i32 %i, 1 ++ br label %for.cond ++ ++if.end: ++ ret void ++} From owner-svn-src-projects@FreeBSD.ORG Tue Dec 9 20:41:53 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0DCFD31D; Tue, 9 Dec 2014 20:41:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D4EE3156; Tue, 9 Dec 2014 20:41:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB9Kfqqu086897; Tue, 9 Dec 2014 20:41:52 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB9KfqA0086745; Tue, 9 Dec 2014 20:41:52 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201412092041.sB9KfqA0086745@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 9 Dec 2014 20:41:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r275654 - in projects/clang350-import/contrib/llvm: include/llvm/MC lib/Target/ARM/AsmParser X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Dec 2014 20:41:53 -0000 Author: dim Date: Tue Dec 9 20:41:51 2014 New Revision: 275654 URL: https://svnweb.freebsd.org/changeset/base/275654 Log: Pull in r223147, r223255 and r223390 from upstream llvm trunk (by Roman Divacky): Introduce CPUStringIsValid() into MCSubtargetInfo and use it for ARM .cpu parsing. Previously .cpu directive in ARM assembler didnt switch to the new CPU and therefore acted as a nop. This implemented real action for .cpu and eg. allows to assembler FreeBSD kernel with -integrated-as. Change the name to be in style. Add a FIXME as requested by Renato Golin. Modified: projects/clang350-import/contrib/llvm/include/llvm/MC/MCSubtargetInfo.h projects/clang350-import/contrib/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Modified: projects/clang350-import/contrib/llvm/include/llvm/MC/MCSubtargetInfo.h ============================================================================== --- projects/clang350-import/contrib/llvm/include/llvm/MC/MCSubtargetInfo.h Tue Dec 9 20:36:07 2014 (r275653) +++ projects/clang350-import/contrib/llvm/include/llvm/MC/MCSubtargetInfo.h Tue Dec 9 20:41:51 2014 (r275654) @@ -132,6 +132,15 @@ public: /// Initialize an InstrItineraryData instance. void initInstrItins(InstrItineraryData &InstrItins) const; + + /// Check whether the CPU string is valid. + bool isCPUStringValid(StringRef CPU) { + auto Found = std::find_if(ProcDesc.begin(), ProcDesc.end(), + [=](const SubtargetFeatureKV &KV) { + return CPU == KV.Key; + }); + return Found != ProcDesc.end(); + } }; } // End llvm namespace Modified: projects/clang350-import/contrib/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp ============================================================================== --- projects/clang350-import/contrib/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Tue Dec 9 20:36:07 2014 (r275653) +++ projects/clang350-import/contrib/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Tue Dec 9 20:41:51 2014 (r275654) @@ -8618,6 +8618,20 @@ bool ARMAsmParser::parseDirectiveEabiAtt bool ARMAsmParser::parseDirectiveCPU(SMLoc L) { StringRef CPU = getParser().parseStringToEndOfStatement().trim(); getTargetStreamer().emitTextAttribute(ARMBuildAttrs::CPU_name, CPU); + + if (!STI.isCPUStringValid(CPU)) { + Error(L, "Unknown CPU name"); + return false; + } + + // FIXME: This switches the CPU features globally, therefore it might + // happen that code you would not expect to assemble will. For details + // see: http://llvm.org/bugs/show_bug.cgi?id=20757 + STI.InitMCProcessorInfo(CPU, ""); + STI.InitCPUSchedModel(CPU); + unsigned FB = ComputeAvailableFeatures(STI.getFeatureBits()); + setAvailableFeatures(FB); + return false; } From owner-svn-src-projects@FreeBSD.ORG Tue Dec 9 20:46:18 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 941B94AE; Tue, 9 Dec 2014 20:46:18 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7615718C; Tue, 9 Dec 2014 20:46:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB9KkIGZ087773; Tue, 9 Dec 2014 20:46:18 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB9KkHLH087767; Tue, 9 Dec 2014 20:46:17 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201412092046.sB9KkHLH087767@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 9 Dec 2014 20:46:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r275655 - projects/clang350-import/contrib/llvm/patches X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Dec 2014 20:46:18 -0000 Author: dim Date: Tue Dec 9 20:46:17 2014 New Revision: 275655 URL: https://svnweb.freebsd.org/changeset/base/275655 Log: Add llvm patch corresponding to r275654, and clean up a few other patches. Added: projects/clang350-import/contrib/llvm/patches/patch-22-llvm-r223147-arm-cpu-directive.diff Modified: projects/clang350-import/contrib/llvm/patches/patch-20-enable-armv6-clrex.diff projects/clang350-import/contrib/llvm/patches/patch-21-llvm-r223171-fix-vectorizer.diff Modified: projects/clang350-import/contrib/llvm/patches/patch-20-enable-armv6-clrex.diff ============================================================================== --- projects/clang350-import/contrib/llvm/patches/patch-20-enable-armv6-clrex.diff Tue Dec 9 20:41:51 2014 (r275654) +++ projects/clang350-import/contrib/llvm/patches/patch-20-enable-armv6-clrex.diff Tue Dec 9 20:46:17 2014 (r275655) @@ -7,8 +7,8 @@ Introduced here: http://svnweb.freebsd.o Index: lib/Target/ARM/ARMInstrInfo.td =================================================================== ---- lib/Target/ARM/ARMInstrInfo.td (revision 20) -+++ lib/Target/ARM/ARMInstrInfo.td (revision 21) +--- lib/Target/ARM/ARMInstrInfo.td ++++ lib/Target/ARM/ARMInstrInfo.td @@ -4615,7 +4615,7 @@ def STLEXD : AIstlex<0b01, (outs GPR:$Rd), def CLREX : AXI<(outs), (ins), MiscFrm, NoItinerary, "clrex", Modified: projects/clang350-import/contrib/llvm/patches/patch-21-llvm-r223171-fix-vectorizer.diff ============================================================================== --- projects/clang350-import/contrib/llvm/patches/patch-21-llvm-r223171-fix-vectorizer.diff Tue Dec 9 20:41:51 2014 (r275654) +++ projects/clang350-import/contrib/llvm/patches/patch-21-llvm-r223171-fix-vectorizer.diff Tue Dec 9 20:46:17 2014 (r275655) @@ -19,8 +19,8 @@ Introduced here: http://svnweb.freebsd.o Index: lib/Transforms/Vectorize/LoopVectorize.cpp =================================================================== ---- lib/Transforms/Vectorize/LoopVectorize.cpp (revision 21) -+++ lib/Transforms/Vectorize/LoopVectorize.cpp (revision 22) +--- lib/Transforms/Vectorize/LoopVectorize.cpp ++++ lib/Transforms/Vectorize/LoopVectorize.cpp @@ -3466,6 +3466,15 @@ bool LoopVectorizationLegality::canVectorize() { return false; } @@ -39,8 +39,8 @@ Index: lib/Transforms/Vectorize/LoopVect TheLoop->getHeader()->getName() << '\n'); Index: test/Transforms/LoopVectorize/loop-form.ll =================================================================== ---- test/Transforms/LoopVectorize/loop-form.ll (revision 0) -+++ test/Transforms/LoopVectorize/loop-form.ll (revision 22) +--- test/Transforms/LoopVectorize/loop-form.ll ++++ test/Transforms/LoopVectorize/loop-form.ll @@ -0,0 +1,31 @@ +; RUN: opt -S -loop-vectorize < %s | FileCheck %s +target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" Added: projects/clang350-import/contrib/llvm/patches/patch-22-llvm-r223147-arm-cpu-directive.diff ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/clang350-import/contrib/llvm/patches/patch-22-llvm-r223147-arm-cpu-directive.diff Tue Dec 9 20:46:17 2014 (r275655) @@ -0,0 +1,79 @@ +Pull in r223147, r223255 and r223390 from upstream llvm trunk (by Roman +Divacky): + + Introduce CPUStringIsValid() into MCSubtargetInfo and use it for ARM + .cpu parsing. + + Previously .cpu directive in ARM assembler didnt switch to the new + CPU and therefore acted as a nop. This implemented real action for + .cpu and eg. allows to assembler FreeBSD kernel with -integrated-as. + + Change the name to be in style. + + Add a FIXME as requested by Renato Golin. + +Introduced here: http://svnweb.freebsd.org/changeset/base/275654 + +Index: include/llvm/MC/MCSubtargetInfo.h +=================================================================== +--- include/llvm/MC/MCSubtargetInfo.h ++++ include/llvm/MC/MCSubtargetInfo.h +@@ -132,6 +132,15 @@ class MCSubtargetInfo { + + /// Initialize an InstrItineraryData instance. + void initInstrItins(InstrItineraryData &InstrItins) const; ++ ++ /// Check whether the CPU string is valid. ++ bool isCPUStringValid(StringRef CPU) { ++ auto Found = std::find_if(ProcDesc.begin(), ProcDesc.end(), ++ [=](const SubtargetFeatureKV &KV) { ++ return CPU == KV.Key; ++ }); ++ return Found != ProcDesc.end(); ++ } + }; + + } // End llvm namespace +Index: lib/Target/ARM/AsmParser/ARMAsmParser.cpp +=================================================================== +--- lib/Target/ARM/AsmParser/ARMAsmParser.cpp ++++ lib/Target/ARM/AsmParser/ARMAsmParser.cpp +@@ -8618,6 +8618,20 @@ bool ARMAsmParser::parseDirectiveEabiAttr(SMLoc L) + bool ARMAsmParser::parseDirectiveCPU(SMLoc L) { + StringRef CPU = getParser().parseStringToEndOfStatement().trim(); + getTargetStreamer().emitTextAttribute(ARMBuildAttrs::CPU_name, CPU); ++ ++ if (!STI.isCPUStringValid(CPU)) { ++ Error(L, "Unknown CPU name"); ++ return false; ++ } ++ ++ // FIXME: This switches the CPU features globally, therefore it might ++ // happen that code you would not expect to assemble will. For details ++ // see: http://llvm.org/bugs/show_bug.cgi?id=20757 ++ STI.InitMCProcessorInfo(CPU, ""); ++ STI.InitCPUSchedModel(CPU); ++ unsigned FB = ComputeAvailableFeatures(STI.getFeatureBits()); ++ setAvailableFeatures(FB); ++ + return false; + } + +Index: test/MC/ARM/cpu-test.s +=================================================================== +--- test/MC/ARM/cpu-test.s ++++ test/MC/ARM/cpu-test.s +@@ -0,0 +1,13 @@ ++// RUN: not llvm-mc -o - -triple arm-gnueabi-freebsd11.0 < %s > %t 2> %t2 ++// RUN: FileCheck %s < %t ++// RUN: FileCheck %s --check-prefix=CHECK-ERROR < %t2 ++ ++// CHECK: .cpu cortex-a8 ++.cpu cortex-a8 ++// CHECK: dsb sy ++dsb ++.cpu arm9 ++// CHECK-ERROR: error: instruction requires: data-barriers ++dsb ++// CHECK-ERROR: error: Unknown CPU name ++.cpu foobar From owner-svn-src-projects@FreeBSD.ORG Wed Dec 10 05:59:32 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 14D0FC4A; Wed, 10 Dec 2014 05:59:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EB06D787; Wed, 10 Dec 2014 05:59:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBA5xVfO060357; Wed, 10 Dec 2014 05:59:31 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBA5xTNn060344; Wed, 10 Dec 2014 05:59:29 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201412100559.sBA5xTNn060344@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Wed, 10 Dec 2014 05:59:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r275661 - in projects/building-blocks: lib share/examples share/man/man4 share/mk sys/conf sys/modules tools/build/options X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2014 05:59:32 -0000 Author: ngie Date: Wed Dec 10 05:59:29 2014 New Revision: 275661 URL: https://svnweb.freebsd.org/changeset/base/275661 Log: Move MK_BHYVE/MK_HYPERV to architecture specific sections in Makefiles instead of introducing an architecture specific section in src.opts.mk Make it clear in the documentation that the options only affect certain architectures to reduce user confusion if the knobs are tweaked A better method for abstracting this out will be done in the future in a different commit Discussed with/Requested by: imp Modified: projects/building-blocks/lib/Makefile projects/building-blocks/share/examples/Makefile projects/building-blocks/share/man/man4/Makefile projects/building-blocks/share/mk/src.opts.mk projects/building-blocks/sys/conf/kern.opts.mk projects/building-blocks/sys/modules/Makefile projects/building-blocks/tools/build/options/WITHOUT_BHYVE projects/building-blocks/tools/build/options/WITH_HYPERV Modified: projects/building-blocks/lib/Makefile ============================================================================== --- projects/building-blocks/lib/Makefile Wed Dec 10 04:54:43 2014 (r275660) +++ projects/building-blocks/lib/Makefile Wed Dec 10 05:59:29 2014 (r275661) @@ -173,10 +173,6 @@ _libngatm= libngatm _libauditd= libauditd .endif -.if ${MK_BHYVE} != "no" -_libvmmapi= libvmmapi -.endif - .if ${MK_BLUETOOTH} != "no" _libbluetooth= libbluetooth _libsdp= libsdp @@ -261,28 +257,6 @@ _libypclnt= libypclnt _libevent= libevent .endif -.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" -_libsmb= libsmb -_libvgl= libvgl -_libproc= libproc -_librtld_db= librtld_db -.endif - -.if ${MACHINE_CPUARCH} == "mips" -_libproc= libproc -_librtld_db= librtld_db -.endif - -.if ${MACHINE_CPUARCH} == "powerpc" -_libproc= libproc -_librtld_db= librtld_db -_libsmb= libsmb -.endif - -.if ${MACHINE_CPUARCH} == "sparc64" -_libsmb= libsmb -.endif - .if ${MK_OPENSSL} != "no" _libmp= libmp .endif @@ -326,6 +300,34 @@ _libusbhid= libusbhid _libusb= libusb .endif +.if ${MACHINE_CPUARCH} == "amd64" +.if ${MK_BHYVE} != "no" +_libvmmapi= libvmmapi +.endif +.endif + +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" +_libsmb= libsmb +_libvgl= libvgl +_libproc= libproc +_librtld_db= librtld_db +.endif + +.if ${MACHINE_CPUARCH} == "mips" +_libproc= libproc +_librtld_db= librtld_db +.endif + +.if ${MACHINE_CPUARCH} == "powerpc" +_libproc= libproc +_librtld_db= librtld_db +_libsmb= libsmb +.endif + +.if ${MACHINE_CPUARCH} == "sparc64" +_libsmb= libsmb +.endif + .if !defined(LIBRARIES_ONLY) afterinstall: ${INSTALL_SYMLINK} ../include ${DESTDIR}/usr/lib/include Modified: projects/building-blocks/share/examples/Makefile ============================================================================== --- projects/building-blocks/share/examples/Makefile Wed Dec 10 04:54:43 2014 (r275660) +++ projects/building-blocks/share/examples/Makefile Wed Dec 10 05:59:29 2014 (r275661) @@ -184,11 +184,6 @@ NO_OBJ= # in environments where it's not possible to keep /sys publicly readable) SHARED?= copies -.if ${MK_BHYVE} != "no" -LDIRS+= bhyve -XFILES+= bhyve/vmrun.sh -.endif - .if ${MK_HAST} != "no" LDIRS+= hast XFILES+= hast/ucarp.sh \ @@ -219,6 +214,13 @@ XFILES+= libusb20/Makefile \ libusb20/control.c .endif +.if ${MACHINE_CPUARCH} == "amd64" +.if ${MK_BHYVE} != "no" +LDIRS+= bhyve +XFILES+= bhyve/vmrun.sh +.endif +.endif + beforeinstall: ${SHARED} etc-examples .ORDER: ${SHARED} etc-examples Modified: projects/building-blocks/share/man/man4/Makefile ============================================================================== --- projects/building-blocks/share/man/man4/Makefile Wed Dec 10 04:54:43 2014 (r275660) +++ projects/building-blocks/share/man/man4/Makefile Wed Dec 10 05:59:29 2014 (r275661) @@ -729,6 +729,10 @@ MLINKS+=qlxge.4 if_qlxge.4 MLINKS+=qlxgb.4 if_qlxgb.4 MLINKS+=qlxgbe.4 if_qlxgbe.4 MLINKS+=sfxge.4 if_sfxge.4 + +.if ${MK_BHYVE} != "no" +_bhyve.4= bhyve.4 +.endif .endif .if ${MACHINE_CPUARCH} == "mips" @@ -739,10 +743,6 @@ _nvram2env.4= nvram2env.4 SUBDIR= man4.${MACHINE_CPUARCH} .endif -.if ${MK_BHYVE} != "no" -_bhyve.4= bhyve.4 -.endif - .if ${MK_CCD} != "no" _ccd.4= ccd.4 .endif Modified: projects/building-blocks/share/mk/src.opts.mk ============================================================================== --- projects/building-blocks/share/mk/src.opts.mk Wed Dec 10 04:54:43 2014 (r275660) +++ projects/building-blocks/share/mk/src.opts.mk Wed Dec 10 05:59:29 2014 (r275661) @@ -53,6 +53,7 @@ __DEFAULT_YES_OPTIONS = \ AUDIT \ AUTHPF \ AUTOFS \ + BHYVE \ BINUTILS \ BINUTILS_BOOTSTRAP \ BLUETOOTH \ @@ -101,6 +102,7 @@ __DEFAULT_YES_OPTIONS = \ GROFF \ HAST \ HTML \ + HYPERV \ ICONV \ INET \ INET6 \ @@ -234,20 +236,6 @@ __DEFAULT_NO_OPTIONS+=CLANG_IS_CC CLANG __DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX .endif -# bhyve is only supported on amd64 -.if ${__T} == "amd64" -__DEFAULT_YES_OPTIONS+=BHYVE -.else -MK_BHYVE:= no -.endif - -# hyperv is only supported on amd64 and i386/i386 -.if ${__T} == "amd64" || (${__T} == "i386" && ${__TT} == "i386") -__DEFAULT_YES_OPTIONS+=HYPERV -.else -MK_HYPERV:= no -.endif - .include # Modified: projects/building-blocks/sys/conf/kern.opts.mk ============================================================================== --- projects/building-blocks/sys/conf/kern.opts.mk Wed Dec 10 04:54:43 2014 (r275660) +++ projects/building-blocks/sys/conf/kern.opts.mk Wed Dec 10 05:59:29 2014 (r275661) @@ -24,11 +24,13 @@ __DEFAULT_YES_OPTIONS = \ AUTOFS \ + BHYVE \ BLUETOOTH \ CCD \ CDDL \ CRYPT \ FORMAT_EXTENSIONS \ + HYPERV \ ISCSI \ INET \ INET6 \ @@ -69,20 +71,6 @@ __TT=${TARGET} __TT=${MACHINE} .endif -# bhyve is only supported on amd64 -.if ${__T} == "amd64" -__DEFAULT_YES_OPTIONS+=BHYVE -.else -MK_BHYVE:= no -.endif - -# hyperv is only supported on amd64 and i386/i386 -.if ${__T} == "amd64" || (${__T} == "i386" && ${__TT} == "i386") -__DEFAULT_YES_OPTIONS+=HYPERV -.else -MK_HYPERV:= no -.endif - # expanded inline from bsd.mkopt.mk to avoid share/mk dependency # Those that default to yes Modified: projects/building-blocks/sys/modules/Makefile ============================================================================== --- projects/building-blocks/sys/modules/Makefile Wed Dec 10 04:54:43 2014 (r275660) +++ projects/building-blocks/sys/modules/Makefile Wed Dec 10 05:59:29 2014 (r275661) @@ -388,10 +388,6 @@ SUBDIR= \ _autofs= autofs .endif -.if ${MK_BHYVE} != "no" || defined(ALL_MODULES) -_vmm= vmm -.endif - .if ${MK_CRYPT} != "no" || defined(ALL_MODULES) .if exists(${.CURDIR}/../opencrypto) _crypto= crypto @@ -402,10 +398,6 @@ _random= random .endif .endif -.if ${MK_HYPERV} != "no" || defined(ALL_MODULES) -_hyperv= hyperv -.endif - .if (${MK_INET_SUPPORT} != "no" || ${MK_INET6_SUPPORT} != "no") || \ defined(ALL_MODULES) _carp= carp @@ -505,6 +497,9 @@ _et= et _exca= exca _ext2fs= ext2fs _filemon= filemon +.if ${MK_HYPERV} != "no" || defined(ALL_MODULES) +_hyperv= hyperv +.endif _i2c= i2c .if ${MK_OFED} != "no" || defined(ALL_MODULES) _ibcore= ibcore @@ -625,6 +620,10 @@ _qlxge= qlxge _qlxgb= qlxgb _qlxgbe= qlxgbe _sfxge= sfxge + +.if ${MK_BHYVE} != "no" || defined(ALL_MODULES) +_vmm= vmm +.endif .endif .if ${MACHINE_CPUARCH} == "i386" Modified: projects/building-blocks/tools/build/options/WITHOUT_BHYVE ============================================================================== --- projects/building-blocks/tools/build/options/WITHOUT_BHYVE Wed Dec 10 04:54:43 2014 (r275660) +++ projects/building-blocks/tools/build/options/WITHOUT_BHYVE Wed Dec 10 05:59:29 2014 (r275661) @@ -2,3 +2,5 @@ Set to not build or install .Xr bhyve 8 , associated utilities, and examples. +.Pp +This option only affects amd64/amd64 Modified: projects/building-blocks/tools/build/options/WITH_HYPERV ============================================================================== --- projects/building-blocks/tools/build/options/WITH_HYPERV Wed Dec 10 04:54:43 2014 (r275660) +++ projects/building-blocks/tools/build/options/WITH_HYPERV Wed Dec 10 05:59:29 2014 (r275661) @@ -1,2 +1,4 @@ .\" $FreeBSD$ Set to build and install HyperV utilities. +.Pp +This option only affects amd64/amd64 and i386/i386 From owner-svn-src-projects@FreeBSD.ORG Wed Dec 10 06:02:32 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 57A96D56; Wed, 10 Dec 2014 06:02:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4572D837; Wed, 10 Dec 2014 06:02:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBA62WH3064379; Wed, 10 Dec 2014 06:02:32 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBA62VRe064375; Wed, 10 Dec 2014 06:02:31 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201412100602.sBA62VRe064375@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Wed, 10 Dec 2014 06:02:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r275662 - projects/building-blocks/tools/build/options X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2014 06:02:32 -0000 Author: ngie Date: Wed Dec 10 06:02:31 2014 New Revision: 275662 URL: https://svnweb.freebsd.org/changeset/base/275662 Log: Add periods to the end of the lines noting architecture caveats for *BHYVE/*HYPERV Modified: projects/building-blocks/tools/build/options/WITHOUT_BHYVE projects/building-blocks/tools/build/options/WITH_HYPERV Modified: projects/building-blocks/tools/build/options/WITHOUT_BHYVE ============================================================================== --- projects/building-blocks/tools/build/options/WITHOUT_BHYVE Wed Dec 10 05:59:29 2014 (r275661) +++ projects/building-blocks/tools/build/options/WITHOUT_BHYVE Wed Dec 10 06:02:31 2014 (r275662) @@ -3,4 +3,4 @@ Set to not build or install .Xr bhyve 8 , associated utilities, and examples. .Pp -This option only affects amd64/amd64 +This option only affects amd64/amd64. Modified: projects/building-blocks/tools/build/options/WITH_HYPERV ============================================================================== --- projects/building-blocks/tools/build/options/WITH_HYPERV Wed Dec 10 05:59:29 2014 (r275661) +++ projects/building-blocks/tools/build/options/WITH_HYPERV Wed Dec 10 06:02:31 2014 (r275662) @@ -1,4 +1,4 @@ .\" $FreeBSD$ Set to build and install HyperV utilities. .Pp -This option only affects amd64/amd64 and i386/i386 +This option only affects amd64/amd64 and i386/i386. From owner-svn-src-projects@FreeBSD.ORG Wed Dec 10 06:33:25 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D24361CD; Wed, 10 Dec 2014 06:33:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BFD7AB0A; Wed, 10 Dec 2014 06:33:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBA6XPUJ079086; Wed, 10 Dec 2014 06:33:25 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBA6XPYI079085; Wed, 10 Dec 2014 06:33:25 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201412100633.sBA6XPYI079085@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Wed, 10 Dec 2014 06:33:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r275663 - projects/building-blocks/tools/build/options X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2014 06:33:25 -0000 Author: ngie Date: Wed Dec 10 06:33:24 2014 New Revision: 275663 URL: https://svnweb.freebsd.org/changeset/base/275663 Log: Add a description for WITHOUT_CCD Added: projects/building-blocks/tools/build/options/WITHOUT_CCD (contents, props changed) Added: projects/building-blocks/tools/build/options/WITHOUT_CCD ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/building-blocks/tools/build/options/WITHOUT_CCD Wed Dec 10 06:33:24 2014 (r275663) @@ -0,0 +1,4 @@ +.\" $FreeBSD$ +Set to not build +.Xr ccd 8 +and related utilities. From owner-svn-src-projects@FreeBSD.ORG Wed Dec 10 06:43:18 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8D7E23A8; Wed, 10 Dec 2014 06:43:18 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7770CC0A; Wed, 10 Dec 2014 06:43:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBA6hIYK083888; Wed, 10 Dec 2014 06:43:18 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBA6hHtk083882; Wed, 10 Dec 2014 06:43:17 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201412100643.sBA6hHtk083882@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Wed, 10 Dec 2014 06:43:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r275664 - in projects/building-blocks: . bin/freebsd-version cddl/compat/opensolaris/misc cddl/contrib/opensolaris/lib/libctf/common cddl/lib/libctf contrib/llvm/lib/Transforms/Vectoriz... X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2014 06:43:18 -0000 Author: ngie Date: Wed Dec 10 06:43:16 2014 New Revision: 275664 URL: https://svnweb.freebsd.org/changeset/base/275664 Log: MFhead @ r275663 Added: projects/building-blocks/cddl/contrib/opensolaris/lib/libctf/common/ctf.5 - copied unchanged from r275663, head/cddl/contrib/opensolaris/lib/libctf/common/ctf.5 projects/building-blocks/contrib/llvm/patches/patch-r275633-llvm-r223171-fix-vectorizer.diff - copied unchanged from r275663, head/contrib/llvm/patches/patch-r275633-llvm-r223171-fix-vectorizer.diff projects/building-blocks/sys/dev/beri/virtio/network/ - copied from r275663, head/sys/dev/beri/virtio/network/ projects/building-blocks/sys/dev/xen/pci/ - copied from r275663, head/sys/dev/xen/pci/ projects/building-blocks/sys/x86/xen/xen_pci_bus.c - copied unchanged from r275663, head/sys/x86/xen/xen_pci_bus.c projects/building-blocks/sys/xen/xen_pci.h - copied unchanged from r275663, head/sys/xen/xen_pci.h projects/building-blocks/usr.sbin/pw/tests/pw_groupdel.sh - copied unchanged from r275663, head/usr.sbin/pw/tests/pw_groupdel.sh projects/building-blocks/usr.sbin/pw/tests/pw_groupmod.sh - copied unchanged from r275663, head/usr.sbin/pw/tests/pw_groupmod.sh projects/building-blocks/usr.sbin/pw/tests/pw_useradd.sh - copied unchanged from r275663, head/usr.sbin/pw/tests/pw_useradd.sh projects/building-blocks/usr.sbin/pw/tests/pw_userdel.sh - copied unchanged from r275663, head/usr.sbin/pw/tests/pw_userdel.sh projects/building-blocks/usr.sbin/pw/tests/pw_usermod.sh - copied unchanged from r275663, head/usr.sbin/pw/tests/pw_usermod.sh Deleted: projects/building-blocks/sys/x86/xen/xen_pci.c projects/building-blocks/usr.sbin/pw/tests/pw_delete.sh projects/building-blocks/usr.sbin/pw/tests/pw_modify.sh Modified: projects/building-blocks/Makefile.inc1 projects/building-blocks/bin/freebsd-version/Makefile projects/building-blocks/cddl/compat/opensolaris/misc/thread_pool.c projects/building-blocks/cddl/lib/libctf/Makefile projects/building-blocks/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp projects/building-blocks/gnu/usr.bin/gdb/kgdb/kthr.c projects/building-blocks/lib/msun/src/e_j0f.c projects/building-blocks/release/scripts/relnotes-search.sh projects/building-blocks/share/man/man4/upgt.4 projects/building-blocks/sys/arm/altera/socfpga/files.socfpga projects/building-blocks/sys/arm/arm/syscall.c projects/building-blocks/sys/arm/broadcom/bcm2835/bcm2835_wdog.c projects/building-blocks/sys/arm/conf/SOCKIT-BERI projects/building-blocks/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts projects/building-blocks/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c projects/building-blocks/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h projects/building-blocks/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c projects/building-blocks/sys/conf/files.amd64 projects/building-blocks/sys/dev/beri/virtio/virtio.c projects/building-blocks/sys/dev/beri/virtio/virtio.h projects/building-blocks/sys/dev/beri/virtio/virtio_block.c projects/building-blocks/sys/dev/beri/virtio/virtio_mmio_platform.c projects/building-blocks/sys/dev/beri/virtio/virtio_mmio_platform.h projects/building-blocks/sys/dev/usb/controller/xhci_pci.c projects/building-blocks/sys/dev/usb/quirk/usb_quirk.c projects/building-blocks/sys/dev/usb/serial/u3g.c projects/building-blocks/sys/dev/usb/usbdevs projects/building-blocks/sys/dev/usb/wlan/if_upgt.c projects/building-blocks/sys/dev/virtio/mmio/virtio_mmio.c projects/building-blocks/sys/dev/virtio/mmio/virtio_mmio_if.m projects/building-blocks/sys/fs/ext2fs/ext2_inode.c projects/building-blocks/sys/fs/msdosfs/msdosfs_vfsops.c projects/building-blocks/sys/kern/kern_exit.c projects/building-blocks/sys/kern/kern_thread.c projects/building-blocks/sys/kern/subr_syscall.c projects/building-blocks/sys/kern/vfs_bio.c projects/building-blocks/sys/kern/vfs_mount.c projects/building-blocks/sys/kern/vfs_subr.c projects/building-blocks/sys/netinet6/nd6.c projects/building-blocks/sys/netinet6/nd6.h projects/building-blocks/sys/netinet6/nd6_nbr.c projects/building-blocks/sys/ofed/include/linux/list.h projects/building-blocks/sys/ofed/include/linux/module.h projects/building-blocks/sys/ofed/include/net/ip.h projects/building-blocks/sys/rpc/svc.c projects/building-blocks/sys/sys/mount.h projects/building-blocks/sys/sys/param.h projects/building-blocks/sys/sys/proc.h projects/building-blocks/sys/x86/xen/pvcpu_enum.c projects/building-blocks/tools/bsdbox/Makefile projects/building-blocks/usr.bin/patch/common.h projects/building-blocks/usr.bin/patch/pch.c projects/building-blocks/usr.sbin/mtree/verify.c projects/building-blocks/usr.sbin/pw/tests/Makefile Directory Properties: projects/building-blocks/ (props changed) projects/building-blocks/cddl/ (props changed) projects/building-blocks/cddl/contrib/opensolaris/ (props changed) projects/building-blocks/contrib/llvm/ (props changed) projects/building-blocks/gnu/usr.bin/gdb/ (props changed) projects/building-blocks/share/ (props changed) projects/building-blocks/share/man/man4/ (props changed) projects/building-blocks/sys/ (props changed) projects/building-blocks/sys/boot/ (props changed) projects/building-blocks/sys/cddl/contrib/opensolaris/ (props changed) projects/building-blocks/sys/conf/ (props changed) Modified: projects/building-blocks/Makefile.inc1 ============================================================================== --- projects/building-blocks/Makefile.inc1 Wed Dec 10 06:33:24 2014 (r275663) +++ projects/building-blocks/Makefile.inc1 Wed Dec 10 06:43:16 2014 (r275664) @@ -793,6 +793,11 @@ ITOOLS= [ awk cap_mkdb cat chflags chmod rm sed services_mkdb sh sysctl test true uname wc ${_zoneinfo} \ ${LOCAL_ITOOLS} +# Needed for share/man +.if ${MK_MAN} != "no" +ITOOLS+=makewhatis +.endif + # # distributeworld # Modified: projects/building-blocks/bin/freebsd-version/Makefile ============================================================================== --- projects/building-blocks/bin/freebsd-version/Makefile Wed Dec 10 06:33:24 2014 (r275663) +++ projects/building-blocks/bin/freebsd-version/Makefile Wed Dec 10 06:43:16 2014 (r275664) @@ -5,8 +5,7 @@ MAN = freebsd-version.1 CLEANFILES = freebsd-version.sh NEWVERS = ${.CURDIR}/../../sys/conf/newvers.sh -freebsd-version.sh.in: ${NEWVERS} -freebsd-version.sh: ${.CURDIR}/freebsd-version.sh.in +freebsd-version.sh: ${.CURDIR}/freebsd-version.sh.in ${NEWVERS} eval $$(egrep '^(TYPE|REVISION|BRANCH)=' ${NEWVERS}) ; \ if ! sed -e "\ s/@@TYPE@@/$${TYPE}/g; \ Modified: projects/building-blocks/cddl/compat/opensolaris/misc/thread_pool.c ============================================================================== --- projects/building-blocks/cddl/compat/opensolaris/misc/thread_pool.c Wed Dec 10 06:33:24 2014 (r275663) +++ projects/building-blocks/cddl/compat/opensolaris/misc/thread_pool.c Wed Dec 10 06:43:16 2014 (r275664) @@ -233,12 +233,11 @@ tpool_create(uint_t min_threads, uint_t return (NULL); } - tpool = malloc(sizeof (*tpool)); + tpool = calloc(1, sizeof (*tpool)); if (tpool == NULL) { errno = ENOMEM; return (NULL); } - bzero(tpool, sizeof(*tpool)); (void) pthread_mutex_init(&tpool->tp_mutex, NULL); (void) pthread_cond_init(&tpool->tp_busycv, NULL); (void) pthread_cond_init(&tpool->tp_workcv, NULL); @@ -267,9 +266,8 @@ tpool_dispatch(tpool_t *tpool, void (*fu { tpool_job_t *job; - if ((job = malloc(sizeof (*job))) == NULL) + if ((job = calloc(1, sizeof (*job))) == NULL) return (-1); - bzero(job, sizeof(*job)); job->tpj_next = NULL; job->tpj_func = func; job->tpj_arg = arg; Copied: projects/building-blocks/cddl/contrib/opensolaris/lib/libctf/common/ctf.5 (from r275663, head/cddl/contrib/opensolaris/lib/libctf/common/ctf.5) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/building-blocks/cddl/contrib/opensolaris/lib/libctf/common/ctf.5 Wed Dec 10 06:43:16 2014 (r275664, copy of r275663, head/cddl/contrib/opensolaris/lib/libctf/common/ctf.5) @@ -0,0 +1,1140 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright (c) 2014 Joyent, Inc. +.\" +.Dd Sep 26, 2014 +.Dt CTF 5 +.Os +.Sh NAME +.Nm ctf +.Nd Compact C Type Format +.Sh SYNOPSIS +.In sys/ctf.h +.Sh DESCRIPTION +.Nm +is designed to be a compact representation of the C programming +language's type information focused on serving the needs of dynamic +tracing, debuggers, and other in-situ and post-mortem introspection +tools. +.Nm +data is generally included in +.Sy ELF +objects and is tagged as +.Sy SHT_PROGBITS +to ensure that the data is accessible in a running process and in subsequent +core dumps, if generated. +.Lp +The +.Nm +data contained in each file has information about the layout and +sizes of C types, including intrinsic types, enumerations, structures, +typedefs, and unions, that are used by the corresponding +.Sy ELF +object. The +.Nm +data may also include information about the types of global objects and +the return type and arguments of functions in the symbol table. +.Lp +Because a +.Nm +file is often embedded inside a file, rather than being a standalone +file itself, it may also be referred to as a +.Nm +.Sy container . +.Lp +On illumos systems, +.Nm +data is consumed by multiple programs. It can be used by the modular +debugger, +.Xr mdb 1 , +as well as by +.Xr dtrace 1M . +Programmatic access to +.Nm +data can be obtained through +.Xr libctf 3LIB . +.Lp +The +.Nm +file format is broken down into seven different sections. The first +section is the +.Sy preamble +and +.Sy header , +which describes the version of the +.Nm +file, links it has to other +.Nm +files, and the sizes of the other sections. The next section is the +.Sy label +section, +which provides a way of identifying similar groups of +.Nm +data across multiple files. This is followed by the +.Sy object +information section, which describes the type of global +symbols. The subsequent section is the +.Sy function +information section, which describes the return +types and arguments of functions. The next section is the +.Sy type +information section, which describes +the format and layout of the C types themselves, and finally the last +section is the +.Sy string +section, which contains the names of types, enumerations, members, and +labels. +.Lp +While strictly speaking, only the +.Sy preamble +and +.Sy header +are required, to be actually useful, both the type and string +sections are necessary. +.Lp +A +.Nm +file may contain all of the type information that it requires, or it +may optionally refer to another +.Nm +file which holds the remaining types. When a +.Nm +file refers to another file, it is called the +.Sy child +and the file it refers to is called the +.Sy parent . +A given file may only refer to one parent. This process is called +.Em uniquification +because it ensures each child only has type information that is +unique to it. A common example of this is that most kernel modules in +illumos are uniquified against the kernel module +.Sy genunix +and the type information that comes from the +.Sy IP +module. This means that a module only has types that are unique to +itself and the most common types in the kernel are not duplicated. +.Sh FILE FORMAT +This documents version +.Em two +of the +.Nm +file format. All applications and tools currently produce and operate on +this version. +.Lp +The file format can be summarized with the following image, the +following sections will cover this in more detail. +.Bd -literal + + +-------------+ 0t0 ++--------| Preamble | +| +-------------+ 0t4 +|+-------| Header | +|| +-------------+ 0t36 + cth_lbloff +||+------| Labels | +||| +-------------+ 0t36 + cth_objtoff +|||+-----| Objects | +|||| +-------------+ 0t36 + cth_funcoff +||||+----| Functions | +||||| +-------------+ 0t36 + cth_typeoff +|||||+---| Types | +|||||| +-------------+ 0t36 + cth_stroff +||||||+--| Strings | +||||||| +-------------+ 0t36 + cth_stroff + cth_strlen +||||||| +||||||| +||||||| +||||||| +-- magic - vers flags +||||||| | | | | +||||||| +------+------+------+------+ ++---------| 0xcf | 0xf1 | 0x02 | 0x00 | + |||||| +------+------+------+------+ + |||||| 0 1 2 3 4 + |||||| + |||||| + parent label + objects + |||||| | + parent name | + functions + strings + |||||| | | + label | | + types | + strlen + |||||| | | | | | | | | + |||||| +------+------+------+------+------+-------+-------+-------+ + +--------| 0x00 | 0x00 | 0x00 | 0x08 | 0x36 | 0x110 | 0x5f4 | 0x611 | + ||||| +------+------+------+------+------+-------+-------+-------+ + ||||| 0x04 0x08 0x0c 0x10 0x14 0x18 0x1c 0x20 0x24 + ||||| + ||||| + Label name + ||||| | + Label type + ||||| | | + Next label + ||||| | | | + ||||| +-------+------+-----+ + +-----------| 0x01 | 0x42 | ... | + |||| +-------+------+-----+ + |||| cth_lbloff +0x4 +0x8 cth_objtoff + |||| + |||| + |||| Symidx 0t15 0t43 0t44 + |||| +------+------+------+-----+ + +----------| 0x00 | 0x42 | 0x36 | ... | + ||| +------+------+------+-----+ + ||| cth_objtoff +0x2 +0x4 +0x6 cth_funcoff + ||| + ||| + CTF_TYPE_INFO + CTF_TYPE_INFO + ||| | + Return type | + ||| | | + arg0 | + ||| +--------+------+------+-----+ + +---------| 0x2c10 | 0x08 | 0x0c | ... | + || +--------+------+------+-----+ + || cth_funcff +0x2 +0x4 +0x6 cth_typeoff + || + || + ctf_stype_t for type 1 + || | integer + integer encoding + || | | + ctf_stype_t for type 2 + || | | | + || +--------------------+-----------+-----+ + +--------| 0x19 * 0xc01 * 0x0 | 0x1000000 | ... | + | +--------------------+-----------+-----+ + | cth_typeoff +0x08 +0x0c cth_stroff + | + | +--- str 0 + | | +--- str 1 + str 2 + | | | | + | v v v + | +----+---+---+---+----+---+---+---+---+---+----+ + +---| \\0 | i | n | t | \\0 | f | o | o | _ | t | \\0 | + +----+---+---+---+----+---+---+---+---+---+----+ + 0 1 2 3 4 5 6 7 8 9 10 11 +.Ed +.Lp +Every +.Nm +file begins with a +.Sy preamble , +followed by a +.Sy header . +The +.Sy preamble +is defined as follows: +.Bd -literal +typedef struct ctf_preamble { + ushort_t ctp_magic; /* magic number (CTF_MAGIC) */ + uchar_t ctp_version; /* data format version number (CTF_VERSION) */ + uchar_t ctp_flags; /* flags (see below) */ +} ctf_preamble_t; +.Ed +.Pp +The +.Sy preamble +is four bytes long and must be four byte aligned. +This +.Sy preamble +defines the version of the +.Nm +file which defines the format of the rest of the header. While the +header may change in subsequent versions, the preamble will not change +across versions, though the interpretation of its flags may change from +version to version. The +.Em ctp_magic +member defines the magic number for the +.Nm +file format. This must always be +.Li 0xcff1 . +If another value is encountered, then the file should not be treated as +a +.Nm +file. The +.Em ctp_version +member defines the version of the +.Nm +file. The current version is +.Li 2 . +It is possible to encounter an unsupported version. In that case, +software should not try to parse the format, as it may have changed. +Finally, the +.Em ctp_flags +member describes aspects of the file which modify its interpretation. +The following flags are currently defined: +.Bd -literal +#define CTF_F_COMPRESS 0x01 +.Ed +.Pp +The flag +.Sy CTF_F_COMPRESS +indicates that the body of the +.Nm +file, all the data following the +.Sy header , +has been compressed through the +.Sy zlib +library and its +.Sy deflate +algorithm. If this flag is not present, then the body has not been +compressed and no special action is needed to interpret it. All offsets +into the data as described by +.Sy header , +always refer to the +.Sy uncompressed +data. +.Lp +In version two of the +.Nm +file format, the +.Sy header +denotes whether whether or not this +.Nm +file is the child of another +.Nm +file and also indicates the size of the remaining sections. The +structure for the +.Sy header , +logically contains a copy of the +.Sy preamble +and the two have a combined size of 36 bytes. +.Bd -literal +typedef struct ctf_header { + ctf_preamble_t cth_preamble; + uint_t cth_parlabel; /* ref to name of parent lbl uniq'd against */ + uint_t cth_parname; /* ref to basename of parent */ + uint_t cth_lbloff; /* offset of label section */ + uint_t cth_objtoff; /* offset of object section */ + uint_t cth_funcoff; /* offset of function section */ + uint_t cth_typeoff; /* offset of type section */ + uint_t cth_stroff; /* offset of string section */ + uint_t cth_strlen; /* length of string section in bytes */ +} ctf_header_t; +.Ed +.Pp +After the +.Sy preamble , +the next two members +.Em cth_parlablel +and +.Em cth_parname , +are used to identify the parent. The value of both members are offsets +into the +.Sy string +section which point to the start of a null-terminated string. For more +information on the encoding of strings, see the subsection on +.Sx String Identifiers . +If the value of either is zero, then there is no entry for that +member. If the member +.Em cth_parlabel +is set, then the +.Em ctf_parname +member must be set, otherwise it will not be possible to find the +parent. If +.Em ctf_parname +is set, it is not necessary to define +.Em cth_parlabel , +as the parent may not have a label. For more information on labels +and their interpretation, see +.Sx The Label Section . +.Lp +The remaining members (excepting +.Em cth_strlen ) +describe the beginning of the corresponding sections. These offsets are +relative to the end of the +.Sy header . +Therefore, something with an offset of 0 is at an offset of thirty-six +bytes relative to the start of the +.Nm +file. The difference between members +indicates the size of the section itself. Different offsets have +different alignment requirements. The start of the +.Em cth_objotoff +and +.Em cth_funcoff +must be two byte aligned, while the sections +.Em cth_lbloff +and +.Em cth_typeoff +must be four-byte aligned. The section +.Em cth_stroff +has no alignment requirements. To calculate the size of a given section, +excepting the +.Sy string +section, one should subtract the offset of the section from the following one. For +example, the size of the +.Sy types +section can be calculated by subtracting +.Em cth_stroff +from +.Em cth_typeoff . +.Lp +Finally, the member +.Em cth_strlen +describes the length of the string section itself. From it, you can also +calculate the size of the entire +.Nm +file by adding together the size of the +.Sy ctf_header_t , +the offset of the string section in +.Em cth_stroff , +and the size of the string section in +.Em cth_srlen . +.Ss Type Identifiers +Through the +.Nm ctf +data, types are referred to by identifiers. A given +.Nm +file supports up to 32767 (0x7fff) types. The first valid type identifier is 0x1. +When a given +.Nm +file is a child, indicated by a non-zero entry for the +.Sy header Ns 's +.Em cth_parname , +then the first valid type identifier is 0x8000 and the last is 0xffff. +In this case, type identifiers 0x1 through 0x7fff are references to the +parent. +.Lp +The type identifier zero is a sentinel value used to indicate that there +is no type information available or it is an unknown type. +.Lp +Throughout the file format, the identifier is stored in different sized +values; however, the minimum size to represent a given identifier is a +.Sy uint16_t . +Other consumers of +.Nm +information may use larger or opaque identifiers. +.Ss String Identifiers +String identifiers are always encoded as four byte unsigned integers +which are an offset into a string table. The +.Nm +format supports two different string tables which have an identifier of +zero or one. This identifier is stored in the high-order bit of the +unsigned four byte offset. Therefore, the maximum supported offset into +one of these tables is 0x7ffffffff. +.Lp +Table identifier zero, always refers to the +.Sy string +section in the CTF file itself. String table identifier one refers to an +external string table which is the ELF string table for the ELF symbol +table associated with the +.Nm +container. +.Ss Type Encoding +Every +.Nm +type begins with metadata encoded into a +.Sy uint16_t . +This encoded information tells us three different pieces of information: +.Bl -bullet -offset indent -compact +.It +The kind of the type +.It +Whether this type is a root type or not +.It +The length of the variable data +.El +.Lp +The 16 bits that make up the encoding are broken down such that you have +five bits for the kind, one bit for indicating whether or not it is a +root type, and 10 bits for the variable length. This is laid out as +follows: +.Bd -literal -offset indent ++--------------------+ +| kind | root | vlen | ++--------------------+ +15 11 10 9 0 +.Ed +.Lp +The current version of the file format defines 14 different kinds. The +interpretation of these different kinds will be discussed in the section +.Sx The Type Section . +If a kind is encountered that is not listed below, then it is not a valid +.Nm +file. The kinds are defined as follows: +.Bd -literal -offset indent +#define CTF_K_UNKNOWN 0 +#define CTF_K_INTEGER 1 +#define CTF_K_FLOAT 2 +#define CTF_K_POINTER 3 +#define CTF_K_ARRAY 4 +#define CTF_K_FUNCTION 5 +#define CTF_K_STRUCT 6 +#define CTF_K_UNION 7 +#define CTF_K_ENUM 8 +#define CTF_K_FORWARD 9 +#define CTF_K_TYPEDEF 10 +#define CTF_K_VOLATILE 11 +#define CTF_K_CONST 12 +#define CTF_K_RESTRICT 13 +.Ed +.Lp +Programs directly reference many types; however, other types are referenced +indirectly because they are part of some other structure. These types that are +referenced directly and used are called +.Sy root +types. Other types may be used indirectly, for example, a program may reference +a structure directly, but not one of its members which has a type. That type is +not considered a +.Sy root +type. If a type is a +.Sy root +type, then it will have bit 10 set. +.Lp +The variable length section is specific to each kind and is discussed in the +section +.Sx The Type Section . +.Lp +The following macros are useful for constructing and deconstructing the encoded +type information: +.Bd -literal -offset indent + +#define CTF_MAX_VLEN 0x3ff +#define CTF_INFO_KIND(info) (((info) & 0xf800) >> 11) +#define CTF_INFO_ISROOT(info) (((info) & 0x0400) >> 10) +#define CTF_INFO_VLEN(info) (((info) & CTF_MAX_VLEN)) + +#define CTF_TYPE_INFO(kind, isroot, vlen) \\ + (((kind) << 11) | (((isroot) ? 1 : 0) << 10) | ((vlen) & CTF_MAX_VLEN)) +.Ed +.Ss The Label Section +When consuming +.Nm +data, it is often useful to know whether two different +.Nm +containers come from the same source base and version. For example, when +building illumos, there are many kernel modules that are built against a +single collection of source code. A label is encoded into the +.Nm +files that corresponds with the particular build. This ensures that if +files on the system were to become mixed up from multiple releases, that +they are not used together by tools, particularly when a child needs to +refer to a type in the parent. Because they are linked used the type +identifiers, if the wrong parent is used then the wrong type will be +encountered. +.Lp +Each label is encoded in the file format using the following eight byte +structure: +.Bd -literal +typedef struct ctf_lblent { + uint_t ctl_label; /* ref to name of label */ + uint_t ctl_typeidx; /* last type associated with this label */ +} ctf_lblent_t; +.Ed +.Lp +Each label has two different components, a name and a type identifier. +The name is encoded in the +.Em ctl_label +member which is in the format defined in the section +.Sx String Identifiers . +Generally, the names of all labels are found in the internal string +section. +.Lp +The type identifier encoded in the member +.Em ctl_typeidx +refers to the last type identifier that a label refers to in the current +file. Labels only refer to types in the current file, if the +.Nm +file is a child, then it will have the same label as its parent; +however, its label will only refer to its types, not its parents. +.Lp +It is also possible, though rather uncommon, for a +.Nm +file to have multiple labels. Labels are placed one after another, every +eight bytes. When multiple labels are present, types may only belong to +a single label. +.Ss The Object Section +The object section provides a mapping from ELF symbols of type +.Sy STT_OBJECT +in the symbol table to a type identifier. Every entry in this section is +a +.Sy uint16_t +which contains a type identifier as described in the section +.Sx Type Identifiers . +If there is no information for an object, then the type identifier 0x0 +is stored for that entry. +.Lp +To walk the object section, you need to have a corresponding +.Sy symbol table +in the ELF object that contains the +.Nm +data. Not every object is included in this section. Specifically, when +walking the symbol table. An entry is skipped if it matches any of the +following conditions: +.Lp +.Bl -bullet -offset indent -compact +.It +The symbol type is not +.Sy STT_OBJECT +.It +The symbol's section index is +.Sy SHN_UNDEF +.It +The symbol's name offset is zero +.It +The symbol's section index is +.Sy SHN_ABS +and the value of the symbol is zero. +.It +The symbol's name is +.Li _START_ +or +.Li _END_ . +These are skipped because they are used for scoping local symbols in +ELF. +.El +.Lp +The following sample code shows an example of iterating the object +section and skipping the correct symbols: +.Bd -literal +#include +#include + +/* + * Given the start of the object section in the CTF file, the number of symbols, + * and the ELF Data sections for the symbol table and the string table, this + * prints the type identifiers that correspond to objects. Note, a more robust + * implementation should ensure that they don't walk beyond the end of the CTF + * object section. + */ +static int +walk_symbols(uint16_t *objtoff, Elf_Data *symdata, Elf_Data *strdata, + long nsyms) +{ + long i; + uintptr_t strbase = strdata->d_buf; + + for (i = 1; i < nsyms; i++, objftoff++) { + const char *name; + GElf_Sym sym; + + if (gelf_getsym(symdata, i, &sym) == NULL) + return (1); + + if (GELF_ST_TYPE(sym.st_info) != STT_OBJECT) + continue; + if (sym.st_shndx == SHN_UNDEF || sym.st_name == 0) + continue; + if (sym.st_shndx == SHN_ABS && sym.st_value == 0) + continue; + name = (const char *)(strbase + sym.st_name); + if (strcmp(name, "_START_") == 0 || strcmp(name, "_END_") == 0) + continue; + + (void) printf("Symbol %d has type %d\n", i, *objtoff); + } + + return (0); +} +.Ed +.Ss The Function Section +The function section of the +.Nm +file encodes the types of both the function's arguments and the function's +return type. Similar to +.Sx The Object Section , +the function section encodes information for all symbols of type +.Sy STT_FUNCTION , +excepting those that fit specific criteria. Unlike with objects, because +functions have a variable number of arguments, they start with a type encoding +as defined in +.Sx Type Encoding , +which is the size of a +.Sy uint16_t . +For functions which have no type information available, they are encoded as +.Li CTF_TYPE_INFO(CTF_K_UNKNOWN, 0, 0) . +Functions with arguments are encoded differently. Here, the variable length is +turned into the number of arguments in the function. If a function is a +.Sy varargs +type function, then the number of arguments is increased by one. Functions with +type information are encoded as: +.Li CTF_TYPE_INFO(CTF_K_FUNCTION, 0, nargs) . +.Lp +For functions that have no type information, nothing else is encoded, and the +next function is encoded. For functions with type information, the next +.Sy uint16_t +is encoded with the type identifier of the return type of the function. It is +followed by each of the type identifiers of the arguments, if any exist, in the +order that they appear in the function. Therefore, argument 0 is the first type +identifier and so on. When a function has a final varargs argument, that is +encoded with the type identifier of zero. +.Lp +Like +.Sx The Object Section , +the function section is encoded in the order of the symbol table. It has +similar, but slightly different considerations from objects. While iterating the +symbol table, if any of the following conditions are true, then the entry is +skipped and no corresponding entry is written: +.Lp +.Bl -bullet -offset indent -compact +.It +The symbol type is not +.Sy STT_FUNCTION +.It +The symbol's section index is +.Sy SHN_UNDEF +.It +The symbol's name offset is zero +.It +The symbol's name is +.Li _START_ +or +.Li _END_ . +These are skipped because they are used for scoping local symbols in +ELF. +.El +.Ss The Type Section +The type section is the heart of the +.Nm +data. It encodes all of the information about the types themselves. The base of +the type information comes in two forms, a short form and a long form, each of +which may be followed by a variable number of arguments. The following +definitions describe the short and long forms: +.Bd -literal +#define CTF_MAX_SIZE 0xfffe /* max size of a type in bytes */ +#define CTF_LSIZE_SENT 0xffff /* sentinel for ctt_size */ +#define CTF_MAX_LSIZE UINT64_MAX + +typedef struct ctf_stype { + uint_t ctt_name; /* reference to name in string table */ + ushort_t ctt_info; /* encoded kind, variant length */ + union { + ushort_t _size; /* size of entire type in bytes */ + ushort_t _type; /* reference to another type */ + } _u; +} ctf_stype_t; + +typedef struct ctf_type { + uint_t ctt_name; /* reference to name in string table */ + ushort_t ctt_info; /* encoded kind, variant length */ + union { + ushort_t _size; /* always CTF_LSIZE_SENT */ + ushort_t _type; /* do not use */ + } _u; + uint_t ctt_lsizehi; /* high 32 bits of type size in bytes */ + uint_t ctt_lsizelo; /* low 32 bits of type size in bytes */ +} ctf_type_t; + +#define ctt_size _u._size /* for fundamental types that have a size */ +#define ctt_type _u._type /* for types that reference another type */ +.Ed +.Pp +Type sizes are stored in +.Sy bytes . +The basic small form uses a +.Sy ushort_t +to store the number of bytes. If the number of bytes in a structure would exceed +0xfffe, then the alternate form, the +.Sy ctf_type_t , +is used instead. To indicate that the larger form is being used, the member +.Em ctt_size +is set to value of +.Sy CTF_LSIZE_SENT +(0xffff). In general, when going through the type section, consumers use the +.Sy ctf_type_t +structure, but pay attention to the value of the member +.Em ctt_size +to determine whether they should increment their scan by the size of the +.Sy ctf_stype_t +or +.Sy ctf_type_t . +Not all kinds of types use +.Sy ctt_size . +Those which do not, will always use the +.Sy ctf_stype_t +structure. The individual sections for each kind have more information. +.Lp +Types are written out in order. Therefore the first entry encountered has a type +id of 0x1, or 0x8000 if a child. The member +.Em ctt_name +is encoded as described in the section +.Sx String Identifiers . +The string that it points to is the name of the type. If the identifier points +to an empty string (one that consists solely of a null terminator) then the type +does not have a name, this is common with anonymous structures and unions that +only have a typedef to name them, as well as, pointers and qualifiers. +.Lp +The next member, the +.Em ctt_info , +is encoded as described in the section +.Sx Type Encoding . +The types kind tells us how to interpret the remaining data in the +.Sy ctf_type_t +and any variable length data that may exist. The rest of this section will be +broken down into the interpretation of the various kinds. +.Ss Encoding of Integers +Integers, which are of type +.Sy CTF_K_INTEGER , +have no variable length arguments. Instead, they are followed by a four byte +.Sy uint_t +which describes their encoding. All integers must be encoded with a variable +length of zero. The +.Em ctt_size +member describes the length of the integer in bytes. In general, integer sizes +will be rounded up to the closest power of two. +.Lp +The integer encoding contains three different pieces of information: +.Bl -bullet -offset indent -compact +.It +The encoding of the integer +.It +The offset in +.Sy bits +of the type +.It +The size in +.Sy bits +of the type +.El +.Pp +This encoding can be expressed through the following macros: +.Bd -literal -offset indent +#define CTF_INT_ENCODING(data) (((data) & 0xff000000) >> 24) +#define CTF_INT_OFFSET(data) (((data) & 0x00ff0000) >> 16) +#define CTF_INT_BITS(data) (((data) & 0x0000ffff)) + +#define CTF_INT_DATA(encoding, offset, bits) \\ + (((encoding) << 24) | ((offset) << 16) | (bits)) +.Ed +.Pp +The following flags are defined for the encoding at this time: +.Bd -literal -offset indent +#define CTF_INT_SIGNED 0x01 +#define CTF_INT_CHAR 0x02 +#define CTF_INT_BOOL 0x04 +#define CTF_INT_VARARGS 0x08 +.Ed +.Lp +By default, an integer is considered to be unsigned, unless it has the +.Sy CTF_INT_SIGNED +flag set. If the flag +.Sy CTF_INT_CHAR +is set, that indicates that the integer is of a type that stores character +data, for example the intrinsic C type +.Sy char +would have the +.Sy CTF_INT_CHAR +flag set. If the flag +.Sy CTF_INT_BOOL +is set, that indicates that the integer represents a boolean type. For example, +the intrinsic C type +.Sy _Bool +would have the +.Sy CTF_INT_BOOL +flag set. Finally, the flag +.Sy CTF_INT_VARARGS +indicates that the integer is used as part of a variable number of arguments. +This encoding is rather uncommon. +.Ss Encoding of Floats +Floats, which are of type +.Sy CTF_K_FLOAT , +are similar to their integer counterparts. They have no variable length +arguments and are followed by a four byte encoding which describes the kind of +float that exists. The +.Em ctt_size +member is the size, in bytes, of the float. The float encoding has three +different pieces of information inside of it: +.Lp +.Bl -bullet -offset indent -compact +.It +The specific kind of float that exists +.It +The offset in +.Sy bits +of the float +.It +The size in +.Sy bits +of the float +.El +.Lp +This encoding can be expressed through the following macros: +.Bd -literal -offset indent +#define CTF_FP_ENCODING(data) (((data) & 0xff000000) >> 24) +#define CTF_FP_OFFSET(data) (((data) & 0x00ff0000) >> 16) +#define CTF_FP_BITS(data) (((data) & 0x0000ffff)) + +#define CTF_FP_DATA(encoding, offset, bits) \\ + (((encoding) << 24) | ((offset) << 16) | (bits)) +.Ed +.Lp +Where as the encoding for integers was a series of flags, the encoding for +floats maps to a specific kind of float. It is not a flag-based value. The kinds of floats +correspond to both their size, and the encoding. This covers all of the basic C +intrinsic floating point types. The following are the different kinds of floats +represented in the encoding: +.Bd -literal -offset indent +#define CTF_FP_SINGLE 1 /* IEEE 32-bit float encoding */ +#define CTF_FP_DOUBLE 2 /* IEEE 64-bit float encoding */ +#define CTF_FP_CPLX 3 /* Complex encoding */ +#define CTF_FP_DCPLX 4 /* Double complex encoding */ +#define CTF_FP_LDCPLX 5 /* Long double complex encoding */ +#define CTF_FP_LDOUBLE 6 /* Long double encoding */ +#define CTF_FP_INTRVL 7 /* Interval (2x32-bit) encoding */ +#define CTF_FP_DINTRVL 8 /* Double interval (2x64-bit) encoding */ +#define CTF_FP_LDINTRVL 9 /* Long double interval (2x128-bit) encoding */ +#define CTF_FP_IMAGRY 10 /* Imaginary (32-bit) encoding */ +#define CTF_FP_DIMAGRY 11 /* Long imaginary (64-bit) encoding */ +#define CTF_FP_LDIMAGRY 12 /* Long double imaginary (128-bit) encoding */ +.Ed +.Ss Encoding of Arrays +Arrays, which are of type +.Sy CTF_K_ARRAY , +have no variable length arguments. They are followed by a structure which +describes the number of elements in the array, the type identifier of the +elements in the array, and the type identifier of the index of the array. With +arrays, the +.Em ctt_size +member is set to zero. The structure that follows an array is defined as: +.Bd -literal +typedef struct ctf_array { + ushort_t cta_contents; /* reference to type of array contents */ + ushort_t cta_index; /* reference to type of array index */ + uint_t cta_nelems; /* number of elements */ +} ctf_array_t; +.Ed +.Lp +The +.Em cta_contents +and +.Em cta_index +members of the +.Sy ctf_array_t +are type identifiers which are encoded as per the section +.Sx Type Identifiers . +The member +.Em cta_nelems +is a simple four byte unsigned count of the number of elements. This count may +be zero when encountering C99's flexible array members. +.Ss Encoding of Functions +Function types, which are of type +.Sy CTF_K_FUNCTION , +use the variable length list to be the number of arguments in the function. When +the function has a final member which is a varargs, then the argument count is +incremented by one to account for the variable argument. Here, the +.Em ctt_type +member is encoded with the type identifier of the return type of the function. +Note that the +.Em ctt_size +member is not used here. +.Lp +The variable argument list contains the type identifiers for the arguments of +the function, if any. Each one is represented by a +.Sy uint16_t +and encoded according to the +.Sx Type Identifiers +section. If the function's last argument is of type varargs, then it is also +written out, but the type identifier is zero. This is included in the count of +the function's arguments. +.Ss Encoding of Structures and Unions +Structures and Unions, which are encoded with +.Sy CTF_K_STRUCT +and +.Sy CTF_K_UNION +respectively, are very similar constructs in C. The main difference +between them is the fact that every member of a structure follows one another, +where as in a union, all members share the same memory. They are also very +similar in terms of their encoding in +.Nm . +The variable length argument for structures and unions represents the number of +members that they have. The value of the member +.Em ctt_size +is the size of the structure and union. There are two different structures which +are used to encode members in the variable list. When the size of a structure or +union is greater than or equal to the large member threshold, 8192, then a +different structure is used to encode the member, all members are encoded using +the same structure. The structure for members is as follows: +.Bd -literal *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Wed Dec 10 19:24:51 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 445FB586; Wed, 10 Dec 2014 19:24:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2D8B27C5; Wed, 10 Dec 2014 19:24:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBAJOpM3064077; Wed, 10 Dec 2014 19:24:51 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBAJOgX3063977; Wed, 10 Dec 2014 19:24:42 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201412101924.sBAJOgX3063977@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 10 Dec 2014 19:24:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r275685 - in projects/clang350-import: bin/freebsd-version contrib/file/doc contrib/file/src etc etc/autofs gnu/usr.bin/gdb/kgdb lib/libc/net lib/libc/stdio sbin/mount sys/arm/altera/so... X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2014 19:24:51 -0000 Author: dim Date: Wed Dec 10 19:24:42 2014 New Revision: 275685 URL: https://svnweb.freebsd.org/changeset/base/275685 Log: Merge ^/head r274961 through r275684. Added: projects/clang350-import/etc/autofs/special_media - copied unchanged from r275684, head/etc/autofs/special_media projects/clang350-import/sys/dev/beri/virtio/network/ - copied from r275684, head/sys/dev/beri/virtio/network/ projects/clang350-import/sys/dev/xen/grant_table/ - copied from r275684, head/sys/dev/xen/grant_table/ projects/clang350-import/sys/dev/xen/pci/ - copied from r275684, head/sys/dev/xen/pci/ projects/clang350-import/sys/x86/xen/xen_pci_bus.c - copied unchanged from r275684, head/sys/x86/xen/xen_pci_bus.c projects/clang350-import/sys/xen/xen_pci.h - copied unchanged from r275684, head/sys/xen/xen_pci.h projects/clang350-import/usr.sbin/fstyp/ - copied from r275684, head/usr.sbin/fstyp/ projects/clang350-import/usr.sbin/pw/tests/pw_groupdel.sh - copied unchanged from r275684, head/usr.sbin/pw/tests/pw_groupdel.sh projects/clang350-import/usr.sbin/pw/tests/pw_groupmod.sh - copied unchanged from r275684, head/usr.sbin/pw/tests/pw_groupmod.sh projects/clang350-import/usr.sbin/pw/tests/pw_useradd.sh - copied unchanged from r275684, head/usr.sbin/pw/tests/pw_useradd.sh projects/clang350-import/usr.sbin/pw/tests/pw_userdel.sh - copied unchanged from r275684, head/usr.sbin/pw/tests/pw_userdel.sh projects/clang350-import/usr.sbin/pw/tests/pw_usermod.sh - copied unchanged from r275684, head/usr.sbin/pw/tests/pw_usermod.sh Deleted: projects/clang350-import/sys/x86/xen/xen_pci.c projects/clang350-import/sys/xen/gnttab.c projects/clang350-import/usr.sbin/pw/tests/pw_delete.sh projects/clang350-import/usr.sbin/pw/tests/pw_modify.sh Modified: projects/clang350-import/bin/freebsd-version/Makefile projects/clang350-import/contrib/file/doc/file.man projects/clang350-import/contrib/file/src/elfclass.h projects/clang350-import/contrib/file/src/file.h projects/clang350-import/contrib/file/src/funcs.c projects/clang350-import/contrib/file/src/readelf.c projects/clang350-import/contrib/file/src/softmagic.c projects/clang350-import/etc/auto_master projects/clang350-import/etc/autofs/Makefile projects/clang350-import/etc/devd.conf projects/clang350-import/gnu/usr.bin/gdb/kgdb/kthr.c projects/clang350-import/lib/libc/net/sctp_sys_calls.c projects/clang350-import/lib/libc/stdio/fflush.c projects/clang350-import/sbin/mount/mount.8 projects/clang350-import/sys/arm/altera/socfpga/files.socfpga projects/clang350-import/sys/arm/arm/syscall.c projects/clang350-import/sys/arm/broadcom/bcm2835/bcm2835_wdog.c projects/clang350-import/sys/arm/conf/SOCKIT-BERI projects/clang350-import/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts projects/clang350-import/sys/conf/files projects/clang350-import/sys/conf/files.amd64 projects/clang350-import/sys/dev/beri/virtio/virtio.c projects/clang350-import/sys/dev/beri/virtio/virtio.h projects/clang350-import/sys/dev/beri/virtio/virtio_block.c projects/clang350-import/sys/dev/beri/virtio/virtio_mmio_platform.c projects/clang350-import/sys/dev/beri/virtio/virtio_mmio_platform.h projects/clang350-import/sys/dev/mii/micphy.c projects/clang350-import/sys/dev/usb/usbdevs projects/clang350-import/sys/dev/usb/wlan/if_upgt.c projects/clang350-import/sys/dev/virtio/mmio/virtio_mmio.c projects/clang350-import/sys/dev/virtio/mmio/virtio_mmio_if.m projects/clang350-import/sys/fs/ext2fs/ext2_inode.c projects/clang350-import/sys/fs/msdosfs/msdosfs_vfsops.c projects/clang350-import/sys/kern/vfs_mount.c projects/clang350-import/sys/kern/vfs_subr.c projects/clang350-import/sys/ofed/include/linux/module.h projects/clang350-import/sys/powerpc/aim/trap.c projects/clang350-import/sys/x86/xen/pvcpu_enum.c projects/clang350-import/sys/x86/xen/xen_intr.c projects/clang350-import/sys/x86/xen/xenpv.c projects/clang350-import/sys/xen/gnttab.h projects/clang350-import/usr.sbin/Makefile projects/clang350-import/usr.sbin/autofs/auto_master.5 projects/clang350-import/usr.sbin/mtree/verify.c projects/clang350-import/usr.sbin/pw/tests/Makefile Directory Properties: projects/clang350-import/ (props changed) projects/clang350-import/contrib/file/ (props changed) projects/clang350-import/contrib/llvm/ (props changed) projects/clang350-import/etc/ (props changed) projects/clang350-import/gnu/usr.bin/gdb/ (props changed) projects/clang350-import/lib/libc/ (props changed) projects/clang350-import/sbin/ (props changed) projects/clang350-import/sys/ (props changed) projects/clang350-import/sys/boot/ (props changed) projects/clang350-import/sys/conf/ (props changed) Modified: projects/clang350-import/bin/freebsd-version/Makefile ============================================================================== --- projects/clang350-import/bin/freebsd-version/Makefile Wed Dec 10 18:41:25 2014 (r275684) +++ projects/clang350-import/bin/freebsd-version/Makefile Wed Dec 10 19:24:42 2014 (r275685) @@ -5,8 +5,7 @@ MAN = freebsd-version.1 CLEANFILES = freebsd-version.sh NEWVERS = ${.CURDIR}/../../sys/conf/newvers.sh -freebsd-version.sh.in: ${NEWVERS} -freebsd-version.sh: ${.CURDIR}/freebsd-version.sh.in +freebsd-version.sh: ${.CURDIR}/freebsd-version.sh.in ${NEWVERS} eval $$(egrep '^(TYPE|REVISION|BRANCH)=' ${NEWVERS}) ; \ if ! sed -e "\ s/@@TYPE@@/$${TYPE}/g; \ Modified: projects/clang350-import/contrib/file/doc/file.man ============================================================================== --- projects/clang350-import/contrib/file/doc/file.man Wed Dec 10 18:41:25 2014 (r275684) +++ projects/clang350-import/contrib/file/doc/file.man Wed Dec 10 19:24:42 2014 (r275685) @@ -1,5 +1,5 @@ .\" $File: file.man,v 1.106 2014/03/07 23:11:51 christos Exp $ -.Dd January 30, 2014 +.Dd December 3, 2014 .Dt FILE __CSECTION__ .Os .Sh NAME @@ -385,6 +385,7 @@ options. .Xr hexdump 1 , .Xr od 1 , .Xr strings 1 , +.Xr fstyp 8 .Sh STANDARDS CONFORMANCE This program is believed to exceed the System V Interface Definition of FILE(CMD), as near as one can determine from the vague language Modified: projects/clang350-import/contrib/file/src/elfclass.h ============================================================================== --- projects/clang350-import/contrib/file/src/elfclass.h Wed Dec 10 18:41:25 2014 (r275684) +++ projects/clang350-import/contrib/file/src/elfclass.h Wed Dec 10 19:24:42 2014 (r275685) @@ -35,10 +35,12 @@ switch (type) { #ifdef ELFCORE case ET_CORE: + phnum = elf_getu16(swap, elfhdr.e_phnum); + if (phnum > MAX_PHNUM) + return toomany(ms, "program", phnum); flags |= FLAGS_IS_CORE; if (dophn_core(ms, clazz, swap, fd, - (off_t)elf_getu(swap, elfhdr.e_phoff), - elf_getu16(swap, elfhdr.e_phnum), + (off_t)elf_getu(swap, elfhdr.e_phoff), phnum, (size_t)elf_getu16(swap, elfhdr.e_phentsize), fsize, &flags) == -1) return -1; @@ -46,18 +48,24 @@ #endif case ET_EXEC: case ET_DYN: + phnum = elf_getu16(swap, elfhdr.e_phnum); + if (phnum > MAX_PHNUM) + return toomany(ms, "program", phnum); + shnum = elf_getu16(swap, elfhdr.e_shnum); + if (shnum > MAX_SHNUM) + return toomany(ms, "section", shnum); if (dophn_exec(ms, clazz, swap, fd, - (off_t)elf_getu(swap, elfhdr.e_phoff), - elf_getu16(swap, elfhdr.e_phnum), + (off_t)elf_getu(swap, elfhdr.e_phoff), phnum, (size_t)elf_getu16(swap, elfhdr.e_phentsize), - fsize, &flags, elf_getu16(swap, elfhdr.e_shnum)) - == -1) + fsize, &flags, shnum) == -1) return -1; /*FALLTHROUGH*/ case ET_REL: + shnum = elf_getu16(swap, elfhdr.e_shnum); + if (shnum > MAX_SHNUM) + return toomany(ms, "section", shnum); if (doshn(ms, clazz, swap, fd, - (off_t)elf_getu(swap, elfhdr.e_shoff), - elf_getu16(swap, elfhdr.e_shnum), + (off_t)elf_getu(swap, elfhdr.e_shoff), shnum, (size_t)elf_getu16(swap, elfhdr.e_shentsize), fsize, &flags, elf_getu16(swap, elfhdr.e_machine), (int)elf_getu16(swap, elfhdr.e_shstrndx)) == -1) Modified: projects/clang350-import/contrib/file/src/file.h ============================================================================== --- projects/clang350-import/contrib/file/src/file.h Wed Dec 10 18:41:25 2014 (r275684) +++ projects/clang350-import/contrib/file/src/file.h Wed Dec 10 19:24:42 2014 (r275685) @@ -482,6 +482,14 @@ protected int file_regexec(file_regex_t protected void file_regfree(file_regex_t *); protected void file_regerror(file_regex_t *, int, struct magic_set *); +typedef struct { + char *buf; + uint32_t offset; +} file_pushbuf_t; + +protected file_pushbuf_t *file_push_buffer(struct magic_set *); +protected char *file_pop_buffer(struct magic_set *, file_pushbuf_t *); + #ifndef COMPILE_ONLY extern const char *file_names[]; extern const size_t file_nnames; Modified: projects/clang350-import/contrib/file/src/funcs.c ============================================================================== --- projects/clang350-import/contrib/file/src/funcs.c Wed Dec 10 18:41:25 2014 (r275684) +++ projects/clang350-import/contrib/file/src/funcs.c Wed Dec 10 19:24:42 2014 (r275685) @@ -491,3 +491,43 @@ file_regerror(file_regex_t *rx, int rc, file_magerror(ms, "regex error %d for `%s', (%s)", rc, rx->pat, errmsg); } + +protected file_pushbuf_t * +file_push_buffer(struct magic_set *ms) +{ + file_pushbuf_t *pb; + + if (ms->event_flags & EVENT_HAD_ERR) + return NULL; + + if ((pb = (CAST(file_pushbuf_t *, malloc(sizeof(*pb))))) == NULL) + return NULL; + + pb->buf = ms->o.buf; + pb->offset = ms->offset; + + ms->o.buf = NULL; + ms->offset = 0; + + return pb; +} + +protected char * +file_pop_buffer(struct magic_set *ms, file_pushbuf_t *pb) +{ + char *rbuf; + + if (ms->event_flags & EVENT_HAD_ERR) { + free(pb->buf); + free(pb); + return NULL; + } + + rbuf = ms->o.buf; + + ms->o.buf = pb->buf; + ms->offset = pb->offset; + + free(pb); + return rbuf; +} Modified: projects/clang350-import/contrib/file/src/readelf.c ============================================================================== --- projects/clang350-import/contrib/file/src/readelf.c Wed Dec 10 18:41:25 2014 (r275684) +++ projects/clang350-import/contrib/file/src/readelf.c Wed Dec 10 19:24:42 2014 (r275685) @@ -60,6 +60,18 @@ private uint16_t getu16(int, uint16_t); private uint32_t getu32(int, uint32_t); private uint64_t getu64(int, uint64_t); +#define MAX_PHNUM 256 +#define MAX_SHNUM 1024 + +private int +toomany(struct magic_set *ms, const char *name, uint16_t num) +{ + if (file_printf(ms, ", too many %s header sections (%u)", name, num + ) == -1) + return -1; + return 0; +} + private uint16_t getu16(int swap, uint16_t value) { @@ -477,6 +489,13 @@ donote(struct magic_set *ms, void *vbuf, uint32_t namesz, descsz; unsigned char *nbuf = CAST(unsigned char *, vbuf); + if (xnh_sizeof + offset > size) { + /* + * We're out of note headers. + */ + return xnh_sizeof + offset; + } + (void)memcpy(xnh_addr, &nbuf[offset], xnh_sizeof); offset += xnh_sizeof; @@ -492,13 +511,13 @@ donote(struct magic_set *ms, void *vbuf, if (namesz & 0x80000000) { (void)file_printf(ms, ", bad note name size 0x%lx", (unsigned long)namesz); - return offset; + return 0; } if (descsz & 0x80000000) { (void)file_printf(ms, ", bad note description size 0x%lx", (unsigned long)descsz); - return offset; + return 0; } @@ -900,6 +919,7 @@ doshn(struct magic_set *ms, int clazz, i Elf32_Shdr sh32; Elf64_Shdr sh64; int stripped = 1; + size_t nbadcap = 0; void *nbuf; off_t noff, coff, name_off; uint64_t cap_hw1 = 0; /* SunOS 5.x hardware capabilites */ @@ -988,6 +1008,8 @@ doshn(struct magic_set *ms, int clazz, i goto skip; } + if (nbadcap > 5) + break; if (lseek(fd, xsh_offset, SEEK_SET) == (off_t)-1) { file_badseek(ms); return -1; @@ -1053,6 +1075,8 @@ doshn(struct magic_set *ms, int clazz, i (unsigned long long)xcap_tag, (unsigned long long)xcap_val) == -1) return -1; + if (nbadcap++ > 2) + coff = xsh_size; break; } } @@ -1233,7 +1257,7 @@ file_tryelf(struct magic_set *ms, int fd int flags = 0; Elf32_Ehdr elf32hdr; Elf64_Ehdr elf64hdr; - uint16_t type; + uint16_t type, phnum, shnum; if (ms->flags & (MAGIC_MIME|MAGIC_APPLE)) return 0; Modified: projects/clang350-import/contrib/file/src/softmagic.c ============================================================================== --- projects/clang350-import/contrib/file/src/softmagic.c Wed Dec 10 18:41:25 2014 (r275684) +++ projects/clang350-import/contrib/file/src/softmagic.c Wed Dec 10 19:24:42 2014 (r275685) @@ -67,6 +67,9 @@ private void cvt_32(union VALUETYPE *, c private void cvt_64(union VALUETYPE *, const struct magic *); #define OFFSET_OOB(n, o, i) ((n) < (o) || (i) > ((n) - (o))) + +#define MAX_RECURSION_LEVEL 10 + /* * softmagic - lookup one file in parsed, in-memory copy of database * Passed the name and FILE * of one file to be typed. @@ -1193,14 +1196,15 @@ mget(struct magic_set *ms, const unsigne int flip, int recursion_level, int *printed_something, int *need_separator, int *returnval) { - uint32_t soffset, offset = ms->offset; + uint32_t offset = ms->offset; uint32_t lhs; + file_pushbuf_t *pb; int rv, oneed_separator, in_type; - char *sbuf, *rbuf; + char *rbuf; union VALUETYPE *p = &ms->ms_value; struct mlist ml; - if (recursion_level >= 20) { + if (recursion_level >= MAX_RECURSION_LEVEL) { file_error(ms, 0, "recursion nesting exceeded"); return -1; } @@ -1644,19 +1648,23 @@ mget(struct magic_set *ms, const unsigne case FILE_INDIRECT: if (offset == 0) return 0; + if (nbytes < offset) return 0; - sbuf = ms->o.buf; - soffset = ms->offset; - ms->o.buf = NULL; - ms->offset = 0; + + if ((pb = file_push_buffer(ms)) == NULL) + return -1; + rv = file_softmagic(ms, s + offset, nbytes - offset, recursion_level, BINTEST, text); + if ((ms->flags & MAGIC_DEBUG) != 0) fprintf(stderr, "indirect @offs=%u[%d]\n", offset, rv); - rbuf = ms->o.buf; - ms->o.buf = sbuf; - ms->offset = soffset; + + rbuf = file_pop_buffer(ms, pb); + if (rbuf == NULL && ms->event_flags & EVENT_HAD_ERR) + return -1; + if (rv == 1) { if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 && file_printf(ms, F(ms, m, "%u"), offset) == -1) { @@ -1674,13 +1682,13 @@ mget(struct magic_set *ms, const unsigne case FILE_USE: if (nbytes < offset) return 0; - sbuf = m->value.s; - if (*sbuf == '^') { - sbuf++; + rbuf = m->value.s; + if (*rbuf == '^') { + rbuf++; flip = !flip; } - if (file_magicfind(ms, sbuf, &ml) == -1) { - file_error(ms, 0, "cannot find entry `%s'", sbuf); + if (file_magicfind(ms, rbuf, &ml) == -1) { + file_error(ms, 0, "cannot find entry `%s'", rbuf); return -1; } Modified: projects/clang350-import/etc/auto_master ============================================================================== --- projects/clang350-import/etc/auto_master Wed Dec 10 18:41:25 2014 (r275684) +++ projects/clang350-import/etc/auto_master Wed Dec 10 19:24:42 2014 (r275685) @@ -3,3 +3,6 @@ # Automounter master map, see auto_master(5) for details. # /net -hosts -nobrowse,nosuid +# When using the -media special map, make sure to edit devd.conf(5) +# to move the call to "automount -c" out of the comments section. +#/media -media -nosuid Modified: projects/clang350-import/etc/autofs/Makefile ============================================================================== --- projects/clang350-import/etc/autofs/Makefile Wed Dec 10 18:41:25 2014 (r275684) +++ projects/clang350-import/etc/autofs/Makefile Wed Dec 10 19:24:42 2014 (r275685) @@ -1,6 +1,6 @@ # $FreeBSD$ -FILES= include_ldap special_hosts special_null +FILES= include_ldap special_hosts special_media special_null NO_OBJ= FILESDIR= /etc/autofs Copied: projects/clang350-import/etc/autofs/special_media (from r275684, head/etc/autofs/special_media) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/clang350-import/etc/autofs/special_media Wed Dec 10 19:24:42 2014 (r275685, copy of r275684, head/etc/autofs/special_media) @@ -0,0 +1,93 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# Print newline-separated list of devices available for mounting. +# If there is a filesystem label - use it, otherwise use device name. +print_available() { + local _fstype _fstype_and_label _label _p + + for _p in ${providers}; do + _fstype_and_label="$(fstyp -l "/dev/${_p}" 2> /dev/null)" + if [ $? -ne 0 ]; then + # Ignore devices for which we were unable + # to determine filesystem type. + continue + fi + + _fstype="${_fstype_and_label%% *}" + if [ "${_fstype}" != "${_fstype_and_label}" ]; then + _label="${_fstype_and_label#* }" + echo "${_label}" + continue + fi + + echo "${_p}" + done +} + +# Print a single map entry. +print_one() { + local _fstype _fstype_and_label _label _key _p + + _key="$1" + + _fstype="$(fstyp "/dev/${_key}" 2> /dev/null)" + if [ $? -eq 0 ]; then + echo "-fstype=${_fstype},nosuid :/dev/${_key}" + return + fi + + for _p in ${providers}; do + _fstype_and_label="$(fstyp -l "/dev/${_p}" 2> /dev/null)" + if [ $? -ne 0 ]; then + # Ignore devices for which we were unable + # to determine filesystem type. + continue + fi + + _fstype="${_fstype_and_label%% *}" + if [ "${_fstype}" = "${_fstype_and_label}" ]; then + # No label, try another device. + continue + fi + + _label="${_fstype_and_label#* }" + if [ "${_label}" != "${_key}" ]; then + # Labels don't match, try another device. + continue + fi + + echo "-fstype=${_fstype},nosuid :/dev/${_p}" + done + + # No matching device - don't print anything, autofs will handle it. +} + +# Obtain a list of (geom-provider-name, access-count) pairs, turning this: +# +# z0xfffff80005085d00 [shape=hexagon,label="ada0\nr2w2e3\nerr#0\nsector=512\nstripe=0"]; +# +# Into this: +# +# ada0 r2w2e3 +# +# XXX: It would be easier to use kern.geom.conftxt instead, but it lacks +# access counts. +pairs=$(sysctl kern.geom.confdot | sed -n 's/^.*hexagon,label="\([^\]*\)\\n\([^\]*\).*/\1 \2/p') + +# Obtain a list of GEOM providers that are not already open - not mounted, +# and without other GEOM class, such as gpart, attached. In other words, +# grep for "r0w0e0". Skip providers with names containing slashes; we're +# not interested in geom_label(4) creations. +providers=$(echo "$pairs" | awk '$2 == "r0w0e0" && $1 !~ /\// { print $1 }') + +if [ $# -eq 0 ]; then + print_available + exit 0 +fi + +print_one "$1" +exit 0 + Modified: projects/clang350-import/etc/devd.conf ============================================================================== --- projects/clang350-import/etc/devd.conf Wed Dec 10 18:41:25 2014 (r275684) +++ projects/clang350-import/etc/devd.conf Wed Dec 10 19:24:42 2014 (r275685) @@ -318,4 +318,16 @@ notify 0 { action "/usr/local/etc/rc.d/postgresql restart"; }; +# Discard autofs caches, useful for the -media special map. The one +# second delay is for GEOM to finish tasting. +# +# XXX: We should probably have a devctl(4) event that fires after GEOM +# tasting. +# +notify 100 { + match "system" "DEVFS"; + match "cdev" "(da|mmcsd)[0-9]+"; + action "sleep 1 && /usr/sbin/automount -c"; +}; + */ Modified: projects/clang350-import/gnu/usr.bin/gdb/kgdb/kthr.c ============================================================================== --- projects/clang350-import/gnu/usr.bin/gdb/kgdb/kthr.c Wed Dec 10 18:41:25 2014 (r275684) +++ projects/clang350-import/gnu/usr.bin/gdb/kgdb/kthr.c Wed Dec 10 19:24:42 2014 (r275685) @@ -96,7 +96,7 @@ kgdb_thr_add_procs(uintptr_t paddr) kt->kaddr = addr; if (td.td_tid == dumptid) kt->pcb = dumppcb; - else if (td.td_state == TDS_RUNNING && + else if (td.td_oncpu != NOCPU && CPU_ISSET(td.td_oncpu, &stopped_cpus)) kt->pcb = kgdb_trgt_core_pcb(td.td_oncpu); else Modified: projects/clang350-import/lib/libc/net/sctp_sys_calls.c ============================================================================== --- projects/clang350-import/lib/libc/net/sctp_sys_calls.c Wed Dec 10 18:41:25 2014 (r275684) +++ projects/clang350-import/lib/libc/net/sctp_sys_calls.c Wed Dec 10 19:24:42 2014 (r275685) @@ -886,7 +886,7 @@ sctp_recvv(int sd, struct sctp_rcvinfo *rcvinfo; struct sctp_nxtinfo *nxtinfo; - if (((info != NULL) && (infolen == NULL)) | + if (((info != NULL) && (infolen == NULL)) || ((info == NULL) && (infolen != NULL) && (*infolen != 0)) || ((info != NULL) && (infotype == NULL))) { errno = EINVAL; Modified: projects/clang350-import/lib/libc/stdio/fflush.c ============================================================================== --- projects/clang350-import/lib/libc/stdio/fflush.c Wed Dec 10 18:41:25 2014 (r275684) +++ projects/clang350-import/lib/libc/stdio/fflush.c Wed Dec 10 19:24:42 2014 (r275685) @@ -124,11 +124,13 @@ __sflush(FILE *fp) t = _swrite(fp, (char *)p, n); if (t <= 0) { /* Reset _p and _w. */ - if (p > fp->_p) /* Some was written. */ + if (p > fp->_p) { + /* Some was written. */ memmove(fp->_p, p, n); - fp->_p += n; - if ((fp->_flags & (__SLBF | __SNBF)) == 0) - fp->_w -= n; + fp->_p += n; + if ((fp->_flags & (__SLBF | __SNBF)) == 0) + fp->_w -= n; + } fp->_flags |= __SERR; return (EOF); } Modified: projects/clang350-import/sbin/mount/mount.8 ============================================================================== --- projects/clang350-import/sbin/mount/mount.8 Wed Dec 10 18:41:25 2014 (r275684) +++ projects/clang350-import/sbin/mount/mount.8 Wed Dec 10 19:24:42 2014 (r275685) @@ -28,7 +28,7 @@ .\" @(#)mount.8 8.8 (Berkeley) 6/16/94 .\" $FreeBSD$ .\" -.Dd November 22, 2014 +.Dd December 3, 2014 .Dt MOUNT 8 .Os .Sh NAME @@ -549,6 +549,7 @@ support for a particular file system mig .Xr fstab 5 , .Xr procfs 5 , .Xr automount 8 , +.Xr fstyp 8 , .Xr kldload 8 , .Xr mount_cd9660 8 , .Xr mount_msdosfs 8 , Modified: projects/clang350-import/sys/arm/altera/socfpga/files.socfpga ============================================================================== --- projects/clang350-import/sys/arm/altera/socfpga/files.socfpga Wed Dec 10 18:41:25 2014 (r275684) +++ projects/clang350-import/sys/arm/altera/socfpga/files.socfpga Wed Dec 10 19:24:42 2014 (r275685) @@ -26,5 +26,6 @@ dev/mmc/host/dwmmc.c optional dwmmc # BERI specific dev/beri/beri_ring.c optional beri_ring dev/beri/beri_mem.c optional beri_mem -dev/beri/virtio/virtio.c optional beri_vtblk +dev/beri/virtio/virtio.c optional beri_vtblk | vtbe dev/beri/virtio/virtio_block.c optional beri_vtblk +dev/beri/virtio/network/if_vtbe.c optional vtbe Modified: projects/clang350-import/sys/arm/arm/syscall.c ============================================================================== --- projects/clang350-import/sys/arm/arm/syscall.c Wed Dec 10 18:41:25 2014 (r275684) +++ projects/clang350-import/sys/arm/arm/syscall.c Wed Dec 10 19:24:42 2014 (r275685) @@ -84,6 +84,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include Modified: projects/clang350-import/sys/arm/broadcom/bcm2835/bcm2835_wdog.c ============================================================================== --- projects/clang350-import/sys/arm/broadcom/bcm2835/bcm2835_wdog.c Wed Dec 10 18:41:25 2014 (r275684) +++ projects/clang350-import/sys/arm/broadcom/bcm2835/bcm2835_wdog.c Wed Dec 10 19:24:42 2014 (r275685) @@ -142,14 +142,13 @@ bcmwd_watchdog_fn(void *private, u_int c if (cmd > 0) { sec = ((uint64_t)1 << (cmd & WD_INTERVAL)) / 1000000000; - ticks = (sec << 16) & BCM2835_WDOG_TIME_MASK; - if (ticks == 0) { + if (sec == 0 || sec > 15) { /* * Can't arm * disable watchdog as watchdog(9) requires */ device_printf(sc->dev, - "Can't arm, timeout is less than 1 second\n"); + "Can't arm, timeout must be between 1-15 seconds\n"); WRITE(sc, BCM2835_RSTC_REG, (BCM2835_PASWORD << BCM2835_PASSWORD_SHIFT) | BCM2835_RSTC_RESET); @@ -157,6 +156,7 @@ bcmwd_watchdog_fn(void *private, u_int c return; } + ticks = (sec << 16) & BCM2835_WDOG_TIME_MASK; reg = (BCM2835_PASWORD << BCM2835_PASSWORD_SHIFT) | ticks; WRITE(sc, BCM2835_WDOG_REG, reg); Modified: projects/clang350-import/sys/arm/conf/SOCKIT-BERI ============================================================================== --- projects/clang350-import/sys/arm/conf/SOCKIT-BERI Wed Dec 10 18:41:25 2014 (r275684) +++ projects/clang350-import/sys/arm/conf/SOCKIT-BERI Wed Dec 10 19:24:42 2014 (r275685) @@ -123,6 +123,7 @@ device spibus device beri_ring device beri_mem device beri_vtblk +device vtbe device altera_pio # Ethernet Modified: projects/clang350-import/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts ============================================================================== --- projects/clang350-import/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts Wed Dec 10 18:41:25 2014 (r275684) +++ projects/clang350-import/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts Wed Dec 10 19:24:42 2014 (r275685) @@ -39,7 +39,8 @@ compatible = "altr,socfpga-cyclone5", "altr,socfpga"; memreserve = < 0x00000000 0x1000 >, /* SMP trampoline */ - < 0x00001000 0x1000 >; /* virtio block */ + < 0x00001000 0x1000 >, /* virtio block */ + < 0x00002000 0x1000 >; /* virtio net */ memory { device_type = "memory"; @@ -111,6 +112,15 @@ pio-recv = <&pio0>; pio-send = <&pio1>; beri-mem = <&beri_mem0>; + status = "disabled"; + }; + + beri_vtnet: vtnet@00002000 { + compatible = "sri-cambridge,beri-vtnet"; + reg = <0x00002000 0x1000>; + pio-recv = <&pio0>; + pio-send = <&pio1>; + beri-mem = <&beri_mem0>; status = "okay"; }; Modified: projects/clang350-import/sys/conf/files ============================================================================== --- projects/clang350-import/sys/conf/files Wed Dec 10 18:41:25 2014 (r275684) +++ projects/clang350-import/sys/conf/files Wed Dec 10 19:24:42 2014 (r275685) @@ -2651,6 +2651,7 @@ dev/xen/blkback/blkback.c optional xen | dev/xen/console/console.c optional xen | xenhvm dev/xen/console/xencons_ring.c optional xen | xenhvm dev/xen/control/control.c optional xen | xenhvm +dev/xen/grant_table/grant_table.c optional xen | xenhvm dev/xen/netback/netback.c optional xen | xenhvm dev/xen/netfront/netfront.c optional xen | xenhvm dev/xen/xenpci/xenpci.c optional xenpci @@ -4000,7 +4001,6 @@ vm/vm_reserv.c standard vm/vm_unix.c standard vm/vm_zeroidle.c standard vm/vnode_pager.c standard -xen/gnttab.c optional xen | xenhvm xen/features.c optional xen | xenhvm xen/xenbus/xenbus_if.m optional xen | xenhvm xen/xenbus/xenbus.c optional xen | xenhvm Modified: projects/clang350-import/sys/conf/files.amd64 ============================================================================== --- projects/clang350-import/sys/conf/files.amd64 Wed Dec 10 18:41:25 2014 (r275684) +++ projects/clang350-import/sys/conf/files.amd64 Wed Dec 10 19:24:42 2014 (r275685) @@ -336,6 +336,8 @@ dev/viawd/viawd.c optional viawd dev/vmware/vmxnet3/if_vmx.c optional vmx dev/wbwd/wbwd.c optional wbwd dev/wpi/if_wpi.c optional wpi +dev/xen/pci/xen_acpi_pci.c optional xenhvm +dev/xen/pci/xen_pci.c optional xenhvm dev/isci/isci.c optional isci dev/isci/isci_controller.c optional isci dev/isci/isci_domain.c optional isci @@ -572,4 +574,4 @@ x86/xen/xen_apic.c optional xenhvm x86/xen/xenpv.c optional xenhvm x86/xen/xen_nexus.c optional xenhvm x86/xen/xen_msi.c optional xenhvm -x86/xen/xen_pci.c optional xenhvm +x86/xen/xen_pci_bus.c optional xenhvm Modified: projects/clang350-import/sys/dev/beri/virtio/virtio.c ============================================================================== --- projects/clang350-import/sys/dev/beri/virtio/virtio.c Wed Dec 10 18:41:25 2014 (r275684) +++ projects/clang350-import/sys/dev/beri/virtio/virtio.c Wed Dec 10 19:24:42 2014 (r275685) @@ -58,10 +58,18 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include +#include + #include #include #include #include +#include + +#include "pio_if.h" int vq_ring_ready(struct vqueue_info *vq) @@ -167,12 +175,13 @@ vq_relchain(struct vqueue_info *vq, stru int i; mask = vq->vq_qsize - 1; + vu = vq->vq_used; head = be16toh(vq->vq_avail->ring[vq->vq_last_avail++ & mask]); - vu = vq->vq_used; uidx = be16toh(vu->idx); vue = &vu->ring[uidx++ & mask]; - vue->id = htobe16(head); + vue->id = htobe32(head); + vue->len = htobe32(iolen); vu->idx = htobe16(uidx); @@ -181,3 +190,59 @@ vq_relchain(struct vqueue_info *vq, stru paddr_unmap((void *)iov[i].iov_base, iov[i].iov_len); } } + +int +setup_pio(device_t dev, char *name, device_t *pio_dev) +{ + phandle_t pio_node; + struct fdt_ic *ic; + phandle_t xref; + phandle_t node; + + if ((node = ofw_bus_get_node(dev)) == -1) + return (ENXIO); + + if (OF_searchencprop(node, name, &xref, + sizeof(xref)) == -1) { + return (ENXIO); + } + + pio_node = OF_node_from_xref(xref); + SLIST_FOREACH(ic, &fdt_ic_list_head, fdt_ics) { + if (ic->iph == pio_node) { + *pio_dev = ic->dev; + PIO_CONFIGURE(*pio_dev, PIO_OUT_ALL, + PIO_UNMASK_ALL); + return (0); + } + } + + return (ENXIO); +} + +int +setup_offset(device_t dev, uint32_t *offset) +{ + pcell_t dts_value[2]; + phandle_t mem_node; + phandle_t xref; + phandle_t node; + int len; + + if ((node = ofw_bus_get_node(dev)) == -1) + return (ENXIO); + + if (OF_searchencprop(node, "beri-mem", &xref, + sizeof(xref)) == -1) { + return (ENXIO); + } + + mem_node = OF_node_from_xref(xref); + if ((len = OF_getproplen(mem_node, "reg")) <= 0) + return (ENXIO); + OF_getencprop(mem_node, "reg", dts_value, len); + *offset = dts_value[0]; + + return (0); +} + Modified: projects/clang350-import/sys/dev/beri/virtio/virtio.h ============================================================================== --- projects/clang350-import/sys/dev/beri/virtio/virtio.h Wed Dec 10 18:41:25 2014 (r275684) +++ projects/clang350-import/sys/dev/beri/virtio/virtio.h Wed Dec 10 19:24:42 2014 (r275685) @@ -41,14 +41,10 @@ #define PAGE_SHIFT 12 #define VRING_ALIGN 4096 -#define NUM_QUEUES 1 #define VQ_ALLOC 0x01 /* set once we have a pfn */ #define VQ_MAX_DESCRIPTORS 512 -#define VTBLK_BLK_ID_BYTES 20 -#define VTBLK_MAXSEGS 256 - struct vqueue_info { uint16_t vq_qsize; /* size of this queue (a power of 2) */ uint16_t vq_num; @@ -70,3 +66,5 @@ int vq_getchain(uint32_t beri_mem_offset struct iovec *iov, int n_iov, uint16_t *flags); void vq_relchain(struct vqueue_info *vq, struct iovec *iov, int n, uint32_t iolen); +int setup_pio(device_t dev, char *name, device_t *pio_dev); +int setup_offset(device_t dev, uint32_t *offset); Modified: projects/clang350-import/sys/dev/beri/virtio/virtio_block.c ============================================================================== --- projects/clang350-import/sys/dev/beri/virtio/virtio_block.c Wed Dec 10 18:41:25 2014 (r275684) +++ projects/clang350-import/sys/dev/beri/virtio/virtio_block.c Wed Dec 10 19:24:42 2014 (r275685) @@ -74,6 +74,13 @@ __FBSDID("$FreeBSD$"); #define DPRINTF(fmt, ...) +/* We use indirect descriptors */ +#define NUM_DESCS 1 +#define NUM_QUEUES 1 + +#define VTBLK_BLK_ID_BYTES 20 +#define VTBLK_MAXSEGS 256 + struct beri_vtblk_softc { struct resource *res[1]; bus_space_tag_t bst; @@ -286,8 +293,12 @@ vtblk_notify(struct beri_vtblk_softc *sc while (vq_has_descs(vq)) vtblk_proc(sc, vq); - /* Interrupt other side */ - PIO_SET(sc->pio_send, Q_INTR, 1); + /* Interrupt the other side */ + if ((be16toh(vq->vq_avail->flags) & VRING_AVAIL_F_NO_INTERRUPT) == 0) { + reg = htobe32(VIRTIO_MMIO_INT_VRING); + WRITE4(sc, VIRTIO_MMIO_INTERRUPT_STATUS, reg); + PIO_SET(sc->pio_send, Q_INTR, 1); + } return (0); } @@ -302,7 +313,7 @@ vq_init(struct beri_vtblk_softc *sc) int pfn; vq = &sc->vs_queues[0]; - vq->vq_qsize = NUM_QUEUES; + vq->vq_qsize = NUM_DESCS; reg = READ4(sc, VIRTIO_MMIO_QUEUE_PFN); pfn = be32toh(reg); @@ -353,61 +364,6 @@ vtblk_thread(void *arg) } static int -setup_pio(struct beri_vtblk_softc *sc, char *name, device_t *dev) -{ - phandle_t pio_node; - struct fdt_ic *ic; - phandle_t xref; - phandle_t node; - - if ((node = ofw_bus_get_node(sc->dev)) == -1) - return (ENXIO); - - if (OF_searchencprop(node, name, &xref, - sizeof(xref)) == -1) { - return (ENXIO); - } - - pio_node = OF_node_from_xref(xref); - SLIST_FOREACH(ic, &fdt_ic_list_head, fdt_ics) { - if (ic->iph == pio_node) { - *dev = ic->dev; - PIO_CONFIGURE(*dev, PIO_OUT_ALL, - PIO_UNMASK_ALL); - return (0); - } - } - - return (ENXIO); -} - -static int -setup_offset(struct beri_vtblk_softc *sc) -{ - pcell_t dts_value[2]; - phandle_t mem_node; - phandle_t xref; - phandle_t node; - int len; - - if ((node = ofw_bus_get_node(sc->dev)) == -1) - return (ENXIO); - - if (OF_searchencprop(node, "beri-mem", &xref, - sizeof(xref)) == -1) { - return (ENXIO); - } - - mem_node = OF_node_from_xref(xref); - if ((len = OF_getproplen(mem_node, "reg")) <= 0) - return (ENXIO); - OF_getencprop(mem_node, "reg", dts_value, len); - sc->beri_mem_offset = dts_value[0]; - - return (0); -} - -static int backend_info(struct beri_vtblk_softc *sc) { struct virtio_blk_config *cfg; @@ -419,9 +375,9 @@ backend_info(struct beri_vtblk_softc *sc reg = htobe32(VIRTIO_ID_BLOCK); WRITE4(sc, VIRTIO_MMIO_DEVICE_ID, reg); - /* The number of queues we support */ - reg = htobe16(NUM_QUEUES); - WRITE2(sc, VIRTIO_MMIO_QUEUE_NUM, reg); + /* Queue size */ + reg = htobe32(NUM_DESCS); + WRITE4(sc, VIRTIO_MMIO_QUEUE_NUM_MAX, reg); /* Our features */ reg = htobe32(VIRTIO_RING_F_INDIRECT_DESC @@ -566,11 +522,11 @@ beri_vtblk_attach(device_t dev) return (ENXIO); } - if (setup_offset(sc) != 0) + if (setup_offset(dev, &sc->beri_mem_offset) != 0) return (ENXIO); - if (setup_pio(sc, "pio-send", &sc->pio_send) != 0) + if (setup_pio(dev, "pio-send", &sc->pio_send) != 0) return (ENXIO); - if (setup_pio(sc, "pio-recv", &sc->pio_recv) != 0) + if (setup_pio(dev, "pio-recv", &sc->pio_recv) != 0) return (ENXIO); sc->cdev = make_dev(&beri_cdevsw, 0, UID_ROOT, GID_WHEEL, Modified: projects/clang350-import/sys/dev/beri/virtio/virtio_mmio_platform.c ============================================================================== --- projects/clang350-import/sys/dev/beri/virtio/virtio_mmio_platform.c Wed Dec 10 18:41:25 2014 (r275684) +++ projects/clang350-import/sys/dev/beri/virtio/virtio_mmio_platform.c Wed Dec 10 19:24:42 2014 (r275685) @@ -149,20 +149,49 @@ virtio_mmio_platform_attach(device_t dev } static int -platform_note(device_t dev, size_t offset) +platform_note(device_t dev, size_t offset, int val) { struct virtio_mmio_platform_softc *sc; + int note; + int i; sc = device_get_softc(dev); - if (offset == VIRTIO_MMIO_QUEUE_NOTIFY) { - mips_dcache_wbinv_all(); - PIO_SET(sc->pio_send, Q_NOTIFY, 1); + switch (offset) { + case (VIRTIO_MMIO_QUEUE_NOTIFY): + if (val == 0) + note = Q_NOTIFY; + else if (val == 1) + note = Q_NOTIFY1; + break; + case (VIRTIO_MMIO_QUEUE_PFN): + note = Q_PFN; + break; + case (VIRTIO_MMIO_QUEUE_SEL): + note = Q_SEL; + break; + default: + note = 0; } - if (offset == VIRTIO_MMIO_QUEUE_PFN) { + if (note) { mips_dcache_wbinv_all(); - PIO_SET(sc->pio_send, Q_PFN, 1); + + PIO_SET(sc->pio_send, note, 1); + + /* + * Wait until host ack the request. + * Usually done within few cycles. + * TODO: bad + */ + + for (i = 100; i > 0; i--) { + if (PIO_READ(sc->pio_send) == 0) + break; + } + + if (i == 0) + device_printf(sc->dev, "Warning: host busy\n"); } return (0); Modified: projects/clang350-import/sys/dev/beri/virtio/virtio_mmio_platform.h ============================================================================== --- projects/clang350-import/sys/dev/beri/virtio/virtio_mmio_platform.h Wed Dec 10 18:41:25 2014 (r275684) +++ projects/clang350-import/sys/dev/beri/virtio/virtio_mmio_platform.h Wed Dec 10 19:24:42 2014 (r275685) @@ -30,6 +30,8 @@ * $FreeBSD$ */ -#define Q_NOTIFY 0x1 -#define Q_PFN 0x2 -#define Q_INTR 0x4 +#define Q_NOTIFY 0x01 +#define Q_PFN 0x02 +#define Q_INTR 0x04 +#define Q_SEL 0x08 +#define Q_NOTIFY1 0x10 Modified: projects/clang350-import/sys/dev/mii/micphy.c ============================================================================== --- projects/clang350-import/sys/dev/mii/micphy.c Wed Dec 10 18:41:25 2014 (r275684) +++ projects/clang350-import/sys/dev/mii/micphy.c Wed Dec 10 19:24:42 2014 (r275685) @@ -68,7 +68,7 @@ __FBSDID("$FreeBSD$"); #define MII_KSZPHY_RX_DATA_PAD_SKEW 0x105 #define MII_KSZPHY_TX_DATA_PAD_SKEW 0x106 -#define PS_TO_REG(p) (p / 200) +#define PS_TO_REG(p) ((p) / 200) static int micphy_probe(device_t); static int micphy_attach(device_t); @@ -104,7 +104,8 @@ static const struct mii_phy_funcs micphy mii_phy_reset }; -static void micphy_write(struct mii_softc *sc, uint32_t reg, uint32_t val) +static void +micphy_write(struct mii_softc *sc, uint32_t reg, uint32_t val) { PHY_WRITE(sc, MII_KSZPHY_EXTREG, KSZPHY_EXTREG_WRITE | reg); Modified: projects/clang350-import/sys/dev/usb/usbdevs ============================================================================== --- projects/clang350-import/sys/dev/usb/usbdevs Wed Dec 10 18:41:25 2014 (r275684) +++ projects/clang350-import/sys/dev/usb/usbdevs Wed Dec 10 19:24:42 2014 (r275685) @@ -3195,7 +3195,7 @@ product NETGEAR EA101X 0x1002 Ethernet product NETGEAR FA101 0x1020 Ethernet 10/100, USB1.1 product NETGEAR FA120 0x1040 USB 2.0 Ethernet product NETGEAR M4100 0x1100 M4100/M5300/M7100 series switch -product NETGEAR WG111V2_2 0x4240 PrismGT USB 2.0 WLAN +product NETGEAR WG111V1_2 0x4240 PrismGT USB 2.0 WLAN product NETGEAR WG111V3 0x4260 WG111v3 product NETGEAR WG111U 0x4300 WG111U product NETGEAR WG111U_NF 0x4301 WG111U (no firmware) Modified: projects/clang350-import/sys/dev/usb/wlan/if_upgt.c ============================================================================== --- projects/clang350-import/sys/dev/usb/wlan/if_upgt.c Wed Dec 10 18:41:25 2014 (r275684) +++ projects/clang350-import/sys/dev/usb/wlan/if_upgt.c Wed Dec 10 19:24:42 2014 (r275685) @@ -182,7 +182,7 @@ static const STRUCT_USB_HOST_ID upgt_dev UPGT_DEV(FSC, E5400), UPGT_DEV(GLOBESPAN, PRISM_GT_1), UPGT_DEV(GLOBESPAN, PRISM_GT_2), - UPGT_DEV(NETGEAR, WG111V2_2), + UPGT_DEV(NETGEAR, WG111V1_2), UPGT_DEV(INTERSIL, PRISM_GT), UPGT_DEV(SMC, 2862WG), UPGT_DEV(USR, USR5422), Modified: projects/clang350-import/sys/dev/virtio/mmio/virtio_mmio.c ============================================================================== --- projects/clang350-import/sys/dev/virtio/mmio/virtio_mmio.c Wed Dec 10 18:41:25 2014 (r275684) +++ projects/clang350-import/sys/dev/virtio/mmio/virtio_mmio.c Wed Dec 10 19:24:42 2014 (r275685) @@ -1,11 +1,15 @@ /*- * Copyright (c) 2014 Ruslan Bukin + * Copyright (c) 2014 The FreeBSD Foundation * All rights reserved. * * This software was developed by SRI International and the University of * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) * ("CTSRD"), as part of the DARPA CRASH research programme. * + * Portions of this software were developed by Andrew Turner *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Wed Dec 10 20:43:17 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EA35DB4; Wed, 10 Dec 2014 20:43:17 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D71FAFFF; Wed, 10 Dec 2014 20:43:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBAKhHlF004101; Wed, 10 Dec 2014 20:43:17 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBAKhHN2004100; Wed, 10 Dec 2014 20:43:17 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201412102043.sBAKhHN2004100@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Wed, 10 Dec 2014 20:43:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r275688 - projects/building-blocks X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2014 20:43:18 -0000 Author: ngie Date: Wed Dec 10 20:43:17 2014 New Revision: 275688 URL: https://svnweb.freebsd.org/changeset/base/275688 Log: Remove building usr.bin/vi as part of build-tools per r275687 Modified: projects/building-blocks/Makefile.inc1 Modified: projects/building-blocks/Makefile.inc1 ============================================================================== --- projects/building-blocks/Makefile.inc1 Wed Dec 10 20:40:03 2014 (r275687) +++ projects/building-blocks/Makefile.inc1 Wed Dec 10 20:43:17 2014 (r275688) @@ -1393,18 +1393,6 @@ build-tools: .MAKE ${MAKE} DIRPRFX=${_tool}/ depend && \ ${MAKE} DIRPRFX=${_tool}/ all .endfor - # usr.bin/vi is required to process files in share/termcap -.if !defined(NO_SHARE) -.for _tool in \ - usr.bin/vi - ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ - cd ${.CURDIR}/${_tool} && \ - ${MAKE} DIRPRFX=${_tool}/ obj && \ - ${MAKE} DIRPRFX=${_tool}/ depend MK_MAN=no SUBDIR= && \ - ${MAKE} DIRPRFX=${_tool}/ all MK_MAN=no SUBDIR= && \ - ${MAKE} DIRPRFX=${_tool}/ install MK_MAN=no SUBDIR= DESTDIR=${WORLDTMP}/ -.endfor -.endif # # kernel-tools: Build kernel-building tools From owner-svn-src-projects@FreeBSD.ORG Wed Dec 10 20:44:56 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 793F12E8; Wed, 10 Dec 2014 20:44:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6277067; Wed, 10 Dec 2014 20:44:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBAKiuPC004439; Wed, 10 Dec 2014 20:44:56 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBAKiqUF004414; Wed, 10 Dec 2014 20:44:52 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201412102044.sBAKiqUF004414@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Wed, 10 Dec 2014 20:44:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r275689 - in projects/building-blocks: contrib/file/doc contrib/file/src etc etc/autofs lib/libc/net lib/libc/stdio sbin/mount share/termcap sys/conf sys/dev/mii sys/dev/xen/grant_table... X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2014 20:44:56 -0000 Author: ngie Date: Wed Dec 10 20:44:51 2014 New Revision: 275689 URL: https://svnweb.freebsd.org/changeset/base/275689 Log: MFhead @ r275688 Added: projects/building-blocks/etc/autofs/special_media - copied unchanged from r275688, head/etc/autofs/special_media projects/building-blocks/share/termcap/termcap - copied unchanged from r275688, head/share/termcap/termcap projects/building-blocks/sys/dev/xen/grant_table/ - copied from r275688, head/sys/dev/xen/grant_table/ projects/building-blocks/usr.sbin/fstyp/ - copied from r275688, head/usr.sbin/fstyp/ Deleted: projects/building-blocks/share/termcap/reorder projects/building-blocks/share/termcap/termcap.src projects/building-blocks/sys/xen/gnttab.c Modified: projects/building-blocks/contrib/file/doc/file.man projects/building-blocks/contrib/file/src/elfclass.h projects/building-blocks/contrib/file/src/file.h projects/building-blocks/contrib/file/src/funcs.c projects/building-blocks/contrib/file/src/readelf.c projects/building-blocks/contrib/file/src/softmagic.c projects/building-blocks/etc/auto_master projects/building-blocks/etc/autofs/Makefile projects/building-blocks/etc/devd.conf projects/building-blocks/lib/libc/net/sctp_sys_calls.c projects/building-blocks/lib/libc/stdio/fflush.c projects/building-blocks/sbin/mount/mount.8 projects/building-blocks/share/termcap/Makefile projects/building-blocks/share/termcap/README projects/building-blocks/sys/conf/files projects/building-blocks/sys/dev/mii/micphy.c projects/building-blocks/sys/powerpc/aim/trap.c projects/building-blocks/sys/powerpc/booke/trap.c projects/building-blocks/sys/x86/xen/xen_intr.c projects/building-blocks/sys/x86/xen/xenpv.c projects/building-blocks/sys/xen/gnttab.h projects/building-blocks/usr.sbin/Makefile projects/building-blocks/usr.sbin/autofs/auto_master.5 Directory Properties: projects/building-blocks/ (props changed) projects/building-blocks/contrib/file/ (props changed) projects/building-blocks/etc/ (props changed) projects/building-blocks/lib/libc/ (props changed) projects/building-blocks/sbin/ (props changed) projects/building-blocks/share/ (props changed) projects/building-blocks/sys/ (props changed) projects/building-blocks/sys/conf/ (props changed) Modified: projects/building-blocks/contrib/file/doc/file.man ============================================================================== --- projects/building-blocks/contrib/file/doc/file.man Wed Dec 10 20:43:17 2014 (r275688) +++ projects/building-blocks/contrib/file/doc/file.man Wed Dec 10 20:44:51 2014 (r275689) @@ -1,5 +1,5 @@ .\" $File: file.man,v 1.106 2014/03/07 23:11:51 christos Exp $ -.Dd January 30, 2014 +.Dd December 3, 2014 .Dt FILE __CSECTION__ .Os .Sh NAME @@ -385,6 +385,7 @@ options. .Xr hexdump 1 , .Xr od 1 , .Xr strings 1 , +.Xr fstyp 8 .Sh STANDARDS CONFORMANCE This program is believed to exceed the System V Interface Definition of FILE(CMD), as near as one can determine from the vague language Modified: projects/building-blocks/contrib/file/src/elfclass.h ============================================================================== --- projects/building-blocks/contrib/file/src/elfclass.h Wed Dec 10 20:43:17 2014 (r275688) +++ projects/building-blocks/contrib/file/src/elfclass.h Wed Dec 10 20:44:51 2014 (r275689) @@ -35,10 +35,12 @@ switch (type) { #ifdef ELFCORE case ET_CORE: + phnum = elf_getu16(swap, elfhdr.e_phnum); + if (phnum > MAX_PHNUM) + return toomany(ms, "program", phnum); flags |= FLAGS_IS_CORE; if (dophn_core(ms, clazz, swap, fd, - (off_t)elf_getu(swap, elfhdr.e_phoff), - elf_getu16(swap, elfhdr.e_phnum), + (off_t)elf_getu(swap, elfhdr.e_phoff), phnum, (size_t)elf_getu16(swap, elfhdr.e_phentsize), fsize, &flags) == -1) return -1; @@ -46,18 +48,24 @@ #endif case ET_EXEC: case ET_DYN: + phnum = elf_getu16(swap, elfhdr.e_phnum); + if (phnum > MAX_PHNUM) + return toomany(ms, "program", phnum); + shnum = elf_getu16(swap, elfhdr.e_shnum); + if (shnum > MAX_SHNUM) + return toomany(ms, "section", shnum); if (dophn_exec(ms, clazz, swap, fd, - (off_t)elf_getu(swap, elfhdr.e_phoff), - elf_getu16(swap, elfhdr.e_phnum), + (off_t)elf_getu(swap, elfhdr.e_phoff), phnum, (size_t)elf_getu16(swap, elfhdr.e_phentsize), - fsize, &flags, elf_getu16(swap, elfhdr.e_shnum)) - == -1) + fsize, &flags, shnum) == -1) return -1; /*FALLTHROUGH*/ case ET_REL: + shnum = elf_getu16(swap, elfhdr.e_shnum); + if (shnum > MAX_SHNUM) + return toomany(ms, "section", shnum); if (doshn(ms, clazz, swap, fd, - (off_t)elf_getu(swap, elfhdr.e_shoff), - elf_getu16(swap, elfhdr.e_shnum), + (off_t)elf_getu(swap, elfhdr.e_shoff), shnum, (size_t)elf_getu16(swap, elfhdr.e_shentsize), fsize, &flags, elf_getu16(swap, elfhdr.e_machine), (int)elf_getu16(swap, elfhdr.e_shstrndx)) == -1) Modified: projects/building-blocks/contrib/file/src/file.h ============================================================================== --- projects/building-blocks/contrib/file/src/file.h Wed Dec 10 20:43:17 2014 (r275688) +++ projects/building-blocks/contrib/file/src/file.h Wed Dec 10 20:44:51 2014 (r275689) @@ -482,6 +482,14 @@ protected int file_regexec(file_regex_t protected void file_regfree(file_regex_t *); protected void file_regerror(file_regex_t *, int, struct magic_set *); +typedef struct { + char *buf; + uint32_t offset; +} file_pushbuf_t; + +protected file_pushbuf_t *file_push_buffer(struct magic_set *); +protected char *file_pop_buffer(struct magic_set *, file_pushbuf_t *); + #ifndef COMPILE_ONLY extern const char *file_names[]; extern const size_t file_nnames; Modified: projects/building-blocks/contrib/file/src/funcs.c ============================================================================== --- projects/building-blocks/contrib/file/src/funcs.c Wed Dec 10 20:43:17 2014 (r275688) +++ projects/building-blocks/contrib/file/src/funcs.c Wed Dec 10 20:44:51 2014 (r275689) @@ -491,3 +491,43 @@ file_regerror(file_regex_t *rx, int rc, file_magerror(ms, "regex error %d for `%s', (%s)", rc, rx->pat, errmsg); } + +protected file_pushbuf_t * +file_push_buffer(struct magic_set *ms) +{ + file_pushbuf_t *pb; + + if (ms->event_flags & EVENT_HAD_ERR) + return NULL; + + if ((pb = (CAST(file_pushbuf_t *, malloc(sizeof(*pb))))) == NULL) + return NULL; + + pb->buf = ms->o.buf; + pb->offset = ms->offset; + + ms->o.buf = NULL; + ms->offset = 0; + + return pb; +} + +protected char * +file_pop_buffer(struct magic_set *ms, file_pushbuf_t *pb) +{ + char *rbuf; + + if (ms->event_flags & EVENT_HAD_ERR) { + free(pb->buf); + free(pb); + return NULL; + } + + rbuf = ms->o.buf; + + ms->o.buf = pb->buf; + ms->offset = pb->offset; + + free(pb); + return rbuf; +} Modified: projects/building-blocks/contrib/file/src/readelf.c ============================================================================== --- projects/building-blocks/contrib/file/src/readelf.c Wed Dec 10 20:43:17 2014 (r275688) +++ projects/building-blocks/contrib/file/src/readelf.c Wed Dec 10 20:44:51 2014 (r275689) @@ -60,6 +60,18 @@ private uint16_t getu16(int, uint16_t); private uint32_t getu32(int, uint32_t); private uint64_t getu64(int, uint64_t); +#define MAX_PHNUM 256 +#define MAX_SHNUM 1024 + +private int +toomany(struct magic_set *ms, const char *name, uint16_t num) +{ + if (file_printf(ms, ", too many %s header sections (%u)", name, num + ) == -1) + return -1; + return 0; +} + private uint16_t getu16(int swap, uint16_t value) { @@ -477,6 +489,13 @@ donote(struct magic_set *ms, void *vbuf, uint32_t namesz, descsz; unsigned char *nbuf = CAST(unsigned char *, vbuf); + if (xnh_sizeof + offset > size) { + /* + * We're out of note headers. + */ + return xnh_sizeof + offset; + } + (void)memcpy(xnh_addr, &nbuf[offset], xnh_sizeof); offset += xnh_sizeof; @@ -492,13 +511,13 @@ donote(struct magic_set *ms, void *vbuf, if (namesz & 0x80000000) { (void)file_printf(ms, ", bad note name size 0x%lx", (unsigned long)namesz); - return offset; + return 0; } if (descsz & 0x80000000) { (void)file_printf(ms, ", bad note description size 0x%lx", (unsigned long)descsz); - return offset; + return 0; } @@ -900,6 +919,7 @@ doshn(struct magic_set *ms, int clazz, i Elf32_Shdr sh32; Elf64_Shdr sh64; int stripped = 1; + size_t nbadcap = 0; void *nbuf; off_t noff, coff, name_off; uint64_t cap_hw1 = 0; /* SunOS 5.x hardware capabilites */ @@ -988,6 +1008,8 @@ doshn(struct magic_set *ms, int clazz, i goto skip; } + if (nbadcap > 5) + break; if (lseek(fd, xsh_offset, SEEK_SET) == (off_t)-1) { file_badseek(ms); return -1; @@ -1053,6 +1075,8 @@ doshn(struct magic_set *ms, int clazz, i (unsigned long long)xcap_tag, (unsigned long long)xcap_val) == -1) return -1; + if (nbadcap++ > 2) + coff = xsh_size; break; } } @@ -1233,7 +1257,7 @@ file_tryelf(struct magic_set *ms, int fd int flags = 0; Elf32_Ehdr elf32hdr; Elf64_Ehdr elf64hdr; - uint16_t type; + uint16_t type, phnum, shnum; if (ms->flags & (MAGIC_MIME|MAGIC_APPLE)) return 0; Modified: projects/building-blocks/contrib/file/src/softmagic.c ============================================================================== --- projects/building-blocks/contrib/file/src/softmagic.c Wed Dec 10 20:43:17 2014 (r275688) +++ projects/building-blocks/contrib/file/src/softmagic.c Wed Dec 10 20:44:51 2014 (r275689) @@ -67,6 +67,9 @@ private void cvt_32(union VALUETYPE *, c private void cvt_64(union VALUETYPE *, const struct magic *); #define OFFSET_OOB(n, o, i) ((n) < (o) || (i) > ((n) - (o))) + +#define MAX_RECURSION_LEVEL 10 + /* * softmagic - lookup one file in parsed, in-memory copy of database * Passed the name and FILE * of one file to be typed. @@ -1193,14 +1196,15 @@ mget(struct magic_set *ms, const unsigne int flip, int recursion_level, int *printed_something, int *need_separator, int *returnval) { - uint32_t soffset, offset = ms->offset; + uint32_t offset = ms->offset; uint32_t lhs; + file_pushbuf_t *pb; int rv, oneed_separator, in_type; - char *sbuf, *rbuf; + char *rbuf; union VALUETYPE *p = &ms->ms_value; struct mlist ml; - if (recursion_level >= 20) { + if (recursion_level >= MAX_RECURSION_LEVEL) { file_error(ms, 0, "recursion nesting exceeded"); return -1; } @@ -1644,19 +1648,23 @@ mget(struct magic_set *ms, const unsigne case FILE_INDIRECT: if (offset == 0) return 0; + if (nbytes < offset) return 0; - sbuf = ms->o.buf; - soffset = ms->offset; - ms->o.buf = NULL; - ms->offset = 0; + + if ((pb = file_push_buffer(ms)) == NULL) + return -1; + rv = file_softmagic(ms, s + offset, nbytes - offset, recursion_level, BINTEST, text); + if ((ms->flags & MAGIC_DEBUG) != 0) fprintf(stderr, "indirect @offs=%u[%d]\n", offset, rv); - rbuf = ms->o.buf; - ms->o.buf = sbuf; - ms->offset = soffset; + + rbuf = file_pop_buffer(ms, pb); + if (rbuf == NULL && ms->event_flags & EVENT_HAD_ERR) + return -1; + if (rv == 1) { if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 && file_printf(ms, F(ms, m, "%u"), offset) == -1) { @@ -1674,13 +1682,13 @@ mget(struct magic_set *ms, const unsigne case FILE_USE: if (nbytes < offset) return 0; - sbuf = m->value.s; - if (*sbuf == '^') { - sbuf++; + rbuf = m->value.s; + if (*rbuf == '^') { + rbuf++; flip = !flip; } - if (file_magicfind(ms, sbuf, &ml) == -1) { - file_error(ms, 0, "cannot find entry `%s'", sbuf); + if (file_magicfind(ms, rbuf, &ml) == -1) { + file_error(ms, 0, "cannot find entry `%s'", rbuf); return -1; } Modified: projects/building-blocks/etc/auto_master ============================================================================== --- projects/building-blocks/etc/auto_master Wed Dec 10 20:43:17 2014 (r275688) +++ projects/building-blocks/etc/auto_master Wed Dec 10 20:44:51 2014 (r275689) @@ -3,3 +3,6 @@ # Automounter master map, see auto_master(5) for details. # /net -hosts -nobrowse,nosuid +# When using the -media special map, make sure to edit devd.conf(5) +# to move the call to "automount -c" out of the comments section. +#/media -media -nosuid Modified: projects/building-blocks/etc/autofs/Makefile ============================================================================== --- projects/building-blocks/etc/autofs/Makefile Wed Dec 10 20:43:17 2014 (r275688) +++ projects/building-blocks/etc/autofs/Makefile Wed Dec 10 20:44:51 2014 (r275689) @@ -1,6 +1,6 @@ # $FreeBSD$ -FILES= include_ldap special_hosts special_null +FILES= include_ldap special_hosts special_media special_null NO_OBJ= FILESDIR= /etc/autofs Copied: projects/building-blocks/etc/autofs/special_media (from r275688, head/etc/autofs/special_media) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/building-blocks/etc/autofs/special_media Wed Dec 10 20:44:51 2014 (r275689, copy of r275688, head/etc/autofs/special_media) @@ -0,0 +1,93 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# Print newline-separated list of devices available for mounting. +# If there is a filesystem label - use it, otherwise use device name. +print_available() { + local _fstype _fstype_and_label _label _p + + for _p in ${providers}; do + _fstype_and_label="$(fstyp -l "/dev/${_p}" 2> /dev/null)" + if [ $? -ne 0 ]; then + # Ignore devices for which we were unable + # to determine filesystem type. + continue + fi + + _fstype="${_fstype_and_label%% *}" + if [ "${_fstype}" != "${_fstype_and_label}" ]; then + _label="${_fstype_and_label#* }" + echo "${_label}" + continue + fi + + echo "${_p}" + done +} + +# Print a single map entry. +print_one() { + local _fstype _fstype_and_label _label _key _p + + _key="$1" + + _fstype="$(fstyp "/dev/${_key}" 2> /dev/null)" + if [ $? -eq 0 ]; then + echo "-fstype=${_fstype},nosuid :/dev/${_key}" + return + fi + + for _p in ${providers}; do + _fstype_and_label="$(fstyp -l "/dev/${_p}" 2> /dev/null)" + if [ $? -ne 0 ]; then + # Ignore devices for which we were unable + # to determine filesystem type. + continue + fi + + _fstype="${_fstype_and_label%% *}" + if [ "${_fstype}" = "${_fstype_and_label}" ]; then + # No label, try another device. + continue + fi + + _label="${_fstype_and_label#* }" + if [ "${_label}" != "${_key}" ]; then + # Labels don't match, try another device. + continue + fi + + echo "-fstype=${_fstype},nosuid :/dev/${_p}" + done + + # No matching device - don't print anything, autofs will handle it. +} + +# Obtain a list of (geom-provider-name, access-count) pairs, turning this: +# +# z0xfffff80005085d00 [shape=hexagon,label="ada0\nr2w2e3\nerr#0\nsector=512\nstripe=0"]; +# +# Into this: +# +# ada0 r2w2e3 +# +# XXX: It would be easier to use kern.geom.conftxt instead, but it lacks +# access counts. +pairs=$(sysctl kern.geom.confdot | sed -n 's/^.*hexagon,label="\([^\]*\)\\n\([^\]*\).*/\1 \2/p') + +# Obtain a list of GEOM providers that are not already open - not mounted, +# and without other GEOM class, such as gpart, attached. In other words, +# grep for "r0w0e0". Skip providers with names containing slashes; we're +# not interested in geom_label(4) creations. +providers=$(echo "$pairs" | awk '$2 == "r0w0e0" && $1 !~ /\// { print $1 }') + +if [ $# -eq 0 ]; then + print_available + exit 0 +fi + +print_one "$1" +exit 0 + Modified: projects/building-blocks/etc/devd.conf ============================================================================== --- projects/building-blocks/etc/devd.conf Wed Dec 10 20:43:17 2014 (r275688) +++ projects/building-blocks/etc/devd.conf Wed Dec 10 20:44:51 2014 (r275689) @@ -318,4 +318,16 @@ notify 0 { action "/usr/local/etc/rc.d/postgresql restart"; }; +# Discard autofs caches, useful for the -media special map. The one +# second delay is for GEOM to finish tasting. +# +# XXX: We should probably have a devctl(4) event that fires after GEOM +# tasting. +# +notify 100 { + match "system" "DEVFS"; + match "cdev" "(da|mmcsd)[0-9]+"; + action "sleep 1 && /usr/sbin/automount -c"; +}; + */ Modified: projects/building-blocks/lib/libc/net/sctp_sys_calls.c ============================================================================== --- projects/building-blocks/lib/libc/net/sctp_sys_calls.c Wed Dec 10 20:43:17 2014 (r275688) +++ projects/building-blocks/lib/libc/net/sctp_sys_calls.c Wed Dec 10 20:44:51 2014 (r275689) @@ -886,7 +886,7 @@ sctp_recvv(int sd, struct sctp_rcvinfo *rcvinfo; struct sctp_nxtinfo *nxtinfo; - if (((info != NULL) && (infolen == NULL)) | + if (((info != NULL) && (infolen == NULL)) || ((info == NULL) && (infolen != NULL) && (*infolen != 0)) || ((info != NULL) && (infotype == NULL))) { errno = EINVAL; Modified: projects/building-blocks/lib/libc/stdio/fflush.c ============================================================================== --- projects/building-blocks/lib/libc/stdio/fflush.c Wed Dec 10 20:43:17 2014 (r275688) +++ projects/building-blocks/lib/libc/stdio/fflush.c Wed Dec 10 20:44:51 2014 (r275689) @@ -124,11 +124,13 @@ __sflush(FILE *fp) t = _swrite(fp, (char *)p, n); if (t <= 0) { /* Reset _p and _w. */ - if (p > fp->_p) /* Some was written. */ + if (p > fp->_p) { + /* Some was written. */ memmove(fp->_p, p, n); - fp->_p += n; - if ((fp->_flags & (__SLBF | __SNBF)) == 0) - fp->_w -= n; + fp->_p += n; + if ((fp->_flags & (__SLBF | __SNBF)) == 0) + fp->_w -= n; + } fp->_flags |= __SERR; return (EOF); } Modified: projects/building-blocks/sbin/mount/mount.8 ============================================================================== --- projects/building-blocks/sbin/mount/mount.8 Wed Dec 10 20:43:17 2014 (r275688) +++ projects/building-blocks/sbin/mount/mount.8 Wed Dec 10 20:44:51 2014 (r275689) @@ -28,7 +28,7 @@ .\" @(#)mount.8 8.8 (Berkeley) 6/16/94 .\" $FreeBSD$ .\" -.Dd November 22, 2014 +.Dd December 3, 2014 .Dt MOUNT 8 .Os .Sh NAME @@ -549,6 +549,7 @@ support for a particular file system mig .Xr fstab 5 , .Xr procfs 5 , .Xr automount 8 , +.Xr fstyp 8 , .Xr kldload 8 , .Xr mount_cd9660 8 , .Xr mount_msdosfs 8 , Modified: projects/building-blocks/share/termcap/Makefile ============================================================================== --- projects/building-blocks/share/termcap/Makefile Wed Dec 10 20:43:17 2014 (r275688) +++ projects/building-blocks/share/termcap/Makefile Wed Dec 10 20:44:51 2014 (r275689) @@ -9,10 +9,7 @@ MAN= termcap.5 FILES= termcap termcap.db FILESDIR= ${BINDIR}/misc -CLEANFILES+= termcap termcap.db - -termcap: reorder termcap.src - TERM=dumb TERMCAP=dumb: ex - ${.CURDIR}/termcap.src < ${.CURDIR}/reorder +CLEANFILES+= termcap.db .include .if ${TARGET_ENDIANNESS} == "1234" Modified: projects/building-blocks/share/termcap/README ============================================================================== --- projects/building-blocks/share/termcap/README Wed Dec 10 20:43:17 2014 (r275688) +++ projects/building-blocks/share/termcap/README Wed Dec 10 20:44:51 2014 (r275689) @@ -1,4 +1,6 @@ # @(#)README 8.1 (Berkeley) 6/8/93 +# +# $FreeBSD$ << 12 May 1983 >> To install this directory on your system: @@ -19,7 +21,7 @@ common and really should go near the fro Third, if you are not a super user and cannot create the directory /usr/lib/tabset, make a corresponding directory somewhere you can and add a line to reorder to globally change all /usr/lib/tabset's to your own -path name. This change is better than just changing the termcap.src file +path name. This change is better than just changing the termcap file because it makes it easier to diff it from newer distributed versions. Try to keep the source as is whenever possible, and put mungings into reorder. Copied: projects/building-blocks/share/termcap/termcap (from r275688, head/share/termcap/termcap) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/building-blocks/share/termcap/termcap Wed Dec 10 20:44:51 2014 (r275689, copy of r275688, head/share/termcap/termcap) @@ -0,0 +1,4667 @@ +# Copyright (c) 1980, 1985, 1989, 1993 +# The Regents of the University of California. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. All advertising materials mentioning features or use of this software +# must display the following acknowledgement: +# This product includes software developed by the University of +# California, Berkeley and its contributors. +# 4. Neither the name of the University nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# @(#)termcap.src 8.2 (Berkeley) 11/17/93 +# $FreeBSD$ + +# Termcap source file +# John Kunze, Berkeley +# Craig Leres, Berkeley +# +# Please submit changes via https://bugs.freebsd.org/submit/ +# +# << EOH - after reordering, above header lines survive and this line dies >> +# +# DESCRIPTION: +# This file describes capabilities of various terminals, as needed by +# software such as screen editors. It does not attempt to describe +# printing terminals very well, nor graphics terminals. Someday. +# See termcap(5) in the Unix Programmers Manual for documentation. +# +# Conventions: First entry is canonical name for model or mode, last entry +# is verbose description. Others are mnemonic synonyms for the terminal. +# +# Terminal naming conventions: +# Terminal names look like - +# Certain abbreviations (e.g. c100 for concept100) are also allowed +# for upward compatibility. The part to the left of the dash, if a +# dash is present, describes the particular hardware of the terminal. +# The part to the right can be used for flags indicating special ROM's, +# extra memory, particular terminal modes, or user preferences. +# All names should be in lower case, for consistency in typing. +# +# The following are conventionally used flags: +# rv Terminal in reverse video mode (black on white) +# 2p Has two pages of memory. Likewise 4p, 8p, etc. +# w Wide - in 132 column mode. +# pp Has a printer port which is used. +# na No arrow keys - termcap ignores arrow keys which are +# actually there on the terminal, so the user can use +# the arrow keys locally. +# +# To easily test a new terminal description, put it in $HOME/.termcap +# and programs will look there before looking in /etc/termcap. +# You can also setenv TERMPATH to a list of full pathnames (separated +# by spaces or colons) to be searched by tgetent() in the order listed. +# The TERMCAP environment variable is usually set to the termcap +# entry itself to avoid reading files when starting up a program. +# +# If you absolutely MUST check for a specific terminal (this is discouraged) +# check for the 2nd entry (the canonical form) since all other codes are +# subject to change. We would much rather put in special capabilities +# to describe your terminal than have you key on the name. +# +# Special manufacturer codes: +# A: hardcopy daisy wheel terminals +# M: Misc. (with only a few terminals) +# q: Homemade +# s: special (dialup, etc.) +# +# Comments in this file begin with # - they cannot appear in the middle +# of a termcap entry. Individual entries are commented out by +# placing a period between the colon and the capability name. +# +# To add a termcap entry under FreeBSD for a new terminal type, insert +# the entry in the appropriate location in /etc/termcap then issue this +# command: +# +# cap_mkdb -f /usr/share/misc/termcap /etc/termcap +# +# Terminfo source entries can be converted to termcap entries with the +# tic program that is part of the ncurses distribution, see the ports +# section. +# +# +# This file is to be installed with an editor script (reorder) +# that moves the most common terminals to the front of the file. +# # -------------------------------- +# +# A: DAISY WHEEL PRINTERS +# +# The A manufacturer represents Diablo, DTC, Xerox, Qume, and other Daisy +# wheel terminals until such time as termcap distinguishes between them +# enough to justify separate codes. +# This is an "experimental" entry for the SRI Agiles. +# It has been tried in a minimal way -- the Agile did not blow up! +# However, it has not been exhaustively tested. +# Anyone who tries it and finds it wanting should get in touch with: +# Ralph Keirstead (ralph@sri-unix); +# EK352; SRI International; 333 Ravenswood Avenue; Menlo Park, CA 94025 +agile|agiles|sri agiles:\ + :bs:hc:os:pl:co#132:do=^J:kb=^H:up=\E\n:\ + :hu=\E0:hd=\E9:if=/usr/share/tabset/std:is=\EE\EF\EJ: +1620|1720|450|ipsi|diablo 1620:\ + :do=^J:ct=\E2:st=\E1:ch=\E\t%i%.:\ + :if=/usr/share/tabset/xerox1720:\ + :kb=^H:le=^H:bs:co#132:hc:hu=\EU:hd=\ED:os:pt:up=\E\n: +1620-m8|1640-m8|diablo 1620 w/8 column left margin:\ + :do=^J:co#124:is=\r \E9:tc=1620: +1640|1740|630|1730|x1700|diablo|xerox|diablo 1640:\ + :if=/usr/share/tabset/xerox1730:\ + :us=\EE:ue=\ER:so=\EW:se=\E&:tc=1620: +1640-lm|1740-lm|630-lm|1730-lm|x1700-lm|diablo-lm|xerox-lm|\ + diablo 1640 with indented left margin:\ + :if=/usr/share/tabset/xerox1730-lm:\ + :co#124:us=\EE:ue=\ER:so=\EW:se=\E&:tc=1620: +# DTC 382 with VDU. Has no cd so we fake it with ce. Standout works but +# won't go away without dynamite. The terminal has tabs, but I'm getting +# tired of fighting the braindamage. If no tab is set or the terminal's +# in a bad mood, it glitches the screen around all of memory. Note that +# return puts a blank ("a return character") in the space the cursor was +# at, so we use ^P return (and thus ^P newline for newline). Note also +# that if you turn off pt and let Unix expand tabs, curses won't work +# (current version) because it doesn't turn off this bit, and cursor +# addressing sends a tab for row/column 9. What a losing terminal! I +# have been unable to get tabs set in all 96 lines - it always leaves at +# least one line with no tabs in it, and once you tab through that line, +# it completely weirds out. +dtc|ps|dtc382|382:\ + :do=^J:al=^P^Z:am:le=^H:\ + :bs:co#80:ce=^P^U:cl=20^P^]:cm=%r^P^Q%.%.:dc=^X:\ + :dl=^P^S:ei=^Pi:ho=^P^R:im=^PI:ve=^Pb:vs=^PB:pc=\177:te=20^P^]:\ + :li#24:nd=^PR:.se=^P \200:.so=^P \002^PF:us=^P \020:ue=^P \200:\ + :up=^P^L:nc:xr:xs:da:db:.pt:cr=^P^M:cd=^P^U^P^S^P^S:\ + :if=/usr/share/tabset/dtc382: +dtc300s|300|300s|dtc 300s:\ + :ct=\E3:st=\E1:do=^J:\ + :kb=^h:le=^H:bs:co#132:hc:hu=\EH:hd=\Eh:os:pt:up=^Z: +gsi:\ + :le=^H:bs:co#132:hc:hd=\Eh:hu=\EH:os:pt:up=^Z:do=^J: +# This used to have :pl: - maybe they meant :pt:? +aj830|aj832|aj|anderson jacobson:\ + :do=^J:le=^H:bs:hc:hd=\E9:hu=\E8:os:up=\E7: +# From Chris Torek Thu, 7 Nov 85 18:21:58 EST +aj510|AJ510|Anderson-Jacobson model 510:\ + :ip=.1*:so=\E"I:us=\E"U:cd=\E'P:ce=\E'L:cl=^L:cm=\E#%+ %+ :\ + :dl=2*\E&D:ue=\E"U:co#80:li#24:se=\E"I:al=2*\E&I:im=\E'I:ei=\E'J:\ + :dc=.1*\E'D:up=\EY:nd=\EX:bs:am:mi:ti=\E"N:te=\E"N:\ + :ku=\EY:kd=\EZ:kl=\EW:kr=\EX:pc=\177: +# From cbosg!ucbvax!pur-ee!cincy!chris Thu Aug 20 09:09:18 1981 +# This is incomplete, but it's a start. +5520|nec|spinwriter|nec 5520:\ + :ct=\E3:st=\E1:do=^J:kb=^h:le=^H:bs:co#132:hc:hu=\E]s\E9\E]W:\ + :hd=\E]s\n\E]W:os:pt:up=\E9: +qume5|qume|Qume Sprint 5:\ + :ct=\E3:st=\E1:do=^J:\ + :kb=^h:le=^H:bs:co#80:hc:hu=\EH:hd=\Eh:os:pt:up=^Z: +q102|qume102|Qume 102:\ + :al=\EE:am:bs:bt=\EI:\ + :cd=\EY:ce=\ET:cl=^Z:cm=\E=%+ %+ :co#80:ct=\E3:\ + :dc=\EW:dl=\ER:do=^J:ho=^^:ic=\EQ:\ + :k0=^A@\r:k1=^AA\r:k2=^AB\r:k3=^AC\r:kd=^J:kl=^H:kr=^L:ku=^K:\ + :le=^H:li#24:ma=^K^P^L :nd=^L:\ + :se=\EG0:sg#1:so=\EG4:st=\E1:\ + :ue=\EG0:ug#1:up=^K:us=\EG8: +# From ucbvax!mtxinu!sybase!tim (Tim Wood) Fri Sep 27 10:25:24 PDT 1985 +# This entry supports line and character insert and delete, scroll up and +# down and the arrow keys. To use it, perform the following on your qvt-101 +# 1) enter SET-UP mode, select the SET 3 line; +# 2) move the cursor to the EMULATION item and hit SPACE +# until QVT-101B appears +# 3) enter SHIFT-S +# 4) exit SET-UP - the terminal is now configured +q101|qvt101|qvt-101|Qume 101 $310 special:\ + :al=\EE:am:bt=\EI:ce=\Et:cl=\E*:dc=\EW:\ + :dl=\ER:do=^J:ic=\EQ:md=\E(:me=\EG0:mh=\E):\ + :le=^H:bs:cm=\E=%+ %+ :cl=1^Z:co#80:ho=^^:li#24:ma=^K^P:nd=^L:ku=^K:\ + :vs=\EM4\040\200\200\200:mr=\EG4:ms:so=\EG4:se=\EG1: +# I suspect the xerox1720 is the same as the diablo 1620. +x1720|1700|x1750|xerox 1720:\ + :co#132:le=^H:bs:hc:os:pt:do=^J:ct=\E2:st=\E1: +# # -------------------------------- +# +# B: AT&T ATT +# +# AT&T Teletype 5410 Terminal (a.k.a. 4410) +# From: carvalho%kepler@Berkeley.EDU (Marcio de Carvalho) +# Date: Thu, 26 Feb 87 09:16:50 PST +# +# Although the 5410 supports labels, it blanks the screen after +# each label is programmed creating to much visual activity. +# To use the labels, use FL=\E[%d;00q%-16s +# +5410|4410|tty5410|att4410|AT&T Teletype 5410 terminal with 80 columns:\ + :al=\E[L:am:bs:cd=\E[J:ce=\E[K:cl=\E[H\E[J:\ + :cm=5\E[%i%2;%2H:co#80:dc=\E[P:dl=\E[M:ic=\E[@:\ + :kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:\ + :li#24:nd=\E[C:se=\E[m:so=\E[2;7m:sr=\EM:\ + :ue=\E[m:up=\E[A:us=\E[4m:EE=\E[m:BO=\E[0;7m:DS=\E[2m:\ + :KM=/usr/lib/ua/kmap.5410:is=\E[0m^O\E[?6l:kn#8:\ + :k1=\EOc:k2=\EOd:k3=\EOe:k4=\EOf:k4=\EOg:k6=\EOh:\ + :k7=\EOi:k8=\EOj:ko=nd,up,ho: +# AT&T 630 MTG DMD from muller%sdcc7@ucsd.edu (Keith Muller) +att630|dmd630|ATT630|630DMD|630dmd|630MTG|AT&T 630 windowing terminal:\ + :am:da:db:ms:bs:co#80:it#8:li#60:lm#0:\ + :up=\E[A:do=\E[B:nd=\E[C:le=\b:UP=\E[%dA:DO=\E[%dB:RI=\E[%dC:\ + :LE=\E[%dD:cm=\E[%i%d;%dH:ho=\E[H:bt=\E[Z:\ + :sf=\n:sr=\EM:SF=\E[%dS:SR=\E[%dT:us=\E[4m:ue=\E[m:so=\E[7m:se=\E[m:\ + :mr=\E[7m:mh=\E[2m:mb=\E[5m:me=\E[m:ce=\E[K:cd=\E[J:cl=\E[H\E[J:\ + :dc=\E[P:dl=\E[M:al=\E[L:DC=\E[%dP:DL=\E[%dM:AL=\E[%dL:\ + :ic=\E[@:IC=\E[%d@:sc=\E7:rc=\E8:i2=\E[m:rs=\Ec:\ + :pf=\E[?4i:po=\E[?5i:\ + :kb=\b:kC=\E[2J:kh=\E[H:ku=\E[A:kd=\E[B:kr=\E[C:kl=\E[D: +dmd630-24|att630-24|ATT630-24|630DMD-24|630MTG-24|AT&T 630 windowing terminal 24 lines:\ + :li#24:tc=att630: +dmd615|att615|ATT615|615DMD|615MTG|AT&T 615 windowing terminal 80 column:\ + :li#24:tc=att630: +dmd615-w|att615-w|ATT615-w|615DMD-w|615MTG-w|AT&T 615 windowing terminal 132 column:\ + :li#24:co#132:tc=att630: +dmd620|att620|ATT620|620DMD|620MTG|AT&T 620 windowing terminal 80 column:\ + :li#24:tc=att630: +dmd620-w|att620-w|ATT620-w|620DMD-w|620MTG-w|AT&T 620 windowing terminal 132 column:\ + :li#24:co#132:tc=att630: +# AT&T Teletype 5420 Terminal (a.k.a. 4415) June 5, 1985 +5420|4415|tty5420|att4415|AT&T Teletype 5420 terminal:\ + :al=\E[L:am:bs:cd=\E[J:ce=\E[K:cl=\E[H\E[J:\ + :cm=\E[%i%2;%2H:co#80:dc=\E[P:dl=\E[M:im=\E[4h:ei=\E[4l:\ + :kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:\ + :li#24:nd=\E[C:se=\E[m:so=\E[2;7m:sr=\EM:\ + :ue=\E[m:up=\E[A:us=\E[4m:EE=\E[m:BO=\E[0;7m:DS=\E[2m:\ + :KM=/usr/lib/ua/kmap.5420:\ + :is=\E[0m^O\E[1;2;3;4;6l\E[12;13;14;20l\E[?6;97;99l\E[?7h\E[4i\Ex\E[25;1j\212\E[8;0j\E[9;0j\E[10;0j\E[19;1j:\ + :db:mi:pt:kn#8:k1=\EOc:k2=\EOd:k3=\EOe:k4=\EOf:k5=\EOg:k6=\EOh:\ + :k7=\EOi:k8=\EOj:ve=\E[11;0j:\ + :vs=\E[11;1j:ko=bt,nd,up,dc,dl,ho,im,al: +# AT&T Teletype 5425 Terminal (a.k.a 4425) June 5, 1985 +5425|4425|tty5425|att4425|AT&T Teletype 5425:\ + :FL=\E[%d;00q%-16s\E~:FE=\E|:KM=/usr/lib/ua/kmap.5425:\ + :is=\E[0m^O\E[1;2;3;4;6l\E[12;13;14;20l\E[?6l\E[?7h\E[4i\E[9;0j\E[10;0j\E[11;0j\E[21;1j\E[25;1j\212:\ + :ve=\E[12;0j:vs=\E[12;1j:tc=5420: +t4|4420|tty4420|Teletype 4420:\ + :vs=\ER:ve=\ER:am:da:db:mi:cr=\EG:\ + :nl=\EG\EB:li#23:\ + :co#80:cl=\EH\EJ:cd=\EJ:cm=\EY%+ %+ :\ + :bs:up=\E7:do=\EB:nd=\EC:al=\EL:\ + :dl=\EM:dc=\EP:ic=\E\136:sf=\EH\EM\EY5 :sr=\ET:kb=^H: +pc6300plus|6300|6300plus:\ + :al=\E[1L:am:bs:cd=\E[0J:ce=\E[0K:cl=\E[2J\E[H:cm=\E[%i%2;%2H:co#80:\ + :dc=\E[1P:dl=\E[1M:do=\E[B:ho=\E[H:\ + :ic=\E[1@:kb=\10:kd=\E[B:kl=\E[D:kr=\E[C:ku=\E[A:li#24:\ + :k1=\EOc:k2=\EOd:k3=\EOe:k4=\EOf:k5=\EOg:k6=\EOh:k7=\EOi:k8=\EOj:\ + :k9=\EOk:k10=\EOu:nd=\E[C:se=\E[m:so=\E[7m:ue=\E[m:up=\E[A:us=\E[4m:\ + :EE=\E[m:BO=\E[0;7m:CV=\E[=C:CI=\E[=1C:KM=/usr/lib/ua/kmap.s5: +# AT&T 6386 decompiled and hacked from SVR3.1 terminfo +# From: caron@polya.Stanford.EDU (Ilan G. Caron) +# Problems: (1) The mode lines are screwed up - they're not in standout +# (an extraneous ESC-RD sequence is prepended to each mode line). +# (2) Cursor addressing into the mode line is often off-by-one, +# in particular, when the percentage indicator is updated. +# (3) When reverting to a single window (C-x 1), the display +# needs refreshing (an extraneous ESC-S seems to be generated). +# (The above 3 might be manifestations of the same problem). +# (4) Deletes sometime don't, especially when done fast - does this +# suggest that I need to pad something? +AT386|at386|386AT|386at|at/386 console:\ + :am:bw:eo:xo:Co#8:NC#3:co#80:li#25:pa#64:kn#6:\ + :@7=\E[Y:AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:\ + :F1=\EOZ:F2=\EOA:IC=\E[%d@:LE=\E[%dD:RI=\E[%dC:\ + :SF=\E[%dS:SR=\E[%dT:UP=\E[%dA:\ + :ac=``a1fxgqh0jYk?lZm@nEooppqDrrsstCu4vAwBx3yyzz{{||}}~~:\ + :ae=\E[10m:al=\E[1L:as=\E[12m:bl=^G:cd=\E[J:ce=\E[K:\ + :cl=\E[2J\E[H:cm=\E[%i%2;%2H:cr=\r:dc=\E[P:dl=\E[1M:\ + :do=\E[B:ho=\E[H:ic=\E[1@:is=\E[0;10;39m:k1=\EOP:\ + :k2=\EOQ:k3=\EOR:k4=\EOS:k5=\EOT:k6=\EOU:k7=\EOV:\ + :k8=\EOW:k9=\EOX:k;=\EOY:kB=^]:kC=\E[2J:kD=\E[P:\ + :kI=\E[@:kM=\E0:kN=\E[U:kP=\E[V:kb=\b:kd=\E[B:kh=\E[H:\ + :kl=\E[D:kr=\E[C:ku=\E[A:le=\E[D:mb=\E[5m:md=\E[1m:\ + :me=\E[0;10m:mk=\E[9m:mr=\E[7m:nd=\E[C:op=\E[0m:\ + :se=\E[m:sf=\E[S:so=\E[43;30m:ta=\t:ue=\E[m:up=\E[A:\ + :sr=\E[T:TC=\E[%d@:IC=\E[%d@:\ + :us=\E[4m:vb=^G:bc=\E[D: +s4|PC7300|unixpc|pc7300|7300|3b1|Safari 4:\ + :so=\E[2;7m:DS=\E[2m:XS=\E[9m:KM=/usr/lib/ua/kmap.s4:tc=pc6300plus: +# AT&T Teletype 610 Terminal +b610|610|610bct|tty610:\ + :CV=\E[25h:CI=\E[25l:KM=/usr/lib/ua/kmap.s4:\ + :FL=\E[%d;00q%-16s\E[0p:FE=\E[2p:cl=\E[1;1H\E[J:\ + :is=\E[0m^O\E[25;1|^J\E[8;0|\E[4;13;20l\E[?5l\E[12h\E[?7h\E[?4i:\ + :ve=\E[?12l:vs=\E[?12h:tc=5420: +# # -------------------------------- +# +# C: CONTROL DATA +# +cdc456|cdc:\ + :do=^J:li#24:co#80:cl=^Y^X:nd=^L:up=^Z:le=^H:bs:\ + :cm=\E1%+ %+ :ho=^Y:al=\E\114:dl=\E\112:ce=^V:cd=^X:am: +cdc456tst:\ + :do=^J:li#24:co#80:cl=^y^x:le=^H:bs:cm=\E1%+ %+ :am: +# # -------------------------------- +# +# D: DATAMEDIA +# +dm1520|dm1521|1521|1520|datamedia 1520:\ + :do=^J:am:le=^H:bs:cd=^K:ce=^]:cl=^L:cm=^^%r%+ %+ :co#80:ho=^Y:\ + :ku=^_:kd=^J:kl=^H:kr=^\:kh=^Y:\ + :li#24:nd=^\:up=^_:xn:ma=^\ ^_^P^YH:pt: +dm2500|datamedia2500|2500|datamedia 2500:\ + :do=^J:al=15^P\n^X^]^X^]:le=^H:bs:ce=^W:cl=^^^^\177:\ + :cm=^L%r%n%.%.:co#80:dc=10*^P\b^X^]:dl=10*^P^Z^X^]:\ + :dm=^P:ed=^X^]:ei=10\377\377^X^]:ho=^B:ic=10*^P^\^X^]:\ + :im=^P:li#24:nc:nd=^\:pc=\377:so@=^N:se=^X^]:up=^Z: +dm3025|datamedia 3025a:\ + :MT:is=\EQ\EU\EV:do=^J:\ + :al=130\EP\n\EQ:le=^H:bs:cd=2\EJ:ce=\EK:cl=2\EM:cm=\EY%r%+ %+ :\ + :co#80:dc=6\b:dl=130\EP\EA\EQ:dm=\EP:ed=\EQ:ei=\EQ:ho=\EH:\ + :im=\EP:ip=6:li#24:nd=\EC:pt:so=\EO1:se=\EO0:up=\EA: +3045|dm3045|datamedia 3045a:\ + :is=\EU\EV:do=^J:\ + :am:le=^H:bs:cd=2\EJ:ce=\EK:cl=2\EM:cm=\EY%r%+ %+ :co#80:\ + :dc=6\EB:ei=\EP:ho=\EH:im=\EP:ip=6:\ + :k0=\Ey\r:k1=\Ep\r:k2=\Eq\r:k3=\Er\r:k4=\Es\r:\ + :k5=\Et\r:k6=\Eu\r:k7=\Ev\r:k8=\Ew\r:k9=\Ex\r:\ + :kh=\EH:ku=\EA:kr=\EC:li#24:nd=\EC:pc=\177:pt:eo:ul:up=\EA:xn: +# dt80/1 is a vt100 lookalike, but it doesn't seem to need any padding. +dt80|dmdt80|dm80|datamedia dt80/1:\ + :do=^J:cd=\E[J:ce=\E[K:cl=\E[2J\E[H:cm=%i\E[%d;%dH:ho=\E[H:\ + :nd=\E[C:sr=\EM:so=\E[7m:se=\E[m:up=\E[A:us=\E[4m:ue=\E[m:tc=vt100: +# except in 132 column mode, where it needs a little padding. +# This is still less padding than the vt100, and you can always turn on +# the ^S/^Q handshaking, so you can use vt100 flavors for things like +# reverse video. +dt80w|dmdt80w|dm80w|datamedia dt80/1 in 132 char mode:\ + :do=^J:cd=20\E[0J:co#132:ce=20\E[0K:\ + :cm=5\E[%i%d;%dH:cl=50\E[H\E[2J:up=5\E[A:tc=dmdt80: +# # -------------------------------- +# +# H: HAZELTINE +# +# Since nd is blank, when you want to erase something you +# are out of luck. You will have to do ^L's a lot to +# redraw the screen. h1000 is untested. It doesn't work in +# vi - this terminal is too dumb for even vi. (The code is +# there but it isn't debugged for this case.) +h1000|hazeltine 1000:\ + :le=^H:bs:ho=^K:cl=^L:nd= :co#80:li#12:do=^J: +# Note: the h1552 appears to be the first Hazeltine terminal which +# is not braindamaged. It has tildes and backprimes and everything! +# Be sure the auto lf/cr switch is set to cr. +h1552|hazeltine 1552:\ + :do=^J:al=\EE:dl=\EO:k1=\EP:l1=blue:k2=\EQ:\ + :l2=red:k3=\ER:l3=green:tc=vt52: +h1552rv|hazeltine 1552 reverse video:\ + :do=^J:so=\ES:se=\ET:tc=h1552: +# From cbosg!ucbvax!pur-ee!cincy!chris Thu Aug 20 09:09:18 1981 +h1420|hazeltine 1420:\ + :do=^J:le=^H:bs:am:li#24:co#80:al=\E^Z:dl=\E^S:cd=\E^X:cl=\E\034:\ + :up=\E^L:nd=^P:ce=\E^O:ta=^N:cm=\E^Q%r%.%+ :so=\E\037:se=\E^Y: +# New "safe" cursor movement (11/87) from cgs@umd5. Prevents freakout with +# out-of-range args and tn3270. No hz since it needs to receive ~'s. +h1500|hazeltine 1500:\ + :al=40~^Z:am:bs:cd=10~^X:ce=~^O:cl=~^\:cm=~^Q%r%>^^ %+`%+`:\ + :co#80:dl=40~^S:do=~^K:ho=~^R:kh=~^R:kr=^P:ku=~^L:kd=^J:kl=^H:\ + :le=^H:li#24:nd=^P:so=~^_:se=~^Y:up=~^L:.cm=~^Q%r%.%.: +# h1510 assumed to be in sane escape mode. Else use h1500. +h1510|hazeltine 1510:\ + :do=^J:al=\E^Z:am:le=^H:bs:cd=\E^X:ce=\E^O:cl=\E^\:cm=\E^Q%r%.%.:\ + :co#80:dl=\E^S:do=\E^K:hz:li#24:nd=^P:.se=\E^_:.so=\E^Y:up=\E^L: +h1520|hazeltine 1520:\ + :do=^J:al=~^Z:am:le=^H:bs:cd=~^X:ce=~^O:cl=~\034:cm=~^Q%r%.%.\200:\ + :co#80:dl=~^S:do=~^K:hz:li#24:nd=^P:se=~^Y:so=~\037:up=~^L:ho=~^R: +# Note: h2000 won't work well because of a clash between upper case and ~'s. +h2000|hazeltine 2000:\ + :do=^J:al=6~^z:am:le=^H:bs:cl=6~^\:cm=~^q%r%.%.:co#74:\ + :dl=6~^s:ho=~^r:li#27:nc:pc=\177: +# Hazeltine esprit entries from Univ of Utah Tue Feb 1 06:39:37 1983 +# J.Lepreau, lepreau@utah-cs, harpo!utah-cs!lepreau +esprit|hazeltine esprit:\ + :al=40\E^Z:bs:cd=5\E^X:ce=\E^O:cl=\E^\:cm=\E^Q%r%>^^ %+`%+`:co#80:\ + :dl=40\E^S:do=\E^K:ho=\E^R:li#24:nd=^P:se=\E^Y:so=\E^_:up=\E^L: +esprit-am|hazeltine esprit auto-margin:\ + :am:tc=esprit: +# # -------------------------------- +# +# I: IBM +# +# ibm61 and ibm63 from Warren Gish (cswarren@violet.berkeley.edu). +# installed 12-17-86. +# 3161 only opens a new line if a null line exists on the screen. +# To ensure a null line exists, an SBA is performed, positioning the +# Buffer Address in column 0 of the last line. The last line is then +# cleared to nulls, BA mode is canceled, and the new line is opened +# at the cursor position. +ibm61|ibm3161|3161|IBM 3161-11:\ + :am:bs:bw:cl=\EL:li#24:co#80:cd=\EJ:al=\EX7 \EI\E Z\EN:\ + :ce=\EI:cm=\EY%+\040%+\040:nd=\EC:up=\EA:do=\EB:\ + :dl=\EO:dc=\EQ:kd=\EB:ku=\EA:kl=\ED:kr=\EC:kh=\EH:\ + :us=\E4\102:ue=\E4\100:so=\E4\110:se=\E4\100: +# From seth@sirius.ctr.columbia.edu Sun May 20 11:02:34 1990 +ibm3163|ibm63|i3163|3163|IBM 3163:\ + :al=\EN:am:bs:bt=\E2:cd=\EJ:ce=\EI:cl=\EL:\ + :cm=\EY%+\040%+\040:co#80:ct=\E 1:dc=\EQ:\ + :dl=\EO:do=\EB:ds=\E#\072:es:fs=\E=:ho=\EH:\ + :hs:ic=\EP:kA=\EN:kB=\E2:kC=\EQ:\ + :kD=\EQ:kE=\EI:kI=\EI:kL=\EO:kS=\EJ:\ + :kb=^H:kd=\EB:kl=\ED:kr=\EC:ku=\EA:kh=\EH:\ + :le=\ED:li#24:mb=\E4D:md=\E4H:me=\E4@:\ + :mk=\E4P:mr=\E4A:nd=\EC:\ + :ds=\E#\::es:fs=\E=\E#;:hs:ts=\E=:ws#80:\ + :se=\E4@:so=\E4I:ue=\E4@:up=\EA:us=\E4B: +ibm|ibm3101|3101|i3101|IBM 3101-10:\ + :do=^J:ct=\EH:st=\E0:\ + :if=/usr/share/tabset/ibm3101:\ + :am:le=^H:bs:cl=\EK:li#24:co#80:nd=\EC:up=\EA:cd=\EJ:ce=\EI:\ + :kd=\EB:kl=\ED:kr=\EC:ku=\EA:ho=\EH:cm=\EY%+\40%+\40:pt: +ibm327-789|ibm-3277-2|ibm-3278-2|ibm-3278-3|ibm-3278-4|ibm-3278-5|ibm-3279-2|ibm-3279-3:\ + :tc=ibm327-56: +ibm327-56|ibm-3275-2|ibm-3276-2|ibm-3276-3|ibm-3276-4|line mode IBM 3270 style:\ + :gn:ce=\r:cl=\r\n:ho=\r: +ibm-apl|apl|IBM apl terminal simulator:\ + :li#25:tc=dm1520: +# ibmapa* and ibmmono entries come from ACIS 4.3 distribution +rtpc|ibmapa16|ibm6155|IBM 6155 Extended Monochrome Graphics Display:\ + :ts=\Ej\EY@%+ \Eo:ds=\Ej\EY@\40\EI\Ek:li#32:tc=ibmconsole: +# Advanced Monochrome (6153) and Color (6154) Graphics Display: +ibmapa8c|ibmapa8|ibm6154|ibm6153|IBM 6153/4 Advanced Graphics Display:\ + :ts=\Ej\EY?%+ \Eo:ds=\Ej\EY?\40\EI\Ek:li#31:tc=ibmconsole: +ibmapa8c-c|ibm6154-c|IBM 6154 Advanced Color Graphics Display color termcap:\ + :ts=\Ej\EY?%+ \Eo:ds=\Ej\EY?\40\EI\Ek:li#31:mh=\EF\Ef7;:tc=ibmega-c: +ibmmono|ibmconsole|ibm5151|IBM workstation monochrome:\ + :se=\Ez:so=\EZ:sr=\EA:al=\EL:dl=\EM:\ + :kb=^H:us=\EW:ue=\Ew:\ + :k1=\ES:k2=\ET:k3=\EU:k4=\EV:k5=\EW:k6=\EP:k7=\EQ:k8=\ER:k9=\EY:\ + :k0=\E<:I0=f10:kI=\000:kh=\EH:kR=\EG:kP=\Eg:kF=\EE:kN=\EE:\ + :md=\EZ:me=\Ew\Eq\Ez\EB:mk=\EF\Ef0;\Eb0;:mr=\Ep:\ + :ts=\Ej\EY8%+ \Eo:fs=\Ek:ds=\Ej\EY8\40\EI\Ek:es:hs:sb:tc=ibm3101: +ibmega-c|ibm5154-c|IBM Enhanced Color Display color termcap:\ + :se=\EB:so=\EF\Ef3;:ue=\EB:us=\EF\Ef2;:tc=ibmconsole: +# from marc pawliger--marc@ibminet.awdpa.ibm.com +# also in /usr/lpp/bos/bsdsysadmin. +hft-c|ibm8512|ibm8513|IBM High Function Terminal:\ + :co#80:li#25:am:ht:\ + :cm=\E[%i%d;%dH:ti=\E[20;4l\E[?7h\Eb:te=\E[20h:\ + :nd=\E[C:up=\E[A:do=^J:ho=\E[H:\ + :ec=\E[%dX:\ + :cl=\E[H\E[J:cd=\E[J:el=\E[K:\ + :AL=\E[%dL:DL=\E[%dM:al=\E[L:dl=\E[M:\ + :im=\E[4h:ei=\E[4l:mi:\ + :dm=\E[4h:ed=\E[4l:\ + :so=\E[7m:se=\E[m:ul=\E[4m:ue=\E[m:ms:\ + :md=\E[1m:mr=\E[7m:mb=\E[5m:me=\E[m:\ + :as=^N:ae=^O:sc=\E[s:rc=\E[u:\ + :kb=\E[D:kf=\E[C:ku=\E[A:kd=\E[B:kh=\E[H:\ + :k1=\E[001q:k2=\E[002q:k3=\E[003q:k4=\E[004q:k5=\E[005q:\ + :k6=\E[006q:k7=\E[007q:k8=\E[008q:k9=\E[009q:k0=\E[010q:\ + :is=\Eb\E[m^O\E[?7h:rs=\Eb\E[m^O\E[?7h\E[H\E[J: +hft|AIWS High Function Terminal:\ + :al=\E[L:cr=^M:do=^J:sf=^J:bl=^G:am:le=^H:cd=\E[J:\ + :ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:co#80:li#25:\ + :dc=\E[P:dl=\E[M:ho=\E[H:\ + :ic=\E[@:im=\E6:ei=\E6:\ + :md=\E[1m:mr=\E[7m:mb=\E[5m:mk=\E[8m:me=\E[0m:\ + :ku=\E[A:kd=\E[B:kl=\E[D:kr=\E[C:kh=\E[H:kb=^H:\ + :nd=\E[C:ta=^I:up=\E[A:xo:\ + :ue=\E[m:us=\E[4m:se=\E[m:so=\E[7m:\ + :kP=\E[159q:kN=\E[153q:\ + :k1=\E[001q:k2=\E[002q:k3=\E[003q:k4=\E[004q:\ + :k5=\E[005q:k6=\E[006q:k7=\E[007q:k8=\E[008q:\ + :k9=\E[009q:ka=\E[010q: +# From pryor@math.berkeley.edu *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Wed Dec 10 21:03:08 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DB9EAA70; Wed, 10 Dec 2014 21:03:08 +0000 (UTC) Received: from h2.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "funkthat.com", Issuer "funkthat.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 9594C289; Wed, 10 Dec 2014 21:03:08 +0000 (UTC) Received: from h2.funkthat.com (localhost [127.0.0.1]) by h2.funkthat.com (8.14.3/8.14.3) with ESMTP id sBAL370M019255 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 10 Dec 2014 13:03:07 -0800 (PST) (envelope-from jmg@h2.funkthat.com) Received: (from jmg@localhost) by h2.funkthat.com (8.14.3/8.14.3/Submit) id sBAL37B0019254; Wed, 10 Dec 2014 13:03:07 -0800 (PST) (envelope-from jmg) Date: Wed, 10 Dec 2014 13:03:07 -0800 From: John-Mark Gurney To: Mark Peek Subject: Re: svn commit: r275601 - projects/building-blocks Message-ID: <20141210210307.GX25139@funkthat.com> References: <201412080743.sB87h3j9044019@svn.freebsd.org> <1418054094.1064.147.camel@revolution.hippie.lan> <5485D8B5.90604@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5485D8B5.90604@FreeBSD.org> User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 7.2-RELEASE i386 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-TipJar: bitcoin:13Qmb6AeTgQecazTWph4XasEsP7nGRbAPE X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.2 (h2.funkthat.com [127.0.0.1]); Wed, 10 Dec 2014 13:03:07 -0800 (PST) Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org, Garrett Cooper , Ian Lepore X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2014 21:03:09 -0000 Mark Peek wrote this message on Mon, Dec 08, 2014 at 08:58 -0800: > On 12/8/14 7:54 AM, Ian Lepore wrote: > >On Mon, 2014-12-08 at 07:43 +0000, Garrett Cooper wrote: > >>Author: ngie > >>Date: Mon Dec 8 07:43:02 2014 > >>New Revision: 275601 > >>URL: https://svnweb.freebsd.org/changeset/base/275601 > >> > >>Log: > >> - Document why usr.bin/vi needs to be built as part of bootstrap-tools > >> ...snip... > > > >Is there any chance someone who understands vi could evaluate what it's > >being used for and perhaps eliminate it? I know just enough about vi to > >get out of it if I accidentally get in. > > > >When I looked into this a few days ago it appears to be using it to sort > >the data before compiling (an optimization that problably hasn't been > >important to do since the 90s). Could another existing build tool such > >as awk do the job? > > My reading of that code agrees with yours in that it is using 'ex' to > prioritize some terminal entries in the termcap file. However, it is then > hashed into a berkeleydb via cap_mkdb which should render the initial > prioritization useless. Rather than rewriting it I would suggest completely > removing the reordering and the ex dependency. There was some dicussion about removing some of the various databases, and having commonly used entries at the top would help in this case.. -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." From owner-svn-src-projects@FreeBSD.ORG Wed Dec 10 21:19:14 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CA697CD7; Wed, 10 Dec 2014 21:19:14 +0000 (UTC) Received: from mail-pa0-x22b.google.com (mail-pa0-x22b.google.com [IPv6:2607:f8b0:400e:c03::22b]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 902023E7; Wed, 10 Dec 2014 21:19:14 +0000 (UTC) Received: by mail-pa0-f43.google.com with SMTP id kx10so3589501pab.30 for ; Wed, 10 Dec 2014 13:19:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :message-id:references:to; bh=TfFUww4YaZT6B0FuTtT3ns3k6b5Omw2nGfnC+4GUuHo=; b=v1WmtD5DeDBiR1Vw2k0hVNh0cJV8ZPoPsQBXlsEYS75VbijH7LVAqhLZe7Dx9dQicx uXUdghceAWGym4TYIM87bnLy+gaHE3WQB/mpAWFW2z8royUy5Atd974ymlxc3Xu2e3wo mcT0vbGozVuYDfVcxrK+VBcihPPxDZtgIvfJasjc7OeZzv1Q8pFnf1/jNuqAq43h+oPD Ok2uL9OOWRnPGhtVMuNHrc4Zxkc1r2kAD+r5xJgQrVQynnSjo/sVnDJhMjpsgACLjqn9 BYdbzr7fqkb9lo1XrU5utO1yK0uvUrmHsZL++clMfb5S5kEWV6vqTrZ+5QE0zW6uvw0u tXzQ== X-Received: by 10.70.33.106 with SMTP id q10mr10759319pdi.120.1418246354111; Wed, 10 Dec 2014 13:19:14 -0800 (PST) Received: from [192.168.242.58] (c-67-182-131-225.hsd1.wa.comcast.net. [67.182.131.225]) by mx.google.com with ESMTPSA id oy7sm4979630pbc.88.2014.12.10.13.19.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 10 Dec 2014 13:19:13 -0800 (PST) Content-Type: multipart/signed; boundary="Apple-Mail=_5C7FD595-2BE0-4D56-9967-021EF5C907DB"; protocol="application/pgp-signature"; micalg=pgp-sha512 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r275601 - projects/building-blocks From: Garrett Cooper In-Reply-To: <20141210210307.GX25139@funkthat.com> Date: Wed, 10 Dec 2014 13:19:10 -0800 Message-Id: References: <201412080743.sB87h3j9044019@svn.freebsd.org> <1418054094.1064.147.camel@revolution.hippie.lan> <5485D8B5.90604@FreeBSD.org> <20141210210307.GX25139@funkthat.com> To: John-Mark Gurney X-Mailer: Apple Mail (2.1878.6) Cc: Mark Peek , svn-src-projects@freebsd.org, src-committers@freebsd.org, Garrett Cooper , Ian Lepore X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2014 21:19:14 -0000 --Apple-Mail=_5C7FD595-2BE0-4D56-9967-021EF5C907DB Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 On Dec 10, 2014, at 13:03, John-Mark Gurney wrote: > Mark Peek wrote this message on Mon, Dec 08, 2014 at 08:58 -0800: >> On 12/8/14 7:54 AM, Ian Lepore wrote: >>> On Mon, 2014-12-08 at 07:43 +0000, Garrett Cooper wrote: >>>> Author: ngie >>>> Date: Mon Dec 8 07:43:02 2014 >>>> New Revision: 275601 >>>> URL: https://svnweb.freebsd.org/changeset/base/275601 >>>>=20 >>>> Log: >>>> - Document why usr.bin/vi needs to be built as part of = bootstrap-tools >>>> ...snip... >>>=20 >>> Is there any chance someone who understands vi could evaluate what = it's >>> being used for and perhaps eliminate it? I know just enough about = vi to >>> get out of it if I accidentally get in. >>>=20 >>> When I looked into this a few days ago it appears to be using it to = sort >>> the data before compiling (an optimization that problably hasn't = been >>> important to do since the 90s). Could another existing build tool = such >>> as awk do the job? >>=20 >> My reading of that code agrees with yours in that it is using 'ex' to=20= >> prioritize some terminal entries in the termcap file. However, it is = then=20 >> hashed into a berkeleydb via cap_mkdb which should render the initial=20= >> prioritization useless. Rather than rewriting it I would suggest = completely=20 >> removing the reordering and the ex dependency. >=20 > There was some dicussion about removing some of the various databases, > and having commonly used entries at the top would help in this case.. I was looking at Fedora 20=92s termcap just the other day, and I was = surprised at the brevity in the file (only a couple entries for = =93xterm=94). They also have it split into multiple files instead of = just one file too (/usr/share/vte/termcap-0.0/xterm). Maybe this would = be a good move going forward (or not=85???)? Why should the .db files be removed? I think reducing the bloat from the = files due to overestimated bucket sizes would be a good first start = instead of just removing them altogether (I noticed that termcap.db has = the same bloat problem services.db has). Thanks! --Apple-Mail=_5C7FD595-2BE0-4D56-9967-021EF5C907DB Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQEcBAEBCgAGBQJUiLjOAAoJEMZr5QU6S73eBdUIAI6M8Pp9cO6j4W9JVgHSLoV3 JrDR+fgsiwVMpx1xLCaF/9rVcd4ITE/e7MJAX0rowubaMMM148ZCrwORY4WU9zPt mOfRhEBq8LZ4CWmOyfj7lRbyWcyB3N997JcS2Q5j6za9XwXbRcRksFCJq429fJZZ 4x9Q2BBT4w3o6FTNheN0/kFr8dDJLqY3FHn2xFN4krzJMCDZnIOQnzPgkmEV04II 6s6kBeFgzc6lXfkEHUGABdTwUwE1llVTeOq4JzH0J9Vkl/g9QaS45IrZFpcOph5q fYwOFxH+35FraFN9jNOc17h9XXTWViNbYbd0v33RctqLxQd2n3seb2rMGlxhaF0= =w2aU -----END PGP SIGNATURE----- --Apple-Mail=_5C7FD595-2BE0-4D56-9967-021EF5C907DB-- From owner-svn-src-projects@FreeBSD.ORG Wed Dec 10 21:56:38 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C49869E7 for ; Wed, 10 Dec 2014 21:56:38 +0000 (UTC) Received: from relay00.pair.com (relay00.pair.com [209.68.5.9]) by mx1.freebsd.org (Postfix) with SMTP id 5895EA49 for ; Wed, 10 Dec 2014 21:56:37 +0000 (UTC) Received: (qmail 64827 invoked by uid 0); 10 Dec 2014 21:56:31 -0000 Received: from 70.35.46.82 (HELO ?192.168.128.65?) (70.35.46.82) by relay00.pair.com with SMTP; 10 Dec 2014 21:56:31 -0000 X-pair-Authenticated: 70.35.46.82 Message-ID: <5488C18D.2020502@FreeBSD.org> Date: Wed, 10 Dec 2014 13:56:29 -0800 From: Mark Peek User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Garrett Cooper , John-Mark Gurney Subject: Re: svn commit: r275601 - projects/building-blocks References: <201412080743.sB87h3j9044019@svn.freebsd.org> <1418054094.1064.147.camel@revolution.hippie.lan> <5485D8B5.90604@FreeBSD.org> <20141210210307.GX25139@funkthat.com> In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org, Garrett Cooper , Ian Lepore X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2014 21:56:39 -0000 On 12/10/14 1:19 PM, Garrett Cooper wrote: > On Dec 10, 2014, at 13:03, John-Mark Gurney wrote: > >> Mark Peek wrote this message on Mon, Dec 08, 2014 at 08:58 -0800: >>> On 12/8/14 7:54 AM, Ian Lepore wrote: >>>> On Mon, 2014-12-08 at 07:43 +0000, Garrett Cooper wrote: >>>>> Author: ngie >>>>> Date: Mon Dec 8 07:43:02 2014 >>>>> New Revision: 275601 >>>>> URL: https://svnweb.freebsd.org/changeset/base/275601 >>>>> >>>>> Log: >>>>> - Document why usr.bin/vi needs to be built as part of bootstrap-tools >>>>> ...snip... >>>> >>>> Is there any chance someone who understands vi could evaluate what it's >>>> being used for and perhaps eliminate it? I know just enough about vi to >>>> get out of it if I accidentally get in. >>>> >>>> When I looked into this a few days ago it appears to be using it to sort >>>> the data before compiling (an optimization that problably hasn't been >>>> important to do since the 90s). Could another existing build tool such >>>> as awk do the job? >>> >>> My reading of that code agrees with yours in that it is using 'ex' to >>> prioritize some terminal entries in the termcap file. However, it is then >>> hashed into a berkeleydb via cap_mkdb which should render the initial >>> prioritization useless. Rather than rewriting it I would suggest completely >>> removing the reordering and the ex dependency. >> >> There was some dicussion about removing some of the various databases, >> and having commonly used entries at the top would help in this case.. > > I was looking at Fedora 20’s termcap just the other day, and I was surprised at the brevity in the file (only a couple entries for “xterm”). They also have it split into multiple files instead of just one file too (/usr/share/vte/termcap-0.0/xterm). Maybe this would be a good move going forward (or not…???)? > > Why should the .db files be removed? I think reducing the bloat from the files due to overestimated bucket sizes would be a good first start instead of just removing them altogether (I noticed that termcap.db has the same bloat problem services.db has). Taking a step back, which problem are we trying to solve? I see: 1. remove a vi (ex) dependency from the bootstrap-tools 2. termcap is too big and should be minimized 3. remove the use of .db files Both #2 and #3 seem to need more thought, discussion and debate before implementing them. #1 can be easily accomplished without any loss of functionality given we are currently using .db files and don't require the reorder step during the bootstrap. #2 and #3 can then be solved independent of #1 while allowing for a more streamlined bootstrap phase. Also, there is etc/termcap.small in the system should there need to be one and the larger termcap could become a port. Mark From owner-svn-src-projects@FreeBSD.ORG Wed Dec 10 22:33:58 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 077A18CB; Wed, 10 Dec 2014 22:33:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E83B2E47; Wed, 10 Dec 2014 22:33:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBAMXvrd062728; Wed, 10 Dec 2014 22:33:57 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBAMXviM062727; Wed, 10 Dec 2014 22:33:57 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201412102233.sBAMXviM062727@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 10 Dec 2014 22:33:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r275691 - projects/clang350-import/share/mk X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2014 22:33:58 -0000 Author: dim Date: Wed Dec 10 22:33:57 2014 New Revision: 275691 URL: https://svnweb.freebsd.org/changeset/base/275691 Log: Since clang 3.5.0 and later must be built by a compiler with C++11 support, make this explicit in src.opts.mk, by updating the default settings. The defaults become as follows: * If the host compiler is not C++11 capable, use gcc and disable clang. * On x86, enable clang, make it the default cc, and disable gcc. * On little-endian ARM, enable clang, but not the full build, make it the default cc, and disable gcc. * On PowerPC, enable clang, but enable gcc and make that the default cc. * On everything else, use gcc, and disable clang. This can be amended later, if we get e.g. sparc64 or big-endian ARM working with clang. Reviewed by: imp, brooks Differential Revision: https://reviews.freebsd.org/D1294 Modified: projects/clang350-import/share/mk/src.opts.mk Modified: projects/clang350-import/share/mk/src.opts.mk ============================================================================== --- projects/clang350-import/share/mk/src.opts.mk Wed Dec 10 20:54:23 2014 (r275690) +++ projects/clang350-import/share/mk/src.opts.mk Wed Dec 10 22:33:57 2014 (r275691) @@ -191,25 +191,29 @@ __TT=${TARGET} .else __TT=${MACHINE} .endif -# Clang is only for x86, powerpc and little-endian arm right now, by default. -.if ${__T} == "amd64" || ${__T} == "i386" || ${__T:Mpowerpc*} -__DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL CLANG_BOOTSTRAP -.elif ${__TT} == "arm" && ${__T:Marm*eb*} == "" -__DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP -# GCC is unable to build the full clang on arm, disable it by default. -__DEFAULT_NO_OPTIONS+=CLANG_FULL -.else -__DEFAULT_NO_OPTIONS+=CLANG CLANG_FULL CLANG_BOOTSTRAP -.endif -# Clang the default system compiler only on little-endian arm and x86. -.if ${__T} == "amd64" || (${__TT} == "arm" && ${__T:Marm*eb*} == "") || \ - ${__T} == "i386" -__DEFAULT_YES_OPTIONS+=CLANG_IS_CC + +.include +.if !${COMPILER_FEATURES:Mc++11} +# If the compiler is not C++11 capable, disable clang and use gcc instead. +__DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX +__DEFAULT_NO_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC +.elif ${__T} == "amd64" || ${__T} == "i386" +# On x86, clang is enabled, and will be installed as the default cc. +__DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC __DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX +.elif ${__TT} == "arm" && ${__T:Marm*eb*} == "" +# On little-endian arm, clang is enabled, and it is installed as the default +# cc, but since gcc is unable to build the full clang, disable it by default. +__DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_IS_CC +__DEFAULT_NO_OPTIONS+=CLANG_FULL GCC GCC_BOOTSTRAP GNUCXX +.elif ${__T:Mpowerpc*} +# On powerpc, clang is enabled, but gcc is installed as the default cc. +__DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL GCC GCC_BOOTSTRAP GNUCXX +__DEFAULT_NO_OPTIONS+=CLANG_BOOTSTRAP CLANG_IS_CC .else -# If clang is not cc, then build gcc by default -__DEFAULT_NO_OPTIONS+=CLANG_IS_CC CLANG CLANG_BOOTSTRAP +# Everything else disables clang, and uses gcc instead. __DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX +__DEFAULT_NO_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC .endif .include @@ -217,7 +221,6 @@ __DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP # # MK_* options that default to "yes" if the compiler is a C++11 compiler. # -.include .for var in \ LIBCPLUSPLUS .if !defined(MK_${var}) From owner-svn-src-projects@FreeBSD.ORG Wed Dec 10 22:54:50 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9E18BEA for ; Wed, 10 Dec 2014 22:54:50 +0000 (UTC) Received: from mail-pa0-x234.google.com (mail-pa0-x234.google.com [IPv6:2607:f8b0:400e:c03::234]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5E1317D for ; Wed, 10 Dec 2014 22:54:50 +0000 (UTC) Received: by mail-pa0-f52.google.com with SMTP id eu11so3685400pac.25 for ; Wed, 10 Dec 2014 14:54:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netflix.com; s=google; h=from:content-type:mime-version:subject:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=UWBLWxNMJsD8cVe4/6SEnmZCFLc025OFQLX/puwQXVs=; b=fMczt+mbch6NpTCU57PDmQiw2IQQ8xzp3Y5aJRj+jOuWbgKdI1/D8j/JrgeoywIvrR /fUWpDzjmg3Fv70uIb6mPhZ0IG/oSTj4tTHsGwPqYMm+sK/NEhdTKQKLznAXOVpZlKUt BMJUyEzXemL49Bja4uLCr/2nsMR0zAK7X0FtM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:content-type:mime-version:subject :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to; bh=UWBLWxNMJsD8cVe4/6SEnmZCFLc025OFQLX/puwQXVs=; b=MjeWPL5pzAJSeXZQwguhB82BKLWPIIm6gU+F8wMqa0o6oG9MhFmfTVaqz1rjKYzv// hXor8nNfZmM7a4hlXvj38IY+TOzBpu+OC74+6ksCD+OahOtePjprriFPOnD92fy1QZxa vP0FfxG7KIvdNWJUyaqn9JYZCesDBl85GGOY24tAXvBGkRt7FiC/nOalhQzdk+IoRut0 l/7ybEpuk78mmDoPacZXcP3wEZor7xsEKIc7eUIQfkCB+x6/5vq8bdja3iWQ2M3dcIFu v2o4bMn+iH2MdZqOM3TMiOU7FeVUiVI+vk+QXYYqqpIMr4F9fooIPYrSM2L7c1P65OmV p1oA== X-Gm-Message-State: ALoCoQl/y94gV7qT0l01+evRxMPnjGEIbUsX/Kf3L8YowH8dx6Lx34/smf/fnjs3ZVWYSQCIhe5r X-Received: by 10.70.98.233 with SMTP id el9mr11536629pdb.132.1418252089844; Wed, 10 Dec 2014 14:54:49 -0800 (PST) Received: from lgmac-vviswanat.corp.netflix.com ([69.53.236.236]) by mx.google.com with ESMTPSA id td4sm5132557pbc.36.2014.12.10.14.54.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 10 Dec 2014 14:54:49 -0800 (PST) From: Warner Losh X-Google-Original-From: Warner Losh Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) Subject: Re: svn commit: r275601 - projects/building-blocks In-Reply-To: <5488C18D.2020502@FreeBSD.org> Date: Wed, 10 Dec 2014 14:54:47 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: <81CD2798-E2EC-4D2F-A204-EE24CDB1B164@gmail.com> References: <201412080743.sB87h3j9044019@svn.freebsd.org> <1418054094.1064.147.camel@revolution.hippie.lan> <5485D8B5.90604@FreeBSD.org> <20141210210307.GX25139@funkthat.com> <5488C18D.2020502@FreeBSD.org> To: Mark Peek X-Mailer: Apple Mail (2.1993) Cc: src-committers@freebsd.org, Ian Lepore , John-Mark Gurney , Garrett Cooper , svn-src-projects@freebsd.org, Garrett Cooper X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2014 22:54:50 -0000 > On Dec 10, 2014, at 1:56 PM, Mark Peek wrote: >=20 > On 12/10/14 1:19 PM, Garrett Cooper wrote: >> On Dec 10, 2014, at 13:03, John-Mark Gurney wrote: >>=20 >>> Mark Peek wrote this message on Mon, Dec 08, 2014 at 08:58 -0800: >>>> On 12/8/14 7:54 AM, Ian Lepore wrote: >>>>> On Mon, 2014-12-08 at 07:43 +0000, Garrett Cooper wrote: >>>>>> Author: ngie >>>>>> Date: Mon Dec 8 07:43:02 2014 >>>>>> New Revision: 275601 >>>>>> URL: https://svnweb.freebsd.org/changeset/base/275601 >>>>>>=20 >>>>>> Log: >>>>>> - Document why usr.bin/vi needs to be built as part of = bootstrap-tools >>>>>> ...snip... >>>>>=20 >>>>> Is there any chance someone who understands vi could evaluate what = it's >>>>> being used for and perhaps eliminate it? I know just enough about = vi to >>>>> get out of it if I accidentally get in. >>>>>=20 >>>>> When I looked into this a few days ago it appears to be using it = to sort >>>>> the data before compiling (an optimization that problably hasn't = been >>>>> important to do since the 90s). Could another existing build tool = such >>>>> as awk do the job? >>>>=20 >>>> My reading of that code agrees with yours in that it is using 'ex' = to >>>> prioritize some terminal entries in the termcap file. However, it = is then >>>> hashed into a berkeleydb via cap_mkdb which should render the = initial >>>> prioritization useless. Rather than rewriting it I would suggest = completely >>>> removing the reordering and the ex dependency. >>>=20 >>> There was some dicussion about removing some of the various = databases, >>> and having commonly used entries at the top would help in this = case.. >>=20 >> I was looking at Fedora 20=92s termcap just the other day, and I was = surprised at the brevity in the file (only a couple entries for = =93xterm=94). They also have it split into multiple files instead of = just one file too (/usr/share/vte/termcap-0.0/xterm). Maybe this would = be a good move going forward (or not=85???)? >>=20 >> Why should the .db files be removed? I think reducing the bloat from = the files due to overestimated bucket sizes would be a good first start = instead of just removing them altogether (I noticed that termcap.db has = the same bloat problem services.db has). >=20 > Taking a step back, which problem are we trying to solve? I see: > 1. remove a vi (ex) dependency from the bootstrap-tools > 2. termcap is too big and should be minimized > 3. remove the use of .db files >=20 > Both #2 and #3 seem to need more thought, discussion and debate before = implementing them. #1 can be easily accomplished without any loss of = functionality given we are currently using .db files and don't require = the reorder step during the bootstrap. #2 and #3 can then be solved = independent of #1 while allowing for a more streamlined bootstrap phase. >=20 > Also, there is etc/termcap.small in the system should there need to be = one and the larger termcap could become a port. termcap is fine the way it is. termcap.small is there when you don=92t = want to use the .db files. With current disk sizes, the .db file bloat = is a total non-issue. If you cared about that, you=92d use = termcap.small. This calculus has been true for about a decade now and = the number of people that care about using termcap.small has been = declining=85 Nothing has really changed with this... Warner= From owner-svn-src-projects@FreeBSD.ORG Wed Dec 10 23:30:19 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4BCD790; Wed, 10 Dec 2014 23:30:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 390B961D; Wed, 10 Dec 2014 23:30:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBANUJcI089252; Wed, 10 Dec 2014 23:30:19 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBANUJw6089251; Wed, 10 Dec 2014 23:30:19 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201412102330.sBANUJw6089251@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Wed, 10 Dec 2014 23:30:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r275693 - projects/building-blocks/share/termcap X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2014 23:30:19 -0000 Author: ngie Date: Wed Dec 10 23:30:18 2014 New Revision: 275693 URL: https://svnweb.freebsd.org/changeset/base/275693 Log: MFhead @ r275692 Modified: projects/building-blocks/share/termcap/Makefile Directory Properties: projects/building-blocks/ (props changed) projects/building-blocks/share/ (props changed) Modified: projects/building-blocks/share/termcap/Makefile ============================================================================== --- projects/building-blocks/share/termcap/Makefile Wed Dec 10 23:18:11 2014 (r275692) +++ projects/building-blocks/share/termcap/Makefile Wed Dec 10 23:30:18 2014 (r275693) @@ -21,7 +21,7 @@ CAP_MKDB_ENDIAN= .endif termcap.db: termcap - cap_mkdb ${CAP_MKDB_ENDIAN} termcap + cap_mkdb ${CAP_MKDB_ENDIAN} -f ${.TARGET:R} ${.ALLSRC} etc-termcap: ln -fs ${BINDIR}/misc/termcap ${DESTDIR}/etc/termcap From owner-svn-src-projects@FreeBSD.ORG Thu Dec 11 19:27:33 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9D2EA463; Thu, 11 Dec 2014 19:27:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8588C1E0; Thu, 11 Dec 2014 19:27:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBBJRXuS022060; Thu, 11 Dec 2014 19:27:33 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBBJRSjw022033; Thu, 11 Dec 2014 19:27:28 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201412111927.sBBJRSjw022033@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 11 Dec 2014 19:27:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r275717 - in projects/clang350-import: contrib/file contrib/file/doc contrib/file/magic contrib/file/magic/Magdir contrib/file/python contrib/file/src contrib/file/tests lib/libmagic sh... X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Dec 2014 19:27:33 -0000 Author: dim Date: Thu Dec 11 19:27:27 2014 New Revision: 275717 URL: https://svnweb.freebsd.org/changeset/base/275717 Log: Merge ^/head r275685 through r275714. Added: projects/clang350-import/contrib/file/magic/Magdir/kerberos - copied unchanged from r275714, head/contrib/file/magic/Magdir/kerberos projects/clang350-import/contrib/file/magic/Magdir/meteorological - copied unchanged from r275714, head/contrib/file/magic/Magdir/meteorological projects/clang350-import/share/termcap/termcap - copied unchanged from r275714, head/share/termcap/termcap Deleted: projects/clang350-import/contrib/file/magic/Magdir/rinex projects/clang350-import/share/termcap/reorder projects/clang350-import/share/termcap/termcap.src Modified: projects/clang350-import/contrib/file/ChangeLog projects/clang350-import/contrib/file/Makefile.in projects/clang350-import/contrib/file/TODO projects/clang350-import/contrib/file/aclocal.m4 projects/clang350-import/contrib/file/config.h.in projects/clang350-import/contrib/file/configure projects/clang350-import/contrib/file/configure.ac projects/clang350-import/contrib/file/doc/Makefile.in projects/clang350-import/contrib/file/doc/file.man projects/clang350-import/contrib/file/doc/libmagic.man projects/clang350-import/contrib/file/magic/Localstuff projects/clang350-import/contrib/file/magic/Magdir/android projects/clang350-import/contrib/file/magic/Magdir/animation projects/clang350-import/contrib/file/magic/Magdir/archive projects/clang350-import/contrib/file/magic/Magdir/blender projects/clang350-import/contrib/file/magic/Magdir/commands projects/clang350-import/contrib/file/magic/Magdir/compress projects/clang350-import/contrib/file/magic/Magdir/database projects/clang350-import/contrib/file/magic/Magdir/elf projects/clang350-import/contrib/file/magic/Magdir/filesystems projects/clang350-import/contrib/file/magic/Magdir/images projects/clang350-import/contrib/file/magic/Magdir/jpeg projects/clang350-import/contrib/file/magic/Magdir/linux projects/clang350-import/contrib/file/magic/Magdir/macintosh projects/clang350-import/contrib/file/magic/Magdir/msooxml projects/clang350-import/contrib/file/magic/Magdir/netbsd projects/clang350-import/contrib/file/magic/Magdir/pascal projects/clang350-import/contrib/file/magic/Magdir/pgp projects/clang350-import/contrib/file/magic/Magdir/python projects/clang350-import/contrib/file/magic/Magdir/riff projects/clang350-import/contrib/file/magic/Magdir/sequent projects/clang350-import/contrib/file/magic/Magdir/sereal projects/clang350-import/contrib/file/magic/Magdir/ssh projects/clang350-import/contrib/file/magic/Magdir/vms projects/clang350-import/contrib/file/magic/Magdir/vorbis projects/clang350-import/contrib/file/magic/Magdir/windows projects/clang350-import/contrib/file/magic/Makefile.am projects/clang350-import/contrib/file/magic/Makefile.in projects/clang350-import/contrib/file/missing projects/clang350-import/contrib/file/python/Makefile.in projects/clang350-import/contrib/file/src/Makefile.in projects/clang350-import/contrib/file/src/apprentice.c projects/clang350-import/contrib/file/src/ascmagic.c projects/clang350-import/contrib/file/src/cdf.c projects/clang350-import/contrib/file/src/cdf.h projects/clang350-import/contrib/file/src/compress.c projects/clang350-import/contrib/file/src/elfclass.h projects/clang350-import/contrib/file/src/encoding.c projects/clang350-import/contrib/file/src/file.c projects/clang350-import/contrib/file/src/file.h projects/clang350-import/contrib/file/src/file_opts.h projects/clang350-import/contrib/file/src/fsmagic.c projects/clang350-import/contrib/file/src/funcs.c projects/clang350-import/contrib/file/src/getline.c projects/clang350-import/contrib/file/src/magic.c projects/clang350-import/contrib/file/src/magic.h projects/clang350-import/contrib/file/src/magic.h.in projects/clang350-import/contrib/file/src/pread.c projects/clang350-import/contrib/file/src/readcdf.c projects/clang350-import/contrib/file/src/readelf.c projects/clang350-import/contrib/file/src/softmagic.c projects/clang350-import/contrib/file/src/vasprintf.c projects/clang350-import/contrib/file/tests/Makefile.in projects/clang350-import/lib/libmagic/config.h projects/clang350-import/share/misc/committers-ports.dot projects/clang350-import/share/termcap/Makefile projects/clang350-import/share/termcap/README projects/clang350-import/sys/netinet/ip_input.c projects/clang350-import/sys/netinet/ip_ipsec.c projects/clang350-import/sys/netinet/ip_ipsec.h projects/clang350-import/sys/netinet/ip_output.c projects/clang350-import/sys/netinet6/ip6_forward.c projects/clang350-import/sys/netinet6/ip6_ipsec.c projects/clang350-import/sys/netinet6/ip6_ipsec.h projects/clang350-import/sys/netinet6/ip6_output.c projects/clang350-import/sys/netipsec/ipsec.c projects/clang350-import/sys/netipsec/ipsec.h projects/clang350-import/sys/netipsec/ipsec6.h projects/clang350-import/sys/netipsec/ipsec_input.c projects/clang350-import/sys/netipsec/ipsec_output.c projects/clang350-import/sys/netipsec/xform_ah.c projects/clang350-import/sys/netipsec/xform_esp.c projects/clang350-import/sys/netipsec/xform_ipcomp.c projects/clang350-import/sys/ofed/drivers/net/mlx4/en_cq.c projects/clang350-import/sys/powerpc/booke/trap.c projects/clang350-import/usr.sbin/bluetooth/bthidd/kbd.c Directory Properties: projects/clang350-import/ (props changed) projects/clang350-import/contrib/file/ (props changed) projects/clang350-import/share/ (props changed) projects/clang350-import/sys/ (props changed) Modified: projects/clang350-import/contrib/file/ChangeLog ============================================================================== --- projects/clang350-import/contrib/file/ChangeLog Thu Dec 11 19:20:13 2014 (r275716) +++ projects/clang350-import/contrib/file/ChangeLog Thu Dec 11 19:27:27 2014 (r275717) @@ -1,3 +1,69 @@ +2014-12-10 20:01 Christos Zoulas + + * release 5.21 + +2014-11-27 18:40 Christos Zoulas + + * Allow setting more parameters from the command line. + * Split name/use and indirect magic recursion limits. + +2014-11-27 11:12 Christos Zoulas + + * Adjust ELF parameters and the default recursion + level. + * Allow setting the recursion level dynamically. + +2014-11-24 8:55 Christos Zoulas + + * The following fixes resulted from Thomas Jarosch's fuzzing + tests that revealed severe performance issues on pathological + input: + - limit number of elf program and sections processing + - abort elf note processing quickly + - reduce the number of recursion levels from 20 to 10 + - preserve error messages in indirect magic handling + +2014-11-12 10:30 Christos Zoulas + + * fix bogus free in the user buffer case. + +2014-11-11 12:35 Christos Zoulas + + * fix out of bounds read for pascal strings + * fix memory leak (not freeing the head of each mlist) + +2014-11-07 10:25 Christos Zoulas + + * When printing strings from a file, convert them to printable + on a byte by byte basis, so that we don't get issues with + locale's trying to interpret random byte streams as UTF-8 and + having printf error out with EILSEQ. + +2014-10-17 11:48 Christos Zoulas + + * fix bounds in note reading (Francisco Alonso / Red Hat) + +2014-10-11 15:02 Christos Zoulas + + * fix autoconf glue for setlocale and locale_t; some OS's + have locale_t in xlocale.h + +2014-10-10 15:01 Christos Zoulas + + * release 5.20 + +2014-08-17 10:01 Christos Zoulas + + * recognize encrypted CDF documents + +2014-08-04 9:18 Christos Zoulas + + * add magic_load_buffers from Brooks Davis + +2014-07-24 16:40 Christos Zoulas + + * add thumbs.db support + 2014-06-12 12:28 Christos Zoulas * release 5.19 Modified: projects/clang350-import/contrib/file/Makefile.in ============================================================================== --- projects/clang350-import/contrib/file/Makefile.in Thu Dec 11 19:20:13 2014 (r275716) +++ projects/clang350-import/contrib/file/Makefile.in Thu Dec 11 19:27:27 2014 (r275717) @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.14 from Makefile.am. +# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. @@ -618,9 +618,10 @@ distcheck: dist && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ - && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + && ../configure \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ + --srcdir=.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ Modified: projects/clang350-import/contrib/file/TODO ============================================================================== --- projects/clang350-import/contrib/file/TODO Thu Dec 11 19:20:13 2014 (r275716) +++ projects/clang350-import/contrib/file/TODO Thu Dec 11 19:27:27 2014 (r275717) @@ -15,3 +15,5 @@ small amount of C is needed (because fas required for soft magic, not the more detailed information given by hard-wired routines). In this regard, note that hplip, which is BSD-licensed, has a magic reimplementation in Python. + +Read the kerberos magic entry for more ideas. Modified: projects/clang350-import/contrib/file/aclocal.m4 ============================================================================== --- projects/clang350-import/contrib/file/aclocal.m4 Thu Dec 11 19:20:13 2014 (r275716) +++ projects/clang350-import/contrib/file/aclocal.m4 Thu Dec 11 19:27:27 2014 (r275717) @@ -1,4 +1,4 @@ -# generated automatically by aclocal 1.14 -*- Autoconf -*- +# generated automatically by aclocal 1.14.1 -*- Autoconf -*- # Copyright (C) 1996-2013 Free Software Foundation, Inc. @@ -21,7 +21,7 @@ If you have problems, you may need to re To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # visibility.m4 serial 5 (gettext-0.18.2) -dnl Copyright (C) 2005, 2008, 2010-2013 Free Software Foundation, Inc. +dnl Copyright (C) 2005, 2008, 2010-2014 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -113,7 +113,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.14' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.14], [], +m4_if([$1], [1.14.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -129,7 +129,7 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.14])dnl +[AM_AUTOMAKE_VERSION([1.14.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) Modified: projects/clang350-import/contrib/file/config.h.in ============================================================================== --- projects/clang350-import/contrib/file/config.h.in Thu Dec 11 19:20:13 2014 (r275716) +++ projects/clang350-import/contrib/file/config.h.in Thu Dec 11 19:27:27 2014 (r275717) @@ -44,6 +44,9 @@ /* Define to 1 if you have the `fork' function. */ #undef HAVE_FORK +/* Define to 1 if you have the `freelocale' function. */ +#undef HAVE_FREELOCALE + /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ #undef HAVE_FSEEKO @@ -95,9 +98,15 @@ /* Define to 1 if you have a working `mmap' system call. */ #undef HAVE_MMAP +/* Define to 1 if you have the `newlocale' function. */ +#undef HAVE_NEWLOCALE + /* Define to 1 if you have the `pread' function. */ #undef HAVE_PREAD +/* Define to 1 if you have the `setlocale' function. */ +#undef HAVE_SETLOCALE + /* Define to 1 if you have the header file. */ #undef HAVE_STDDEF_H @@ -182,6 +191,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H +/* Define to 1 if you have the `uselocale' function. */ +#undef HAVE_USELOCALE + /* Define to 1 if you have the `utime' function. */ #undef HAVE_UTIME @@ -219,6 +231,9 @@ /* Define to 1 if `vfork' works. */ #undef HAVE_WORKING_VFORK +/* Define to 1 if you have the header file. */ +#undef HAVE_XLOCALE_H + /* Define to 1 if you have the header file. */ #undef HAVE_ZLIB_H Modified: projects/clang350-import/contrib/file/configure ============================================================================== --- projects/clang350-import/contrib/file/configure Thu Dec 11 19:20:13 2014 (r275716) +++ projects/clang350-import/contrib/file/configure Thu Dec 11 19:27:27 2014 (r275717) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for file 5.19. +# Generated by GNU Autoconf 2.69 for file 5.21. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='file' PACKAGE_TARNAME='file' -PACKAGE_VERSION='5.19' -PACKAGE_STRING='file 5.19' +PACKAGE_VERSION='5.21' +PACKAGE_STRING='file 5.21' PACKAGE_BUGREPORT='christos@astron.com' PACKAGE_URL='' @@ -1327,7 +1327,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures file 5.19 to adapt to many kinds of systems. +\`configure' configures file 5.21 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1397,7 +1397,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of file 5.19:";; + short | recursive ) echo "Configuration of file 5.21:";; esac cat <<\_ACEOF @@ -1507,7 +1507,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -file configure 5.19 +file configure 5.21 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2163,7 +2163,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by file $as_me 5.19, which was +It was created by file $as_me 5.21, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3029,7 +3029,7 @@ fi # Define the identity of the package. PACKAGE='file' - VERSION='5.19' + VERSION='5.21' cat >>confdefs.h <<_ACEOF @@ -12785,7 +12785,7 @@ fi done -for ac_header in getopt.h err.h +for ac_header in getopt.h err.h xlocale.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -14191,7 +14191,7 @@ fi fi -for ac_func in strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof +for ac_func in strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale setlocale do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -14998,7 +14998,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by file $as_me 5.19, which was +This file was extended by file $as_me 5.21, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15064,7 +15064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -file config.status 5.19 +file config.status 5.21 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Modified: projects/clang350-import/contrib/file/configure.ac ============================================================================== --- projects/clang350-import/contrib/file/configure.ac Thu Dec 11 19:20:13 2014 (r275716) +++ projects/clang350-import/contrib/file/configure.ac Thu Dec 11 19:27:27 2014 (r275717) @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT([file],[5.19],[christos@astron.com]) +AC_INIT([file],[5.21],[christos@astron.com]) AM_INIT_AUTOMAKE([subdir-objects foreign]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) @@ -82,7 +82,7 @@ AC_HEADER_MAJOR AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(stdint.h fcntl.h locale.h stdint.h inttypes.h unistd.h) AC_CHECK_HEADERS(stddef.h utime.h wchar.h wctype.h limits.h) -AC_CHECK_HEADERS(getopt.h err.h) +AC_CHECK_HEADERS(getopt.h err.h xlocale.h) AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h) AC_CHECK_HEADERS(zlib.h) @@ -138,7 +138,7 @@ else fi]) dnl Checks for functions -AC_CHECK_FUNCS(strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof) +AC_CHECK_FUNCS(strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale setlocale) dnl Provide implementation of some required functions if necessary AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline ctime_r asctime_r pread strcasestr fmtcheck) Modified: projects/clang350-import/contrib/file/doc/Makefile.in ============================================================================== --- projects/clang350-import/contrib/file/doc/Makefile.in Thu Dec 11 19:20:13 2014 (r275716) +++ projects/clang350-import/contrib/file/doc/Makefile.in Thu Dec 11 19:27:27 2014 (r275717) @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.14 from Makefile.am. +# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. Modified: projects/clang350-import/contrib/file/doc/file.man ============================================================================== --- projects/clang350-import/contrib/file/doc/file.man Thu Dec 11 19:20:13 2014 (r275716) +++ projects/clang350-import/contrib/file/doc/file.man Thu Dec 11 19:27:27 2014 (r275717) @@ -1,5 +1,5 @@ -.\" $File: file.man,v 1.106 2014/03/07 23:11:51 christos Exp $ -.Dd December 3, 2014 +.\" $File: file.man,v 1.110 2014/11/28 02:46:39 christos Exp $ +.Dd November 27, 2014 .Dt FILE __CSECTION__ .Os .Sh NAME @@ -16,6 +16,7 @@ .Op Fl F Ar separator .Op Fl f Ar namefile .Op Fl m Ar magicfiles +.Op Fl P Ar name=value .Ar .Ek .Nm @@ -303,6 +304,15 @@ or attempt to preserve the access time of files analyzed, to pretend that .Nm never read them. +.It Fl P , Fl Fl parameter Ar name=value +Set various parameter limits. +.Bl -column "elf_phnum" "Default" "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" -offset indent +.It Sy "Name" Ta Sy "Default" Ta Sy "Explanation" +.It Li indir Ta 15 Ta recursion limit for indirect magic +.It Li name Ta 30 Ta use count limit for name/use magic +.It Li elf_phnum Ta 128 Ta max ELF program sections processed +.It Li elf_shnum Ta 32768 Ta max ELF sections processed +.El .It Fl r , Fl Fl raw Don't translate unprintable characters to \eooo. Normally Modified: projects/clang350-import/contrib/file/doc/libmagic.man ============================================================================== --- projects/clang350-import/contrib/file/doc/libmagic.man Thu Dec 11 19:20:13 2014 (r275716) +++ projects/clang350-import/contrib/file/doc/libmagic.man Thu Dec 11 19:27:27 2014 (r275717) @@ -1,4 +1,4 @@ -.\" $File: libmagic.man,v 1.28 2014/03/02 14:47:16 christos Exp $ +.\" $File: libmagic.man,v 1.33 2014/11/28 02:46:39 christos Exp $ .\" .\" Copyright (c) Christos Zoulas 2003. .\" All Rights Reserved. @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd January 6, 2012 +.Dd November 27, 2014 .Dt LIBMAGIC 3 .Os .Sh NAME @@ -40,6 +40,9 @@ .Nm magic_compile , .Nm magic_list , .Nm magic_load , +.Nm magic_load_buffers , +.Nm magic_setparam , +.Nm magic_getparam , .Nm magic_version .Nd Magic number recognition library .Sh LIBRARY @@ -71,6 +74,12 @@ .Ft int .Fn magic_load "magic_t cookie" "const char *filename" .Ft int +.Fn magic_load_buffers "magic_t cookie" "void **buffers" "size_t *sizes" "size_t nbuffers" +.Ft int +.Fn magic_getparam "magic_t cookie" "int param" "void *value" +.Ft int +.Fn magic_setparam "magic_t cookie" "int param" "const void *value" +.Ft int .Fn magic_version "void" .Sh DESCRIPTION These functions @@ -253,6 +262,55 @@ adds to the database filename as appropriate. .Pp The +.Fn magic_load_buffers +function takes an array of size +.Fa nbuffers +of +.Fa buffers +with a respective size for each in the array of +.Fa sizes +loaded with the contents of the magic databases from the filesystem. +This function can be used in environment where the magic library does +not have direct access to the filesystem, but can access the magic +database via shared memory or other IPC means. +.Pp +The +.Fn magic_getparam +and +.Fn magic_setparam +allow getting and setting various limits related to the the magic +library. +.Bl -column "MAGIC_PARAM_ELF_PHNUM_MAX" "size_t" "Default" -offset indent +.It Sy "Parameter" Ta Sy "Type" Ta Sy "Default" +.It Li MAGIC_PARAM_INDIR_MAX Ta size_t Ta 15 +.It Li MAGIC_PARAM_NAME_MAX Ta size_t Ta 30 +.It Li MAGIC_PARAM_ELF_PHNUM_MAX Ta size_t Ta 128 +.It Li MAGIC_PARAM_ELF_SHNUM_MAX Ta size_t Ta 32768 +.El +.Pp +The +.Dv MAGIC_PARAM_INDIR_RECURSION +parameter controls how many levels of recursion will be followed for +indirect magic entries. +.Pp +The +.Dv MAGIC_PARAM_NAME_RECURSION +parameter controls how many levels of recursion will be followed for +for name/use calls. +.Pp +The +.Dv MAGIC_PARAM_NAME_MAX +parameter controls the maximum number of calls for name/use. +.Pp +The +.Dv MAGIC_PARAM_PHNUM_MAX +parameter controls how many elf program sections will be processed. +.Pp +The +.Dv MAGIC_PARAM_SHNUM_MAX +parameter controls how many elf sections will be processed. +.Pp +The .Fn magic_version command returns the version number of this library which is compiled into the shared library using the constant Modified: projects/clang350-import/contrib/file/magic/Localstuff ============================================================================== --- projects/clang350-import/contrib/file/magic/Localstuff Thu Dec 11 19:20:13 2014 (r275716) +++ projects/clang350-import/contrib/file/magic/Localstuff Thu Dec 11 19:27:27 2014 (r275717) @@ -2,6 +2,6 @@ #------------------------------------------------------------------------------ # Localstuff: file(1) magic for locally observed files # -# $File: Localstuff,v 1.4 2003/03/23 04:17:27 christos Exp $ +# $File: Localstuff,v 1.5 2007/01/12 17:38:27 christos Exp $ # Add any locally observed files here. Remember: # text if readable, executable if runnable binary, data if unreadable. Modified: projects/clang350-import/contrib/file/magic/Magdir/android ============================================================================== --- projects/clang350-import/contrib/file/magic/Magdir/android Thu Dec 11 19:20:13 2014 (r275716) +++ projects/clang350-import/contrib/file/magic/Magdir/android Thu Dec 11 19:27:27 2014 (r275717) @@ -1,6 +1,6 @@ #------------------------------------------------------------ -# $File: android,v 1.4 2014/06/03 19:01:34 christos Exp $ +# $File: android,v 1.7 2014/11/10 05:08:23 christos Exp $ # Various android related magic entries #------------------------------------------------------------ @@ -15,54 +15,11 @@ >0 regex dey\n[0-9]{2}\0 Dalvik dex file (optimized for host) >4 string >000 version %s -# http://android.stackexchange.com/questions/23357/\ -# is-there-a-way-to-look-inside-and-modify-an-adb-backup-created-file/\ -# 23608#23608 -0 string ANDROID\040BACKUP\n Android Backup ->15 string 1\n \b, version 1 ->17 string 0\n \b, uncompressed ->17 string 1\n \b, compressed ->19 string none\n \b, unencrypted ->19 string AES-256\n \b, encrypted AES-256 - -# Android bootimg format -# From https://android.googlesource.com/\ -# platform/system/core/+/master/mkbootimg/bootimg.h -0 string ANDROID! Android bootimg ->8 lelong >0 \b, kernel ->>12 lelong >0 \b (0x%x) ->16 lelong >0 \b, ramdisk ->>20 lelong >0 \b (0x%x) ->24 lelong >0 \b, second stage ->>28 lelong >0 \b (0x%x) ->36 lelong >0 \b, page size: %d ->38 string >0 \b, name: %s ->64 string >0 \b, cmdline (%s) -# Dalvik .dex format. http://retrodev.com/android/dexformat.html -# From "Mike Fleming" -# Fixed to avoid regexec 17 errors on some dex files -# From "Tim Strazzere" -0 string dex\n ->0 regex dex\n[0-9]{2}\0 Dalvik dex file ->4 string >000 version %s -0 string dey\n ->0 regex dey\n[0-9]{2}\0 Dalvik dex file (optimized for host) ->4 string >000 version %s - -# http://android.stackexchange.com/questions/23357/\ -# is-there-a-way-to-look-inside-and-modify-an-adb-backup-created-file/\ -# 23608#23608 -0 string ANDROID\040BACKUP\n Android Backup ->15 string 1\n \b, version 1 ->17 string 0\n \b, uncompressed ->17 string 1\n \b, compressed ->19 string none\n \b, unencrypted ->19 string AES-256\n \b, encrypted AES-256 - # Android bootimg format # From https://android.googlesource.com/\ # platform/system/core/+/master/mkbootimg/bootimg.h 0 string ANDROID! Android bootimg +>1024 string LOKI\01 \b, LOKI'd >8 lelong >0 \b, kernel >>12 lelong >0 \b (0x%x) >16 lelong >0 \b, ramdisk @@ -98,3 +55,85 @@ #>>>>>&1 regex/1l .* \b, PBKDF2 rounds: %s #>>>>>>&1 regex/1l .* \b, IV: %s #>>>>>>>&1 regex/1l .* \b, Key: %s + +# *.pit files by Joerg Jenderek +# http://forum.xda-developers.com/showthread.php?p=9122369 +# http://forum.xda-developers.com/showthread.php?t=816449 +# Partition Information Table for Samsung's smartphone with Android +# used by flash software Odin +0 ulelong 0x12349876 +# 1st pit entry marker +>0x01C ulequad&0xFFFFFFFCFFFFFFFC =0x0000000000000000 +# minimal 13 and maximal 18 PIT entries found +>>4 ulelong <128 Partition Information Table for Samsung smartphone +>>>4 ulelong x \b, %d entries +# 1. pit entry +>>>4 ulelong >0 \b; #1 +>>>0x01C use PIT-entry +>>>4 ulelong >1 \b; #2 +>>>0x0A0 use PIT-entry +>>>4 ulelong >2 \b; #3 +>>>0x124 use PIT-entry +>>>4 ulelong >3 \b; #4 +>>>0x1A8 use PIT-entry +>>>4 ulelong >4 \b; #5 +>>>0x22C use PIT-entry +>>>4 ulelong >5 \b; #6 +>>>0x2B0 use PIT-entry +>>>4 ulelong >6 \b; #7 +>>>0x334 use PIT-entry +>>>4 ulelong >7 \b; #8 +>>>0x3B8 use PIT-entry +>>>4 ulelong >8 \b; #9 +>>>0x43C use PIT-entry +>>>4 ulelong >9 \b; #10 +>>>0x4C0 use PIT-entry +>>>4 ulelong >10 \b; #11 +>>>0x544 use PIT-entry +>>>4 ulelong >11 \b; #12 +>>>0x5C8 use PIT-entry +>>>4 ulelong >12 \b; #13 +>>>>0x64C use PIT-entry +# 14. pit entry +>>>4 ulelong >13 \b; #14 +>>>>0x6D0 use PIT-entry +>>>4 ulelong >14 \b; #15 +>>>0x754 use PIT-entry +>>>4 ulelong >15 \b; #16 +>>>0x7D8 use PIT-entry +>>>4 ulelong >16 \b; #17 +>>>0x85C use PIT-entry +# 18. pit entry +>>>4 ulelong >17 \b; #18 +>>>0x8E0 use PIT-entry + +0 name PIT-entry +# garbage value implies end of pit entries +>0x00 ulequad&0xFFFFFFFCFFFFFFFC =0x0000000000000000 +# skip empty partition name +>>0x24 ubyte !0 +# partition name +>>>0x24 string >\0 %-.32s +# flags +>>>0x0C ulelong&0x00000002 2 \b+RW +# partition ID: +# 0~IPL,MOVINAND,GANG;1~PIT,GPT;2~HIDDEN;3~SBL,HIDDEN;4~SBL2,HIDDEN;5~BOOT;6~KENREl,RECOVER,misc;7~RECOVER +# ;11~MODEM;20~efs;21~PARAM;22~FACTORY,SYSTEM;23~DBDATAFS,USERDATA;24~CACHE;80~BOOTLOADER;81~TZSW +>>>0x08 ulelong x (0x%x) +# filename +>>>0x44 string >\0 "%-.64s" +#>>>0x18 ulelong >0 +# blocksize in 512 byte units ? +#>>>>0x18 ulelong x \b, %db +# partition size in blocks ? +#>>>>0x22 ulelong x \b*%d + +# Android bootimg format +# From https://android.googlesource.com/\ +# platform/system/core/+/master/libsparse/sparse_format.h +0 lelong 0xed26ff3a Android sparse image +>4 leshort x \b, version: %d +>6 leshort x \b.%d +>16 lelong x \b, Total of %d +>12 lelong x \b %d-byte output blocks in +>20 lelong x \b %d input chunks. Modified: projects/clang350-import/contrib/file/magic/Magdir/animation ============================================================================== --- projects/clang350-import/contrib/file/magic/Magdir/animation Thu Dec 11 19:20:13 2014 (r275716) +++ projects/clang350-import/contrib/file/magic/Magdir/animation Thu Dec 11 19:27:27 2014 (r275717) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: animation,v 1.53 2014/04/30 21:41:02 christos Exp $ +# $File: animation,v 1.56 2014/10/23 23:12:51 christos Exp $ # animation: file(1) magic for animation/movie formats # # animation formats @@ -32,43 +32,155 @@ !:mime application/x-quicktime-player 4 string/W jP JPEG 2000 image !:mime image/jp2 +# http://www.ftyps.com/ with local additions 4 string ftyp ISO Media ->8 string isom \b, MPEG v4 system, version 1 -!:mime video/mp4 ->8 string iso2 \b, MPEG v4 system, part 12 revision ->8 string mp41 \b, MPEG v4 system, version 1 -!:mime video/mp4 ->8 string mp42 \b, MPEG v4 system, version 2 -!:mime video/mp4 ->8 string mp7t \b, MPEG v4 system, MPEG v7 XML ->8 string mp7b \b, MPEG v4 system, MPEG v7 binary XML ->8 string/W jp2 \b, JPEG 2000 -!:mime image/jp2 +>8 string 3g2 \b, MPEG v4 system, 3GPP2 +!:mime video/3gpp2 +>>11 byte 4 \b v4 (H.263/AMR GSM 6.10) +>>11 byte 5 \b v5 (H.263/AMR GSM 6.10) +>>11 byte 6 \b v6 (ITU H.264/AMR GSM 6.10) +>>11 byte a \b C.S0050-0 V1.0 +>>11 byte b \b C.S0050-0-A V1.0.0 +>>11 byte c \b C.S0050-0-B V1.0 >8 string 3ge \b, MPEG v4 system, 3GPP !:mime video/3gpp +>>11 byte 6 \b, Release 6 MBMS Extended Presentations +>>11 byte 7 \b, Release 7 MBMS Extended Presentations >8 string 3gg \b, MPEG v4 system, 3GPP +>11 byte 6 \b, Release 6 General Profile !:mime video/3gpp >8 string 3gp \b, MPEG v4 system, 3GPP +>11 byte 1 \b, Release %d (non existent) +>11 byte 2 \b, Release %d (non existent) +>11 byte 3 \b, Release %d (non existent) +>11 byte 4 \b, Release %d +>11 byte 5 \b, Release %d +>11 byte 6 \b, Release %d +>11 byte 7 \b, Release %d Streaming Servers !:mime video/3gpp >8 string 3gs \b, MPEG v4 system, 3GPP +>11 byte 7 \b, Release %d Streaming Servers !:mime video/3gpp ->8 string 3g2 \b, MPEG v4 system, 3GPP2 +>8 string avc1 \b, MPEG v4 system, 3GPP JVT AVC [ISO 14496-12:2005] +!:mime video/mp4 +>8 string/W qt \b, Apple QuickTime movie +!:mime video/quicktime +>8 string CAEP \b, Canon Digital Camera +>8 string caqv \b, Casio Digital Camera +>8 string CDes \b, Convergent Design +>8 string da0a \b, DMB MAF w/ MPEG Layer II aud, MOT slides, DLS, JPG/PNG/MNG +>8 string da0b \b, DMB MAF, ext DA0A, with 3GPP timed text, DID, TVA, REL, IPMP +>8 string da1a \b, DMB MAF audio with ER-BSAC audio, JPG/PNG/MNG images +>8 string da1b \b, DMB MAF, ext da1a, with 3GPP timed text, DID, TVA, REL, IPMP +>8 string da2a \b, DMB MAF aud w/ HE-AAC v2 aud, MOT slides, DLS, JPG/PNG/MNG +>8 string da2b \b, DMB MAF, ext da2a, with 3GPP timed text, DID, TVA, REL, IPMP +>8 string da3a \b, DMB MAF aud with HE-AAC aud, JPG/PNG/MNG images +>8 string da3b \b, DMB MAF, ext da3a w/ BIFS, 3GPP, DID, TVA, REL, IPMP +>8 string dmb1 \b, DMB MAF supporting all the components defined in the spec +>8 string dmpf \b, Digital Media Project +>8 string drc1 \b, Dirac (wavelet compression), encap in ISO base media (MP4) +>8 string dv1a \b, DMB MAF vid w/ AVC vid, ER-BSAC aud, BIFS, JPG/PNG/MNG, TS +>8 string dv1b \b, DMB MAF, ext dv1a, with 3GPP timed text, DID, TVA, REL, IPMP +>8 string dv2a \b, DMB MAF vid w/ AVC vid, HE-AAC v2 aud, BIFS, JPG/PNG/MNG, TS +>8 string dv2b \b, DMB MAF, ext dv2a, with 3GPP timed text, DID, TVA, REL, IPMP +>8 string dv3a \b, DMB MAF vid w/ AVC vid, HE-AAC aud, BIFS, JPG/PNG/MNG, TS +>8 string dv3b \b, DMB MAF, ext dv3a, with 3GPP timed text, DID, TVA, REL, IPMP +>8 string dvr1 \b, DVB (.DVB) over RTP +!:mime video/vnd.dvb.file +>8 string dvt1 \b, DVB (.DVB) over MPEG-2 Transport Stream +!:mime video/vnd.dvb.file +>8 string F4V \b, Video for Adobe Flash Player 9+ (.F4V) +!:mime video/mp4 +>8 string F4P \b, Protected Video for Adobe Flash Player 9+ (.F4P) +!:mime video/mp4 +>8 string F4A \b, Audio for Adobe Flash Player 9+ (.F4A) +!:mime audio/mp4 +>8 string F4B \b, Audio Book for Adobe Flash Player 9+ (.F4B) +!:mime audio/mp4 +>8 string isc2 \b, ISMACryp 2.0 Encrypted File +# ?/enc-isoff-generic +>8 string iso2 \b, MP4 Base Media v2 [ISO 14496-12:2005] +!:mime video/mp4 +>8 string isom \b, MP4 Base Media v1 [IS0 14496-12:2003] +!:mime video/mp4 +>8 string/W jp2 \b, JPEG 2000 +!:mime image/jp2 +>8 string JP2 \b, JPEG 2000 Image (.JP2) [ISO 15444-1 ?] +!:mime image/jp2 +>8 string JP20 \b, Unknown, from GPAC samples (prob non-existent) +>8 string jpm \b, JPEG 2000 Compound Image (.JPM) [ISO 15444-6] +!:mime image/jpm +>8 string jpx \b, JPEG 2000 w/ extensions (.JPX) [ISO 15444-2] +!:mime image/jpx +>8 string KDDI \b, 3GPP2 EZmovie for KDDI 3G cellphones !:mime video/3gpp2 ->>11 byte 4 \b v4 (H.263/AMR GSM 6.10) ->>11 byte 5 \b v5 (H.263/AMR GSM 6.10) ->>11 byte 6 \b v6 (ITU H.264/AMR GSM 6.10) +>8 string M4A \b, Apple iTunes ALAC/AAC-LC (.M4A) Audio +!:mime audio/x-m4a +>8 string M4B \b, Apple iTunes ALAC/AAC-LC (.M4B) Audio Book +!:mime audio/mp4 +>8 string M4P \b, Apple iTunes ALAC/AAC-LC (.M4P) AES Protected Audio +!:mime video/mp4 +>8 string M4V \b, Apple iTunes Video (.M4V) Video +!:mime video/x-m4v +>8 string M4VH \b, Apple TV (.M4V) +!:mime video/x-m4v +>8 string M4VP \b, Apple iPhone (.M4V) +!:mime video/x-m4v +>8 string mj2s \b, Motion JPEG 2000 [ISO 15444-3] Simple Profile +!:mime video/mj2 +>8 string mjp2 \b, Motion JPEG 2000 [ISO 15444-3] General Profile +!:mime video/mj2 +>8 string mmp4 \b, MPEG-4/3GPP Mobile Profile (.MP4 / .3GP) (for NTT) +!:mime video/mp4 +>8 string mobi \b, MPEG-4, MOBI format +!:mime video/mp4 +>8 string mp21 \b, MPEG-21 [ISO/IEC 21000-9] +>8 string mp41 \b, MP4 v1 [ISO 14496-1:ch13] +!:mime video/mp4 +>8 string mp42 \b, MP4 v2 [ISO 14496-14] +!:mime video/mp4 +>8 string mp71 \b, MP4 w/ MPEG-7 Metadata [per ISO 14496-12] +>8 string mp7t \b, MPEG v4 system, MPEG v7 XML +>8 string mp7b \b, MPEG v4 system, MPEG v7 binary XML >8 string mmp4 \b, MPEG v4 system, 3GPP Mobile !:mime video/mp4 ->8 string avc1 \b, MPEG v4 system, 3GPP JVT AVC -!:mime video/3gpp ->8 string/W M4A \b, MPEG v4 system, iTunes AAC-LC +>8 string MPPI \b, Photo Player, MAF [ISO/IEC 23000-3] +>8 string mqt \b, Sony / Mobile QuickTime (.MQV) US Pat 7,477,830 +!:mime video/quicktime +>8 string MSNV \b, MPEG-4 (.MP4) for SonyPSP +!:mime audio/mp4 +>8 string NDAS \b, MP4 v2 [ISO 14496-14] Nero Digital AAC Audio !:mime audio/mp4 ->8 string/W M4V \b, MPEG v4 system, iTunes AVC-LC +>8 string NDSC \b, MPEG-4 (.MP4) Nero Cinema Profile !:mime video/mp4 ->8 string/W M4P \b, MPEG v4 system, iTunes AES encrypted ->8 string/W M4B \b, MPEG v4 system, iTunes bookmarked ->8 string/W qt \b, Apple QuickTime movie +>8 string NDSH \b, MPEG-4 (.MP4) Nero HDTV Profile +!:mime video/mp4 +>8 string NDSM \b, MPEG-4 (.MP4) Nero Mobile Profile +!:mime video/mp4 +>8 string NDSP \b, MPEG-4 (.MP4) Nero Portable Profile +!:mime video/mp4 +>8 string NDSS \b, MPEG-4 (.MP4) Nero Standard Profile +!:mime video/mp4 +>8 string NDXC \b, H.264/MPEG-4 AVC (.MP4) Nero Cinema Profile +!:mime video/mp4 +>8 string NDXH \b, H.264/MPEG-4 AVC (.MP4) Nero HDTV Profile +!:mime video/mp4 +>8 string NDXM \b, H.264/MPEG-4 AVC (.MP4) Nero Mobile Profile +!:mime video/mp4 +>8 string NDXP \b, H.264/MPEG-4 AVC (.MP4) Nero Portable Profile +!:mime video/mp4 +>8 string NDXS \b, H.264/MPEG-4 AVC (.MP4) Nero Standard Profile +!:mime video/mp4 +>8 string odcf \b, OMA DCF DRM Format 2.0 (OMA-TS-DRM-DCF-V2_0-20060303-A) +>8 string opf2 \b, OMA PDCF DRM Format 2.1 (OMA-TS-DRM-DCF-V2_1-20070724-C) +>8 string opx2 \b, OMA PDCF DRM + XBS ext (OMA-TS-DRM_XBS-V1_0-20070529-C) +>8 string pana \b, Panasonic Digital Camera +>8 string qt \b, Apple QuickTime (.MOV/QT) !:mime video/quicktime +>8 string ROSS \b, Ross Video +>8 string sdv \b, SD Memory Card Video +>8 string ssc1 \b, Samsung stereo, single stream (patent pending) +>8 string ssc2 \b, Samsung stereo, dual stream (patent pending) # MPEG sequences # Scans for all common MPEG header start codes Modified: projects/clang350-import/contrib/file/magic/Magdir/archive ============================================================================== --- projects/clang350-import/contrib/file/magic/Magdir/archive Thu Dec 11 19:20:13 2014 (r275716) +++ projects/clang350-import/contrib/file/magic/Magdir/archive Thu Dec 11 19:27:27 2014 (r275717) @@ -1,5 +1,5 @@ #------------------------------------------------------------------------------ -# $File: archive,v 1.87 2014/06/03 19:15:58 christos Exp $ +# $File: archive,v 1.88 2014/08/16 10:42:17 christos Exp $ # archive: file(1) magic for archive formats (see also "msdos" for self- # extracting compressed archives) # @@ -954,34 +954,3 @@ >0xE08 search/7776 \x55\xAA >>&-512 indirect x \b; contains -# Symantec GHOST image by Joerg Jenderek at May 2014 -# http://us.norton.com/ghost/ -# http://www.garykessler.net/library/file_sigs.html -0 ubelong&0xFFFFf7f0 0xFEEF0100 Norton GHost image -# *.GHO ->2 ubyte&0x08 0x00 \b, first file -# *.GHS or *.[0-9] with cns program option ->2 ubyte&0x08 0x08 \b, split file -# part of split index interesting for *.ghs ->>4 ubyte x id=0x%x -# compression tag minus one equals numeric compression command line switch z[1-9] ->3 ubyte 0 \b, no compression ->3 ubyte 2 \b, fast compression (Z1) ->3 ubyte 3 \b, medium compression (Z2) ->3 ubyte >3 ->>3 ubyte <11 \b, compression (Z%d-1) ->2 ubyte&0x08 0x00 -# ~ 30 byte password field only for *.gho ->>12 ubequad !0 \b, password protected ->>44 ubyte !1 -# 1~Image All, sector-by-sector only for *.gho ->>>10 ubyte 1 \b, sector copy -# 1~Image Boot track only for *.gho ->>>43 ubyte 1 \b, boot track -# 1~Image Disc only for *.gho implies Image Boot track and sector copy ->>44 ubyte 1 \b, disc sector copy -# optional image description only *.gho ->>0xff string >\0 "%-.254s" -# look for DOS sector end sequence ->0xE08 search/7776 \x55\xAA ->>&-512 indirect x \b; contains Modified: projects/clang350-import/contrib/file/magic/Magdir/blender ============================================================================== --- projects/clang350-import/contrib/file/magic/Magdir/blender Thu Dec 11 19:20:13 2014 (r275716) +++ projects/clang350-import/contrib/file/magic/Magdir/blender Thu Dec 11 19:27:27 2014 (r275717) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: blender,v 1.5 2009/09/19 16:28:08 christos Exp $ +# $File: blender,v 1.6 2014/08/30 08:34:17 christos Exp $ # blender: file(1) magic for Blender 3D related files # # Native format rule v1.2. For questions use the developers list @@ -35,5 +35,5 @@ >>>0x44 string =GLOB \b. >>>>0x60 beshort x \b%.4d -# Scripts that run in the embeded Python interpreter +# Scripts that run in the embedded Python interpreter 0 string #!BPY Blender3D BPython script Modified: projects/clang350-import/contrib/file/magic/Magdir/commands ============================================================================== --- projects/clang350-import/contrib/file/magic/Magdir/commands Thu Dec 11 19:20:13 2014 (r275716) +++ projects/clang350-import/contrib/file/magic/Magdir/commands Thu Dec 11 19:27:27 2014 (r275717) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: commands,v 1.50 2014/05/30 16:48:44 christos Exp $ +# $File: commands,v 1.51 2014/09/27 00:12:55 christos Exp $ # commands: file(1) magic for various shells and interpreters # #0 string/w : shell archive or script for antique kernel text @@ -56,7 +56,7 @@ !:mime text/x-awk 0 string/wt #!\ /usr/bin/awk awk script text executable !:mime text/x-awk -0 regex/4096 =^\\s{0,100}BEGIN\\s{0,100}[{] awk script text +0 regex/4096 =^\\s{0,100}BEGIN\\s{0,100}[{] awk or perl script text # AT&T Bell Labs' Plan 9 shell 0 string/wt #!\ /bin/rc Plan 9 rc shell script text executable Modified: projects/clang350-import/contrib/file/magic/Magdir/compress ============================================================================== --- projects/clang350-import/contrib/file/magic/Magdir/compress Thu Dec 11 19:20:13 2014 (r275716) +++ projects/clang350-import/contrib/file/magic/Magdir/compress Thu Dec 11 19:27:27 2014 (r275717) @@ -1,5 +1,5 @@ #------------------------------------------------------------------------------ -# $File: compress,v 1.58 2014/05/07 19:36:59 christos Exp $ +# $File: compress,v 1.62 2014/09/13 14:27:12 christos Exp $ # compress: file(1) magic for pure-compression formats (no archives) # # compress, gzip, pack, compact, huf, squeeze, crunch, freeze, yabba, etc. @@ -251,3 +251,13 @@ # http://code.google.com/p/snappy/source/browse/trunk/framing_format.txt 0 string \377\006\0\0sNaPpY snappy framed data !:mime application/x-snappy-framed + +# qpress, http://www.quicklz.com/ +0 string qpress10 qpress compressed data +!:mime application/x-qpress + +# Zlib https://www.ietf.org/rfc/rfc6713.txt +0 beshort%31 =0 +>0 byte&0xf =8 +>>0 byte&0x80 =0 zlib compressed data +!:mime application/zlib Modified: projects/clang350-import/contrib/file/magic/Magdir/database ============================================================================== --- projects/clang350-import/contrib/file/magic/Magdir/database Thu Dec 11 19:20:13 2014 (r275716) +++ projects/clang350-import/contrib/file/magic/Magdir/database Thu Dec 11 19:27:27 2014 (r275717) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: database,v 1.41 2014/06/03 19:17:27 christos Exp $ +# $File: database,v 1.43 2014/10/28 15:47:39 christos Exp $ # database: file(1) magic for various databases # # extracted from header/code files by Graeme Wilford (eep2gw@ee.surrey.ac.uk) @@ -9,9 +9,17 @@ # GDBM magic numbers # Will be maintained as part of the GDBM distribution in the future. # -0 belong 0x13579ace GNU dbm 1.x or ndbm database, big endian +0 belong 0x13579acd GNU dbm 1.x or ndbm database, big endian, 32-bit !:mime application/x-gdbm -0 lelong 0x13579ace GNU dbm 1.x or ndbm database, little endian +0 belong 0x13579ace GNU dbm 1.x or ndbm database, big endian, old +!:mime application/x-gdbm +0 belong 0x13579acf GNU dbm 1.x or ndbm database, big endian, 64-bit +!:mime application/x-gdbm +0 lelong 0x13579acd GNU dbm 1.x or ndbm database, little endian, 32-bit +!:mime application/x-gdbm +0 lelong 0x13579ace GNU dbm 1.x or ndbm database, little endian, old +!:mime application/x-gdbm +0 lelong 0x13579acf GNU dbm 1.x or ndbm database, little endian, 64-bit !:mime application/x-gdbm 0 string GDBM GNU dbm 2.x database !:mime application/x-gdbm @@ -202,27 +210,27 @@ # for multiple index files (*.MDX) Production flag,tag numbers(<=0x30),tag length(<=0x20), reserverd (NULL) >>>>>>>24 ubelong&0x0133f7ff >0 # test for reserved NULL byte ->>>>>>>>47 ubyte x +>>>>>>>>47 ubyte 0 # test for valid TAG key format (0x10 or 0) >>>>>>>>>559 ubyte&0xeF 0 # test MM <= 12 ->>>>>>>>>45 ubeshort <0x0C20 ->>>>>>>>>>45 ubyte >0 ->>>>>>>>>>>46 ubyte <32 ->>>>>>>>>>>>46 ubyte >0 +>>>>>>>>>>45 ubeshort <0x0C20 +>>>>>>>>>>>45 ubyte >0 +>>>>>>>>>>>>46 ubyte <32 +>>>>>>>>>>>>>46 ubyte >0 #!:mime application/x-mdx ->>>>>>>>>>>>>0 use xbase-type ->>>>>>>>>>>>>0 ubyte x \b MDX ->>>>>>>>>>>>>1 ubyte x \b, creation-date ->>>>>>>>>>>>>1 use xbase-date ->>>>>>>>>>>>>44 ubyte x \b, update-date ->>>>>>>>>>>>>44 use xbase-date +>>>>>>>>>>>>>>0 use xbase-type +>>>>>>>>>>>>>>0 ubyte x \b MDX +>>>>>>>>>>>>>>1 ubyte x \b, creation-date +>>>>>>>>>>>>>>1 use xbase-date +>>>>>>>>>>>>>>44 ubyte x \b, update-date +>>>>>>>>>>>>>>44 use xbase-date # No.of tags in use (1,2,5,12) ->>>>>>>>>>>>>28 uleshort x \b, %d +>>>>>>>>>>>>>>28 uleshort x \b, %d # No. of entries in tag (0x30) ->>>>>>>>>>>>>25 ubyte x \b/%d tags +>>>>>>>>>>>>>>25 ubyte x \b/%d tags # Length of tag ->>>>>>>>>>>>>26 ubyte x * %d +>>>>>>>>>>>>>>26 ubyte x * %d # 1st tag name_ >>>>>>>>>>>>>548 string x \b, 1st tag "%.11s" # 2nd tag name @@ -337,60 +345,103 @@ # dBASE III >>>>>>16 ubyte 3 # dBASE III DBT ->>>>>>>0 use xbase-memo-print -# dBASE IV DBT , FoxPro FPT or many PNG , ZIP , DBF garbage +>>>>>>>0 use dbase3-memo-print +# dBASE III DBT without version, dBASE IV DBT , FoxPro FPT , or many ZIP , DBF garbage >>>>>>16 ubyte 0 -# dBASE IV DBT with DBF name or DBF garbage ->>>>>>>8 ubelong >0x40000000 -# skip DBF and catch dBASE IV DBT with DBF name and with non big index of next free block ->>>>>>>>0 ulelong <0x01010002 ->>>>>>>>>0 use xbase-memo-print ->>>>>>>8 ubelong 0 +# unusual dBASE III DBT like angest.dbt, dBASE IV DBT with block size 0 , FoxPro FPT , or garbage PCX DBF +>>>>>>>20 uleshort 0 +# FoxPro FPT , unusual dBASE III DBT like biblio.dbt or garbage +>>>>>>>>8 ulong =0 +>>>>>>>>>6 ubeshort >0 +# skip emacs.PIF +>>>>>>>>>>4 ushort 0 +>>>>>>>>>>>0 use foxpro-memo-print +# dBASE III DBT , garbage +>>>>>>>>>6 ubeshort 0 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Sat Dec 13 19:45:20 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EDC91C36; Sat, 13 Dec 2014 19:45:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D5880E07; Sat, 13 Dec 2014 19:45:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBDJjK4f056437; Sat, 13 Dec 2014 19:45:20 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBDJjJQc056427; Sat, 13 Dec 2014 19:45:19 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201412131945.sBDJjJQc056427@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 13 Dec 2014 19:45:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r275749 - in projects/clang350-import: bin/ps cddl/contrib/opensolaris/cmd/zfs contrib/binutils/bfd contrib/binutils/include/elf etc/mtree gnu/usr.bin/binutils/libbfd share/man/man4 sha... X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Dec 2014 19:45:21 -0000 Author: dim Date: Sat Dec 13 19:45:18 2014 New Revision: 275749 URL: https://svnweb.freebsd.org/changeset/base/275749 Log: Merge ^/head r275715 through r275748. Added: projects/clang350-import/share/man/man7/crypto.7 - copied unchanged from r275748, head/share/man/man7/crypto.7 projects/clang350-import/sys/crypto/aesni/aesni_ghash.c - copied unchanged from r275748, head/sys/crypto/aesni/aesni_ghash.c projects/clang350-import/sys/libkern/timingsafe_bcmp.c - copied unchanged from r275748, head/sys/libkern/timingsafe_bcmp.c projects/clang350-import/sys/opencrypto/gfmult.c - copied unchanged from r275748, head/sys/opencrypto/gfmult.c projects/clang350-import/sys/opencrypto/gfmult.h - copied unchanged from r275748, head/sys/opencrypto/gfmult.h projects/clang350-import/sys/opencrypto/gmac.c - copied unchanged from r275748, head/sys/opencrypto/gmac.c projects/clang350-import/sys/opencrypto/gmac.h - copied unchanged from r275748, head/sys/opencrypto/gmac.h projects/clang350-import/tests/sys/opencrypto/ - copied from r275748, head/tests/sys/opencrypto/ Modified: projects/clang350-import/bin/ps/ps.1 projects/clang350-import/cddl/contrib/opensolaris/cmd/zfs/zfs.8 projects/clang350-import/contrib/binutils/bfd/ChangeLog projects/clang350-import/contrib/binutils/bfd/bfd-in2.h projects/clang350-import/contrib/binutils/bfd/ecoff.c projects/clang350-import/contrib/binutils/bfd/elf32-ppc.c projects/clang350-import/contrib/binutils/bfd/elf64-ppc.c projects/clang350-import/contrib/binutils/bfd/libbfd.h projects/clang350-import/contrib/binutils/bfd/reloc.c projects/clang350-import/contrib/binutils/bfd/section.c projects/clang350-import/contrib/binutils/include/elf/ChangeLog projects/clang350-import/contrib/binutils/include/elf/ppc.h projects/clang350-import/contrib/binutils/include/elf/ppc64.h projects/clang350-import/etc/mtree/BSD.tests.dist projects/clang350-import/gnu/usr.bin/binutils/libbfd/bfd.h projects/clang350-import/share/man/man4/crypto.4 projects/clang350-import/share/man/man7/Makefile projects/clang350-import/share/man/man9/crypto.9 projects/clang350-import/share/mk/bsd.opts.mk projects/clang350-import/share/mk/src.opts.mk projects/clang350-import/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c projects/clang350-import/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c projects/clang350-import/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c projects/clang350-import/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c projects/clang350-import/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c projects/clang350-import/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c projects/clang350-import/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h projects/clang350-import/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c projects/clang350-import/sys/conf/files projects/clang350-import/sys/conf/files.amd64 projects/clang350-import/sys/conf/files.i386 projects/clang350-import/sys/crypto/aesni/aesni.c projects/clang350-import/sys/crypto/aesni/aesni.h projects/clang350-import/sys/crypto/aesni/aesni_wrap.c projects/clang350-import/sys/crypto/via/padlock_hash.c projects/clang350-import/sys/dev/beri/virtio/virtio_mmio_platform.c projects/clang350-import/sys/dev/cxgbe/adapter.h projects/clang350-import/sys/dev/cxgbe/tom/t4_tom.h projects/clang350-import/sys/dev/virtio/mmio/virtio_mmio.c projects/clang350-import/sys/dev/virtio/mmio/virtio_mmio_if.m projects/clang350-import/sys/dev/virtio/virtio_bus_if.m projects/clang350-import/sys/dev/virtio/virtqueue.c projects/clang350-import/sys/geom/eli/g_eli_crypto.c projects/clang350-import/sys/geom/eli/g_eli_integrity.c projects/clang350-import/sys/geom/eli/g_eli_privacy.c projects/clang350-import/sys/kern/kern_exec.c projects/clang350-import/sys/kern/kern_exit.c projects/clang350-import/sys/kern/kern_fork.c projects/clang350-import/sys/kern/kern_proc.c projects/clang350-import/sys/kern/kern_sig.c projects/clang350-import/sys/kern/kern_thread.c projects/clang350-import/sys/kern/subr_clock.c projects/clang350-import/sys/kern/vfs_subr.c projects/clang350-import/sys/kern/vfs_vnops.c projects/clang350-import/sys/mips/rmi/dev/sec/rmisec.c projects/clang350-import/sys/modules/aesni/Makefile projects/clang350-import/sys/modules/crypto/Makefile projects/clang350-import/sys/net/if_dead.c projects/clang350-import/sys/netinet/sctp_input.c projects/clang350-import/sys/netinet/tcp_input.c projects/clang350-import/sys/netinet/udp_usrreq.c projects/clang350-import/sys/netinet6/ip6_forward.c projects/clang350-import/sys/netinet6/ip6_ipsec.c projects/clang350-import/sys/netinet6/raw_ip6.c projects/clang350-import/sys/netinet6/udp6_usrreq.c projects/clang350-import/sys/opencrypto/criov.c projects/clang350-import/sys/opencrypto/crypto.c projects/clang350-import/sys/opencrypto/cryptodev.c projects/clang350-import/sys/opencrypto/cryptodev.h projects/clang350-import/sys/opencrypto/cryptosoft.c projects/clang350-import/sys/opencrypto/xform.c projects/clang350-import/sys/opencrypto/xform.h projects/clang350-import/sys/rpc/svc.c projects/clang350-import/sys/sys/bufobj.h projects/clang350-import/sys/sys/libkern.h projects/clang350-import/sys/sys/proc.h projects/clang350-import/tests/sys/Makefile projects/clang350-import/usr.bin/mkimg/Makefile projects/clang350-import/usr.bin/mkimg/qcow.c projects/clang350-import/usr.sbin/autofs/autounmountd.8 projects/clang350-import/usr.sbin/syslogd/syslogd.c Directory Properties: projects/clang350-import/ (props changed) projects/clang350-import/cddl/ (props changed) projects/clang350-import/cddl/contrib/opensolaris/ (props changed) projects/clang350-import/cddl/contrib/opensolaris/cmd/zfs/ (props changed) projects/clang350-import/contrib/binutils/ (props changed) projects/clang350-import/contrib/llvm/ (props changed) projects/clang350-import/etc/ (props changed) projects/clang350-import/gnu/usr.bin/binutils/ (props changed) projects/clang350-import/share/ (props changed) projects/clang350-import/share/man/man4/ (props changed) projects/clang350-import/sys/ (props changed) projects/clang350-import/sys/cddl/contrib/opensolaris/ (props changed) projects/clang350-import/sys/conf/ (props changed) projects/clang350-import/usr.bin/mkimg/ (props changed) Modified: projects/clang350-import/bin/ps/ps.1 ============================================================================== --- projects/clang350-import/bin/ps/ps.1 Sat Dec 13 19:17:28 2014 (r275748) +++ projects/clang350-import/bin/ps/ps.1 Sat Dec 13 19:45:18 2014 (r275749) @@ -29,7 +29,7 @@ .\" @(#)ps.1 8.3 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd August 27, 2014 +.Dd December 9, 2014 .Dt PS 1 .Os .Sh NAME @@ -332,6 +332,7 @@ the include file .It Dv "P_SINGLE_BOUNDARY" Ta No "0x400000" Ta "Threads should suspend at user boundary" .It Dv "P_HWPMC" Ta No "0x800000" Ta "Process is using HWPMCs" .It Dv "P_JAILED" Ta No "0x1000000" Ta "Process is in jail" +.It Dv "P_TOTAL_STOP" Ta No "0x2000000" Ta "Stopped for system suspend" .It Dv "P_INEXEC" Ta No "0x4000000" Ta "Process is in execve()" .It Dv "P_STATCHILD" Ta No "0x8000000" Ta "Child process stopped or exited" .It Dv "P_INMEM" Ta No "0x10000000" Ta "Loaded into memory" Modified: projects/clang350-import/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- projects/clang350-import/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sat Dec 13 19:17:28 2014 (r275748) +++ projects/clang350-import/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sat Dec 13 19:45:18 2014 (r275749) @@ -23,15 +23,15 @@ .\" Copyright (c) 2012, Glen Barber .\" Copyright (c) 2012, Bryan Drewery .\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved. -.\" Copyright (c) 2013 Nexenta Systems, Inc. All Rights Reserved. .\" Copyright (c) 2014, Joyent, Inc. All rights reserved. .\" Copyright (c) 2013, Steven Hartland +.\" Copyright (c) 2014 Nexenta Systems, Inc. All Rights Reserved. .\" Copyright (c) 2014, Xin LI .\" Copyright (c) 2014, The FreeBSD Foundation, All Rights Reserved. .\" .\" $FreeBSD$ .\" -.Dd November 12, 2014 +.Dd December 12, 2014 .Dt ZFS 8 .Os .Sh NAME @@ -3505,10 +3505,9 @@ are also displayed. .Bd -literal -offset 2n .Li # Ic zfs allow cindys create,destroy,mount,snapshot tank/cindys .Li # Ic zfs allow tank/cindys -------------------------------------------------------------- -Local+Descendent permissions on (tank/cindys) - user cindys create,destroy,mount,snapshot -------------------------------------------------------------- +---- Permissions on tank/cindys -------------------------------------- +Local+Descendent permissions: + user cindys create,destroy,mount,snapshot .Ed .It Sy Example 18 No Delegating Create Time Permissions on a Tn ZFS No Dataset .Pp @@ -3524,12 +3523,11 @@ are also displayed. .Li # Ic zfs allow staff create,mount tank/users .Li # Ic zfs allow -c destroy tank/users .Li # Ic zfs allow tank/users -------------------------------------------------------------- -Create time permissions on (tank/users) - create,destroy -Local+Descendent permissions on (tank/users) - group staff create,mount -------------------------------------------------------------- +---- Permissions on tank/users --------------------------------------- +Permission sets: + destroy +Local+Descendent permissions: + group staff create,mount .Ed .It Xo .Sy Example 19 @@ -3547,14 +3545,11 @@ are also displayed. .Li # Ic zfs allow -s @pset create,destroy,snapshot,mount tank/users .Li # Ic zfs allow staff @pset tank/users .Li # Ic zfs allow tank/users -------------------------------------------------------------- -Permission sets on (tank/users) +---- Permissions on tank/users --------------------------------------- +Permission sets: @pset create,destroy,mount,snapshot -Create time permissions on (tank/users) - create,destroy -Local+Descendent permissions on (tank/users) - group staff @pset,create,mount -------------------------------------------------------------- +Local+Descendent permissions: + group staff @pset .Ed .It Sy Example 20 No Delegating Property Permissions on a Tn ZFS No Dataset .Pp @@ -3566,16 +3561,15 @@ file system. The permissions on are also displayed. .Bd -literal -offset 2n .Li # Ic zfs allow cindys quota,reservation users/home -.Li # Ic zfs allow cindys -------------------------------------------------------------- -Local+Descendent permissions on (users/home) +.Li # Ic zfs allow users/home +---- Permissions on users/home --------------------------------------- +Local+Descendent permissions: user cindys quota,reservation -------------------------------------------------------------- .Li # Ic su - cindys .Li cindys% Ic zfs set quota=10G users/home/marks .Li cindys% Ic zfs get quota users/home/marks -NAME PROPERTY VALUE SOURCE -users/home/marks quota 10G local +NAME PROPERTY VALUE SOURCE +users/home/marks quota 10G local .Ed .It Sy Example 21 No Removing ZFS Delegated Permissions on a Tn ZFS No Dataset .Pp @@ -3589,14 +3583,11 @@ are also displayed. .Bd -literal -offset 2n .Li # Ic zfs unallow staff snapshot tank/users .Li # Ic zfs allow tank/users -------------------------------------------------------------- -Permission sets on (tank/users) +---- Permissions on tank/users --------------------------------------- +Permission sets: @pset create,destroy,mount,snapshot -Create time permissions on (tank/users) - create,destroy -Local+Descendent permissions on (tank/users) - group staff @pset,create,mount -------------------------------------------------------------- +Local+Descendent permissions: + group staff @pset .Ed .It Sy Example 22 Showing the differences between a snapshot and a ZFS Dataset .Pp Modified: projects/clang350-import/contrib/binutils/bfd/ChangeLog ============================================================================== --- projects/clang350-import/contrib/binutils/bfd/ChangeLog Sat Dec 13 19:17:28 2014 (r275748) +++ projects/clang350-import/contrib/binutils/bfd/ChangeLog Sat Dec 13 19:45:18 2014 (r275749) @@ -1,3 +1,49 @@ +2009-02-15 Alan Modra + + * elf64-ppc.c (struct _ppc64_elf_section_data): Delete t_symndx, + add toc.symndx and toc.add. + (ppc64_elf_check_relocs): Don't set htab->tls_get_addr here. + Set up toc.add. + (get_tls_mask): Add toc_addend param, set from toc.add. Adjust all + callers. + (ppc64_elf_tls_setup): Set htab->tls_get_addr and tls_get_addr_fd. + (branch_reloc_hash_match): New function, extracted from.. + (ppc64_elf_tls_optimize): ..here. + (ppc64_elf_relocate_section): Properly set addends when optimizing + tls sequences. Avoid unnecessary reading and writing of insns. + Only redo reloc when symbol changed. Bypass symbol checks when + using tlsld_got. + * elf32-ppc.c (ppc_elf_tls_setup): Correct comment. + (branch_reloc_hash_match): New function, extracted from.. + (ppc_elf_tls_optimize): ..here. + (ppc_elf_relocate_section): Avoid unnecessary reading of insns. + Don't clear addend on zapped __tls_get_addr reloc. + +2008-08-11 Alan Modra + + * elf64-ppc.c (toc_adjusting_stub_needed): Any call via the plt + needs r2 valid, not just those to external syms. + +2007-11-06 Alan Modra + + * elf32-ppc.c (ppc_elf_check_relocs): Don't refcount tlsld_got here.. + (ppc_elf_gc_sweep_hook): ..or here.. + (ppc_elf_tls_optimize): ..or here. Make two passes through the + relocs, ensuring that tls_get_addr calls follow gd and ld relocs. + (allocate_dynrelocs): Refcount tlsld_got here. + (ppc_elf_size_dynamic_sections): Call allocate_dynrelocs before + allocating tlsld_got. + (ppc_elf_relocate_section): Remove check that a tls_get_addr + call follows gd and ld relocs. + +2007-08-13 Alan Modra + + * elf64-ppc.c (ADDI_R12_R12, LD_R11_0R2, LD_R2_0R2): Define. + Update stub comments. + (build_plt_stub): Build two variants, one without "addis". + (ppc_build_one_stub): Build stubs without "addis" if possible. + (ppc_size_one_stub): Size new stubs. + 2007-07-02 Joseph Myers * elfxx-mips.c (mips_elf_calculate_relocation): Handle Modified: projects/clang350-import/contrib/binutils/bfd/bfd-in2.h ============================================================================== --- projects/clang350-import/contrib/binutils/bfd/bfd-in2.h Sat Dec 13 19:17:28 2014 (r275748) +++ projects/clang350-import/contrib/binutils/bfd/bfd-in2.h Sat Dec 13 19:45:18 2014 (r275749) @@ -1380,6 +1380,9 @@ typedef struct bfd_section /* Nonzero if this section has TLS related relocations. */ unsigned int has_tls_reloc:1; + /* Nonzero if this section has a call to __tls_get_addr. */ + unsigned int has_tls_get_addr_call:1; + /* Nonzero if this section has a gp reloc. */ unsigned int has_gp_reloc:1; @@ -1640,11 +1643,11 @@ extern asection bfd_ind_section; /* segment_mark, sec_info_type, use_rela_p, has_tls_reloc, */ \ 0, 0, 0, 0, \ \ - /* has_gp_reloc, need_finalize_relax, reloc_done, */ \ - 0, 0, 0, \ + /* has_tls_get_addr_call, has_gp_reloc, need_finalize_relax, */ \ + 0, 0, 0, \ \ - /* vma, lma, size, rawsize */ \ - 0, 0, 0, 0, \ + /* reloc_done, vma, lma, size, rawsize */ \ + 0, 0, 0, 0, 0, \ \ /* output_offset, output_section, alignment_power, */ \ 0, (struct bfd_section *) &SEC, 0, \ @@ -2896,6 +2899,8 @@ in the instruction. */ /* PowerPC and PowerPC64 thread-local storage relocations. */ BFD_RELOC_PPC_TLS, + BFD_RELOC_PPC_TLSGD, + BFD_RELOC_PPC_TLSLD, BFD_RELOC_PPC_DTPMOD, BFD_RELOC_PPC_TPREL16, BFD_RELOC_PPC_TPREL16_LO, Modified: projects/clang350-import/contrib/binutils/bfd/ecoff.c ============================================================================== --- projects/clang350-import/contrib/binutils/bfd/ecoff.c Sat Dec 13 19:17:28 2014 (r275748) +++ projects/clang350-import/contrib/binutils/bfd/ecoff.c Sat Dec 13 19:45:18 2014 (r275749) @@ -58,10 +58,10 @@ static asection bfd_debug_section = 0, 0, 1, 0, /* segment_mark, sec_info_type, use_rela_p, has_tls_reloc, */ 0, 0, 0, 0, - /* has_gp_reloc, need_finalize_relax, reloc_done, */ - 0, 0, 0, - /* vma, lma, size, rawsize, */ - 0, 0, 0, 0, + /* has_tls_get_addr_call, has_gp_reloc, need_finalize_relax, */ + 0, 0, 0, + /* reloc_done, vma, lma, size, rawsize, */ + 0, 0, 0, 0, 0, /* output_offset, output_section, alignment_power, */ 0, NULL, 0, /* relocation, orelocation, reloc_count, filepos, rel_filepos, */ Modified: projects/clang350-import/contrib/binutils/bfd/elf32-ppc.c ============================================================================== --- projects/clang350-import/contrib/binutils/bfd/elf32-ppc.c Sat Dec 13 19:17:28 2014 (r275748) +++ projects/clang350-import/contrib/binutils/bfd/elf32-ppc.c Sat Dec 13 19:45:18 2014 (r275749) @@ -746,7 +746,7 @@ static reloc_howto_type ppc_elf_howto_ra 0xffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* Marker reloc for TLS. */ + /* Marker relocs for TLS. */ HOWTO (R_PPC_TLS, 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ @@ -761,6 +761,34 @@ static reloc_howto_type ppc_elf_howto_ra 0, /* dst_mask */ FALSE), /* pcrel_offset */ + HOWTO (R_PPC_TLSGD, + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_PPC_TLSGD", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_PPC_TLSLD, + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_PPC_TLSLD", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + /* Computes the load module index of the load module that contains the definition of its TLS sym. */ HOWTO (R_PPC_DTPMOD32, @@ -1524,6 +1552,8 @@ ppc_elf_reloc_type_lookup (bfd *abfd ATT case BFD_RELOC_CTOR: r = R_PPC_ADDR32; break; case BFD_RELOC_PPC_TOC16: r = R_PPC_TOC16; break; case BFD_RELOC_PPC_TLS: r = R_PPC_TLS; break; + case BFD_RELOC_PPC_TLSGD: r = R_PPC_TLSGD; break; + case BFD_RELOC_PPC_TLSLD: r = R_PPC_TLSLD; break; case BFD_RELOC_PPC_DTPMOD: r = R_PPC_DTPMOD32; break; case BFD_RELOC_PPC_TPREL16: r = R_PPC_TPREL16; break; case BFD_RELOC_PPC_TPREL16_LO: r = R_PPC_TPREL16_LO; break; @@ -2345,16 +2375,34 @@ struct plt_entry bfd_vma glink_offset; }; -/* Of those relocs that might be copied as dynamic relocs, this macro +/* Of those relocs that might be copied as dynamic relocs, this function selects those that must be copied when linking a shared library, even when the symbol is local. */ -#define MUST_BE_DYN_RELOC(RTYPE) \ - ((RTYPE) != R_PPC_REL24 \ - && (RTYPE) != R_PPC_REL14 \ - && (RTYPE) != R_PPC_REL14_BRTAKEN \ - && (RTYPE) != R_PPC_REL14_BRNTAKEN \ - && (RTYPE) != R_PPC_REL32) +static int +must_be_dyn_reloc (struct bfd_link_info *info, + enum elf_ppc_reloc_type r_type) +{ + switch (r_type) + { + default: + return 1; + + case R_PPC_REL24: + case R_PPC_REL14: + case R_PPC_REL14_BRTAKEN: + case R_PPC_REL14_BRNTAKEN: + case R_PPC_REL32: + return 0; + + case R_PPC_TPREL32: + case R_PPC_TPREL16: + case R_PPC_TPREL16_LO: + case R_PPC_TPREL16_HI: + case R_PPC_TPREL16_HA: + return !info->executable; + } +} /* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid copying dynamic variables from a shared lib into an app's dynbss @@ -2421,7 +2469,7 @@ struct ppc_elf_link_hash_table /* The .got.plt section (VxWorks only)*/ asection *sgotplt; - /* Shortcut to .__tls_get_addr. */ + /* Shortcut to __tls_get_addr. */ struct elf_link_hash_entry *tls_get_addr; /* The bfd that forced an old-style PLT. */ @@ -3040,6 +3088,7 @@ ppc_elf_check_relocs (bfd *abfd, const Elf_Internal_Rela *rel; const Elf_Internal_Rela *rel_end; asection *got2, *sreloc; + struct elf_link_hash_entry *tga; if (info->relocatable) return TRUE; @@ -3063,6 +3112,8 @@ ppc_elf_check_relocs (bfd *abfd, ppc_elf_howto_init (); htab = ppc_elf_hash_table (info); + tga = elf_link_hash_lookup (&htab->elf, "__tls_get_addr", + FALSE, FALSE, TRUE); symtab_hdr = &elf_tdata (abfd)->symtab_hdr; sym_hashes = elf_sym_hashes (abfd); got2 = bfd_get_section_by_name (abfd, ".got2"); @@ -3074,7 +3125,7 @@ ppc_elf_check_relocs (bfd *abfd, unsigned long r_symndx; enum elf_ppc_reloc_type r_type; struct elf_link_hash_entry *h; - int tls_type = 0; + int tls_type; r_symndx = ELF32_R_SYM (rel->r_info); if (r_symndx < symtab_hdr->sh_info) @@ -3101,14 +3152,48 @@ ppc_elf_check_relocs (bfd *abfd, BFD_ASSERT (h == htab->elf.hgot); } + tls_type = 0; r_type = ELF32_R_TYPE (rel->r_info); + if (h != NULL && h == tga) + switch (r_type) + { + default: + break; + + case R_PPC_PLTREL24: + case R_PPC_LOCAL24PC: + case R_PPC_REL24: + case R_PPC_REL14: + case R_PPC_REL14_BRTAKEN: + case R_PPC_REL14_BRNTAKEN: + case R_PPC_ADDR24: + case R_PPC_ADDR14: + case R_PPC_ADDR14_BRTAKEN: + case R_PPC_ADDR14_BRNTAKEN: + if (rel != relocs + && (ELF32_R_TYPE (rel[-1].r_info) == R_PPC_TLSGD + || ELF32_R_TYPE (rel[-1].r_info) == R_PPC_TLSLD)) + /* We have a new-style __tls_get_addr call with a marker + reloc. */ + ; + else + /* Mark this section as having an old-style call. */ + sec->has_tls_get_addr_call = 1; + break; + } + switch (r_type) { + case R_PPC_TLSGD: + case R_PPC_TLSLD: + /* These special tls relocs tie a call to __tls_get_addr with + its parameter symbol. */ + break; + case R_PPC_GOT_TLSLD16: case R_PPC_GOT_TLSLD16_LO: case R_PPC_GOT_TLSLD16_HI: case R_PPC_GOT_TLSLD16_HA: - htab->tlsld_got.refcount += 1; tls_type = TLS_TLS | TLS_LD; goto dogottls; @@ -3123,7 +3208,7 @@ ppc_elf_check_relocs (bfd *abfd, case R_PPC_GOT_TPREL16_LO: case R_PPC_GOT_TPREL16_HI: case R_PPC_GOT_TPREL16_HA: - if (info->shared) + if (!info->executable) info->flags |= DF_STATIC_TLS; tls_type = TLS_TLS | TLS_TPREL; goto dogottls; @@ -3358,7 +3443,7 @@ ppc_elf_check_relocs (bfd *abfd, /* This refers only to functions defined in the shared library. */ case R_PPC_LOCAL24PC: - if (h && h == htab->elf.hgot && htab->plt_type == PLT_UNSET) + if (h != NULL && h == htab->elf.hgot && htab->plt_type == PLT_UNSET) { htab->plt_type = PLT_OLD; htab->old_bfd = abfd; @@ -3381,7 +3466,11 @@ ppc_elf_check_relocs (bfd *abfd, /* We shouldn't really be seeing these. */ case R_PPC_TPREL32: - if (info->shared) + case R_PPC_TPREL16: + case R_PPC_TPREL16_LO: + case R_PPC_TPREL16_HI: + case R_PPC_TPREL16_HA: + if (!info->executable) info->flags |= DF_STATIC_TLS; goto dodyn; @@ -3390,14 +3479,6 @@ ppc_elf_check_relocs (bfd *abfd, case R_PPC_DTPREL32: goto dodyn; - case R_PPC_TPREL16: - case R_PPC_TPREL16_LO: - case R_PPC_TPREL16_HI: - case R_PPC_TPREL16_HA: - if (info->shared) - info->flags |= DF_STATIC_TLS; - goto dodyn; - case R_PPC_REL32: if (h == NULL && got2 != NULL @@ -3488,7 +3569,7 @@ ppc_elf_check_relocs (bfd *abfd, dynamic library if we manage to avoid copy relocs for the symbol. */ if ((info->shared - && (MUST_BE_DYN_RELOC (r_type) + && (must_be_dyn_reloc (info, r_type) || (h != NULL && (! info->symbolic || h->root.type == bfd_link_hash_defweak @@ -3583,7 +3664,7 @@ ppc_elf_check_relocs (bfd *abfd, } p->count += 1; - if (!MUST_BE_DYN_RELOC (r_type)) + if (!must_be_dyn_reloc (info, r_type)) p->pc_count += 1; } @@ -3903,9 +3984,6 @@ ppc_elf_gc_sweep_hook (bfd *abfd, case R_PPC_GOT_TLSLD16_LO: case R_PPC_GOT_TLSLD16_HI: case R_PPC_GOT_TLSLD16_HA: - htab->tlsld_got.refcount -= 1; - /* Fall thru */ - case R_PPC_GOT_TLSGD16: case R_PPC_GOT_TLSGD16_LO: case R_PPC_GOT_TLSGD16_HI: @@ -3979,7 +4057,8 @@ ppc_elf_gc_sweep_hook (bfd *abfd, return TRUE; } -/* Set htab->tls_get_addr and call the generic ELF tls_setup function. */ +/* Set plt output section type, htab->tls_get_addr, and call the + generic ELF tls_setup function. */ asection * ppc_elf_tls_setup (bfd *obfd, struct bfd_link_info *info) @@ -4000,6 +4079,43 @@ ppc_elf_tls_setup (bfd *obfd, struct bfd return _bfd_elf_tls_setup (obfd, info); } +/* Return TRUE iff REL is a branch reloc with a global symbol matching + HASH. */ + +static bfd_boolean +branch_reloc_hash_match (const bfd *ibfd, + const Elf_Internal_Rela *rel, + const struct elf_link_hash_entry *hash) +{ + Elf_Internal_Shdr *symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; + enum elf_ppc_reloc_type r_type = ELF32_R_TYPE (rel->r_info); + unsigned int r_symndx = ELF32_R_SYM (rel->r_info); + + if (r_symndx >= symtab_hdr->sh_info + && (r_type == R_PPC_PLTREL24 + || r_type == R_PPC_LOCAL24PC + || r_type == R_PPC_REL14 + || r_type == R_PPC_REL14_BRTAKEN + || r_type == R_PPC_REL14_BRNTAKEN + || r_type == R_PPC_REL24 + || r_type == R_PPC_ADDR24 + || r_type == R_PPC_ADDR14 + || r_type == R_PPC_ADDR14_BRTAKEN + || r_type == R_PPC_ADDR14_BRNTAKEN)) + { + struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (ibfd); + struct elf_link_hash_entry *h; + + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + if (h == hash) + return TRUE; + } + return FALSE; +} + /* Run through all the TLS relocs looking for optimization opportunities. */ @@ -4010,187 +4126,204 @@ ppc_elf_tls_optimize (bfd *obfd ATTRIBUT bfd *ibfd; asection *sec; struct ppc_elf_link_hash_table *htab; + int pass; - if (info->relocatable || info->shared) + if (info->relocatable || !info->executable) return TRUE; htab = ppc_elf_hash_table (info); - for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) - { - Elf_Internal_Sym *locsyms = NULL; - Elf_Internal_Shdr *symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; - - for (sec = ibfd->sections; sec != NULL; sec = sec->next) - if (sec->has_tls_reloc && !bfd_is_abs_section (sec->output_section)) - { - Elf_Internal_Rela *relstart, *rel, *relend; - int expecting_tls_get_addr; + /* Make two passes through the relocs. First time check that tls + relocs involved in setting up a tls_get_addr call are indeed + followed by such a call. If they are not, exclude them from + the optimizations done on the second pass. */ + for (pass = 0; pass < 2; ++pass) + for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) + { + Elf_Internal_Sym *locsyms = NULL; + Elf_Internal_Shdr *symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; - /* Read the relocations. */ - relstart = _bfd_elf_link_read_relocs (ibfd, sec, NULL, NULL, - info->keep_memory); - if (relstart == NULL) - return FALSE; + for (sec = ibfd->sections; sec != NULL; sec = sec->next) + if (sec->has_tls_reloc && !bfd_is_abs_section (sec->output_section)) + { + Elf_Internal_Rela *relstart, *rel, *relend; - expecting_tls_get_addr = 0; - relend = relstart + sec->reloc_count; - for (rel = relstart; rel < relend; rel++) - { - enum elf_ppc_reloc_type r_type; - unsigned long r_symndx; - struct elf_link_hash_entry *h = NULL; - char *tls_mask; - char tls_set, tls_clear; - bfd_boolean is_local; + /* Read the relocations. */ + relstart = _bfd_elf_link_read_relocs (ibfd, sec, NULL, NULL, + info->keep_memory); + if (relstart == NULL) + return FALSE; - r_symndx = ELF32_R_SYM (rel->r_info); - if (r_symndx >= symtab_hdr->sh_info) - { - struct elf_link_hash_entry **sym_hashes; + relend = relstart + sec->reloc_count; + for (rel = relstart; rel < relend; rel++) + { + enum elf_ppc_reloc_type r_type; + unsigned long r_symndx; + struct elf_link_hash_entry *h = NULL; + char *tls_mask; + char tls_set, tls_clear; + bfd_boolean is_local; + int expecting_tls_get_addr; + bfd_signed_vma *got_count; - sym_hashes = elf_sym_hashes (ibfd); - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; - while (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - } + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx >= symtab_hdr->sh_info) + { + struct elf_link_hash_entry **sym_hashes; - is_local = FALSE; - if (h == NULL - || !h->def_dynamic) - is_local = TRUE; + sym_hashes = elf_sym_hashes (ibfd); + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + } - r_type = ELF32_R_TYPE (rel->r_info); - switch (r_type) - { - case R_PPC_GOT_TLSLD16: - case R_PPC_GOT_TLSLD16_LO: - case R_PPC_GOT_TLSLD16_HI: - case R_PPC_GOT_TLSLD16_HA: - /* These relocs should never be against a symbol - defined in a shared lib. Leave them alone if - that turns out to be the case. */ - expecting_tls_get_addr = 0; - htab->tlsld_got.refcount -= 1; - if (!is_local) - continue; + expecting_tls_get_addr = 0; + is_local = FALSE; + if (h == NULL + || !h->def_dynamic) + is_local = TRUE; - /* LD -> LE */ - tls_set = 0; - tls_clear = TLS_LD; - expecting_tls_get_addr = 1; - break; + r_type = ELF32_R_TYPE (rel->r_info); + switch (r_type) + { + case R_PPC_GOT_TLSLD16: + case R_PPC_GOT_TLSLD16_LO: + expecting_tls_get_addr = 1; + /* Fall thru */ + + case R_PPC_GOT_TLSLD16_HI: + case R_PPC_GOT_TLSLD16_HA: + /* These relocs should never be against a symbol + defined in a shared lib. Leave them alone if + that turns out to be the case. */ + if (!is_local) + continue; - case R_PPC_GOT_TLSGD16: - case R_PPC_GOT_TLSGD16_LO: - case R_PPC_GOT_TLSGD16_HI: - case R_PPC_GOT_TLSGD16_HA: - if (is_local) - /* GD -> LE */ + /* LD -> LE */ tls_set = 0; - else - /* GD -> IE */ - tls_set = TLS_TLS | TLS_TPRELGD; - tls_clear = TLS_GD; - expecting_tls_get_addr = 1; - break; + tls_clear = TLS_LD; + break; - case R_PPC_GOT_TPREL16: - case R_PPC_GOT_TPREL16_LO: - case R_PPC_GOT_TPREL16_HI: - case R_PPC_GOT_TPREL16_HA: - expecting_tls_get_addr = 0; - if (is_local) - { - /* IE -> LE */ + case R_PPC_GOT_TLSGD16: + case R_PPC_GOT_TLSGD16_LO: + expecting_tls_get_addr = 1; + /* Fall thru */ + + case R_PPC_GOT_TLSGD16_HI: + case R_PPC_GOT_TLSGD16_HA: + if (is_local) + /* GD -> LE */ tls_set = 0; - tls_clear = TLS_TPREL; - break; - } - else + else + /* GD -> IE */ + tls_set = TLS_TLS | TLS_TPRELGD; + tls_clear = TLS_GD; + break; + + case R_PPC_GOT_TPREL16: + case R_PPC_GOT_TPREL16_LO: + case R_PPC_GOT_TPREL16_HI: + case R_PPC_GOT_TPREL16_HA: + if (is_local) + { + /* IE -> LE */ + tls_set = 0; + tls_clear = TLS_TPREL; + break; + } + else + continue; + + default: continue; + } - case R_PPC_REL14: - case R_PPC_REL14_BRTAKEN: - case R_PPC_REL14_BRNTAKEN: - case R_PPC_REL24: - if (expecting_tls_get_addr - && h != NULL - && h == htab->tls_get_addr) - { - struct plt_entry *ent = find_plt_ent (h, NULL, 0); - if (ent != NULL && ent->plt.refcount > 0) - ent->plt.refcount -= 1; - } - expecting_tls_get_addr = 0; - continue; + if (pass == 0) + { + if (!expecting_tls_get_addr + || !sec->has_tls_get_addr_call) + continue; + + if (rel + 1 < relend + && branch_reloc_hash_match (ibfd, rel + 1, + htab->tls_get_addr)) + continue; + + /* Uh oh, we didn't find the expected call. We + could just mark this symbol to exclude it + from tls optimization but it's safer to skip + the entire section. */ + sec->has_tls_reloc = 0; + break; + } - default: - expecting_tls_get_addr = 0; - continue; - } + if (h != NULL) + { + tls_mask = &ppc_elf_hash_entry (h)->tls_mask; + got_count = &h->got.refcount; + } + else + { + Elf_Internal_Sym *sym; + bfd_signed_vma *lgot_refs; + char *lgot_masks; - if (h != NULL) - { - if (tls_set == 0) - { - /* We managed to get rid of a got entry. */ - if (h->got.refcount > 0) - h->got.refcount -= 1; - } - tls_mask = &ppc_elf_hash_entry (h)->tls_mask; - } - else - { - Elf_Internal_Sym *sym; - bfd_signed_vma *lgot_refs; - char *lgot_masks; + if (locsyms == NULL) + { + locsyms = (Elf_Internal_Sym *) symtab_hdr->contents; + if (locsyms == NULL) + locsyms = bfd_elf_get_elf_syms (ibfd, symtab_hdr, + symtab_hdr->sh_info, + 0, NULL, NULL, NULL); + if (locsyms == NULL) + { + if (elf_section_data (sec)->relocs != relstart) + free (relstart); + return FALSE; + } + } + sym = locsyms + r_symndx; + lgot_refs = elf_local_got_refcounts (ibfd); + if (lgot_refs == NULL) + abort (); + lgot_masks = (char *) (lgot_refs + symtab_hdr->sh_info); + tls_mask = &lgot_masks[r_symndx]; + got_count = &lgot_refs[r_symndx]; + } - if (locsyms == NULL) - { - locsyms = (Elf_Internal_Sym *) symtab_hdr->contents; - if (locsyms == NULL) - locsyms = bfd_elf_get_elf_syms (ibfd, symtab_hdr, - symtab_hdr->sh_info, - 0, NULL, NULL, NULL); - if (locsyms == NULL) - { - if (elf_section_data (sec)->relocs != relstart) - free (relstart); - return FALSE; - } - } - sym = locsyms + r_symndx; - lgot_refs = elf_local_got_refcounts (ibfd); - if (lgot_refs == NULL) - abort (); - if (tls_set == 0) - { - /* We managed to get rid of a got entry. */ - if (lgot_refs[r_symndx] > 0) - lgot_refs[r_symndx] -= 1; - } - lgot_masks = (char *) (lgot_refs + symtab_hdr->sh_info); - tls_mask = &lgot_masks[r_symndx]; - } + if (tls_set == 0) + { + /* We managed to get rid of a got entry. */ + if (*got_count > 0) + *got_count -= 1; + } - *tls_mask |= tls_set; - *tls_mask &= ~tls_clear; - } + if (expecting_tls_get_addr) + { + struct plt_entry *ent; - if (elf_section_data (sec)->relocs != relstart) - free (relstart); - } + ent = find_plt_ent (htab->tls_get_addr, NULL, 0); + if (ent != NULL && ent->plt.refcount > 0) + ent->plt.refcount -= 1; + } - if (locsyms != NULL - && (symtab_hdr->contents != (unsigned char *) locsyms)) - { - if (!info->keep_memory) - free (locsyms); - else - symtab_hdr->contents = (unsigned char *) locsyms; - } - } + *tls_mask |= tls_set; + *tls_mask &= ~tls_clear; + } + + if (elf_section_data (sec)->relocs != relstart) + free (relstart); + } + + if (locsyms != NULL + && (symtab_hdr->contents != (unsigned char *) locsyms)) + { + if (!info->keep_memory) + free (locsyms); + else + symtab_hdr->contents = (unsigned char *) locsyms; + } + } return TRUE; } @@ -4615,8 +4748,11 @@ allocate_dynrelocs (struct elf_link_hash if (eh->tls_mask == (TLS_TLS | TLS_LD) && !eh->elf.def_dynamic) - /* If just an LD reloc, we'll just use htab->tlsld_got.offset. */ - eh->elf.got.offset = (bfd_vma) -1; + { + /* If just an LD reloc, we'll just use htab->tlsld_got.offset. */ + htab->tlsld_got.refcount += 1; + eh->elf.got.offset = (bfd_vma) -1; + } else { bfd_boolean dyn; @@ -4664,7 +4800,7 @@ allocate_dynrelocs (struct elf_link_hash if (info->shared) { /* Relocs that use pc_count are those that appear on a call insn, - or certain REL relocs (see MUST_BE_DYN_RELOC) that can be + or certain REL relocs (see must_be_dyn_reloc) that can be generated via assembly. We want calls to protected symbols to resolve directly to the function rather than going via the plt. If people want function pointer comparisons to work as expected @@ -4891,6 +5027,9 @@ ppc_elf_size_dynamic_sections (bfd *outp *local_got = (bfd_vma) -1; } + /* Allocate space for global sym dynamic relocs. */ + elf_link_hash_traverse (elf_hash_table (info), allocate_dynrelocs, info); + if (htab->tlsld_got.refcount > 0) { htab->tlsld_got.offset = allocate_got (htab, 8); @@ -4900,9 +5039,6 @@ ppc_elf_size_dynamic_sections (bfd *outp else htab->tlsld_got.offset = (bfd_vma) -1; - /* Allocate space for global sym dynamic relocs. */ - elf_link_hash_traverse (elf_hash_table (info), allocate_dynrelocs, info); - if (htab->got != NULL && htab->plt_type != PLT_VXWORKS) { unsigned int g_o_t = 32768; @@ -5754,16 +5890,13 @@ ppc_elf_relocate_section (bfd *output_bf for the final instruction stream. */ tls_mask = 0; tls_gd = 0; - if (IS_PPC_TLS_RELOC (r_type)) - { - if (h != NULL) - tls_mask = ((struct ppc_elf_link_hash_entry *) h)->tls_mask; - else if (local_got_offsets != NULL) - { - char *lgot_masks; - lgot_masks = (char *) (local_got_offsets + symtab_hdr->sh_info); - tls_mask = lgot_masks[r_symndx]; - } + if (h != NULL) + tls_mask = ((struct ppc_elf_link_hash_entry *) h)->tls_mask; + else if (local_got_offsets != NULL) + { + char *lgot_masks; + lgot_masks = (char *) (local_got_offsets + symtab_hdr->sh_info); + tls_mask = lgot_masks[r_symndx]; } /* Ensure reloc mapping code below stays sane. */ @@ -5870,85 +6003,147 @@ ppc_elf_relocate_section (bfd *output_bf case R_PPC_GOT_TLSGD16_LO: tls_gd = TLS_TPRELGD; if (tls_mask != 0 && (tls_mask & TLS_GD) == 0) - goto tls_get_addr_check; + goto tls_ldgd_opt; break; case R_PPC_GOT_TLSLD16: case R_PPC_GOT_TLSLD16_LO: if (tls_mask != 0 && (tls_mask & TLS_LD) == 0) { - tls_get_addr_check: - if (rel + 1 < relend) - { - enum elf_ppc_reloc_type r_type2; - unsigned long r_symndx2; - struct elf_link_hash_entry *h2; - bfd_vma insn1, insn2; - bfd_vma offset; - - /* The next instruction should be a call to - __tls_get_addr. Peek at the reloc to be sure. */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Sat Dec 13 20:17:55 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BB1F9678; Sat, 13 Dec 2014 20:17:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A4D0E155; Sat, 13 Dec 2014 20:17:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBDKHtf6072560; Sat, 13 Dec 2014 20:17:55 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBDKHtQm072559; Sat, 13 Dec 2014 20:17:55 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201412132017.sBDKHtQm072559@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 13 Dec 2014 20:17:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r275750 - projects/clang350-import/contrib/llvm/patches X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Dec 2014 20:17:55 -0000 Author: dim Date: Sat Dec 13 20:17:54 2014 New Revision: 275750 URL: https://svnweb.freebsd.org/changeset/base/275750 Log: Update llvm patch for r275635 so all the tests will pass. Modified: projects/clang350-import/contrib/llvm/patches/patch-21-llvm-r223171-fix-vectorizer.diff Modified: projects/clang350-import/contrib/llvm/patches/patch-21-llvm-r223171-fix-vectorizer.diff ============================================================================== --- projects/clang350-import/contrib/llvm/patches/patch-21-llvm-r223171-fix-vectorizer.diff Sat Dec 13 19:45:18 2014 (r275749) +++ projects/clang350-import/contrib/llvm/patches/patch-21-llvm-r223171-fix-vectorizer.diff Sat Dec 13 20:17:54 2014 (r275750) @@ -1,3 +1,11 @@ +Pull in r223170 from upstream llvm trunk (by Michael Zolotukhin): + + Apply loop-rotate to several vectorizer tests. + + Such loops shouldn't be vectorized due to the loops form. + After applying loop-rotate (+simplifycfg) the tests again start to check + what they are intended to check. + Pull in r223171 from upstream llvm trunk (by Michael Zolotukhin): PR21302. Vectorize only bottom-tested loops. @@ -37,6 +45,90 @@ Index: lib/Transforms/Vectorize/LoopVect // We need to have a loop header. DEBUG(dbgs() << "LV: Found a loop: " << TheLoop->getHeader()->getName() << '\n'); +Index: test/Transforms/LoopVectorize/vect.stats.ll +=================================================================== +--- test/Transforms/LoopVectorize/vect.stats.ll ++++ test/Transforms/LoopVectorize/vect.stats.ll +@@ -13,53 +13,47 @@ target triple = "x86_64-unknown-linux-gnu" + + define void @vectorized(float* nocapture %a, i64 %size) { + entry: +- %cmp1 = icmp sgt i64 %size, 0 +- br i1 %cmp1, label %for.header, label %for.end ++ %cmp1 = icmp sle i64 %size, 0 ++ %cmp21 = icmp sgt i64 0, %size ++ %or.cond = or i1 %cmp1, %cmp21 ++ br i1 %or.cond, label %for.end, label %for.body + +-for.header: +- %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] +- %cmp2 = icmp sgt i64 %indvars.iv, %size +- br i1 %cmp2, label %for.end, label %for.body +- +-for.body: +- +- %arrayidx = getelementptr inbounds float* %a, i64 %indvars.iv ++for.body: ; preds = %entry, %for.body ++ %indvars.iv2 = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] ++ %arrayidx = getelementptr inbounds float* %a, i64 %indvars.iv2 + %0 = load float* %arrayidx, align 4 + %mul = fmul float %0, %0 + store float %mul, float* %arrayidx, align 4 ++ %indvars.iv.next = add nuw nsw i64 %indvars.iv2, 1 ++ %cmp2 = icmp sgt i64 %indvars.iv.next, %size ++ br i1 %cmp2, label %for.end, label %for.body + +- %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 +- br label %for.header +- +-for.end: ++for.end: ; preds = %entry, %for.body + ret void + } + + define void @not_vectorized(float* nocapture %a, i64 %size) { + entry: +- %cmp1 = icmp sgt i64 %size, 0 +- br i1 %cmp1, label %for.header, label %for.end ++ %cmp1 = icmp sle i64 %size, 0 ++ %cmp21 = icmp sgt i64 0, %size ++ %or.cond = or i1 %cmp1, %cmp21 ++ br i1 %or.cond, label %for.end, label %for.body + +-for.header: +- %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] +- %cmp2 = icmp sgt i64 %indvars.iv, %size +- br i1 %cmp2, label %for.end, label %for.body +- +-for.body: +- +- %0 = add nsw i64 %indvars.iv, -5 ++for.body: ; preds = %entry, %for.body ++ %indvars.iv2 = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] ++ %0 = add nsw i64 %indvars.iv2, -5 + %arrayidx = getelementptr inbounds float* %a, i64 %0 + %1 = load float* %arrayidx, align 4 +- %2 = add nsw i64 %indvars.iv, 2 ++ %2 = add nsw i64 %indvars.iv2, 2 + %arrayidx2 = getelementptr inbounds float* %a, i64 %2 + %3 = load float* %arrayidx2, align 4 + %mul = fmul float %1, %3 +- %arrayidx4 = getelementptr inbounds float* %a, i64 %indvars.iv ++ %arrayidx4 = getelementptr inbounds float* %a, i64 %indvars.iv2 + store float %mul, float* %arrayidx4, align 4 ++ %indvars.iv.next = add nuw nsw i64 %indvars.iv2, 1 ++ %cmp2 = icmp sgt i64 %indvars.iv.next, %size ++ br i1 %cmp2, label %for.end, label %for.body + +- %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 +- br label %for.header +- +-for.end: ++for.end: ; preds = %entry, %for.body + ret void +-} +\ No newline at end of file ++} Index: test/Transforms/LoopVectorize/loop-form.ll =================================================================== --- test/Transforms/LoopVectorize/loop-form.ll @@ -73,3 +165,453 @@ Index: test/Transforms/LoopVectorize/loo +if.end: + ret void +} +Index: test/Transforms/LoopVectorize/runtime-check-readonly-address-space.ll +=================================================================== +--- test/Transforms/LoopVectorize/runtime-check-readonly-address-space.ll ++++ test/Transforms/LoopVectorize/runtime-check-readonly-address-space.ll +@@ -8,26 +8,24 @@ define void @add_ints_1_1_1(i32 addrspace(1)* %a, + ; CHECK-LABEL: @add_ints_1_1_1( + ; CHECK: <4 x i32> + ; CHECK: ret ++ + entry: +- br label %for.cond ++ br label %for.body + +-for.cond: ; preds = %for.body, %entry +- %i.0 = phi i64 [ 0, %entry ], [ %inc, %for.body ] +- %cmp = icmp ult i64 %i.0, 200 +- br i1 %cmp, label %for.body, label %for.end +- +-for.body: ; preds = %for.cond +- %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %i.0 ++for.body: ; preds = %entry, %for.body ++ %i.01 = phi i64 [ 0, %entry ], [ %inc, %for.body ] ++ %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %i.01 + %0 = load i32 addrspace(1)* %arrayidx, align 4 +- %arrayidx1 = getelementptr inbounds i32 addrspace(1)* %c, i64 %i.0 ++ %arrayidx1 = getelementptr inbounds i32 addrspace(1)* %c, i64 %i.01 + %1 = load i32 addrspace(1)* %arrayidx1, align 4 + %add = add nsw i32 %0, %1 +- %arrayidx2 = getelementptr inbounds i32 addrspace(1)* %a, i64 %i.0 ++ %arrayidx2 = getelementptr inbounds i32 addrspace(1)* %a, i64 %i.01 + store i32 %add, i32 addrspace(1)* %arrayidx2, align 4 +- %inc = add i64 %i.0, 1 +- br label %for.cond ++ %inc = add i64 %i.01, 1 ++ %cmp = icmp ult i64 %inc, 200 ++ br i1 %cmp, label %for.body, label %for.end + +-for.end: ; preds = %for.cond ++for.end: ; preds = %for.body + ret void + } + +@@ -35,26 +33,24 @@ define void @add_ints_as_1_0_0(i32 addrspace(1)* % + ; CHECK-LABEL: @add_ints_as_1_0_0( + ; CHECK-NOT: <4 x i32> + ; CHECK: ret ++ + entry: +- br label %for.cond ++ br label %for.body + +-for.cond: ; preds = %for.body, %entry +- %i.0 = phi i64 [ 0, %entry ], [ %inc, %for.body ] +- %cmp = icmp ult i64 %i.0, 200 +- br i1 %cmp, label %for.body, label %for.end +- +-for.body: ; preds = %for.cond +- %arrayidx = getelementptr inbounds i32* %b, i64 %i.0 ++for.body: ; preds = %entry, %for.body ++ %i.01 = phi i64 [ 0, %entry ], [ %inc, %for.body ] ++ %arrayidx = getelementptr inbounds i32* %b, i64 %i.01 + %0 = load i32* %arrayidx, align 4 +- %arrayidx1 = getelementptr inbounds i32* %c, i64 %i.0 ++ %arrayidx1 = getelementptr inbounds i32* %c, i64 %i.01 + %1 = load i32* %arrayidx1, align 4 + %add = add nsw i32 %0, %1 +- %arrayidx2 = getelementptr inbounds i32 addrspace(1)* %a, i64 %i.0 ++ %arrayidx2 = getelementptr inbounds i32 addrspace(1)* %a, i64 %i.01 + store i32 %add, i32 addrspace(1)* %arrayidx2, align 4 +- %inc = add i64 %i.0, 1 +- br label %for.cond ++ %inc = add i64 %i.01, 1 ++ %cmp = icmp ult i64 %inc, 200 ++ br i1 %cmp, label %for.body, label %for.end + +-for.end: ; preds = %for.cond ++for.end: ; preds = %for.body + ret void + } + +@@ -62,26 +58,24 @@ define void @add_ints_as_0_1_0(i32* %a, i32 addrsp + ; CHECK-LABEL: @add_ints_as_0_1_0( + ; CHECK-NOT: <4 x i32> + ; CHECK: ret ++ + entry: +- br label %for.cond ++ br label %for.body + +-for.cond: ; preds = %for.body, %entry +- %i.0 = phi i64 [ 0, %entry ], [ %inc, %for.body ] +- %cmp = icmp ult i64 %i.0, 200 +- br i1 %cmp, label %for.body, label %for.end +- +-for.body: ; preds = %for.cond +- %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %i.0 ++for.body: ; preds = %entry, %for.body ++ %i.01 = phi i64 [ 0, %entry ], [ %inc, %for.body ] ++ %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %i.01 + %0 = load i32 addrspace(1)* %arrayidx, align 4 +- %arrayidx1 = getelementptr inbounds i32* %c, i64 %i.0 ++ %arrayidx1 = getelementptr inbounds i32* %c, i64 %i.01 + %1 = load i32* %arrayidx1, align 4 + %add = add nsw i32 %0, %1 +- %arrayidx2 = getelementptr inbounds i32* %a, i64 %i.0 ++ %arrayidx2 = getelementptr inbounds i32* %a, i64 %i.01 + store i32 %add, i32* %arrayidx2, align 4 +- %inc = add i64 %i.0, 1 +- br label %for.cond ++ %inc = add i64 %i.01, 1 ++ %cmp = icmp ult i64 %inc, 200 ++ br i1 %cmp, label %for.body, label %for.end + +-for.end: ; preds = %for.cond ++for.end: ; preds = %for.body + ret void + } + +@@ -89,26 +83,24 @@ define void @add_ints_as_0_1_1(i32* %a, i32 addrsp + ; CHECK-LABEL: @add_ints_as_0_1_1( + ; CHECK-NOT: <4 x i32> + ; CHECK: ret ++ + entry: +- br label %for.cond ++ br label %for.body + +-for.cond: ; preds = %for.body, %entry +- %i.0 = phi i64 [ 0, %entry ], [ %inc, %for.body ] +- %cmp = icmp ult i64 %i.0, 200 +- br i1 %cmp, label %for.body, label %for.end +- +-for.body: ; preds = %for.cond +- %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %i.0 ++for.body: ; preds = %entry, %for.body ++ %i.01 = phi i64 [ 0, %entry ], [ %inc, %for.body ] ++ %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %i.01 + %0 = load i32 addrspace(1)* %arrayidx, align 4 +- %arrayidx1 = getelementptr inbounds i32 addrspace(1)* %c, i64 %i.0 ++ %arrayidx1 = getelementptr inbounds i32 addrspace(1)* %c, i64 %i.01 + %1 = load i32 addrspace(1)* %arrayidx1, align 4 + %add = add nsw i32 %0, %1 +- %arrayidx2 = getelementptr inbounds i32* %a, i64 %i.0 ++ %arrayidx2 = getelementptr inbounds i32* %a, i64 %i.01 + store i32 %add, i32* %arrayidx2, align 4 +- %inc = add i64 %i.0, 1 +- br label %for.cond ++ %inc = add i64 %i.01, 1 ++ %cmp = icmp ult i64 %inc, 200 ++ br i1 %cmp, label %for.body, label %for.end + +-for.end: ; preds = %for.cond ++for.end: ; preds = %for.body + ret void + } + +@@ -116,26 +108,24 @@ define void @add_ints_as_0_1_2(i32* %a, i32 addrsp + ; CHECK-LABEL: @add_ints_as_0_1_2( + ; CHECK-NOT: <4 x i32> + ; CHECK: ret ++ + entry: +- br label %for.cond ++ br label %for.body + +-for.cond: ; preds = %for.body, %entry +- %i.0 = phi i64 [ 0, %entry ], [ %inc, %for.body ] +- %cmp = icmp ult i64 %i.0, 200 +- br i1 %cmp, label %for.body, label %for.end +- +-for.body: ; preds = %for.cond +- %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %i.0 ++for.body: ; preds = %entry, %for.body ++ %i.01 = phi i64 [ 0, %entry ], [ %inc, %for.body ] ++ %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %i.01 + %0 = load i32 addrspace(1)* %arrayidx, align 4 +- %arrayidx1 = getelementptr inbounds i32 addrspace(2)* %c, i64 %i.0 ++ %arrayidx1 = getelementptr inbounds i32 addrspace(2)* %c, i64 %i.01 + %1 = load i32 addrspace(2)* %arrayidx1, align 4 + %add = add nsw i32 %0, %1 +- %arrayidx2 = getelementptr inbounds i32* %a, i64 %i.0 ++ %arrayidx2 = getelementptr inbounds i32* %a, i64 %i.01 + store i32 %add, i32* %arrayidx2, align 4 +- %inc = add i64 %i.0, 1 +- br label %for.cond ++ %inc = add i64 %i.01, 1 ++ %cmp = icmp ult i64 %inc, 200 ++ br i1 %cmp, label %for.body, label %for.end + +-for.end: ; preds = %for.cond ++for.end: ; preds = %for.body + ret void + } + +Index: test/Transforms/LoopVectorize/runtime-check-address-space.ll +=================================================================== +--- test/Transforms/LoopVectorize/runtime-check-address-space.ll ++++ test/Transforms/LoopVectorize/runtime-check-address-space.ll +@@ -31,25 +31,23 @@ define void @foo(i32 addrspace(1)* %a, i32 addrspa + ; CHECK: ret + + entry: +- br label %for.cond ++ %cmp1 = icmp slt i32 0, %n ++ br i1 %cmp1, label %for.body, label %for.end + +-for.cond: ; preds = %for.body, %entry +- %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ] +- %cmp = icmp slt i32 %i.0, %n +- br i1 %cmp, label %for.body, label %for.end +- +-for.body: ; preds = %for.cond +- %idxprom = sext i32 %i.0 to i64 ++for.body: ; preds = %entry, %for.body ++ %i.02 = phi i32 [ %inc, %for.body ], [ 0, %entry ] ++ %idxprom = sext i32 %i.02 to i64 + %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %idxprom + %0 = load i32 addrspace(1)* %arrayidx, align 4 + %mul = mul nsw i32 %0, 3 +- %idxprom1 = sext i32 %i.0 to i64 ++ %idxprom1 = sext i32 %i.02 to i64 + %arrayidx2 = getelementptr inbounds i32 addrspace(1)* %a, i64 %idxprom1 + store i32 %mul, i32 addrspace(1)* %arrayidx2, align 4 +- %inc = add nsw i32 %i.0, 1 +- br label %for.cond ++ %inc = add nsw i32 %i.02, 1 ++ %cmp = icmp slt i32 %inc, %n ++ br i1 %cmp, label %for.body, label %for.end + +-for.end: ; preds = %for.cond ++for.end: ; preds = %for.body, %entry + ret void + } + +@@ -60,25 +58,23 @@ define void @bar0(i32* %a, i32 addrspace(1)* %b, i + ; CHECK: ret + + entry: +- br label %for.cond ++ %cmp1 = icmp slt i32 0, %n ++ br i1 %cmp1, label %for.body, label %for.end + +-for.cond: ; preds = %for.body, %entry +- %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ] +- %cmp = icmp slt i32 %i.0, %n +- br i1 %cmp, label %for.body, label %for.end +- +-for.body: ; preds = %for.cond +- %idxprom = sext i32 %i.0 to i64 ++for.body: ; preds = %entry, %for.body ++ %i.02 = phi i32 [ %inc, %for.body ], [ 0, %entry ] ++ %idxprom = sext i32 %i.02 to i64 + %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %idxprom + %0 = load i32 addrspace(1)* %arrayidx, align 4 + %mul = mul nsw i32 %0, 3 +- %idxprom1 = sext i32 %i.0 to i64 ++ %idxprom1 = sext i32 %i.02 to i64 + %arrayidx2 = getelementptr inbounds i32* %a, i64 %idxprom1 + store i32 %mul, i32* %arrayidx2, align 4 +- %inc = add nsw i32 %i.0, 1 +- br label %for.cond ++ %inc = add nsw i32 %i.02, 1 ++ %cmp = icmp slt i32 %inc, %n ++ br i1 %cmp, label %for.body, label %for.end + +-for.end: ; preds = %for.cond ++for.end: ; preds = %for.body, %entry + ret void + } + +@@ -89,25 +85,23 @@ define void @bar1(i32 addrspace(1)* %a, i32* %b, i + ; CHECK: ret + + entry: +- br label %for.cond ++ %cmp1 = icmp slt i32 0, %n ++ br i1 %cmp1, label %for.body, label %for.end + +-for.cond: ; preds = %for.body, %entry +- %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ] +- %cmp = icmp slt i32 %i.0, %n +- br i1 %cmp, label %for.body, label %for.end +- +-for.body: ; preds = %for.cond +- %idxprom = sext i32 %i.0 to i64 ++for.body: ; preds = %entry, %for.body ++ %i.02 = phi i32 [ %inc, %for.body ], [ 0, %entry ] ++ %idxprom = sext i32 %i.02 to i64 + %arrayidx = getelementptr inbounds i32* %b, i64 %idxprom + %0 = load i32* %arrayidx, align 4 + %mul = mul nsw i32 %0, 3 +- %idxprom1 = sext i32 %i.0 to i64 ++ %idxprom1 = sext i32 %i.02 to i64 + %arrayidx2 = getelementptr inbounds i32 addrspace(1)* %a, i64 %idxprom1 + store i32 %mul, i32 addrspace(1)* %arrayidx2, align 4 +- %inc = add nsw i32 %i.0, 1 +- br label %for.cond ++ %inc = add nsw i32 %i.02, 1 ++ %cmp = icmp slt i32 %inc, %n ++ br i1 %cmp, label %for.body, label %for.end + +-for.end: ; preds = %for.cond ++for.end: ; preds = %for.body, %entry + ret void + } + +@@ -119,25 +113,23 @@ define void @bar2(i32* noalias %a, i32 addrspace(1 + ; CHECK: ret + + entry: +- br label %for.cond ++ %cmp1 = icmp slt i32 0, %n ++ br i1 %cmp1, label %for.body, label %for.end + +-for.cond: ; preds = %for.body, %entry +- %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ] +- %cmp = icmp slt i32 %i.0, %n +- br i1 %cmp, label %for.body, label %for.end +- +-for.body: ; preds = %for.cond +- %idxprom = sext i32 %i.0 to i64 ++for.body: ; preds = %entry, %for.body ++ %i.02 = phi i32 [ %inc, %for.body ], [ 0, %entry ] ++ %idxprom = sext i32 %i.02 to i64 + %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %idxprom + %0 = load i32 addrspace(1)* %arrayidx, align 4 + %mul = mul nsw i32 %0, 3 +- %idxprom1 = sext i32 %i.0 to i64 ++ %idxprom1 = sext i32 %i.02 to i64 + %arrayidx2 = getelementptr inbounds i32* %a, i64 %idxprom1 + store i32 %mul, i32* %arrayidx2, align 4 +- %inc = add nsw i32 %i.0, 1 +- br label %for.cond ++ %inc = add nsw i32 %i.02, 1 ++ %cmp = icmp slt i32 %inc, %n ++ br i1 %cmp, label %for.body, label %for.end + +-for.end: ; preds = %for.cond ++for.end: ; preds = %for.body, %entry + ret void + } + +@@ -149,25 +141,23 @@ define void @arst0(i32* %b, i32 %n) #0 { + ; CHECK: ret + + entry: +- br label %for.cond ++ %cmp1 = icmp slt i32 0, %n ++ br i1 %cmp1, label %for.body, label %for.end + +-for.cond: ; preds = %for.body, %entry +- %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ] +- %cmp = icmp slt i32 %i.0, %n +- br i1 %cmp, label %for.body, label %for.end +- +-for.body: ; preds = %for.cond +- %idxprom = sext i32 %i.0 to i64 ++for.body: ; preds = %entry, %for.body ++ %i.02 = phi i32 [ %inc, %for.body ], [ 0, %entry ] ++ %idxprom = sext i32 %i.02 to i64 + %arrayidx = getelementptr inbounds i32* %b, i64 %idxprom + %0 = load i32* %arrayidx, align 4 + %mul = mul nsw i32 %0, 3 +- %idxprom1 = sext i32 %i.0 to i64 ++ %idxprom1 = sext i32 %i.02 to i64 + %arrayidx2 = getelementptr inbounds [1024 x i32] addrspace(1)* @g_as1, i64 0, i64 %idxprom1 + store i32 %mul, i32 addrspace(1)* %arrayidx2, align 4 +- %inc = add nsw i32 %i.0, 1 +- br label %for.cond ++ %inc = add nsw i32 %i.02, 1 ++ %cmp = icmp slt i32 %inc, %n ++ br i1 %cmp, label %for.body, label %for.end + +-for.end: ; preds = %for.cond ++for.end: ; preds = %for.body, %entry + ret void + } + +@@ -180,25 +170,23 @@ define void @arst1(i32* %b, i32 %n) #0 { + ; CHECK: ret + + entry: +- br label %for.cond ++ %cmp1 = icmp slt i32 0, %n ++ br i1 %cmp1, label %for.body, label %for.end + +-for.cond: ; preds = %for.body, %entry +- %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ] +- %cmp = icmp slt i32 %i.0, %n +- br i1 %cmp, label %for.body, label %for.end +- +-for.body: ; preds = %for.cond +- %idxprom = sext i32 %i.0 to i64 ++for.body: ; preds = %entry, %for.body ++ %i.02 = phi i32 [ %inc, %for.body ], [ 0, %entry ] ++ %idxprom = sext i32 %i.02 to i64 + %arrayidx = getelementptr inbounds [1024 x i32] addrspace(1)* @g_as1, i64 0, i64 %idxprom + %0 = load i32 addrspace(1)* %arrayidx, align 4 + %mul = mul nsw i32 %0, 3 +- %idxprom1 = sext i32 %i.0 to i64 ++ %idxprom1 = sext i32 %i.02 to i64 + %arrayidx2 = getelementptr inbounds i32* %b, i64 %idxprom1 + store i32 %mul, i32* %arrayidx2, align 4 +- %inc = add nsw i32 %i.0, 1 +- br label %for.cond ++ %inc = add nsw i32 %i.02, 1 ++ %cmp = icmp slt i32 %inc, %n ++ br i1 %cmp, label %for.body, label %for.end + +-for.end: ; preds = %for.cond ++for.end: ; preds = %for.body, %entry + ret void + } + +@@ -210,25 +198,23 @@ define void @aoeu(i32 %n) #0 { + ; CHECK: ret + + entry: +- br label %for.cond ++ %cmp1 = icmp slt i32 0, %n ++ br i1 %cmp1, label %for.body, label %for.end + +-for.cond: ; preds = %for.body, %entry +- %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ] +- %cmp = icmp slt i32 %i.0, %n +- br i1 %cmp, label %for.body, label %for.end +- +-for.body: ; preds = %for.cond +- %idxprom = sext i32 %i.0 to i64 ++for.body: ; preds = %entry, %for.body ++ %i.02 = phi i32 [ %inc, %for.body ], [ 0, %entry ] ++ %idxprom = sext i32 %i.02 to i64 + %arrayidx = getelementptr inbounds [1024 x i32] addrspace(2)* @q_as2, i64 0, i64 %idxprom + %0 = load i32 addrspace(2)* %arrayidx, align 4 + %mul = mul nsw i32 %0, 3 +- %idxprom1 = sext i32 %i.0 to i64 ++ %idxprom1 = sext i32 %i.02 to i64 + %arrayidx2 = getelementptr inbounds [1024 x i32] addrspace(1)* @g_as1, i64 0, i64 %idxprom1 + store i32 %mul, i32 addrspace(1)* %arrayidx2, align 4 +- %inc = add nsw i32 %i.0, 1 +- br label %for.cond ++ %inc = add nsw i32 %i.02, 1 ++ %cmp = icmp slt i32 %inc, %n ++ br i1 %cmp, label %for.body, label %for.end + +-for.end: ; preds = %for.cond ++for.end: ; preds = %for.body, %entry + ret void + } +