svn commit: r315924 - head/sys/dev/iwm

2017-03-24 Thread Adrian Chadd
Author: adrian
Date: Sat Mar 25 02:44:25 2017
New Revision: 315924
URL: https://svnweb.freebsd.org/changeset/base/315924

Log:
  [iwm] GC unused code from if_iwm_scan.c, copyied from iwn or iwlwifi/dvm.
  
  Obtained from:dragonflybsd.git 
10881df269b93c26e5ee6af629c36db5672e6e52

Modified:
  head/sys/dev/iwm/if_iwm_scan.c

Modified: head/sys/dev/iwm/if_iwm_scan.c
==
--- head/sys/dev/iwm/if_iwm_scan.c  Sat Mar 25 02:42:52 2017
(r315923)
+++ head/sys/dev/iwm/if_iwm_scan.c  Sat Mar 25 02:44:25 2017
(r315924)
@@ -161,12 +161,6 @@ __FBSDID("$FreeBSD$");
  * BEGIN mvm/scan.c
  */
 
-#define IWM_PLCP_QUIET_THRESH 1
-#define IWM_ACTIVE_QUIET_TIME 10
-#define LONG_OUT_TIME_PERIOD (600 * IEEE80211_DUR_TU)
-#define SHORT_OUT_TIME_PERIOD (200 * IEEE80211_DUR_TU)
-#define SUSPEND_TIME_PERIOD (100 * IEEE80211_DUR_TU)
-
 static uint16_t
 iwm_mvm_scan_rx_chain(struct iwm_softc *sc)
 {
@@ -181,26 +175,6 @@ iwm_mvm_scan_rx_chain(struct iwm_softc *
return htole16(rx_chain);
 }
 
-#if 0
-static uint32_t
-iwm_mvm_scan_max_out_time(struct iwm_softc *sc, uint32_t flags, int is_assoc)
-{
-   if (!is_assoc)
-   return 0;
-   if (flags & 0x1)
-   return htole32(SHORT_OUT_TIME_PERIOD);
-   return htole32(LONG_OUT_TIME_PERIOD);
-}
-
-static uint32_t
-iwm_mvm_scan_suspend_time(struct iwm_softc *sc, int is_assoc)
-{
-   if (!is_assoc)
-   return 0;
-   return htole32(SUSPEND_TIME_PERIOD);
-}
-#endif
-
 static uint32_t
 iwm_mvm_scan_rate_n_flags(struct iwm_softc *sc, int flags, int no_cck)
 {
@@ -224,32 +198,6 @@ iwm_mvm_scan_rate_n_flags(struct iwm_sof
return htole32(IWM_RATE_6M_PLCP | tx_ant);
 }
 
-#if 0
-/*
- * If req->n_ssids > 0, it means we should do an active scan.
- * In case of active scan w/o directed scan, we receive a zero-length SSID
- * just to notify that this scan is active and not passive.
- * In order to notify the FW of the number of SSIDs we wish to scan (including
- * the zero-length one), we need to set the corresponding bits in chan->type,
- * one for each SSID, and set the active bit (first). If the first SSID is
- * already included in the probe template, so we need to set only
- * req->n_ssids - 1 bits in addition to the first bit.
- */
-static uint16_t
-iwm_mvm_get_active_dwell(struct iwm_softc *sc, int flags, int n_ssids)
-{
-   if (flags & IEEE80211_CHAN_2GHZ)
-   return 30  + 3 * (n_ssids + 1);
-   return 20  + 2 * (n_ssids + 1);
-}
-
-static uint16_t
-iwm_mvm_get_passive_dwell(struct iwm_softc *sc, int flags)
-{
-   return (flags & IEEE80211_CHAN_2GHZ) ? 100 + 20 : 100 + 10;
-}
-#endif
-
 static int
 iwm_mvm_scan_skip_channel(struct ieee80211_channel *c)
 {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r315926 - head/sys/dev/iwm

2017-03-24 Thread Adrian Chadd
Author: adrian
Date: Sat Mar 25 02:55:13 2017
New Revision: 315926
URL: https://svnweb.freebsd.org/changeset/base/315926

Log:
  [iwm] Add the BSS's basic rates to iwm's LQ command, not all the rates.
  
  Makes the firmware use appropriate Tx rates for ACKs.
  
  Obtained from: dragonflybsd.git ab1d3efc208e797c1e09759cd506c95c0aeaa06e

Modified:
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwm/if_iwm_mac_ctxt.c
  head/sys/dev/iwm/if_iwm_util.h

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Sat Mar 25 02:49:20 2017(r315925)
+++ head/sys/dev/iwm/if_iwm.c   Sat Mar 25 02:55:13 2017(r315926)
@@ -4291,6 +4291,21 @@ iwm_node_alloc(struct ieee80211vap *vap,
M_NOWAIT | M_ZERO);
 }
 
+uint8_t
+iwm_ridx2rate(struct ieee80211_rateset *rs, int ridx)
+{
+   int i;
+   uint8_t rval;
+
+   for (i = 0; i < rs->rs_nrates; i++) {
+   rval = (rs->rs_rates[i] & IEEE80211_RATE_VAL);
+   if (rval == iwm_rates[ridx].rate)
+   return rs->rs_rates[i];
+   }
+
+   return 0;
+}
+
 static void
 iwm_setrates(struct iwm_softc *sc, struct iwm_node *in)
 {

Modified: head/sys/dev/iwm/if_iwm_mac_ctxt.c
==
--- head/sys/dev/iwm/if_iwm_mac_ctxt.c  Sat Mar 25 02:49:20 2017
(r315925)
+++ head/sys/dev/iwm/if_iwm_mac_ctxt.c  Sat Mar 25 02:55:13 2017
(r315926)
@@ -162,24 +162,28 @@ __FBSDID("$FreeBSD$");
 
 static void
 iwm_mvm_ack_rates(struct iwm_softc *sc, int is2ghz,
-   int *cck_rates, int *ofdm_rates)
+   int *cck_rates, int *ofdm_rates, struct iwm_node *in)
 {
int lowest_present_ofdm = 100;
int lowest_present_cck = 100;
uint8_t cck = 0;
uint8_t ofdm = 0;
int i;
+   struct ieee80211_rateset *rs = >in_ni.ni_rates;
 
if (is2ghz) {
-   for (i = 0; i <= IWM_LAST_CCK_RATE; i++) {
+   for (i = IWM_FIRST_CCK_RATE; i <= IWM_LAST_CCK_RATE; i++) {
+   if ((iwm_ridx2rate(rs, i) & IEEE80211_RATE_BASIC) == 0)
+   continue;
cck |= (1 << i);
if (lowest_present_cck > i)
lowest_present_cck = i;
}
}
for (i = IWM_FIRST_OFDM_RATE; i <= IWM_LAST_NON_HT_RATE; i++) {
-   int adj = i - IWM_FIRST_OFDM_RATE;
-   ofdm |= (1 << adj);
+   if ((iwm_ridx2rate(rs, i) & IEEE80211_RATE_BASIC) == 0)
+   continue;
+   ofdm |= (1 << (i - IWM_FIRST_OFDM_RATE));
if (lowest_present_ofdm > i)
lowest_present_ofdm = i;
}
@@ -307,7 +311,7 @@ iwm_mvm_mac_ctxt_cmd_common(struct iwm_s
} else {
is2ghz = 1;
}
-   iwm_mvm_ack_rates(sc, is2ghz, _ack_rates, _ack_rates);
+   iwm_mvm_ack_rates(sc, is2ghz, _ack_rates, _ack_rates, in);
cmd->cck_rates = htole32(cck_ack_rates);
cmd->ofdm_rates = htole32(ofdm_ack_rates);
 
@@ -446,13 +450,11 @@ iwm_mvm_mac_ctxt_cmd_station(struct iwm_
 {
struct ieee80211_node *ni = vap->iv_bss;
struct iwm_node *in = IWM_NODE(ni);
-   struct iwm_mac_ctx_cmd cmd;
+   struct iwm_mac_ctx_cmd cmd = {};
 
IWM_DPRINTF(sc, IWM_DEBUG_RESET,
"%s: called; action=%d\n", __func__, action);
 
-   memset(, 0, sizeof(cmd));
-
/* Fill the common data for all mac context types */
iwm_mvm_mac_ctxt_cmd_common(sc, in, , action);
 

Modified: head/sys/dev/iwm/if_iwm_util.h
==
--- head/sys/dev/iwm/if_iwm_util.h  Sat Mar 25 02:49:20 2017
(r315925)
+++ head/sys/dev/iwm/if_iwm_util.h  Sat Mar 25 02:55:13 2017
(r315926)
@@ -120,6 +120,8 @@ extern  int iwm_dma_contig_alloc(bus_dma_
 bus_size_t size, bus_size_t alignment);
 extern void iwm_dma_contig_free(struct iwm_dma_info *);
 
+extern uint8_t iwm_ridx2rate(struct ieee80211_rateset *rs, int ridx);
+
 static inline uint8_t
 iwm_mvm_get_valid_tx_ant(struct iwm_softc *sc)
 {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r315925 - head/sys/dev/iwm

2017-03-24 Thread Adrian Chadd
Author: adrian
Date: Sat Mar 25 02:49:20 2017
New Revision: 315925
URL: https://svnweb.freebsd.org/changeset/base/315925

Log:
  [iwm] Enable Energy Based Scan (EBS).
  
  This can significantly reduce scan duration thus saving time and power.
  EBS failure reported by FW disables EBS for current connection. It is
  re-enabled upon new connection attempt on any WLAN interface.
  
  Obtained from:dragonflybsd.git 
89f579e9823a5c446ca172cf82bbc210d6a054a4

Modified:
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwm/if_iwm_scan.c
  head/sys/dev/iwm/if_iwm_scan.h
  head/sys/dev/iwm/if_iwmreg.h
  head/sys/dev/iwm/if_iwmvar.h

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Sat Mar 25 02:44:25 2017(r315924)
+++ head/sys/dev/iwm/if_iwm.c   Sat Mar 25 02:49:20 2017(r315925)
@@ -4518,6 +4518,11 @@ iwm_newstate(struct ieee80211vap *vap, e
break;
 
case IEEE80211_S_ASSOC:
+   /*
+* EBS may be disabled due to previous failures reported by FW.
+* Reset EBS status here assuming environment has been changed.
+*/
+sc->last_ebs_successful = TRUE;
if ((error = iwm_assoc(vap, sc)) != 0) {
device_printf(sc->sc_dev,
"%s: failed to associate: %d\n", __func__,
@@ -5525,36 +5530,27 @@ iwm_notif_intr(struct iwm_softc *sc)
case IWM_INIT_COMPLETE_NOTIF:
break;
 
-   case IWM_SCAN_OFFLOAD_COMPLETE: {
-   struct iwm_periodic_scan_complete *notif;
-   notif = (void *)pkt->data;
+   case IWM_SCAN_OFFLOAD_COMPLETE:
+   iwm_mvm_rx_lmac_scan_complete_notif(sc, pkt);
if (sc->sc_flags & IWM_FLAG_SCAN_RUNNING) {
sc->sc_flags &= ~IWM_FLAG_SCAN_RUNNING;
ieee80211_runtask(ic, >sc_es_task);
}
break;
-   }
 
case IWM_SCAN_ITERATION_COMPLETE: {
struct iwm_lmac_scan_complete_notif *notif;
notif = (void *)pkt->data;
-   ieee80211_runtask(>sc_ic, >sc_es_task);
-   break;
+   break;
}
- 
-   case IWM_SCAN_COMPLETE_UMAC: {
-   struct iwm_umac_scan_complete *notif;
-   notif = (void *)pkt->data;
 
-   IWM_DPRINTF(sc, IWM_DEBUG_SCAN,
-   "UMAC scan complete, status=0x%x\n",
-   notif->status);
+   case IWM_SCAN_COMPLETE_UMAC:
+   iwm_mvm_rx_umac_scan_complete_notif(sc, pkt);
if (sc->sc_flags & IWM_FLAG_SCAN_RUNNING) {
sc->sc_flags &= ~IWM_FLAG_SCAN_RUNNING;
ieee80211_runtask(ic, >sc_es_task);
}
break;
-   }
 
case IWM_SCAN_ITERATION_COMPLETE_UMAC: {
struct iwm_umac_scan_iter_complete_notif *notif;
@@ -5563,7 +5559,6 @@ iwm_notif_intr(struct iwm_softc *sc)
IWM_DPRINTF(sc, IWM_DEBUG_SCAN, "UMAC scan iteration "
"complete, status=0x%x, %d channels scanned\n",
notif->status, notif->scanned_channels);
-   ieee80211_runtask(>sc_ic, >sc_es_task);
break;
}
 
@@ -5967,6 +5962,9 @@ iwm_attach(device_t dev)
goto fail;
}
 
+   /* Set EBS as successful as long as not stated otherwise by the FW. */
+   sc->last_ebs_successful = TRUE;
+
/* PCI attach */
error = iwm_pci_attach(dev);
if (error != 0)

Modified: head/sys/dev/iwm/if_iwm_scan.c
==
--- head/sys/dev/iwm/if_iwm_scan.c  Sat Mar 25 02:44:25 2017
(r315924)
+++ head/sys/dev/iwm/if_iwm_scan.c  Sat Mar 25 02:49:20 2017
(r315925)
@@ -161,6 +161,9 @@ __FBSDID("$FreeBSD$");
  * BEGIN mvm/scan.c
  */
 
+#define IWM_DENSE_EBS_SCAN_RATIO 5
+#define IWM_SPARSE_EBS_SCAN_RATIO 1
+
 static uint16_t
 iwm_mvm_scan_rx_chain(struct iwm_softc *sc)
 {
@@ -198,6 +201,67 @@ iwm_mvm_scan_rate_n_flags(struct iwm_sof
return htole32(IWM_RATE_6M_PLCP | tx_ant);
 }
 
+static const char *
+iwm_mvm_ebs_status_str(enum iwm_scan_ebs_status status)
+{
+   switch (status) {
+   case IWM_SCAN_EBS_SUCCESS:
+   return "successful";
+   case IWM_SCAN_EBS_INACTIVE:
+   return "inactive";
+   case IWM_SCAN_EBS_FAILED:
+   case IWM_SCAN_EBS_CHAN_NOT_FOUND:
+   default:
+   

svn commit: r315923 - head/sys/dev/iwm

2017-03-24 Thread Adrian Chadd
Author: adrian
Date: Sat Mar 25 02:42:52 2017
New Revision: 315923
URL: https://svnweb.freebsd.org/changeset/base/315923

Log:
  [iwm]  Tiny cleanup in iwm_rx_addbuf().
  
  Obtained from:dragonflybsd.git 
3370bc5504ebb3c1b9bb960a185cd0c8052a2845

Modified:
  head/sys/dev/iwm/if_iwm.c

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Sat Mar 25 02:28:21 2017(r315922)
+++ head/sys/dev/iwm/if_iwm.c   Sat Mar 25 02:42:52 2017(r315923)
@@ -3032,7 +3032,7 @@ iwm_rx_addbuf(struct iwm_softc *sc, int 
struct iwm_rx_ring *ring = >rxq;
struct iwm_rx_data *data = >data[idx];
struct mbuf *m;
-   bus_dmamap_t dmamap = NULL;
+   bus_dmamap_t dmamap;
bus_dma_segment_t seg;
int nsegs, error;
 
@@ -3046,7 +3046,8 @@ iwm_rx_addbuf(struct iwm_softc *sc, int 
if (error != 0) {
device_printf(sc->sc_dev,
"%s: can't map mbuf, error %d\n", __func__, error);
-   goto fail;
+   m_freem(m);
+   return error;
}
 
if (data->m != NULL)
@@ -3067,9 +3068,6 @@ iwm_rx_addbuf(struct iwm_softc *sc, int 
BUS_DMASYNC_PREWRITE);
 
return 0;
-fail:
-   m_freem(m);
-   return error;
 }
 
 /* iwlwifi: mvm/rx.c */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r315922 - head/sys/dev/cxgbe/iw_cxgbe

2017-03-24 Thread Navdeep Parhar
Author: np
Date: Sat Mar 25 02:28:21 2017
New Revision: 315922
URL: https://svnweb.freebsd.org/changeset/base/315922

Log:
  cxgbe/iw_cxgbe: allocations that use GFP_KERNEL (which is M_WAITOK on
  FreeBSD) cannot fail.
  
  MFC after:3 days

Modified:
  head/sys/dev/cxgbe/iw_cxgbe/cm.c

Modified: head/sys/dev/cxgbe/iw_cxgbe/cm.c
==
--- head/sys/dev/cxgbe/iw_cxgbe/cm.cSat Mar 25 01:45:04 2017
(r315921)
+++ head/sys/dev/cxgbe/iw_cxgbe/cm.cSat Mar 25 02:28:21 2017
(r315922)
@@ -2135,14 +2135,6 @@ int c4iw_connect(struct iw_cm_id *cm_id,
goto out;
}
ep = alloc_ep(sizeof(*ep), GFP_KERNEL);
-
-   if (!ep) {
-
-   CTR2(KTR_IW_CXGBE, "%s:cc2 %p", __func__, cm_id);
-   printk(KERN_ERR MOD "%s - cannot alloc ep.\n", __func__);
-   err = -ENOMEM;
-   goto out;
-   }
init_timer(>timer);
ep->plen = conn_param->private_data_len;
 
@@ -2229,21 +2221,11 @@ out:
 int
 c4iw_create_listen_ep(struct iw_cm_id *cm_id, int backlog)
 {
-   int rc;
struct c4iw_dev *dev = to_c4iw_dev(cm_id->device);
struct c4iw_listen_ep *ep;
struct socket *so = cm_id->so;
 
ep = alloc_ep(sizeof(*ep), GFP_KERNEL);
-   CTR5(KTR_IW_CXGBE, "%s: cm_id %p, lso %p, ep %p, inp %p", __func__,
-   cm_id, so, ep, so->so_pcb);
-   if (ep == NULL) {
-   log(LOG_ERR, "%s: failed to alloc memory for endpoint\n",
-   __func__);
-   rc = ENOMEM;
-   goto failed;
-   }
-
ep->com.cm_id = cm_id;
ref_cm_id(>com);
ep->com.dev = dev;
@@ -2255,10 +2237,6 @@ c4iw_create_listen_ep(struct iw_cm_id *c
 
cm_id->provider_data = ep;
return (0);
-
-failed:
-   CTR3(KTR_IW_CXGBE, "%s: cm_id %p, FAILED (%d)", __func__, cm_id, rc);
-   return (-rc);
 }
 
 void
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r315921 - head/sys/dev/cxgbe/iw_cxgbe

2017-03-24 Thread Navdeep Parhar
Author: np
Date: Sat Mar 25 01:45:04 2017
New Revision: 315921
URL: https://svnweb.freebsd.org/changeset/base/315921

Log:
  cxgbe/iw_cxgbe: alloc_ep expects a gfp_t, and it's always ok to sleep during
  alloc_ep.

Modified:
  head/sys/dev/cxgbe/iw_cxgbe/cm.c

Modified: head/sys/dev/cxgbe/iw_cxgbe/cm.c
==
--- head/sys/dev/cxgbe/iw_cxgbe/cm.cSat Mar 25 01:38:17 2017
(r315920)
+++ head/sys/dev/cxgbe/iw_cxgbe/cm.cSat Mar 25 01:45:04 2017
(r315921)
@@ -695,7 +695,7 @@ process_newconn(struct iw_cm_id *parent_
 
MPASS(child_so != NULL);
 
-   child_ep = alloc_ep(sizeof(*child_ep), M_WAITOK);
+   child_ep = alloc_ep(sizeof(*child_ep), GFP_KERNEL);
 
CTR5(KTR_IW_CXGBE,
"%s: parent so %p, parent ep %p, child so %p, child ep %p",
@@ -2134,7 +2134,7 @@ int c4iw_connect(struct iw_cm_id *cm_id,
err = -EINVAL;
goto out;
}
-   ep = alloc_ep(sizeof(*ep), M_NOWAIT);
+   ep = alloc_ep(sizeof(*ep), GFP_KERNEL);
 
if (!ep) {
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r315920 - head/sys/dev/cxgbe/iw_cxgbe

2017-03-24 Thread Navdeep Parhar
Author: np
Date: Sat Mar 25 01:38:17 2017
New Revision: 315920
URL: https://svnweb.freebsd.org/changeset/base/315920

Log:
  cxgbe/iw_cxgbe: c4iw_connect should always returns a -ve errno on failure.
  
  MFC after:3 days

Modified:
  head/sys/dev/cxgbe/iw_cxgbe/cm.c

Modified: head/sys/dev/cxgbe/iw_cxgbe/cm.c
==
--- head/sys/dev/cxgbe/iw_cxgbe/cm.cSat Mar 25 00:52:33 2017
(r315919)
+++ head/sys/dev/cxgbe/iw_cxgbe/cm.cSat Mar 25 01:38:17 2017
(r315920)
@@ -2202,7 +2202,7 @@ int c4iw_connect(struct iw_cm_id *cm_id,
ep->tos = 0;
ep->com.local_addr = cm_id->local_addr;
ep->com.remote_addr = cm_id->remote_addr;
-   err = soconnect(ep->com.so, (struct sockaddr *)>com.remote_addr,
+   err = -soconnect(ep->com.so, (struct sockaddr *)>com.remote_addr,
ep->com.thread);
 
if (!err) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r315918 - head/sys/arm64/conf

2017-03-24 Thread Warner Losh
Author: imp
Date: Fri Mar 24 22:33:03 2017
New Revision: 315918
URL: https://svnweb.freebsd.org/changeset/base/315918

Log:
  Add 'device iic' to bring in userland I2C driver.
  
  Submitted by: karl@

Modified:
  head/sys/arm64/conf/GENERIC

Modified: head/sys/arm64/conf/GENERIC
==
--- head/sys/arm64/conf/GENERIC Fri Mar 24 22:29:51 2017(r315917)
+++ head/sys/arm64/conf/GENERIC Fri Mar 24 22:33:03 2017(r315918)
@@ -174,6 +174,7 @@ device  fdt_pinctrl
 device aw_rsb  # Allwinner Reduced Serial Bus
 device bcm2835_bsc # Broadcom BCM283x I2C bus
 device iicbus
+device iic
 
 # Clock and reset controllers
 device aw_ccu  # Allwinner clock controller
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r315917 - head/sys/net80211

2017-03-24 Thread Andriy Voskoboinyk
Author: avos
Date: Fri Mar 24 22:29:51 2017
New Revision: 315917
URL: https://svnweb.freebsd.org/changeset/base/315917

Log:
  net80211: fix possible panic when wlan(4) interface is destroyed.
  
  If this is the last running vap wait until device will be powered off
  (fixes panic when 'ifconfig wlan0 destroy' is executed for running iwn(4)
  interface).
  
  Tested with:
   - Intel 6205, STA mode.
   - RTL8188EU, STA / IBSS modes.
   - RTL8821AU, STA / HOSTAP modes.

Modified:
  head/sys/net80211/ieee80211.c

Modified: head/sys/net80211/ieee80211.c
==
--- head/sys/net80211/ieee80211.c   Fri Mar 24 18:28:48 2017
(r315916)
+++ head/sys/net80211/ieee80211.c   Fri Mar 24 22:29:51 2017
(r315917)
@@ -728,6 +728,7 @@ ieee80211_vap_detach(struct ieee80211vap
ieee80211_draintask(ic, >iv_nstate_task);
ieee80211_draintask(ic, >iv_swbmiss_task);
ieee80211_draintask(ic, >iv_wme_task);
+   ieee80211_draintask(ic, >ic_parent_task);
 
/* XXX band-aid until ifnet handles this for us */
taskqueue_drain(taskqueue_swi, >if_linktask);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r315901 - head/sbin/devd

2017-03-24 Thread Cy Schubert
In message <201703241346.v2odkqtj019...@repo.freebsd.org>, Warner Losh 
writes:
> Author: imp
> Date: Fri Mar 24 13:46:26 2017
> New Revision: 315901
> URL: https://svnweb.freebsd.org/changeset/base/315901
> 
> Log:
>   Use a more stream-lined version of fix_value.
>   
>   Submitted by: ian@
> 
> Modified:
>   head/sbin/devd/devd.cc
>   head/sbin/devd/devd.hh
> 
> Modified: head/sbin/devd/devd.cc
> =
> =
> --- head/sbin/devd/devd.ccFri Mar 24 11:46:49 2017(r315900)
> +++ head/sbin/devd/devd.ccFri Mar 24 13:46:26 2017(r315901)
> @@ -417,24 +417,16 @@ var_list::is_set(const string ) cons
>   * converted to ". For all other characters, both \ and following
>   * character. So the string 'fre\:\"' is translated to 'fred\:"'.
>   */
> -const std::string &
> +std::string
>  var_list::fix_value(const std::string ) const
>  {
> - char *tmp, *dst;
> - const char *src;
> - std::string *rv;
> -
> - dst = tmp = new char[val.length()];
> - src = val.c_str();
> - while (*src) {
> - if (*src == '\\' && src[1] == '"')
> - src++;
> - else
> - *dst++ = *src++;
> - }
> - rv = new string(tmp);
> - delete tmp;
> - return *rv;
> +std::string rv(val);
> +std::string::size_type pos(0);
> +
> +while ((pos = rv.find("\\\"", pos)) != rv.npos) {
> +rv.erase(pos, 1);
> +}
> +return (rv);
>  }
>  
>  void
> 
> Modified: head/sbin/devd/devd.hh
> =
> =
> --- head/sbin/devd/devd.hhFri Mar 24 11:46:49 2017(r315900)
> +++ head/sbin/devd/devd.hhFri Mar 24 13:46:26 2017(r315901)
> @@ -57,7 +57,7 @@ public:
>   static const std::string nothing;
>  
>  private:
> - const std::string _value(const std::string ) const;
> + std::string fix_value(const std::string ) const;
>  
>   std::map _vars;
>  };
> 
> 

Thank you Warner.


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX:     Web:  http://www.FreeBSD.org

The need of the many outweighs the greed of the few.


___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r315662 - in head: contrib/bsnmp/snmp_mibII contrib/ipfilter/ipsend lib/libprocstat sys/netinet sys/sys usr.bin/netstat usr.bin/sockstat usr.bin/systat usr.sbin/tcpdrop usr.sbin/trpt

2017-03-24 Thread John Baldwin
On Friday, March 24, 2017 10:45:09 AM Gleb Smirnoff wrote:
>   John,
> 
> On Tue, Mar 21, 2017 at 02:24:30PM -0700, John Baldwin wrote:
> J> > I have very much anticipated this comment from you, John.
> J> > 
> J> > I would like to remind you, that we have had this very exact conversation
> J> > back when I removed kvm support from netstat/route.c. Let me search the
> J> > archives:
> J> > 
> J> > https://lists.freebsd.org/pipermail/svn-src-head/2015-April/070480.html
> J> > 
> J> > This conversation has had a continuation on IRC, which I don't archive.
> J> > 
> J> > AFAIR, first I told that with all my involvement into networking stack,
> J> > I never ever had experienced a need to run route stats on a core. The
> J> > debugger were the only useful tool. And that opinion was seconded by
> J> > other network hackers. Then we discussed that a proper tool chould use
> J> > dynamic type parsing and not kvm(3). You said that future gdb has python
> J> > scripting and that would work fine. Meanwhile, you insisted that I 
> restore
> J> > the functionality. I resisted to put kvm(3) back into netstat/route.c, 
> and
> J> > instead I created a gdb script that prints exactly what 'nestat -anr -M 
> core'
> J> > prints. And I committed the script just to satisfy your demand:
> J> > 
> J> > tools/debugscripts/netstat-anr.gdb
> J> > 
> J> > Can you please fairly answer, have you (or anyone else) ever used the
> J> > script during these 2 years?
> J> 
> J> You never updated crashinfo to use the script (the point of crashinfo is to
> J> give an automated bit of information users can include in bug reports).
> J> crashinfo came from Yahoo! where knowing the active state of the system
> J> during a crash was indeed useful.  It wasn't necessarily about debugging a
> J> panic in the network stack, but about obtaining information about the 
> system
> J> useful in debugging crashes in arbitrary parts of the kernel.  I don't work
> J> at Y! anymore, so I'm not in the same environment.  Those things tend to be
> J> more useful when dealing with a large deployment of hetergenous systems
> J> rather than doing focused development on a driver or a bunch of identical
> J> systems with the same workload / role (e.g. appliances).
> 
> Since you outlined that it is important that systems are heterogenous, looks
> like you anticipated my reply that at Netflix we also do automated crash
> collection. :)
> 
> Still, my personal experience is that when analyzing a crash, you aren't
> interested in full table, be it a routing table or a PCB list. You are
> focused on the entry that crashed. This experience comes from my previous
> job Rambler, which is a Russian version of Yahoo! :)
> All the time I analyzed our internal crashes, or FreeBSD PRs, I always
> PgDown-ed this tons of information.

I'm not saying it is always useful, but it is sometimes useful.  And it may
not be a panic in the network stack, but more "which connections and on which
mix of ports were active when it crashed".  'ps' output isn't only useful
when you have a crash in fork().  It happens to be useful for other types of
panics as well.
 
> J> Also, the setgid thing is a red herring.  You don't need setgid to read 
> from
> J> a core, only to use kvm against a live system.  I'm all for using sysctls 
> to
> J> fetch data against live system and only keeping kvm for use with core dumps
> J> which doesn't require setgid.
> 
> Which means that if you want a tool to print out stats from a core, that 
> should
> be a separate tool. And the runtime tool netstat should get free of kvm, and 
> of
> setgid bit.

A separate tool means that you have to reproduce the formatting bits, and it
is convenient to have consistent output.
 
> Here we again come to the need of debugger with better scripting support. What
> are the expectations for newer gdb which has python scripting?

'pkg install gdb' has provided a working kgdb for over a year now.  crashinfo
will even look for and prefer kgdb from ports over kgdb from base.

-- 
John Baldwin
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r315662 - in head: contrib/bsnmp/snmp_mibII contrib/ipfilter/ipsend lib/libprocstat sys/netinet sys/sys usr.bin/netstat usr.bin/sockstat usr.bin/systat usr.sbin/tcpdrop usr.sbin/trpt

2017-03-24 Thread Gleb Smirnoff
  John,

On Tue, Mar 21, 2017 at 02:24:30PM -0700, John Baldwin wrote:
J> > I have very much anticipated this comment from you, John.
J> > 
J> > I would like to remind you, that we have had this very exact conversation
J> > back when I removed kvm support from netstat/route.c. Let me search the
J> > archives:
J> > 
J> > https://lists.freebsd.org/pipermail/svn-src-head/2015-April/070480.html
J> > 
J> > This conversation has had a continuation on IRC, which I don't archive.
J> > 
J> > AFAIR, first I told that with all my involvement into networking stack,
J> > I never ever had experienced a need to run route stats on a core. The
J> > debugger were the only useful tool. And that opinion was seconded by
J> > other network hackers. Then we discussed that a proper tool chould use
J> > dynamic type parsing and not kvm(3). You said that future gdb has python
J> > scripting and that would work fine. Meanwhile, you insisted that I restore
J> > the functionality. I resisted to put kvm(3) back into netstat/route.c, and
J> > instead I created a gdb script that prints exactly what 'nestat -anr -M 
core'
J> > prints. And I committed the script just to satisfy your demand:
J> > 
J> > tools/debugscripts/netstat-anr.gdb
J> > 
J> > Can you please fairly answer, have you (or anyone else) ever used the
J> > script during these 2 years?
J> 
J> You never updated crashinfo to use the script (the point of crashinfo is to
J> give an automated bit of information users can include in bug reports).
J> crashinfo came from Yahoo! where knowing the active state of the system
J> during a crash was indeed useful.  It wasn't necessarily about debugging a
J> panic in the network stack, but about obtaining information about the system
J> useful in debugging crashes in arbitrary parts of the kernel.  I don't work
J> at Y! anymore, so I'm not in the same environment.  Those things tend to be
J> more useful when dealing with a large deployment of hetergenous systems
J> rather than doing focused development on a driver or a bunch of identical
J> systems with the same workload / role (e.g. appliances).

Since you outlined that it is important that systems are heterogenous, looks
like you anticipated my reply that at Netflix we also do automated crash
collection. :)

Still, my personal experience is that when analyzing a crash, you aren't
interested in full table, be it a routing table or a PCB list. You are
focused on the entry that crashed. This experience comes from my previous
job Rambler, which is a Russian version of Yahoo! :)
All the time I analyzed our internal crashes, or FreeBSD PRs, I always
PgDown-ed this tons of information.

J> Also, the setgid thing is a red herring.  You don't need setgid to read from
J> a core, only to use kvm against a live system.  I'm all for using sysctls to
J> fetch data against live system and only keeping kvm for use with core dumps
J> which doesn't require setgid.

Which means that if you want a tool to print out stats from a core, that should
be a separate tool. And the runtime tool netstat should get free of kvm, and of
setgid bit.

Here we again come to the need of debugger with better scripting support. What
are the expectations for newer gdb which has python scripting?

-- 
Totus tuus, Glebius.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r315914 - in head/sys: amd64/amd64 i386/i386

2017-03-24 Thread Bruce Evans
Author: bde
Date: Fri Mar 24 17:34:55 2017
New Revision: 315914
URL: https://svnweb.freebsd.org/changeset/base/315914

Log:
  Remove buggy adjustment of page tables in db_write_bytes().
  
  Long ago, perhaps only on i386, kernel text was mapped read-only and
  it was necessary to change the mapping to read-write to set breakpoints
  in kernel text.  Other writes by ddb to kernel text were also allowed.
  This write protection is harder to implement with 4MB pages, and was
  lost even for 4K pages when 4MB pages were implemented.  So changing
  the mapping became useless.  It was actually worse than useless since
  it followed followed various null and otherwise garbage pointers to
  not change random memory instead of the mapping.  (On i386s, the
  pointers became good in pmap_bootstrap(), and on amd64 the pointers
  became bad in pmap_bootstrap() if not before.)
  
  Another bug broke detection of following of null pointers on i386,
  except early in boot where not detecting this was a feature.  When
  I fixed the bug, I accidentally broke the feature and soon got traps
  in db_write_bytes().  Setting breakpoints early in ddb was broken.
  
  kib pointed out that a clean way to do the adjustment would be to use
  a special [sub]map giving a small window on the bytes to be written.
  
  The trap handler didn't know how to fix up errors for pagefaults
  accessing the map itself.  Such errors rarely need fixups, since most
  traps for the map are for the first access which is a read.
  
  Reviewed by:  kib

Modified:
  head/sys/amd64/amd64/db_interface.c
  head/sys/i386/i386/db_interface.c

Modified: head/sys/amd64/amd64/db_interface.c
==
--- head/sys/amd64/amd64/db_interface.c Fri Mar 24 16:26:11 2017
(r315913)
+++ head/sys/amd64/amd64/db_interface.c Fri Mar 24 17:34:55 2017
(r315914)
@@ -30,17 +30,11 @@ __FBSDID("$FreeBSD$");
 /*
  * Interface to new debugger.
  */
+
 #include 
 #include 
 #include 
-#include 
 #include 
-#include 
-
-#include 
-
-#include 
-#include 
 
 #include 
 
@@ -75,63 +69,16 @@ db_write_bytes(vm_offset_t addr, size_t 
jmp_buf jb;
void *prev_jb;
char *dst;
-   pt_entry_t  *ptep0 = NULL;
-   pt_entry_t  oldmap0 = 0;
-   vm_offset_t addr1;
-   pt_entry_t  *ptep1 = NULL;
-   pt_entry_t  oldmap1 = 0;
int ret;
 
prev_jb = kdb_jmpbuf(jb);
ret = setjmp(jb);
if (ret == 0) {
-   if (addr > trunc_page((vm_offset_t)btext) - size &&
-   addr < round_page((vm_offset_t)etext)) {
-
-   ptep0 = vtopte(addr);
-   oldmap0 = *ptep0;
-   *ptep0 |= PG_RW;
-
-   /*
-* Map another page if the data crosses a page
-* boundary.
-*/
-   if ((*ptep0 & PG_PS) == 0) {
-   addr1 = trunc_page(addr + size - 1);
-   if (trunc_page(addr) != addr1) {
-   ptep1 = vtopte(addr1);
-   oldmap1 = *ptep1;
-   *ptep1 |= PG_RW;
-   }
-   } else {
-   addr1 = trunc_2mpage(addr + size - 1);
-   if (trunc_2mpage(addr) != addr1) {
-   ptep1 = vtopte(addr1);
-   oldmap1 = *ptep1;
-   *ptep1 |= PG_RW;
-   }
-   }
-
-   invltlb();
-   }
-
dst = (char *)addr;
-
while (size-- > 0)
*dst++ = *data++;
}
-
(void)kdb_jmpbuf(prev_jb);
-
-   if (ptep0) {
-   *ptep0 = oldmap0;
-
-   if (ptep1)
-   *ptep1 = oldmap1;
-
-   invltlb();
-   }
-
return (ret);
 }
 

Modified: head/sys/i386/i386/db_interface.c
==
--- head/sys/i386/i386/db_interface.c   Fri Mar 24 16:26:11 2017
(r315913)
+++ head/sys/i386/i386/db_interface.c   Fri Mar 24 17:34:55 2017
(r315914)
@@ -30,17 +30,14 @@ __FBSDID("$FreeBSD$");
 /*
  * Interface to new debugger.
  */
+
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
 
-#include 
-
-#include 
-#include 
+#include 
 
 #include 
 
@@ -75,63 +72,16 @@ db_write_bytes(vm_offset_t addr, size_t 
jmp_buf jb;
void *prev_jb;
char *dst;
-   pt_entry_t *ptep0 = NULL;
-   pt_entry_t oldmap0 = 0;
-   vm_offset_t addr1;
-   pt_entry_t *ptep1 = NULL;
-   pt_entry_t oldmap1 = 0;
int ret;
 
prev_jb = 

svn commit: r315913 - head/sys/dev/isp

2017-03-24 Thread Alexander Motin
Author: mav
Date: Fri Mar 24 16:26:11 2017
New Revision: 315913
URL: https://svnweb.freebsd.org/changeset/base/315913

Log:
  Add brackets to fix incorrect macro expansion.
  
  Reported by:  Andreas Hollmann / PVS-Studio
  MFC after:2 weeks

Modified:
  head/sys/dev/isp/ispmbox.h

Modified: head/sys/dev/isp/ispmbox.h
==
--- head/sys/dev/isp/ispmbox.h  Fri Mar 24 16:18:57 2017(r315912)
+++ head/sys/dev/isp/ispmbox.h  Fri Mar 24 16:26:11 2017(r315913)
@@ -1207,7 +1207,7 @@ typedef struct {
 #defineICB2400_VPINFO_OFF  0x80/* offset from start of ICB */
 #defineICB2400_VPINFO_PORT_OFF(chan)   \
 (ICB2400_VPINFO_OFF +  \
- sizeof (isp_icb_2400_vpinfo_t) + (chan * ICB2400_VPOPT_WRITE_SIZE))
+ sizeof (isp_icb_2400_vpinfo_t) + ((chan) * ICB2400_VPOPT_WRITE_SIZE))
 
 #defineICB2400_VPGOPT_FCA  0x01/* Assume Clean Address 
bit in FLOGI ACC set (works only in static configurations) */
 #defineICB2400_VPGOPT_MID_DISABLE  0x02/* when set, connection 
mode2 will work with NPIV-capable switched */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r315912 - head/usr.sbin/pw

2017-03-24 Thread Eugene Grosbein
Author: eugen (ports committer)
Date: Fri Mar 24 16:18:57 2017
New Revision: 315912
URL: https://svnweb.freebsd.org/changeset/base/315912

Log:
  Properly initialise with content of pw.conf(5) that was mistakenly ignored.
  Also, respect "defaultgroup" if specified there.
  
  PR:   217934
  Reported by:  Victor Sudakov 
  Reviewed by:  bapt
  Approved by:  bapt, vsevolod (mentor)
  MFC after:1 week

Modified:
  head/usr.sbin/pw/pw_user.c

Modified: head/usr.sbin/pw/pw_user.c
==
--- head/usr.sbin/pw/pw_user.c  Fri Mar 24 16:18:20 2017(r315911)
+++ head/usr.sbin/pw/pw_user.c  Fri Mar 24 16:18:57 2017(r315912)
@@ -1177,7 +1177,7 @@ pw_user_add(int argc, char **argv, char 
char line[_PASSWORD_LEN+1], path[MAXPATHLEN];
char *gecos, *homedir, *skel, *walk, *userid, *groupid, *grname;
char *default_passwd, *name, *p;
-   const char *cfg;
+   const char *cfg = NULL;
login_cap_t *lc;
FILE *pfp, *fp;
intmax_t id = -1;
@@ -1356,6 +1356,9 @@ pw_user_add(int argc, char **argv, char 
if (GETPWNAM(name) != NULL)
errx(EX_DATAERR, "login name `%s' already exists", name);
 
+   if (!grname)
+   grname = cmdcnf->default_group;
+
pwd = 
pwd->pw_name = name;
pwd->pw_class = cmdcnf->default_class ? cmdcnf->default_class : "";
@@ -1485,7 +1488,7 @@ pw_user_mod(int argc, char **argv, char 
struct group *grp;
StringList *groups = NULL;
char args[] = "C:qn:u:c:d:e:p:g:G:mM:l:k:s:w:L:h:H:NPYy:";
-   const char *cfg;
+   const char *cfg = NULL;
char *gecos, *homedir, *grname, *name, *newname, *walk, *skel, *shell;
char *passwd, *class, *nispasswd;
login_cap_t *lc;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r315911 - head/sys/x86/x86

2017-03-24 Thread Gavin Atkinson
Author: gavin
Date: Fri Mar 24 16:18:20 2017
New Revision: 315911
URL: https://svnweb.freebsd.org/changeset/base/315911

Log:
  Improve grammar on a warning, and only use one line rather than two when
  printing it.

Modified:
  head/sys/x86/x86/mp_x86.c

Modified: head/sys/x86/x86/mp_x86.c
==
--- head/sys/x86/x86/mp_x86.c   Fri Mar 24 16:01:19 2017(r315910)
+++ head/sys/x86/x86/mp_x86.c   Fri Mar 24 16:18:20 2017(r315911)
@@ -209,14 +209,14 @@ add_deterministic_cache(int type, int le
 
if (caches[level - 1].id_shift > pkg_id_shift) {
printf("WARNING: L%u data cache covers more "
-   "APIC IDs than a package\n", level);
-   printf("%u > %u\n", caches[level - 1].id_shift, pkg_id_shift);
+   "APIC IDs than a package (%u > %u)\n", level,
+   caches[level - 1].id_shift, pkg_id_shift);
caches[level - 1].id_shift = pkg_id_shift;
}
if (caches[level - 1].id_shift < core_id_shift) {
-   printf("WARNING: L%u data cache covers less "
-   "APIC IDs than a core\n", level);
-   printf("%u < %u\n", caches[level - 1].id_shift, core_id_shift);
+   printf("WARNING: L%u data cache covers fewer "
+   "APIC IDs than a core (%u < %u)\n", level,
+   caches[level - 1].id_shift, core_id_shift);
caches[level - 1].id_shift = core_id_shift;
}
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r315910 - head/sys/kern

2017-03-24 Thread Gleb Smirnoff
Author: glebius
Date: Fri Mar 24 16:01:19 2017
New Revision: 315910
URL: https://svnweb.freebsd.org/changeset/base/315910

Log:
  Make sendfile(2) more robust against file change.  This fixes a possible
  crash when the file shrinks.  This also fixes sendfile(2) not sending more
  data in a case when the file grows, and the request is open-ended or
  specifies a size that is greater than old file size.
  
  PR:   217789
  Reviewed by:  gallatin
  MFC after:10 days

Modified:
  head/sys/kern/kern_sendfile.c

Modified: head/sys/kern/kern_sendfile.c
==
--- head/sys/kern/kern_sendfile.c   Fri Mar 24 14:45:58 2017
(r315909)
+++ head/sys/kern/kern_sendfile.c   Fri Mar 24 16:01:19 2017
(r315910)
@@ -689,11 +689,10 @@ retry_space:
goto done;
}
if (va.va_size != obj_size) {
-   if (nbytes == 0)
-   rem += va.va_size - obj_size;
-   else if (offset + nbytes > va.va_size)
-   rem -= (offset + nbytes - va.va_size);
obj_size = va.va_size;
+   rem = nbytes ?
+   omin(nbytes + offset, obj_size) : obj_size;
+   rem -= off;
}
}
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r315909 - in head/contrib/openpam: include/security lib/libpam

2017-03-24 Thread Dag-Erling Smørgrav
Author: des
Date: Fri Mar 24 14:45:58 2017
New Revision: 315909
URL: https://svnweb.freebsd.org/changeset/base/315909

Log:
  Restore the NULL check that was removed in upstream r913.  It is not
  unreasonable to call pam_end() with a NULL pamh in error handling code.
  
  Reported by:  rwatson

Modified:
  head/contrib/openpam/include/security/pam_appl.h
  head/contrib/openpam/lib/libpam/pam_end.c

Modified: head/contrib/openpam/include/security/pam_appl.h
==
--- head/contrib/openpam/include/security/pam_appl.hFri Mar 24 14:44:03 
2017(r315908)
+++ head/contrib/openpam/include/security/pam_appl.hFri Mar 24 14:45:58 
2017(r315909)
@@ -72,8 +72,7 @@ pam_close_session(pam_handle_t *_pamh,
 
 int
 pam_end(pam_handle_t *_pamh,
-   int _status)
-   OPENPAM_NONNULL((1));
+   int _status);
 
 int
 pam_get_data(const pam_handle_t *_pamh,

Modified: head/contrib/openpam/lib/libpam/pam_end.c
==
--- head/contrib/openpam/lib/libpam/pam_end.c   Fri Mar 24 14:44:03 2017
(r315908)
+++ head/contrib/openpam/lib/libpam/pam_end.c   Fri Mar 24 14:45:58 2017
(r315909)
@@ -60,6 +60,8 @@ pam_end(pam_handle_t *pamh,
int i;
 
ENTER();
+   if (pamh == NULL)
+   RETURNC(PAM_SYSTEM_ERR);
 
/* clear module data */
while ((dp = pamh->module_data) != NULL) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r315908 - head/sys/dev/isp

2017-03-24 Thread Alexander Motin
Author: mav
Date: Fri Mar 24 14:44:03 2017
New Revision: 315908
URL: https://svnweb.freebsd.org/changeset/base/315908

Log:
  Unify initiator and target DMA setup and command sending.
  
  The code is so alike that it is pointless to keep it separate.
  
  MFC after:2 weeks

Modified:
  head/sys/dev/isp/isp_freebsd.c
  head/sys/dev/isp/isp_freebsd.h
  head/sys/dev/isp/isp_library.c
  head/sys/dev/isp/isp_library.h
  head/sys/dev/isp/isp_pci.c
  head/sys/dev/isp/isp_sbus.c
  head/sys/dev/isp/ispvar.h

Modified: head/sys/dev/isp/isp_freebsd.c
==
--- head/sys/dev/isp/isp_freebsd.c  Fri Mar 24 14:40:53 2017
(r315907)
+++ head/sys/dev/isp/isp_freebsd.c  Fri Mar 24 14:44:03 2017
(r315908)
@@ -1372,10 +1372,7 @@ isp_target_start_ctio(ispsoftc_t *isp, u
} else {
ct2_entry_t *cto = (ct2_entry_t *) local;
 
-   if (isp->isp_osinfo.sixtyfourbit)
-   cto->ct_header.rqs_entry_type = RQSTYPE_CTIO3;
-   else
-   cto->ct_header.rqs_entry_type = RQSTYPE_CTIO2;
+   cto->ct_header.rqs_entry_type = RQSTYPE_CTIO2;
cto->ct_header.rqs_entry_count = 1;
cto->ct_header.rqs_seqno |= ATPD_SEQ_NOTIFY_CAM;
ATPD_SET_SEQNO(cto, atp);
@@ -1468,14 +1465,8 @@ isp_target_start_ctio(ispsoftc_t *isp, u
isp_prt(isp, ISP_LOGTDEBUG0, "%s: ests 
base %p vaddr %p ecmd_dma %jx addr %jx len %u", __func__, 
isp->isp_osinfo.ecmd_base, atp->ests,
(uintmax_t) 
isp->isp_osinfo.ecmd_dma, (uintmax_t)addr, MIN_FCP_RESPONSE_SIZE + 
sense_length);
cto->rsp.m2.ct_datalen = 
MIN_FCP_RESPONSE_SIZE + sense_length;
-   if (cto->ct_header.rqs_entry_type == 
RQSTYPE_CTIO3) {
-   
cto->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_base = DMA_LO32(addr);
-   
cto->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_basehi = DMA_HI32(addr);
-   
cto->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_count = MIN_FCP_RESPONSE_SIZE + 
sense_length;
-   } else {
-   
cto->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_base = DMA_LO32(addr);
-   
cto->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_count = MIN_FCP_RESPONSE_SIZE + 
sense_length;
-   }
+   
cto->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_base = DMA_LO32(addr);
+   
cto->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_count = MIN_FCP_RESPONSE_SIZE + 
sense_length;
}
if (sense_length) {
isp_prt(isp, ISP_LOGTDEBUG0, "%s: 
CTIO2[0x%x] seq %u nc %d CDB0=%x sstatus=0x%x flags=0x%x resid=%d sense: %x 
%x/%x/%x", __func__,
@@ -3468,7 +3459,7 @@ isp_action(struct cam_sim *sim, union cc
cpi->max_lun = ISP_MAX_LUNS(isp) == 0 ?
255 : ISP_MAX_LUNS(isp) - 1;
cpi->bus_id = cam_sim_bus(sim);
-   if (isp->isp_osinfo.sixtyfourbit)
+   if (sizeof (bus_size_t) > 4)
cpi->maxio = (ISP_NSEG64_MAX - 1) * PAGE_SIZE;
else
cpi->maxio = (ISP_NSEG_MAX - 1) * PAGE_SIZE;

Modified: head/sys/dev/isp/isp_freebsd.h
==
--- head/sys/dev/isp/isp_freebsd.h  Fri Mar 24 14:40:53 2017
(r315907)
+++ head/sys/dev/isp/isp_freebsd.h  Fri Mar 24 14:44:03 2017
(r315908)
@@ -293,7 +293,6 @@ struct isposinfo {
struct isp_pcmd *   pcmd_pool;
struct isp_pcmd *   pcmd_free;
 
-   int sixtyfourbit;   /* sixtyfour bit platform */
int mbox_sleeping;
int mbox_sleep_ok;
int mboxbsy;
@@ -505,6 +504,13 @@ default:   
\
 d->ds_base = DMA_LO32(e->ds_addr); \
 d->ds_count = e->ds_len;   \
 }
+#if (BUS_SPACE_MAXADDR > UINT32_MAX)
+#define XS_NEED_DMA64_SEG(s, n)\
+   (((bus_dma_segment_t *)s)[n].ds_addr +  \
+   ((bus_dma_segment_t *)s)[n].ds_len > UINT32_MAX)
+#else
+#define XS_NEED_DMA64_SEG(s, n)(0)
+#endif
 #defineXS_ISP(ccb) 
cam_sim_softc(xpt_path_sim((ccb)->ccb_h.path))
 #defineXS_CHANNEL(ccb) 
cam_sim_bus(xpt_path_sim((ccb)->ccb_h.path))
 #defineXS_TGT(ccb)  

svn commit: r315905 - head/sys/dev/e1000

2017-03-24 Thread Sean Bruno
Author: sbruno
Date: Fri Mar 24 14:27:29 2017
New Revision: 315905
URL: https://svnweb.freebsd.org/changeset/base/315905

Log:
  Add missing 'else' to conditional.  This doesn't really affect the code
  flow or configuration in any way.

Modified:
  head/sys/dev/e1000/if_em.c

Modified: head/sys/dev/e1000/if_em.c
==
--- head/sys/dev/e1000/if_em.c  Fri Mar 24 14:26:01 2017(r315904)
+++ head/sys/dev/e1000/if_em.c  Fri Mar 24 14:27:29 2017(r315905)
@@ -3231,7 +3231,7 @@ em_if_enable_intr(if_ctx_t ctx)
if (hw->mac.type == e1000_82574) {
E1000_WRITE_REG(hw, EM_EIAC, EM_MSIX_MASK);
ims_mask |= adapter->ims;
-   } if (adapter->intr_type == IFLIB_INTR_MSIX && hw->mac.type >= 
igb_mac_min)  {
+   } else if (adapter->intr_type == IFLIB_INTR_MSIX && hw->mac.type >= 
igb_mac_min)  {
u32 mask = (adapter->que_mask | adapter->link_mask);
 
E1000_WRITE_REG(>hw, E1000_EIAC, mask);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r315903 - head/sys/dev/e1000

2017-03-24 Thread Sean Bruno
Author: sbruno
Date: Fri Mar 24 14:25:56 2017
New Revision: 315903
URL: https://svnweb.freebsd.org/changeset/base/315903

Log:
  Add missing 'else' to 3-state conditional during setup of interrupts.
  
  We don't want to overwrite the 82574 interrupt setup with a different
  configuration.
  
  PR:   218041
  Submitted by: razmys...@viva64.com

Modified:
  head/sys/dev/e1000/if_em.c

Modified: head/sys/dev/e1000/if_em.c
==
--- head/sys/dev/e1000/if_em.c  Fri Mar 24 14:19:52 2017(r315902)
+++ head/sys/dev/e1000/if_em.c  Fri Mar 24 14:25:56 2017(r315903)
@@ -1941,10 +1941,11 @@ em_if_msix_intr_assign(if_ctx_t ctx, int
tx_que->eims = 1 << (22 + i);
adapter->ims |= tx_que->eims;
adapter->ivars |= (8 | tx_que->msix) << (8 + (i * 4));
-   } if (adapter->hw.mac.type == e1000_82575)
+   } else if (adapter->hw.mac.type == e1000_82575) {
tx_que->eims = E1000_EICR_TX_QUEUE0 << (i %  
adapter->tx_num_queues);
-   else
+   } else {
tx_que->eims = 1 << (i %  adapter->tx_num_queues);
+   }
}
 
/* Link interrupt */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r315901 - head/sbin/devd

2017-03-24 Thread Warner Losh
Author: imp
Date: Fri Mar 24 13:46:26 2017
New Revision: 315901
URL: https://svnweb.freebsd.org/changeset/base/315901

Log:
  Use a more stream-lined version of fix_value.
  
  Submitted by: ian@

Modified:
  head/sbin/devd/devd.cc
  head/sbin/devd/devd.hh

Modified: head/sbin/devd/devd.cc
==
--- head/sbin/devd/devd.cc  Fri Mar 24 11:46:49 2017(r315900)
+++ head/sbin/devd/devd.cc  Fri Mar 24 13:46:26 2017(r315901)
@@ -417,24 +417,16 @@ var_list::is_set(const string ) cons
  * converted to ". For all other characters, both \ and following
  * character. So the string 'fre\:\"' is translated to 'fred\:"'.
  */
-const std::string &
+std::string
 var_list::fix_value(const std::string ) const
 {
-   char *tmp, *dst;
-   const char *src;
-   std::string *rv;
-
-   dst = tmp = new char[val.length()];
-   src = val.c_str();
-   while (*src) {
-   if (*src == '\\' && src[1] == '"')
-   src++;
-   else
-   *dst++ = *src++;
-   }
-   rv = new string(tmp);
-   delete tmp;
-   return *rv;
+std::string rv(val);
+std::string::size_type pos(0);
+
+while ((pos = rv.find("\\\"", pos)) != rv.npos) {
+rv.erase(pos, 1);
+}
+return (rv);
 }
 
 void

Modified: head/sbin/devd/devd.hh
==
--- head/sbin/devd/devd.hh  Fri Mar 24 11:46:49 2017(r315900)
+++ head/sbin/devd/devd.hh  Fri Mar 24 13:46:26 2017(r315901)
@@ -57,7 +57,7 @@ public:
static const std::string nothing;
 
 private:
-   const std::string _value(const std::string ) const;
+   std::string fix_value(const std::string ) const;
 
std::map _vars;
 };
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r315900 - in head: lib/libthread_db/arch/arm sys/arm/arm sys/arm/include

2017-03-24 Thread Michal Meloun
Author: mmel
Date: Fri Mar 24 11:46:49 2017
New Revision: 315900
URL: https://svnweb.freebsd.org/changeset/base/315900

Log:
  Cleanup structures related to VFP and/or mcontext_t.
  - in mcontext_t, rename newer used 'union __vfp' to equaly sized 'mc_spare'.
Space allocated by 'union __vfp' is too small and cannot hold full
VFP context.
  - move structures defined in fp.h to more appropriate headers.
  - remove all unused VFP structures.
  
  MFC after:2 weeks

Deleted:
  head/sys/arm/include/fp.h
Modified:
  head/lib/libthread_db/arch/arm/libpthread_md.c
  head/sys/arm/arm/vfp.c
  head/sys/arm/include/pcb.h
  head/sys/arm/include/reg.h
  head/sys/arm/include/ucontext.h
  head/sys/arm/include/vfp.h

Modified: head/lib/libthread_db/arch/arm/libpthread_md.c
==
--- head/lib/libthread_db/arch/arm/libpthread_md.c  Fri Mar 24 10:27:05 
2017(r315899)
+++ head/lib/libthread_db/arch/arm/libpthread_md.c  Fri Mar 24 11:46:49 
2017(r315900)
@@ -90,7 +90,7 @@ pt_fpreg_to_ucontext(const struct fpreg 
mcontext_t *mc = >uc_mcontext;
 
/* XXX */
-   memset(>__fpu, 0, sizeof(mc->__fpu));
+   memset(>mc_spare, 0, sizeof(mc->mc_spare));
 }
 
 void

Modified: head/sys/arm/arm/vfp.c
==
--- head/sys/arm/arm/vfp.c  Fri Mar 24 10:27:05 2017(r315899)
+++ head/sys/arm/arm/vfp.c  Fri Mar 24 11:46:49 2017(r315900)
@@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: head/sys/arm/include/pcb.h
==
--- head/sys/arm/include/pcb.h  Fri Mar 24 10:27:05 2017(r315899)
+++ head/sys/arm/include/pcb.h  Fri Mar 24 11:46:49 2017(r315900)
@@ -38,8 +38,8 @@
 #ifndef_MACHINE_PCB_H_
 #define_MACHINE_PCB_H_
 
-#include 
 #include 
+#include 
 
 
 /*

Modified: head/sys/arm/include/reg.h
==
--- head/sys/arm/include/reg.h  Fri Mar 24 10:27:05 2017(r315899)
+++ head/sys/arm/include/reg.h  Fri Mar 24 11:46:49 2017(r315900)
@@ -3,8 +3,6 @@
 #ifndef MACHINE_REG_H
 #define MACHINE_REG_H
 
-#include 
-
 struct reg {
unsigned int r[13];
unsigned int r_sp;
@@ -13,6 +11,14 @@ struct reg {
unsigned int r_cpsr;
 };
 
+struct fp_extended_precision {
+   u_int32_t fp_exponent;
+   u_int32_t fp_mantissa_hi;
+   u_int32_t fp_mantissa_lo;
+};
+
+typedef struct fp_extended_precision fp_reg_t;
+
 struct fpreg {
unsigned int fpr_fpsr;
fp_reg_t fpr[8];

Modified: head/sys/arm/include/ucontext.h
==
--- head/sys/arm/include/ucontext.h Fri Mar 24 10:27:05 2017
(r315899)
+++ head/sys/arm/include/ucontext.h Fri Mar 24 11:46:49 2017
(r315900)
@@ -63,38 +63,14 @@ typedef __greg_t__gregset_t[_NGREG];
 #define _REG_LR_REG_R14
 #define _REG_PC_REG_R15
 
-/*
- * Floating point register state
- */
-/* Note: the storage layout of this structure must be identical to ARMFPE! */
-typedef struct {
-   unsigned int__fp_fpsr;
-   struct {
-   unsigned int__fp_exponent;
-   unsigned int__fp_mantissa_hi;
-   unsigned int__fp_mantissa_lo;
-   }   __fp_fr[8];
-} __fpregset_t;
-
-typedef struct {
-   unsigned int__vfp_fpscr;
-   unsigned int__vfp_fstmx[33];
-   unsigned int__vfp_fpsid;
-} __vfpregset_t;
-
 typedef struct {
__gregset_t __gregs;
-   union {
-   __fpregset_t __fpregs;
-   __vfpregset_t __vfpregs;
-   } __fpu;
-} mcontext_t;
-
-/* Machine-dependent uc_flags */
-#define_UC_ARM_VFP 0x0001  /* FPU field is VFP */
 
-/* used by signal delivery to indicate status of signal stack */
-#define _UC_SETSTACK   0x0002
-#define _UC_CLRSTACK   0x0004
+   /*
+* Originally, rest of this structure was named __fpu, 35 * 4 bytes
+* long, never accessed from kernel. 
+*/
+   unsigned intmc_spare[35];
+} mcontext_t;
 
 #endif /* !_MACHINE_MCONTEXT_H_ */

Modified: head/sys/arm/include/vfp.h
==
--- head/sys/arm/include/vfp.h  Fri Mar 24 10:27:05 2017(r315899)
+++ head/sys/arm/include/vfp.h  Fri Mar 24 11:46:49 2017(r315900)
@@ -133,9 +133,19 @@
 #define COPROC11   (0x3 << 22)
 
 #ifndef LOCORE
+struct vfp_state {
+   uint64_t reg[32];
+   uint32_t fpscr;
+   uint32_t fpexec;
+   uint32_t fpinst;
+   uint32_t fpinst2;
+};
+
+#ifdef _KERNEL
 voidvfp_init(void);
 voidvfp_store(struct vfp_state *, 

svn commit: r315896 - in head: cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/lib/libzpool/common sys/cddl/compat/opensolaris/kern sys/cddl/compat/open...

2017-03-24 Thread Alexander Motin
Author: mav
Date: Fri Mar 24 09:37:00 2017
New Revision: 315896
URL: https://svnweb.freebsd.org/changeset/base/315896

Log:
  MFV r315290, r315291: 7303 dynamic metaslab selection
  
  illumos/illumos-gate@8363e80ae72609660f6090766ca8c2c18aa53f0c
  
https://github.com/illumos/illumos-gate/commit/8363e80ae72609660f6090766ca8c2c18
  
  https://www.illumos.org/issues/7303
  
This change introduces a new weighting algorithm to improve metaslab 
selection.
The new weighting algorithm relies on the SPACEMAP_HISTOGRAM feature. As a 
result,
the metaslab weight now encodes the type of weighting algorithm used
(size-based vs segment-based).
  
This also introduce a new allocation tracing facility and two new dcmds to 
help
debug allocation problems. Each zio now contains a zio_alloc_list_t 
structure
that is populated as the zio goes through the allocations stage. Here's an
example of how to use the tracing facility:
  
  > c5ec000::print zio_t io_alloc_list | ::walk list | ::metaslab_trace
MSIDDVAASIZE  WEIGHT RESULT   VDEV
   -  0  400   0NOT_ALLOCATABLE   ztest.0a
   -  0  400   0NOT_ALLOCATABLE   ztest.0a
   -  0  400   0 ENOSPC   ztest.0a
   -  0  200   0NOT_ALLOCATABLE   ztest.0a
   -  0  200   0NOT_ALLOCATABLE   ztest.0a
   -  0  200   0 ENOSPC   ztest.0a
   1  0  400  1 x 8M17b1a00   ztest.0a
  
  > 1ff2400::print zio_t io_alloc_list | ::walk list | ::metaslab_trace
MSIDDVAASIZE  WEIGHT RESULT   VDEV
   -  0  200   0NOT_ALLOCATABLE   mirror-2
   -  0  200   0NOT_ALLOCATABLE   mirror-0
   1  0  200  1 x 4M112ae00   mirror-1
   -  1  200   0NOT_ALLOCATABLE   mirror-2
   -  1  200   0NOT_ALLOCATABLE   mirror-0
   1  1  200  1 x 4M112b000   mirror-1
   -  2  200   0NOT_ALLOCATABLE   mirror-2
  
If the metaslab is using segment-based weighting then the WEIGHT column will
display the number of segments available in the bucket where the allocation
attempt was made.
  
  Author: George Wilson 
  Reviewed by: Alex Reece 
  Reviewed by: Chris Siden 
  Reviewed by: Dan Kimmel 
  Reviewed by: Matthew Ahrens 
  Reviewed by: Paul Dagnelie 
  Reviewed by: Pavel Zakharov 
  Reviewed by: Prakash Surya 
  Reviewed by: Don Brady 
  Approved by: Richard Lowe 

Modified:
  head/cddl/contrib/opensolaris/cmd/zdb/zdb.c
  head/cddl/contrib/opensolaris/cmd/ztest/ztest.c
  head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c
  head/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c
  head/sys/cddl/compat/opensolaris/sys/kstat.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_debug.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)
  head/cddl/contrib/opensolaris/cmd/zdb/   (props changed)
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c
==
--- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Fri Mar 24 08:06:00 2017
(r315895)
+++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Fri Mar 24 09:37:00 2017
(r315896)
@@ -2589,10 +2589,21 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb)
 
if (!dump_opt['L']) {
vdev_t *rvd = spa->spa_root_vdev;
+
+   /*
+* We are going to be changing the meaning of the metaslab's
+* ms_tree.  Ensure that the allocator doesn't try to
+* use the tree.
+*/
+   spa->spa_normal_class->mc_ops = _metaslab_ops;
+   spa->spa_log_class->mc_ops = _metaslab_ops;
+
for (uint64_t c = 0; c < rvd->vdev_children; c++) {
vdev_t *vd = 

Re: svn commit: r315850 - head/sys/boot/forth

2017-03-24 Thread Dag-Erling Smørgrav
Conrad Meyer  writes:
> Yep.  In this context an 'em' dash should be used instead of an 'en'
> dash.  Theoretically, there also should not be spaces around the
> dashes.  I'm not sure that's easy to do in manual pages, though.

The Chicago Manual of Style agrees with you.  The Oxford Style Manual
agrees with me.  I actually prefer the former style, but don't trust
software to break lines correctly.  It's easy enough to do, though:

Index: sys/boot/forth/beastie.4th.8
===
--- sys/boot/forth/beastie.4th.8(revision 315894)
+++ sys/boot/forth/beastie.4th.8(working copy)
@@ -33,10 +33,10 @@
 .Sh DESCRIPTION
 The file that goes by the name of
 .Nm
-is a set of commands designed to draw the ASCII art FreeBSD mascot
-\(en known simply as
-.Em beastie
-\(en to the right of the boot loader menu.
+is a set of commands designed to draw the ASCII art FreeBSD
+mascot\(emknown simply as
+.Em beastie Ns
+\(emto the right of the boot loader menu.
 The commands of
 .Nm
 by themselves are not enough for most uses.

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Re: svn commit: r315773 - head/sbin/devd

2017-03-24 Thread Cy Schubert
In message <201703240340.v2o3eekh002...@slippy.cwsent.com>, Cy Schubert 
writes:
> In message <1490297671.58015.102.ca...@freebsd.org>, Ian Lepore writes:
> > On Thu, 2017-03-23 at 19:58 +0100, Roman Divacky wrote:
> > > On Thu, Mar 23, 2017 at 02:36:51AM +, Warner Losh wrote:
> > > > 
> > > > Author: imp
> > > > Date: Thu Mar 23 02:36:51 2017
> > > > New Revision: 315773
> > > > URL: https://svnweb.freebsd.org/changeset/base/315773
> > > > 
> > > > Log:
> > > >   Implement quote escaping. String values may now contain " if you
> > > >   it is preceded by \.
> > > >   
> > > >   foo="I \"like\" C++"
> > > >   
> > > >   gives the value 'I "like" C++' to the variable 'foo'. If a
> > > > character
> > > >   other than " follows the \, both the \ and that character are
> > > > passed
> > > >   through.
> > > >   
> > > >   Differential Revision: https://reviews.freebsd.org/D6286
> > > >   Sponsored by: Netflix
> > > > 
> > > > Modified:
> > > >   head/sbin/devd/devd.cc
> > > >   head/sbin/devd/devd.hh
> > > > 
> > > > Modified: head/sbin/devd/devd.cc
> > > > ===
> > > > ===
> > > > --- head/sbin/devd/devd.cc  Thu Mar 23 02:33:27 2017(
> > > > r315772)
> > > > +++ head/sbin/devd/devd.cc  Thu Mar 23 02:36:51 2017(
> > > > r315773)
> > > > @@ -411,6 +411,32 @@ var_list::is_set(const string ) cons
> > > >    return (_vars.find(var) != _vars.end());
> > > >  }
> > > >  
> > > > +/** fix_value
> > > > + *
> > > > + * Removes quoted characters that have made it this far. \" are
> > > > + * converted to ". For all other characters, both \ and following
> > > > + * character. So the string 'fre\:\"' is translated to 'fred\:"'.
> > > > + */
> > > > +const std::string &
> > > > +var_list::fix_value(const std::string ) const
> > > > +{
> > > > +   char *tmp, *dst;
> > > > +   const char *src;
> > > > +   std::string *rv;
> > > > +
> > > > +   dst = tmp = new char[val.length()];
> > > > +   src = val.c_str();
> > > > +   while (*src) {
> > > > +   if (*src == '\\' && src[1] == '"')
> > > > +   src++;
> > > > +   else
> > > > +   *dst++ = *src++;
> > > > +   }
> > > > +   rv = new string(tmp);
> > > > +   delete tmp;
> > > > +   return *rv;
> > > > +}
> > > Can the temporary char[] be stack allocated? Also, when returning a
> > > reference to
> > > a heap allocated string who is responsible for freeing it? Perhaps
> > > you can just
> > > return std::string and let the compiler optimize it?
> > > 
> > > Roman
> > > 
> > 
> > Returning a reference to a new'd string is not good.
> > 
> > IMO, the implementation of the function should take into account the
> > idea that embedded escaped quotes are rare.  The function should be
> > optimized for readability and the common case of simply copying the
> > string unmodified, something like:
> > 
> > 
> > std::string
> > var_list::fix_value(const std::string ) const
> > {
> > std::string rv(val);
> > std::string::size_type pos(0);
> > 
> > while ((pos = rv.find("\\\"", pos)) != rv.npos) {
> > rv.erase(pos, 1);
> > }
> > return (rv);
> > }
> 
> This revision caused devd a little gas. It failed to start moused for usb 
> attached mice (ums0 & ums1) to my latpop and nut failed to recognize my USB 
> connected UPS on a server.  downstairs due to a permission issue which nut 
> provides a devd.conf file with:
> 
>   chgrp uucp /dev/$cdev; chmod g+rw /dev/$cdev

Hi Ian,

Your example above fixes the problem.


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX:     Web:  http://www.FreeBSD.org

The need of the many outweighs the greed of the few.


___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r315892 - head/sys/compat/cloudabi

2017-03-24 Thread Ed Schouten
Author: ed
Date: Fri Mar 24 07:09:33 2017
New Revision: 315892
URL: https://svnweb.freebsd.org/changeset/base/315892

Log:
  Include  to obtain the memcpy() prototype.
  
  I got a report of this source file not building on Raspberry Pi. It's
  interesting that this only fails for that target and not for others.
  Again, that's no reason not to include the right headers.
  
  PR:   217969
  Reported by:  Johannes Jost Meixner
  MFC after:1 week

Modified:
  head/sys/compat/cloudabi/cloudabi_clock.c

Modified: head/sys/compat/cloudabi/cloudabi_clock.c
==
--- head/sys/compat/cloudabi/cloudabi_clock.c   Fri Mar 24 07:03:26 2017
(r315891)
+++ head/sys/compat/cloudabi/cloudabi_clock.c   Fri Mar 24 07:09:33 2017
(r315892)
@@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"