Re: svn commit: r298367 - head/lib/libc/locale

2016-04-21 Thread Andrey Chernov
On 21.04.2016 9:29, Baptiste Daroussin wrote:
 Modified: head/lib/libc/locale/ascii.c
 ==
 --- head/lib/libc/locale/ascii.c   Wed Apr 20 20:43:05 2016
 (r298366)
 +++ head/lib/libc/locale/ascii.c   Wed Apr 20 20:44:30 2016
 (r298367)
 @@ -133,11 +133,14 @@ _ascii_mbsnrtowcs(wchar_t * __restrict d
  
if (dst == NULL) {
s = memchr(*src, '\0', nms);
 +  if (s == NULL)
 +  return (nms);
 +
if (*s & 0x80) {
errno = EILSEQ;
return ((size_t)-1);
}
 -  return (s != NULL ? s - *src : nms);
 +  return (s - *src);
}
  
s = *src;

>>>
>>> The whole code is incorrect, only the very first char is checked, there
>>> must be a loop like in -stable:
>>>
>>> if (dst == NULL) {
>>> for (s = *src; nms > 0 && *s != '\0'; s++, nms--) {
>>> if (*s & 0x80) {
>>> errno = EILSEQ;
>>> return ((size_t)-1);
>>> }
>>> }
>>> return (s - *src);
>>> }
>>>
>>> Since svn history is lost on deleting, I don't know why incorrect
>>> version was committed.
>>>
>>
>> Typo, the very first == the very last, i.e. only NUL char is checked
>> which always pass.
>>
> 
> I have restored the history (I hope correctly)
> 
> Bapt
> 

All the restored history is related to none.c, but ascii.c was made
afterwards a bit differently and transition history between none.c ->
ascii.c is lost in any case somehow.
We still have correct version in -stable.
The diff is attached.
BTW, recent none.c from which ascii.c is made don't have this two
copyrights too:
- * Copyright 2013 Garrett D'Amore 
- * Copyright 2010 Nexenta Systems, Inc.  All rights reserved.
Index: ascii.c
===
--- ascii.c (.../head/lib/libc/locale/ascii.c)  (revision 298395)
+++ ascii.c (.../stable/10/lib/libc/locale/ascii.c) (working copy)
@@ -1,6 +1,4 @@
-/*
- * Copyright 2013 Garrett D'Amore 
- * Copyright 2010 Nexenta Systems, Inc.  All rights reserved.
+/*-
  * Copyright (c) 2002-2004 Tim J. Robbins. All rights reserved.
  * Copyright (c) 1993
  * The Regents of the University of California.  All rights reserved.
@@ -36,8 +34,6 @@
  * 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.
- *
- * @(#)none.c  8.1 (Berkeley) 6/4/93
  */
 
 #include 
@@ -65,7 +61,7 @@
size_t, size_t, mbstate_t * __restrict);
 
 int
-_ascii_init(struct xlocale_ctype *l, _RuneLocale *rl)
+_ascii_init(struct xlocale_ctype *l,_RuneLocale *rl)
 {
 
l->__mbrtowc = _ascii_mbrtowc;
@@ -82,6 +78,7 @@
 static int
 _ascii_mbsinit(const mbstate_t *ps __unused)
 {
+
/*
 * Encoding is not state dependent - we are always in the
 * initial state.
@@ -93,6 +90,7 @@
 _ascii_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
 mbstate_t * __restrict ps __unused)
 {
+
if (s == NULL)
/* Reset to initial shift state (no-op) */
return (0);
@@ -132,13 +130,11 @@
size_t nchr;
 
if (dst == NULL) {
-   s = memchr(*src, '\0', nms);
-   if (s == NULL)
-   return (nms);
-
-   if (*s & 0x80) {
-   errno = EILSEQ;
-   return ((size_t)-1);
+   for (s = *src; nms > 0 && *s != '\0'; s++, nms--) {
+   if (*s & 0x80) {
+   errno = EILSEQ;
+   return ((size_t)-1);
+   }
}
return (s - *src);
}
@@ -193,3 +189,4 @@
*src = s;
return (nchr);
 }
+


signature.asc
Description: OpenPGP digital signature


svn commit: r298396 - head/lib/libc/locale

2016-04-21 Thread Baptiste Daroussin
Author: bapt
Date: Thu Apr 21 07:36:11 2016
New Revision: 298396
URL: https://svnweb.freebsd.org/changeset/base/298396

Log:
  Restore the original ascii.c from prior to r290494
  
  It was doing the right thing, there was no need to "fail" to reinvent it from
  none.c
  
  Pointy hat:   bapt
  Submitted by: ache

Replaced:
 - copied unchanged from r290493, head/lib/libc/locale/ascii.c
Directory Properties:
  head/lib/libc/locale/ascii.c   (props changed)

Copied: head/lib/libc/locale/ascii.c (from r290493, 
head/lib/libc/locale/ascii.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libc/locale/ascii.cThu Apr 21 07:36:11 2016
(r298396, copy of r290493, head/lib/libc/locale/ascii.c)
@@ -0,0 +1,192 @@
+/*-
+ * Copyright (c) 2002-2004 Tim J. Robbins. All rights reserved.
+ * Copyright (c) 1993
+ * The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Paul Borman at Krystal Technologies.
+ *
+ * Copyright (c) 2011 The FreeBSD Foundation
+ * All rights reserved.
+ * Portions of this software were developed by David Chisnall
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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.
+ * 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.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "mblocal.h"
+
+static size_t  _ascii_mbrtowc(wchar_t * __restrict, const char * __restrict,
+   size_t, mbstate_t * __restrict);
+static int _ascii_mbsinit(const mbstate_t *);
+static size_t  _ascii_mbsnrtowcs(wchar_t * __restrict dst,
+   const char ** __restrict src, size_t nms, size_t len,
+   mbstate_t * __restrict ps __unused);
+static size_t  _ascii_wcrtomb(char * __restrict, wchar_t,
+   mbstate_t * __restrict);
+static size_t  _ascii_wcsnrtombs(char * __restrict, const wchar_t ** 
__restrict,
+   size_t, size_t, mbstate_t * __restrict);
+
+int
+_ascii_init(struct xlocale_ctype *l,_RuneLocale *rl)
+{
+
+   l->__mbrtowc = _ascii_mbrtowc;
+   l->__mbsinit = _ascii_mbsinit;
+   l->__mbsnrtowcs = _ascii_mbsnrtowcs;
+   l->__wcrtomb = _ascii_wcrtomb;
+   l->__wcsnrtombs = _ascii_wcsnrtombs;
+   l->runes = rl;
+   l->__mb_cur_max = 1;
+   l->__mb_sb_limit = 128;
+   return(0);
+}
+
+static int
+_ascii_mbsinit(const mbstate_t *ps __unused)
+{
+
+   /*
+* Encoding is not state dependent - we are always in the
+* initial state.
+*/
+   return (1);
+}
+
+static size_t
+_ascii_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
+mbstate_t * __restrict ps __unused)
+{
+
+   if (s == NULL)
+   /* Reset to initial shift state (no-op) */
+   return (0);
+   if (n == 0)
+   /* Incomplete multibyte sequence */
+   return ((size_t)-2);
+   if (*s & 0x80) {
+   errno = EILSEQ;
+   return ((size_t)-1);
+   }
+   if (pwc != NULL)
+   *pwc = (unsigned char)*s;
+   return (*s == '\0' ? 0 : 1);
+}
+
+static size_t
+_ascii_wcrtomb(char * __restrict s, wchar_t wc,
+mbstate_t * __restrict ps __unused)
+{
+
+   if (s == NULL)
+   /* Reset to initial shift state (no-op) */
+   return (1);
+   if (wc < 0 ||

svn commit: r298397 - in head/sys/mips: conf mediatek

2016-04-21 Thread Stanislav Galabov
Author: sgalabov
Date: Thu Apr 21 07:40:03 2016
New Revision: 298397
URL: https://svnweb.freebsd.org/changeset/base/298397

Log:
  Rework Mediatek/Ralink configuration files
  
  Only compile what each SoC needs and get rid of MEDIATEK generic config.
  
  Approved by:  adrian (mentor)
  Sponsored by: Smartcom - Bulgaria AD
  Differential Revision:https://reviews.freebsd.org/D5996

Added:
  head/sys/mips/mediatek/files.mediatek   (contents, props changed)
  head/sys/mips/mediatek/std.mediatek   (contents, props changed)
Deleted:
  head/sys/mips/conf/MEDIATEK
  head/sys/mips/conf/MEDIATEK_BASE
Modified:
  head/sys/mips/conf/MT7620A_FDT
  head/sys/mips/conf/MT7620N_FDT
  head/sys/mips/conf/MT7621_FDT
  head/sys/mips/conf/MT7628_FDT
  head/sys/mips/conf/RT3050_FDT
  head/sys/mips/conf/RT3352_FDT
  head/sys/mips/conf/RT3883_FDT
  head/sys/mips/conf/RT5350_FDT

Modified: head/sys/mips/conf/MT7620A_FDT
==
--- head/sys/mips/conf/MT7620A_FDT  Thu Apr 21 07:36:11 2016
(r298396)
+++ head/sys/mips/conf/MT7620A_FDT  Thu Apr 21 07:40:03 2016
(r298397)
@@ -1,8 +1,7 @@
 #
 # MT7620A_FDT -- Kernel configuration file for FreeBSD/MIPS MT7620A SoC
 #
-# This includes all the configurable parts of the kernel. Please read through
-# MEDIATEK kernel config and customize the options to fit your board if needed.
+# This includes all the configurable parts of the kernel.
 #
 # $FreeBSD$
 #
@@ -14,17 +13,65 @@
 #
 #makeoptions   FDT_DTS_FILE=MT7620a.dts
 
-#
-# The user should never have to edit what's below this line.
-# If customizations are needed, they should be done to the MEDIATEK kernel
-# configuration.
-#
-
 # Start with a base configuration
-includeMEDIATEK_BASE
+include"../mediatek/std.mediatek"
 
 ident  MT7620A
 cpuCPU_MIPS24K
 
-# Include optional configuration (to be edited by the user if needed)
-includeMEDIATEK
+# Don't build any modules by default
+makeoptionsMODULES_OVERRIDE=""
+
+# Default rootfs device configuration, should be changed to suit target board
+optionsROOTDEVNAME=\"ufs:md0.uzip\"
+
+# Support geom_uzip(4) compressed disk images
+device geom_uzip
+optionsGEOM_UZIP
+
+# Support md(4) and md-based rootfs
+device md
+optionsMD_ROOT
+
+# Interrupt controller support
+device mtk_intr_v1
+
+# UART device support
+nodevice   uart_ns8250
+device uart_dev_mtk
+
+# SPI and SPI flash support
+device mtk_spi_v1
+device spibus
+device mx25l
+
+# GPIO and gpioled support
+device mtk_gpio_v1
+device gpio
+device gpioled
+
+# PCI support
+device pci
+
+# USB (ehci, ohci) support
+device usb
+device mtk_usb_phy
+device ehci
+device ohci
+
+# USB umass(4) storage and da(4) support
+device umass
+device da
+
+# CAM support, required if umass(4) is enabled above
+device pass
+device scbus
+
+# Ethernet, BPF and bridge support
+device rt
+device bpf
+device if_bridge
+
+# Extres
+device ext_resources
+device clk

Modified: head/sys/mips/conf/MT7620N_FDT
==
--- head/sys/mips/conf/MT7620N_FDT  Thu Apr 21 07:36:11 2016
(r298396)
+++ head/sys/mips/conf/MT7620N_FDT  Thu Apr 21 07:40:03 2016
(r298397)
@@ -1,8 +1,7 @@
 #
 # MT7620N_FDT -- Kernel configuration file for FreeBSD/MIPS MT7620N SoC
 #
-# This includes all the configurable parts of the kernel. Please read through
-# MEDIATEK kernel config and customize the options to fit your board if needed.
+# This includes all the configurable parts of the kernel.
 #
 # $FreeBSD$
 #
@@ -14,17 +13,62 @@
 #
 #makeoptions   FDT_DTS_FILE=WRTNODE.dts
 
-#
-# The user should never have to edit what's below this line.
-# If customizations are needed, they should be done to the MEDIATEK kernel
-# configuration.
-#
-
 # Start with a base configuration
-includeMEDIATEK_BASE
+include"../mediatek/std.mediatek"
 
 ident  MT7620N
 cpuCPU_MIPS24K
 
-# Include optional configuration (to be edited by the user if needed)
-includeMEDIATEK
+# Don't build any modules by default
+makeoptionsMODULES_OVERRIDE=""
+
+# Default rootfs device configuration, should be changed to suit target board
+optionsROOTDEVNAME=\"ufs:md0.uzip\"
+
+# Support geom_uzip(4) compressed disk images
+device geom_uzip
+optionsGEOM_UZIP
+
+# Support md(4) and md-based rootfs
+device md
+optionsMD_ROOT
+
+# Interrupt controller support
+device mtk_intr_v1
+
+

Re: svn commit: r298367 - head/lib/libc/locale

2016-04-21 Thread Baptiste Daroussin
On Thu, Apr 21, 2016 at 10:22:48AM +0300, Andrey Chernov wrote:
> On 21.04.2016 9:29, Baptiste Daroussin wrote:
>  Modified: head/lib/libc/locale/ascii.c
>  ==
>  --- head/lib/libc/locale/ascii.c Wed Apr 20 20:43:05 2016
>  (r298366)
>  +++ head/lib/libc/locale/ascii.c Wed Apr 20 20:44:30 2016
>  (r298367)
>  @@ -133,11 +133,14 @@ _ascii_mbsnrtowcs(wchar_t * __restrict d
>   
>   if (dst == NULL) {
>   s = memchr(*src, '\0', nms);
>  +if (s == NULL)
>  +return (nms);
>  +
>   if (*s & 0x80) {
>   errno = EILSEQ;
>   return ((size_t)-1);
>   }
>  -return (s != NULL ? s - *src : nms);
>  +return (s - *src);
>   }
>   
>   s = *src;
> 
> >>>
> >>> The whole code is incorrect, only the very first char is checked, there
> >>> must be a loop like in -stable:
> >>>
> >>>   if (dst == NULL) {
> >>> for (s = *src; nms > 0 && *s != '\0'; s++, nms--) {
> >>> if (*s & 0x80) {
> >>> errno = EILSEQ;
> >>> return ((size_t)-1);
> >>> }
> >>> }
> >>> return (s - *src);
> >>>   }
> >>>
> >>> Since svn history is lost on deleting, I don't know why incorrect
> >>> version was committed.
> >>>
> >>
> >> Typo, the very first == the very last, i.e. only NUL char is checked
> >> which always pass.
> >>
> > 
> > I have restored the history (I hope correctly)
> > 
> > Bapt
> > 
> 
I backed it out to the original version, I really sorry for all the mess I made
there.

Bapt


signature.asc
Description: PGP signature


Re: svn commit: r298230 - in head: lib/libstand sys/boot/common sys/boot/efi/libefi sys/boot/efi/loader sys/boot/i386/libfirewire sys/boot/i386/libi386 sys/boot/i386/loader sys/boot/mips/beri/loader s

2016-04-21 Thread Bjoern A. Zeeb

> On 19 Apr 2016, at 15:49 , Allan Jude  wrote:
> 
> On 2016-04-19 05:08, Bjoern A. Zeeb wrote:
>> 
>>> On 18 Apr 2016, at 23:09 , Allan Jude  wrote:
>>> 
>>> Author: allanjude
>>> Date: Mon Apr 18 23:09:22 2016
>>> New Revision: 298230
>>> URL: https://svnweb.freebsd.org/changeset/base/298230
>>> 
>> 
>> Can you have a look at this please?
> 
> Fixed in r298275, sorry I missed that one

Can you also look at this one, which still happens?


==> sys/boot/pc98/kgzldr (all)
===> sys/boot/pc98/libpc98 (all)
/scratch/tmp/bz/head.svn/sys/boot/pc98/libpc98/biosdisk.c:740:33: error: use of 
undeclared identifier 'f'
struct i386_devdesc *dev = f->f_devdata;
   ^
/scratch/tmp/bz/head.svn/sys/boot/pc98/libpc98/biosdisk.c:747:13: error: too 
many arguments to function call, expected 7, have 8
size, buf, rsize));
   ^
/scratch/tmp/bz/head.svn/sys/boot/pc98/libpc98/../../common/bootstrap.h:79:1: 
note: 'bcache_strategy' declared here
int bcache_strategy(void *devdata, int rw, daddr_t blk, size_t offset,
^
2 errors generated.
--- biosdisk.o ---
*** [biosdisk.o] Error code 1

bmake[8]: stopped in /scratch/tmp/bz/head.svn/sys/boot/pc98/libpc98
===> sbin/ipf/ipmon (all)
--- all ---
*** [all] Error code 1

bmake[7]: stopped in /scratch/tmp/bz/head.svn/sys/boot/pc98
--- all ---
*** [all] Error code 1

bmake[6]: stopped in /scratch/tmp/bz/head.svn/sys/boot
--- all ---
*** [all] Error code 1

bmake[5]: stopped in /scratch/tmp/bz/head.svn/sys
--- all_subdir_sys ---
*** [all_subdir_sys] Error code 1

bmake[4]: stopped in /scratch/tmp/bz/head.svn
___
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: r298398 - head/sys/netipsec

2016-04-21 Thread Andrey V. Elsukov
Author: ae
Date: Thu Apr 21 10:58:07 2016
New Revision: 298398
URL: https://svnweb.freebsd.org/changeset/base/298398

Log:
  Constify mbuf pointer for IPSEC functions where mbuf isn't modified.

Modified:
  head/sys/netipsec/ipsec.c
  head/sys/netipsec/ipsec.h
  head/sys/netipsec/ipsec6.h
  head/sys/netipsec/key_debug.c
  head/sys/netipsec/key_debug.h

Modified: head/sys/netipsec/ipsec.c
==
--- head/sys/netipsec/ipsec.c   Thu Apr 21 07:40:03 2016(r298397)
+++ head/sys/netipsec/ipsec.c   Thu Apr 21 10:58:07 2016(r298398)
@@ -240,14 +240,14 @@ SYSCTL_VNET_PCPUSTAT(_net_inet6_ipsec6, 
 struct ipsecstat, ipsec6stat, "IPsec IPv6 statistics.");
 #endif /* INET6 */
 
-static int ipsec_in_reject(struct secpolicy *, struct mbuf *);
-static int ipsec_setspidx_inpcb(struct mbuf *, struct inpcb *);
-static int ipsec_setspidx(struct mbuf *, struct secpolicyindex *, int);
-static void ipsec4_get_ulp(struct mbuf *m, struct secpolicyindex *, int);
-static int ipsec4_setspidx_ipaddr(struct mbuf *, struct secpolicyindex *);
+static int ipsec_in_reject(struct secpolicy *, const struct mbuf *);
+static int ipsec_setspidx_inpcb(const struct mbuf *, struct inpcb *);
+static int ipsec_setspidx(const struct mbuf *, struct secpolicyindex *, int);
+static void ipsec4_get_ulp(const struct mbuf *m, struct secpolicyindex *, int);
+static int ipsec4_setspidx_ipaddr(const struct mbuf *, struct secpolicyindex 
*);
 #ifdef INET6
-static void ipsec6_get_ulp(struct mbuf *m, struct secpolicyindex *, int);
-static int ipsec6_setspidx_ipaddr(struct mbuf *, struct secpolicyindex *);
+static void ipsec6_get_ulp(const struct mbuf *m, struct secpolicyindex *, int);
+static int ipsec6_setspidx_ipaddr(const struct mbuf *, struct secpolicyindex 
*);
 #endif
 static void ipsec_delpcbpolicy(struct inpcbpolicy *);
 static struct secpolicy *ipsec_deepcopy_policy(struct secpolicy *src);
@@ -324,7 +324,8 @@ ipsec_getpolicy(struct tdb_ident *tdbi, 
  * NOTE: IPv6 mapped adddress concern is implemented here.
  */
 static struct secpolicy *
-ipsec_getpolicybysock(struct mbuf *m, u_int dir, struct inpcb *inp, int *error)
+ipsec_getpolicybysock(const struct mbuf *m, u_int dir, struct inpcb *inp,
+int *error)
 {
struct inpcbpolicy *pcbsp;
struct secpolicy *currsp = NULL;/* Policy on socket. */
@@ -427,7 +428,7 @@ ipsec_getpolicybysock(struct mbuf *m, u_
  * others  : error occured.
  */
 struct secpolicy *
-ipsec_getpolicybyaddr(struct mbuf *m, u_int dir, int *error)
+ipsec_getpolicybyaddr(const struct mbuf *m, u_int dir, int *error)
 {
struct secpolicyindex spidx;
struct secpolicy *sp;
@@ -457,7 +458,8 @@ ipsec_getpolicybyaddr(struct mbuf *m, u_
 }
 
 struct secpolicy *
-ipsec4_checkpolicy(struct mbuf *m, u_int dir, int *error, struct inpcb *inp)
+ipsec4_checkpolicy(const struct mbuf *m, u_int dir, int *error,
+struct inpcb *inp)
 {
struct secpolicy *sp;
 
@@ -499,7 +501,7 @@ ipsec4_checkpolicy(struct mbuf *m, u_int
 }
 
 static int
-ipsec_setspidx_inpcb(struct mbuf *m, struct inpcb *inp)
+ipsec_setspidx_inpcb(const struct mbuf *m, struct inpcb *inp)
 {
int error;
 
@@ -528,12 +530,13 @@ ipsec_setspidx_inpcb(struct mbuf *m, str
  * The caller is responsible for error recovery (like clearing up spidx).
  */
 static int
-ipsec_setspidx(struct mbuf *m, struct secpolicyindex *spidx, int needport)
+ipsec_setspidx(const struct mbuf *m, struct secpolicyindex *spidx,
+int needport)
 {
-   struct ip *ip = NULL;
struct ip ipbuf;
+   const struct ip *ip = NULL;
+   const struct mbuf *n;
u_int v;
-   struct mbuf *n;
int len;
int error;
 
@@ -562,7 +565,7 @@ ipsec_setspidx(struct mbuf *m, struct se
}
 
if (m->m_len >= sizeof(*ip))
-   ip = mtod(m, struct ip *);
+   ip = mtod(m, const struct ip *);
else {
m_copydata(m, 0, sizeof(ipbuf), (caddr_t)&ipbuf);
ip = &ipbuf;
@@ -598,7 +601,8 @@ ipsec_setspidx(struct mbuf *m, struct se
 }
 
 static void
-ipsec4_get_ulp(struct mbuf *m, struct secpolicyindex *spidx, int needport)
+ipsec4_get_ulp(const struct mbuf *m, struct secpolicyindex *spidx,
+int needport)
 {
u_int8_t nxt;
int off;
@@ -608,7 +612,7 @@ ipsec4_get_ulp(struct mbuf *m, struct se
IPSEC_ASSERT(m->m_pkthdr.len >= sizeof(struct ip),("packet too short"));
 
if (m->m_len >= sizeof (struct ip)) {
-   struct ip *ip = mtod(m, struct ip *);
+   const struct ip *ip = mtod(m, const struct ip *);
if (ip->ip_off & htons(IP_MF | IP_OFFMASK))
goto done;
off = ip->ip_hl << 2;
@@ -673,7 +677,7 @@ done_proto:
 
 /* Assumes that m is sane. */
 static int
-ipsec4_setspidx_ipaddr(struct mbuf *m, struct secpolicyindex *spidx)
+ipsec4_setspidx_ipaddr(const struct mbuf *m, struct 

svn commit: r298399 - head/sys/netipsec

2016-04-21 Thread Andrey V. Elsukov
Author: ae
Date: Thu Apr 21 11:02:06 2016
New Revision: 298399
URL: https://svnweb.freebsd.org/changeset/base/298399

Log:
  Remove stale function declaration

Modified:
  head/sys/netipsec/ipsec.h

Modified: head/sys/netipsec/ipsec.h
==
--- head/sys/netipsec/ipsec.h   Thu Apr 21 10:58:07 2016(r298398)
+++ head/sys/netipsec/ipsec.h   Thu Apr 21 11:02:06 2016(r298399)
@@ -354,8 +354,6 @@ extern int ipsec4_common_input_cb(struct
 extern int ipsec4_process_packet(struct mbuf *, struct ipsecrequest *);
 extern int ipsec_process_done(struct mbuf *, struct ipsecrequest *);
 
-extern struct mbuf *ipsec_copypkt(struct mbuf *);
-
 extern void m_checkalignment(const char* where, struct mbuf *m0,
int off, int len);
 extern struct mbuf *m_makespace(struct mbuf *m0, int skip, int hlen, int *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: r298400 - head/sys/ofed/drivers/infiniband/core

2016-04-21 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Apr 21 11:32:22 2016
New Revision: 298400
URL: https://svnweb.freebsd.org/changeset/base/298400

Log:
  Properly setup arguments for if_resolvemulti() callback.
  
  Sponsored by: Mellanox Technologies
  MFC after:1 week

Modified:
  head/sys/ofed/drivers/infiniband/core/addr.c

Modified: head/sys/ofed/drivers/infiniband/core/addr.c
==
--- head/sys/ofed/drivers/infiniband/core/addr.cThu Apr 21 11:02:06 
2016(r298399)
+++ head/sys/ofed/drivers/infiniband/core/addr.cThu Apr 21 11:32:22 
2016(r298400)
@@ -310,13 +310,19 @@ mcast:
return rdma_copy_addr(addr, ifp, ifp->if_broadcastaddr);
if (multi) {
struct sockaddr *llsa;
+   struct sockaddr_dl sdl;
+
+   sdl.sdl_len = sizeof(sdl);
+   llsa = (struct sockaddr *)&sdl;
+
+   if (ifp->if_resolvemulti == NULL)
+   return -EOPNOTSUPP;
 
error = ifp->if_resolvemulti(ifp, &llsa, dst_in);
if (error)
return -error;
error = rdma_copy_addr(addr, ifp,
LLADDR((struct sockaddr_dl *)llsa));
-   free(llsa, M_IFMADDR);
if (error == 0)
memcpy(src_in, ifa->ifa_addr, 
ip_addr_size(ifa->ifa_addr));
return error;
___
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: r298401 - in head: lib/libdwarf lib/libelf lib/libelftc usr.bin/addr2line usr.bin/cxxfilt usr.bin/elfcopy usr.bin/nm usr.bin/readelf usr.bin/size usr.bin/strings

2016-04-21 Thread Ed Maste
Author: emaste
Date: Thu Apr 21 12:58:29 2016
New Revision: 298401
URL: https://svnweb.freebsd.org/changeset/base/298401

Log:
  elftoolchain: Use ${SRCTOP} for the top of the FreeBSD tree
  
  It's provided by sys.mk so there's no need to derive it from ${.CURDIR}.
  
  Suggested by: ngie
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D5998

Modified:
  head/lib/libdwarf/Makefile
  head/lib/libelf/Makefile
  head/lib/libelftc/Makefile
  head/usr.bin/addr2line/Makefile
  head/usr.bin/cxxfilt/Makefile
  head/usr.bin/elfcopy/Makefile
  head/usr.bin/nm/Makefile
  head/usr.bin/readelf/Makefile
  head/usr.bin/size/Makefile
  head/usr.bin/strings/Makefile

Modified: head/lib/libdwarf/Makefile
==
--- head/lib/libdwarf/Makefile  Thu Apr 21 11:32:22 2016(r298400)
+++ head/lib/libdwarf/Makefile  Thu Apr 21 12:58:29 2016(r298401)
@@ -2,8 +2,8 @@
 .include 
 
 PACKAGE=lib${LIB}
-TOP=   ${.CURDIR:H:H}/contrib/elftoolchain
-SRCDIR=${TOP}/libdwarf
+ELFTCDIR=${SRCTOP}/contrib/elftoolchain
+SRCDIR=${ELFTCDIR}/libdwarf
 
 .PATH: ${SRCDIR}
 
@@ -92,7 +92,7 @@ GENSRCS=  dwarf_pubnames.c dwarf_pubtypes
dwarf_pro_vars.c
 CLEANFILES=${GENSRCS}
 CLEANDIRS= sys
-CFLAGS+=   -I. -I${SRCDIR} -I${TOP}/common -I${TOP}/libelf
+CFLAGS+=   -I. -I${SRCDIR} -I${ELFTCDIR}/common -I${ELFTCDIR}/libelf
 
 sys/elf32.h sys/elf64.h sys/elf_common.h: ${.CURDIR}/../../sys/${.TARGET} 
.NOMETA
mkdir -p ${.OBJDIR}/sys

Modified: head/lib/libelf/Makefile
==
--- head/lib/libelf/MakefileThu Apr 21 11:32:22 2016(r298400)
+++ head/lib/libelf/MakefileThu Apr 21 12:58:29 2016(r298401)
@@ -5,8 +5,8 @@ SHLIBDIR?= /lib
 
 .include 
 
-TOP=   ${.CURDIR:H:H}/contrib/elftoolchain
-SRCDIR=${TOP}/libelf
+ELFTCDIR=${SRCTOP}/contrib/elftoolchain
+SRCDIR=${ELFTCDIR}/libelf
 
 .PATH: ${SRCDIR}
 
@@ -80,7 +80,7 @@ SRCS+=sys/elf32.h sys/elf64.h sys/elf_c
 GENSRCS=   libelf_fsize.c libelf_msize.c libelf_convert.c
 CLEANFILES=${GENSRCS}
 CLEANDIRS= sys
-CFLAGS+=   -I. -I${SRCDIR} -I${TOP}/common
+CFLAGS+=   -I. -I${SRCDIR} -I${ELFTCDIR}/common
 
 sys/elf32.h sys/elf64.h sys/elf_common.h: ${.CURDIR}/../../sys/${.TARGET} 
.NOMETA
mkdir -p ${.OBJDIR}/sys

Modified: head/lib/libelftc/Makefile
==
--- head/lib/libelftc/Makefile  Thu Apr 21 11:32:22 2016(r298400)
+++ head/lib/libelftc/Makefile  Thu Apr 21 12:58:29 2016(r298401)
@@ -4,7 +4,7 @@
 PACKAGE=lib${LIB}
 INTERNALLIB=
 
-ELFTCDIR=  ${.CURDIR:H:H}/contrib/elftoolchain
+ELFTCDIR=  ${SRCTOP}/contrib/elftoolchain
 
 .PATH: ${ELFTCDIR}/libelftc
 

Modified: head/usr.bin/addr2line/Makefile
==
--- head/usr.bin/addr2line/Makefile Thu Apr 21 11:32:22 2016
(r298400)
+++ head/usr.bin/addr2line/Makefile Thu Apr 21 12:58:29 2016
(r298401)
@@ -2,7 +2,7 @@
 
 .include 
 
-ELFTCDIR=  ${.CURDIR:H:H}/contrib/elftoolchain
+ELFTCDIR=  ${SRCTOP}/contrib/elftoolchain
 ADDR2LINEDIR=  ${ELFTCDIR}/addr2line
 
 .PATH: ${ADDR2LINEDIR}

Modified: head/usr.bin/cxxfilt/Makefile
==
--- head/usr.bin/cxxfilt/Makefile   Thu Apr 21 11:32:22 2016
(r298400)
+++ head/usr.bin/cxxfilt/Makefile   Thu Apr 21 12:58:29 2016
(r298401)
@@ -2,7 +2,7 @@
 
 .include 
 
-ELFTCDIR=  ${.CURDIR:H:H}/contrib/elftoolchain
+ELFTCDIR=  ${SRCTOP}/contrib/elftoolchain
 SRCDIR=${ELFTCDIR}/cxxfilt
 
 .PATH: ${SRCDIR}

Modified: head/usr.bin/elfcopy/Makefile
==
--- head/usr.bin/elfcopy/Makefile   Thu Apr 21 11:32:22 2016
(r298400)
+++ head/usr.bin/elfcopy/Makefile   Thu Apr 21 12:58:29 2016
(r298401)
@@ -2,7 +2,7 @@
 
 .include 
 
-ELFTCDIR=  ${.CURDIR:H:H}/contrib/elftoolchain
+ELFTCDIR=  ${SRCTOP}/contrib/elftoolchain
 ELFCOPYDIR=${ELFTCDIR}/elfcopy
 
 .PATH: ${ELFCOPYDIR}

Modified: head/usr.bin/nm/Makefile
==
--- head/usr.bin/nm/MakefileThu Apr 21 11:32:22 2016(r298400)
+++ head/usr.bin/nm/MakefileThu Apr 21 12:58:29 2016(r298401)
@@ -2,7 +2,7 @@
 
 .include 
 
-ELFTCDIR=  ${.CURDIR:H:H}/contrib/elftoolchain
+ELFTCDIR=  ${SRCTOP}/contrib/elftoolchain
 NMDIR= ${ELFTCDIR}/nm
 
 .PATH: ${NMDIR}

Modified: head/usr.bin/readelf/Makefile
==
--- head/usr.bin/readelf/Makefile   Thu Apr 21 11:32:22 2016
(

svn commit: r298402 - head

2016-04-21 Thread Ed Maste
Author: emaste
Date: Thu Apr 21 13:14:55 2016
New Revision: 298402
URL: https://svnweb.freebsd.org/changeset/base/298402

Log:
  Adjust BOOTSTRAPPING test after MFC of kbdcontrol's -P option

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Thu Apr 21 12:58:29 2016(r298401)
+++ head/Makefile.inc1  Thu Apr 21 13:14:55 2016(r298402)
@@ -1520,8 +1520,9 @@ _crunch=  usr.sbin/crunch
 _awk=  usr.bin/awk
 .endif
 
-# r296926 -P keymap search path
-.if ${BOOTSTRAPPING} < 1100103
+# r296926 -P keymap search path, MFC to stable/10 in r298297
+.if ${BOOTSTRAPPING} < 1003501 || \
+   (${BOOTSTRAPPING} >= 110 && ${BOOTSTRAPPING} < 1100103)
 _kbdcontrol=   usr.sbin/kbdcontrol
 .endif
 
___
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: r298378 - head/usr.bin/localedef

2016-04-21 Thread Cy Schubert
Should we MFC this too?

Sent from my cellphone,
~Cy

-Original Message-
From: Baptiste Daroussin
Sent: 20/04/2016 14:23
To: src-committ...@freebsd.org; svn-src-...@freebsd.org; 
svn-src-head@freebsd.org
Subject: svn commit: r298378 - head/usr.bin/localedef

Author: bapt
Date: Wed Apr 20 21:23:42 2016
New Revision: 298378
URL: https://svnweb.freebsd.org/changeset/base/298378

Log:
  Plug memory leaks
  
  Reported by:  Coverity
  CID=  1338535, 1338536, 1338542, 1338569, 1338570

Modified:
  head/usr.bin/localedef/collate.c
  head/usr.bin/localedef/time.c

Modified: head/usr.bin/localedef/collate.c
==
--- head/usr.bin/localedef/collate.cWed Apr 20 21:21:47 2016
(r298377)
+++ head/usr.bin/localedef/collate.cWed Apr 20 21:23:42 2016
(r298378)
@@ -502,6 +502,7 @@ define_collsym(char *name)
 * This should never happen because we are only called
 * for undefined symbols.
 */
+   free(sym);
INTERR;
return;
}
@@ -538,6 +539,7 @@ get_collundef(char *name)
if (((ud = calloc(sizeof (*ud), 1)) == NULL) ||
((ud->name = strdup(name)) == NULL)) {
fprintf(stderr,"out of memory");
+   free(ud);
return (NULL);
}
for (i = 0; i < NUM_WT; i++) {
@@ -812,6 +814,7 @@ define_collelem(char *name, wchar_t *wcs
if ((RB_FIND(elem_by_symbol, &elem_by_symbol, e) != NULL) ||
(RB_FIND(elem_by_expand, &elem_by_expand, e) != NULL)) {
fprintf(stderr, "duplicate collating element definition");
+   free(e);
return;
}
RB_INSERT(elem_by_symbol, &elem_by_symbol, e);

Modified: head/usr.bin/localedef/time.c
==
--- head/usr.bin/localedef/time.c   Wed Apr 20 21:21:47 2016
(r298377)
+++ head/usr.bin/localedef/time.c   Wed Apr 20 21:23:42 2016
(r298378)
@@ -87,6 +87,7 @@ add_time_str(wchar_t *wcs)
case T_ERA_T_FMT:
case T_ERA_D_T_FMT:
/* Silently ignore it. */
+   free(str);
break;
default:
free(str);
@@ -139,6 +140,7 @@ add_time_list(wchar_t *wcs)
tm.pm = str;
} else {
fprintf(stderr,"too many list elements");
+   free(str);
}
break;
case T_ALT_DIGITS:

___
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: r298378 - head/usr.bin/localedef

2016-04-21 Thread Baptiste Daroussin
On Thu, Apr 21, 2016 at 06:15:56AM -0700, Cy Schubert wrote:
> Should we MFC this too?
> 
localdef is only on head

Best regards,
Bapt


signature.asc
Description: PGP signature


svn commit: r298403 - head/sys/arm/arm

2016-04-21 Thread Andrew Turner
Author: andrew
Date: Thu Apr 21 14:04:56 2016
New Revision: 298403
URL: https://svnweb.freebsd.org/changeset/base/298403

Log:
  Make the GIC SGI global variables static, they are only ever used within
  within this file.
  
  Approved by:  ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm/arm/gic.c

Modified: head/sys/arm/arm/gic.c
==
--- head/sys/arm/arm/gic.c  Thu Apr 21 13:14:55 2016(r298402)
+++ head/sys/arm/arm/gic.c  Thu Apr 21 14:04:56 2016(r298403)
@@ -131,8 +131,8 @@ static int arm_gic_intr(void *);
 static int arm_gic_bind_intr(device_t dev, struct intr_irqsrc *isrc);
 
 #ifdef SMP
-u_int sgi_to_ipi[GIC_LAST_SGI - GIC_FIRST_SGI + 1];
-u_int sgi_first_unused = GIC_FIRST_SGI;
+static u_int sgi_to_ipi[GIC_LAST_SGI - GIC_FIRST_SGI + 1];
+static u_int sgi_first_unused = GIC_FIRST_SGI;
 #endif
 #endif
 
___
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: r298404 - head/release/doc/en_US.ISO8859-1/relnotes

2016-04-21 Thread Steven Kreuzer
Author: skreuzer (doc,ports committer)
Date: Thu Apr 21 14:20:45 2016
New Revision: 298404
URL: https://svnweb.freebsd.org/changeset/base/298404

Log:
  Document r296417, clang, llvm, etc. updated to upstream 3.8.0
  
  Approved by:  gjb@
  Differential Revision:D6037

Modified:
  head/release/doc/en_US.ISO8859-1/relnotes/article.xml

Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml
==
--- head/release/doc/en_US.ISO8859-1/relnotes/article.xml   Thu Apr 21 
14:04:56 2016(r298403)
+++ head/release/doc/en_US.ISO8859-1/relnotes/article.xml   Thu Apr 21 
14:20:45 2016(r298404)
@@ -585,21 +585,21 @@
   The &man.nc.1; utility has been updated
to the OpenBSD 5.8 version.
 
-  Clang has
-   been updated to version 3.7.0.
+  Clang has
+   been updated to version 3.8.0.
 
-  LLVM has
-   been updated to version 3.7.0.
+  LLVM has
+   been updated to version 3.8.0.
 
-  LLDB has
-   been updated to version 3.7.0.
+  LLDB has
+   been updated to version 3.8.0.
 
-  libc++ has
-   been updated to version 3.7.0.
+  libc++ has
+   been updated to version 3.8.0.
 
-  The
+  The
compiler_rt utility has been
-   updated to version 3.7.0.
+   updated to version 3.8.0.
 
 
 
___
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: r298408 - head/sys/netinet

2016-04-21 Thread Jonathan T. Looney
Author: jtl
Date: Thu Apr 21 15:06:53 2016
New Revision: 298408
URL: https://svnweb.freebsd.org/changeset/base/298408

Log:
  Prevent underflows in tp->snd_wnd if the remote side ACKs more than
  tp->snd_wnd. This can happen, for example, when the remote side responds to
  a window probe by ACKing the one byte it contains.
  
  Differential Revision:https://reviews.freebsd.org/D5625
  Reviewed by:  hiren
  Obtained from:Juniper Networks (earlier version)
  MFC after:2 weeks
  Sponsored by: Juniper Networks

Modified:
  head/sys/netinet/tcp_input.c

Modified: head/sys/netinet/tcp_input.c
==
--- head/sys/netinet/tcp_input.cThu Apr 21 15:02:57 2016
(r298407)
+++ head/sys/netinet/tcp_input.cThu Apr 21 15:06:53 2016
(r298408)
@@ -2754,6 +2754,9 @@ process_ACK:
INP_WLOCK_ASSERT(tp->t_inpcb);
 
acked = BYTES_THIS_ACK(tp, th);
+   KASSERT(acked >= 0, ("%s: acked unexepectedly negative "
+   "(tp->snd_una=%u, th->th_ack=%u, tp=%p, m=%p)", __func__,
+   tp->snd_una, th->th_ack, tp, m));
TCPSTAT_INC(tcps_rcvackpack);
TCPSTAT_ADD(tcps_rcvackbyte, acked);
 
@@ -2823,13 +2826,19 @@ process_ACK:
 
SOCKBUF_LOCK(&so->so_snd);
if (acked > sbavail(&so->so_snd)) {
-   tp->snd_wnd -= sbavail(&so->so_snd);
+   if (tp->snd_wnd >= sbavail(&so->so_snd))
+   tp->snd_wnd -= sbavail(&so->so_snd);
+   else
+   tp->snd_wnd = 0;
mfree = sbcut_locked(&so->so_snd,
(int)sbavail(&so->so_snd));
ourfinisacked = 1;
} else {
mfree = sbcut_locked(&so->so_snd, acked);
-   tp->snd_wnd -= acked;
+   if (tp->snd_wnd >= (u_long) acked)
+   tp->snd_wnd -= acked;
+   else
+   tp->snd_wnd = 0;
ourfinisacked = 0;
}
/* NB: sowwakeup_locked() does an implicit unlock. */
___
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: r298247 - head/sbin/fdisk_pc98

2016-04-21 Thread John Baldwin
On Thursday, April 21, 2016 04:01:17 PM Bruce Evans wrote:
> On Wed, 20 Apr 2016, John Baldwin wrote:
> 
> > On Wednesday, April 20, 2016 01:06:38 PM Bruce Evans wrote:
> >> On Wed, 20 Apr 2016, Marcelo Araujo wrote:
> >>
> >>> 2016-04-20 0:16 GMT+08:00 John Baldwin :
> >>>
>  On Tuesday, April 19, 2016 04:46:13 AM Marcelo Araujo wrote:
> > Author: araujo
> > Date: Tue Apr 19 04:46:13 2016
> > New Revision: 298247
> > URL: https://svnweb.freebsd.org/changeset/base/298247
> >
> > Log:
> >   Remove redundant parenthesis.
> >
> >   Submitted by:   pfg
> >   MFC after:  2 weeks.
> >>
> >> I don't realling like churnging to the nonstandard nitems().  Use
> >> of the nonstandard  is bad enough.
> >
> > I think it's not that bad from a readability standpoint.  Other languages
> > have fairly concise syntax for 'for-each' loops and this provides a
> > closer variant of that for statically sized arrays.  TAILQ_FOREACH() is
> > still nicer of course.  One could imagine doing some sort of
> > ARRAY_FOREACH() that was:
> 
> Ugh, I really realling (sic) don't like the FOREACH macros.  The FOREACH
> macros add syntactic salt.  The queue macros were bad enough before they
> had FOREACH.  Arrays don't start with such nastiness.
> 
> > #define ARRAY_FOREACH(p, array)\
> > for (size_t __i = 0, (p) = &(array)[0]; __i < nitems((array)); __i++, 
> > (p)++)
> 
> This only works in the not very usual case of a simple loop from the start
> to the end.  Even the name EACH becomes wrong if the range is anything else.
> For full nastiness, add a few hundred FORFOO macros to handle multi-
> dimensional arrays with different access methods, array slices, sentinels
> and other terminating conditions, etc.

Actually, combined with break this is a common case.  The fairly widespread
use of the queue FOREACH macros (and most of the uses of nitems() in the
tree) are a testament to this.

> > Perhaps better is this:
> >
> > #define ARRAY_FOREACH(p, array) \
> > for ((p) = &(array)[0]; (p) < &(array)[nitems((array))]; (p)++)
> >
> > (No need for __i)
> 
> But hiding the indexes forces the old C programming idiom of using
> pointers for everything.  A mere few hundred FORFOO macros won't do.
> For just 1-dimensional FOREACH, you need 3 versions to expose p, i or
> both p and i.

If someone wanted 'i' they could maintain it on their own through the loop.
In practice, 'foreach' is a common idiom in other languages and is used to
mean 'for each item in container'.  The 'short' syntax always implies a full
iteration (though you could use break to bail early).  For example, in
python:

for item in list:
# do stuff

Or in C++11:

for (p : array) {
}

In C++11 I think this only works for std::array rather than a plain C
array, though compared to a fixed-size array for which nitems() works,
std::array is equivalent.  Both of these work for dynamically sized
containers for which our queue macros are the equivalent.

-- 
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"


svn commit: r298409 - head/sys/dev/siba

2016-04-21 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Apr 21 15:24:21 2016
New Revision: 298409
URL: https://svnweb.freebsd.org/changeset/base/298409

Log:
  siba(4): remove slightly used 'bound' variable.
  
  It can be replaced with nitems(). While here simplify the function
  
  Suggested by: jhb

Modified:
  head/sys/dev/siba/siba.c

Modified: head/sys/dev/siba/siba.c
==
--- head/sys/dev/siba/siba.cThu Apr 21 15:06:53 2016(r298408)
+++ head/sys/dev/siba/siba.cThu Apr 21 15:24:21 2016(r298409)
@@ -337,22 +337,19 @@ siba_attach(device_t dev)
 static struct siba_devid *
 siba_dev_match(uint16_t vid, uint16_t devid, uint8_t rev)
 {
-   size_t   i, bound;
+   size_t   i;
struct siba_devid   *sd;
 
-   bound = sizeof(siba_devids) / sizeof(struct siba_devid);
sd = &siba_devids[0];
-   for (i = 0; i < bound; i++, sd++) {
+   for (i = 0; i < nitems(siba_devids); i++, sd++) {
if (((vid == SIBA_VID_ANY) || (vid == sd->sd_vendor)) &&
((devid == SIBA_DEVID_ANY) || (devid == sd->sd_device)) &&
((rev == SIBA_REV_ANY) || (rev == sd->sd_rev) ||
 (sd->sd_rev == SIBA_REV_ANY)))
-   break;
+   return(sd);
}
-   if (i == bound)
-   sd = NULL;
 
-   return (sd);
+   return (NULL);
 }
 
 static int
___
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: r298411 - in head/sys: cam cam/ata cam/scsi dev/advansys dev/hwpmc dev/pccard dev/sge dev/sound/pci dev/uart kern mips/nlm net netgraph/bluetooth/socket nlm security/audit vm

2016-04-21 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Apr 21 15:38:28 2016
New Revision: 298411
URL: https://svnweb.freebsd.org/changeset/base/298411

Log:
  Remove slightly used const values that can be replaced with nitems().
  
  Suggested by: jhb

Modified:
  head/sys/cam/ata/ata_xpt.c
  head/sys/cam/cam.c
  head/sys/cam/scsi/scsi_all.c
  head/sys/dev/advansys/adw_pci.c
  head/sys/dev/advansys/adwlib.c
  head/sys/dev/hwpmc/hwpmc_core.c
  head/sys/dev/hwpmc/hwpmc_mpc7xxx.c
  head/sys/dev/hwpmc/hwpmc_uncore.c
  head/sys/dev/hwpmc/hwpmc_xscale.c
  head/sys/dev/pccard/pccard_cis_quirks.c
  head/sys/dev/sge/if_sge.c
  head/sys/dev/sound/pci/emu10kx.c
  head/sys/dev/uart/uart_subr.c
  head/sys/kern/subr_witness.c
  head/sys/mips/nlm/xlp_machdep.c
  head/sys/net/netisr.c
  head/sys/netgraph/bluetooth/socket/ng_btsocket.c
  head/sys/nlm/nlm_prot_impl.c
  head/sys/security/audit/audit_bsm_klib.c
  head/sys/security/audit/bsm_errno.c
  head/sys/vm/vm_pager.c

Modified: head/sys/cam/ata/ata_xpt.c
==
--- head/sys/cam/ata/ata_xpt.c  Thu Apr 21 15:25:17 2016(r298410)
+++ head/sys/cam/ata/ata_xpt.c  Thu Apr 21 15:38:28 2016(r298411)
@@ -160,9 +160,6 @@ static struct ata_quirk_entry ata_quirk_
},
 };
 
-static const int ata_quirk_table_size =
-   sizeof(ata_quirk_table) / sizeof(*ata_quirk_table);
-
 static cam_status  proberegister(struct cam_periph *periph,
  void *arg);
 static void probeschedule(struct cam_periph *probe_periph);
@@ -1284,7 +1281,7 @@ ata_find_quirk(struct cam_ed *device)
 
match = cam_quirkmatch((caddr_t)&device->ident_data,
   (caddr_t)ata_quirk_table,
-  ata_quirk_table_size,
+  nitems(ata_quirk_table),
   sizeof(*ata_quirk_table), ata_identify_match);
 
if (match == NULL)
@@ -1579,7 +1576,7 @@ ata_alloc_device(struct cam_eb *bus, str
 * Take the default quirk entry until we have inquiry
 * data and can determine a better quirk to use.
 */
-   quirk = &ata_quirk_table[ata_quirk_table_size - 1];
+   quirk = &ata_quirk_table[nitems(ata_quirk_table) - 1];
device->quirk = (void *)quirk;
device->mintags = 0;
device->maxtags = 0;

Modified: head/sys/cam/cam.c
==
--- head/sys/cam/cam.c  Thu Apr 21 15:25:17 2016(r298410)
+++ head/sys/cam/cam.c  Thu Apr 21 15:38:28 2016(r298411)
@@ -105,9 +105,6 @@ const struct cam_status_entry cam_status
{ CAM_SCSI_BUSY, "SCSI Bus Busy" },
 };
 
-const int num_cam_status_entries =
-sizeof(cam_status_table)/sizeof(*cam_status_table);
-
 #ifdef _KERNEL
 SYSCTL_NODE(_kern, OID_AUTO, cam, CTLFLAG_RD, 0, "CAM Subsystem");
 
@@ -256,7 +253,7 @@ cam_fetch_status_entry(cam_status status
 {
status &= CAM_STATUS_MASK;
return (bsearch(&status, &cam_status_table,
-   num_cam_status_entries,
+   nitems(cam_status_table),
sizeof(*cam_status_table),
camstatusentrycomp));
 }

Modified: head/sys/cam/scsi/scsi_all.c
==
--- head/sys/cam/scsi/scsi_all.cThu Apr 21 15:25:17 2016
(r298410)
+++ head/sys/cam/scsi/scsi_all.cThu Apr 21 15:38:28 2016
(r298411)
@@ -737,9 +737,6 @@ const struct sense_key_table_entry sense
{ SSD_KEY_COMPLETED, SS_NOP, "COMPLETED" }
 };
 
-const int sense_key_table_size =
-sizeof(sense_key_table)/sizeof(sense_key_table[0]);
-
 static struct asc_table_entry quantum_fireball_entries[] = {
{ SST(0x04, 0x0b, SS_START | SSQ_DECREMENT_COUNT | ENXIO, 
 "Logical unit not ready, initializing cmd. required") }
@@ -3291,14 +3288,14 @@ fetchtableentries(int sense_key, int asc
sense_tables[0] = quirk->sense_key_info;
sense_tables_size[0] = quirk->num_sense_keys;
sense_tables[1] = sense_key_table;
-   sense_tables_size[1] = sense_key_table_size;
+   sense_tables_size[1] = nitems(sense_key_table);
num_sense_tables = 2;
} else {
asc_tables[0] = asc_table;
asc_tables_size[0] = asc_table_size;
num_asc_tables = 1;
sense_tables[0] = sense_key_table;
-   sense_tables_size[0] = sense_key_table_size;
+   sense_tables_size[0] = nitems(sense_key_table);
num_sense_tables = 1;
}
 

Modified: head/sys/dev/advansys/adw_pci.c
==
--- head/sys/dev/advansys/adw_pci.c Thu Apr 21 15:25:17 2016
(r298410)
+++ head/sys/dev/advansys/adw_pci.c   

svn commit: r298412 - head/sys/ofed/drivers/infiniband/core

2016-04-21 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Apr 21 16:04:58 2016
New Revision: 298412
URL: https://svnweb.freebsd.org/changeset/base/298412

Log:
  Fix for resolving mac address when the destination address is a gateway.
  Remove some dead code while at it.
  
  Sponsored by: Mellanox Technologies
  MFC after:1 week

Modified:
  head/sys/ofed/drivers/infiniband/core/addr.c

Modified: head/sys/ofed/drivers/infiniband/core/addr.c
==
--- head/sys/ofed/drivers/infiniband/core/addr.cThu Apr 21 15:38:28 
2016(r298411)
+++ head/sys/ofed/drivers/infiniband/core/addr.cThu Apr 21 16:04:58 
2016(r298412)
@@ -333,17 +333,18 @@ mcast:
switch (dst_in->sa_family) {
 #ifdef INET
case AF_INET:
-   error = arpresolve(ifp, is_gw, NULL, dst_in, edst, NULL);
+   error = arpresolve(ifp, is_gw, NULL,
+   is_gw ? rte->rt_gateway : dst_in, edst, NULL);
break;
 #endif
 #ifdef INET6
case AF_INET6:
-   error = nd6_resolve(ifp, is_gw, NULL, dst_in, edst, NULL);
+   error = nd6_resolve(ifp, is_gw, NULL,
+   is_gw ? rte->rt_gateway : dst_in, edst, NULL);
break;
 #endif
default:
-   /* XXX: Shouldn't happen. */
-   error = -EINVAL;
+   break;
}
RTFREE(rte);
if (error == 0) {
___
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: r298413 - head/share/mk

2016-04-21 Thread Bryan Drewery
Author: bdrewery
Date: Thu Apr 21 16:12:55 2016
New Revision: 298413
URL: https://svnweb.freebsd.org/changeset/base/298413

Log:
  Follow-up r298219: Don't error with 'make all install'.
  
  Reported by:  kib
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/share/mk/bsd.sys.mk

Modified: head/share/mk/bsd.sys.mk
==
--- head/share/mk/bsd.sys.mkThu Apr 21 16:04:58 2016(r298412)
+++ head/share/mk/bsd.sys.mkThu Apr 21 16:12:55 2016(r298413)
@@ -180,7 +180,7 @@ CXXFLAGS+=  ${CXXFLAGS.${.IMPSRC:T}}
 
 .if defined(SRCTOP)
 # Prevent rebuilding during install to support read-only objdirs.
-.if make(install) && empty(.MAKE.MODE:Mmeta)
+.if !make(all) && make(install) && empty(.MAKE.MODE:Mmeta)
 CFLAGS+=   ERROR-tried-to-rebuild-during-make-install
 .endif
 .endif
___
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: r298219 - head/share/mk

2016-04-21 Thread Bryan Drewery
On 4/19/16 5:15 AM, Konstantin Belousov wrote:
> On Mon, Apr 18, 2016 at 06:14:02PM +, Bryan Drewery wrote:
>> Author: bdrewery
>> Date: Mon Apr 18 18:14:02 2016
>> New Revision: 298219
>> URL: https://svnweb.freebsd.org/changeset/base/298219
>>
>> Log:
>>   Cause an error during 'make install' if trying to compile with CC.
>>   
>>   This is limited to src-tree builds, meaning not extended to ports or other
>>   out-of-tree builds.
>>   
>>   This will help ensure that read-only OBJDIRS will be respected at 
>> install-time
>>   by causing a more consistent failure for those who don't use a read-only
>>   OBJDIR.  It also will cause Jenkins to yell.  This is a better solution 
>> than
>>   trying to see CC=false as has been attempted and discussed before.
>>   
>>   Of course this is only relevant for files generated by CC.
>>   
>>   Disable this for META_MODE since it will detect the CFLAGS/command
>>   change and force a rebuild.
>>   
>>   Sponsored by:  EMC / Isilon Storage Division
>>
>> Modified:
>>   head/share/mk/bsd.sys.mk
>>
>> Modified: head/share/mk/bsd.sys.mk
>> ==
>> --- head/share/mk/bsd.sys.mk Mon Apr 18 18:13:58 2016(r298218)
>> +++ head/share/mk/bsd.sys.mk Mon Apr 18 18:14:02 2016(r298219)
>> @@ -178,6 +178,13 @@ ACFLAGS+=   ${ACFLAGS.${.IMPSRC:T}}
>>  CFLAGS+=${CFLAGS.${.IMPSRC:T}}
>>  CXXFLAGS+=  ${CXXFLAGS.${.IMPSRC:T}}
>>  
>> +.if defined(SRCTOP)
>> +# Prevent rebuilding during install to support read-only objdirs.
>> +.if make(install) && empty(.MAKE.MODE:Mmeta)
>> +CFLAGS+=ERROR-tried-to-rebuild-during-make-install
>> +.endif
>> +.endif
>> +
>>  # Tell bmake not to mistake standard targets for things to be searched for
>>  # or expect to ever be up-to-date.
>>  PHONY_NOTMAIN = analyze afterdepend afterinstall all beforedepend 
>> beforeinstall \
> 
> It seems to cause the following behaviour:
> make buildenv
> cd lib/libthr
> # make DEBUG_FLAGS=-g WITHOUT_TESTS=yes all install

By the way, since r295646 it should be safe to use -j here. Let me know
if you run into trouble with it.

> cc   -O2 -pipe   -DPTHREAD_KERNEL 
> -I/usr/home/kostik/work/build/bsd/DEV/src/lib/libthr/../libc/include 
> -I/usr/home/kostik/work/build/bsd/DEV/src/lib/libthr/thread  
> -I/usr/home/kostik/work/build/bsd/DEV/src/lib/libthr/../../include 
> -I/usr/home/kostik/work/build/bsd/DEV/src/lib/libthr/arch/amd64/include 
> -I/usr/home/kostik/work/build/bsd/DEV/src/lib/libthr/sys 
> -I/usr/home/kostik/work/build/bsd/DEV/src/lib/libthr/../../libexec/rtld-elf 
> -I/usr/home/kostik/work/build/bsd/DEV/src/lib/libthr/../../libexec/rtld-elf/amd64
>  -I/usr/home/kostik/work/build/bsd/DEV/src/lib/libthr/../libthread_db 
> -Winline -fexceptions -D_PTHREAD_FORCED_UNWIND -D_PTHREADS_INVARIANTS 
> -mno-mmx -mno-sse -mno-avx -g -MD -MP -MF.depend.thr_init.o -MTthr_init.o 
> -std=gnu99 -Wsystem-headers -Werror -Wall -Wno-format-y2k -W 
> -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes 
> -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body 
> -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compar
 e
 -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function 
-Wno-enum-conversion -Wno-unused-local-typedef  -Qunused-arguments  
ERROR-tried-to-rebuild-during-make-install -c 
/usr/home/kostik/work/build/bsd/DEV/src/lib/libthr/thread/thr_init.c -o 
thr_init.o
> cc: error: no such file or directory: 
> 'ERROR-tried-to-rebuild-during-make-install'
> *** Error code 1
> 
> Stop.
> make[3]: stopped in /usr/home/kostik/work/build/bsd/DEV/src/lib/libthr
> 
> Doing separate steps for all and install targets work, but before, it also
> worked and was convenient to list sequential targets on the make command
> line.
> 

Fixed in r298413.

-- 
Regards,
Bryan Drewery
___
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: r298414 - in head/sys: kern sys

2016-04-21 Thread Edward Tomasz Napierala
Author: trasz
Date: Thu Apr 21 16:22:52 2016
New Revision: 298414
URL: https://svnweb.freebsd.org/changeset/base/298414

Log:
  Get rid of rctl_lock; use racct_lock where appropriate. The fast paths
  already required both of them, so having a separate rctl_lock didn't
  buy us anything.
  
  Reviewed by:  mjg@
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D5914

Modified:
  head/sys/kern/kern_racct.c
  head/sys/kern/kern_rctl.c
  head/sys/sys/racct.h

Modified: head/sys/kern/kern_racct.c
==
--- head/sys/kern/kern_racct.c  Thu Apr 21 16:12:55 2016(r298413)
+++ head/sys/kern/kern_racct.c  Thu Apr 21 16:22:52 2016(r298414)
@@ -91,13 +91,9 @@ SYSCTL_UINT(_kern_racct, OID_AUTO, pcpu_
  */
 #define RACCT_PCPU_SECS3
 
-static struct mtx racct_lock;
+struct mtx racct_lock;
 MTX_SYSINIT(racct_lock, &racct_lock, "racct lock", MTX_DEF);
 
-#define RACCT_LOCK()   mtx_lock(&racct_lock)
-#define RACCT_UNLOCK() mtx_unlock(&racct_lock)
-#define RACCT_LOCK_ASSERT()mtx_assert(&racct_lock, MA_OWNED)
-
 static uma_zone_t racct_zone;
 
 static void racct_sub_racct(struct racct *dest, const struct racct *src);
@@ -111,6 +107,8 @@ SDT_PROBE_DEFINE3(racct, , rusage, add,
 "struct proc *", "int", "uint64_t");
 SDT_PROBE_DEFINE3(racct, , rusage, add__failure,
 "struct proc *", "int", "uint64_t");
+SDT_PROBE_DEFINE3(racct, , rusage, add__buf,
+"struct proc *", "const struct buf *", "int");
 SDT_PROBE_DEFINE3(racct, , rusage, add__cred,
 "struct ucred *", "int", "uint64_t");
 SDT_PROBE_DEFINE3(racct, , rusage, add__force,
@@ -618,8 +616,6 @@ racct_add_cred_locked(struct ucred *cred
 
ASSERT_RACCT_ENABLED();
 
-   SDT_PROBE3(racct, , rusage, add__cred, cred, resource, amount);
-
racct_adjust_resource(cred->cr_ruidinfo->ui_racct, resource, amount);
for (pr = cred->cr_prison; pr != NULL; pr = pr->pr_parent)
racct_adjust_resource(pr->pr_prison_racct->prr_racct, resource,
@@ -638,6 +634,8 @@ racct_add_cred(struct ucred *cred, int r
if (!racct_enable)
return;
 
+   SDT_PROBE3(racct, , rusage, add__cred, cred, resource, amount);
+
RACCT_LOCK();
racct_add_cred_locked(cred, resource, amount);
RACCT_UNLOCK();
@@ -654,6 +652,8 @@ racct_add_buf(struct proc *p, const stru
ASSERT_RACCT_ENABLED();
PROC_LOCK_ASSERT(p, MA_OWNED);
 
+   SDT_PROBE3(racct, , rusage, add__buf, p, bp, is_write);
+
RACCT_LOCK();
if (is_write) {
racct_add_locked(curproc, RACCT_WRITEBPS, bp->b_bcount, 1);
@@ -766,13 +766,19 @@ racct_set_force(struct proc *p, int reso
 uint64_t
 racct_get_limit(struct proc *p, int resource)
 {
+#ifdef RCTL
+   uint64_t available;
 
if (!racct_enable)
return (UINT64_MAX);
 
-#ifdef RCTL
-   return (rctl_get_limit(p, resource));
+   RACCT_LOCK();
+   available = rctl_get_limit(p, resource);
+   RACCT_UNLOCK();
+
+   return (available);
 #else
+
return (UINT64_MAX);
 #endif
 }
@@ -786,13 +792,19 @@ racct_get_limit(struct proc *p, int reso
 uint64_t
 racct_get_available(struct proc *p, int resource)
 {
+#ifdef RCTL
+   uint64_t available;
 
if (!racct_enable)
return (UINT64_MAX);
 
-#ifdef RCTL
-   return (rctl_get_available(p, resource));
+   RACCT_LOCK();
+   available = rctl_get_available(p, resource);
+   RACCT_UNLOCK();
+
+   return (available);
 #else
+
return (UINT64_MAX);
 #endif
 }
@@ -805,12 +817,18 @@ racct_get_available(struct proc *p, int 
 static int64_t
 racct_pcpu_available(struct proc *p)
 {
+#ifdef RCTL
+   uint64_t available;
 
ASSERT_RACCT_ENABLED();
 
-#ifdef RCTL
-   return (rctl_pcpu_available(p));
+   RACCT_LOCK();
+   available = rctl_pcpu_available(p);
+   RACCT_UNLOCK();
+
+   return (available);
 #else
+
return (INT64_MAX);
 #endif
 }
@@ -852,14 +870,6 @@ racct_sub_cred_locked(struct ucred *cred
 
ASSERT_RACCT_ENABLED();
 
-   SDT_PROBE3(racct, , rusage, sub__cred, cred, resource, amount);
-
-#ifdef notyet
-   KASSERT(RACCT_CAN_DROP(resource),
-   ("%s: called for resource %d which can not drop", __func__,
-resource));
-#endif
-
racct_adjust_resource(cred->cr_ruidinfo->ui_racct, resource, -amount);
for (pr = cred->cr_prison; pr != NULL; pr = pr->pr_parent)
racct_adjust_resource(pr->pr_prison_racct->prr_racct, resource,
@@ -877,6 +887,14 @@ racct_sub_cred(struct ucred *cred, int r
if (!racct_enable)
return;
 
+   SDT_PROBE3(racct, , rusage, sub__cred, cred, resource, amount);
+
+#ifdef notyet
+   KASSERT(RACCT_CAN_DROP(resource),
+   ("%s: called for resource %d which can not drop", __func__,
+

svn commit: r298416 - head

2016-04-21 Thread Bryan Drewery
Author: bdrewery
Date: Thu Apr 21 16:30:25 2016
New Revision: 298416
URL: https://svnweb.freebsd.org/changeset/base/298416

Log:
  Fix 'make -n' for new packaging targets.
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Thu Apr 21 16:30:16 2016(r298415)
+++ head/Makefile.inc1  Thu Apr 21 16:30:25 2016(r298416)
@@ -1238,7 +1238,7 @@ packagekernel: .PHONY
 .endif
 
 stagekernel: .PHONY
-   ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} distributekernel
+   ${_+_}${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} distributekernel
 
 PORTSDIR?= /usr/ports
 WSTAGEDIR?=
${MAKEOBJDIRPREFIX}${.CURDIR}/${TARGET}.${TARGET_ARCH}/worldstage
@@ -1257,7 +1257,7 @@ _pkgbootstrap: .PHONY
 .endif
 
 packages: .PHONY
-   ${MAKE} -C ${.CURDIR} PKG_VERSION=${PKG_VERSION} real-packages
+   ${_+_}${MAKE} -C ${.CURDIR} PKG_VERSION=${PKG_VERSION} real-packages
 
 package-pkg: .PHONY
rm -rf /tmp/ports.${TARGET} || :
___
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: r298415 - head

2016-04-21 Thread Bryan Drewery
Author: bdrewery
Date: Thu Apr 21 16:30:16 2016
New Revision: 298415
URL: https://svnweb.freebsd.org/changeset/base/298415

Log:
  Add more missing .PHONY.
  
  This also protects them from trying to create .meta files
  with WITH_META_MODE.
  
  Reported by:  Nikolai Lifanov 
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Thu Apr 21 16:22:52 2016(r298414)
+++ head/Makefile.inc1  Thu Apr 21 16:30:16 2016(r298415)
@@ -729,9 +729,9 @@ kernel-toolchain: ${TOOLCHAIN_TGTS:N_inc
 #
 # Checks to be sure system is ready for installworld/installkernel.
 #
-installcheck: _installcheck_world _installcheck_kernel
-_installcheck_world:
-_installcheck_kernel:
+installcheck: _installcheck_world _installcheck_kernel .PHONY
+_installcheck_world: .PHONY
+_installcheck_kernel: .PHONY
 
 #
 # Require DESTDIR to be set if installing for a different architecture or
@@ -742,7 +742,7 @@ _installcheck_kernel:
 .if !make(distributeworld)
 _installcheck_world: __installcheck_DESTDIR
 _installcheck_kernel: __installcheck_DESTDIR
-__installcheck_DESTDIR:
+__installcheck_DESTDIR: .PHONY
 .if !defined(DESTDIR) || empty(DESTDIR)
@echo "ERROR: Please set DESTDIR!"; \
false
@@ -769,7 +769,7 @@ CHECK_UIDS+=unbound
 CHECK_GIDS+=   unbound
 .endif
 _installcheck_world: __installcheck_UGID
-__installcheck_UGID:
+__installcheck_UGID: .PHONY
 .for uid in ${CHECK_UIDS}
@if ! `id -u ${uid} >/dev/null 2>&1`; then \
echo "ERROR: Required ${uid} user is missing, see 
/usr/src/UPDATING."; \
@@ -933,7 +933,7 @@ distributeworld installworld stageworld:
 .endif
 .endif
 
-packageworld:
+packageworld: .PHONY
 .for dist in base ${EXTRA_DISTRIBUTIONS}
 .if defined(NO_ROOT)
${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
@@ -1129,7 +1129,7 @@ buildkernel: .MAKE .PHONY
 # Install the kernel defined by INSTALLKERNEL
 #
 installkernel installkernel.debug \
-reinstallkernel reinstallkernel.debug: _installcheck_kernel
+reinstallkernel reinstallkernel.debug: _installcheck_kernel .PHONY
 .if !defined(NO_INSTALLKERNEL)
 .if empty(INSTALLKERNEL)
@echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
@@ -1153,7 +1153,7 @@ reinstallkernel reinstallkernel.debug: _
 .endfor
 .endif
 
-distributekernel distributekernel.debug:
+distributekernel distributekernel.debug: .PHONY
 .if !defined(NO_INSTALLKERNEL)
 .if empty(INSTALLKERNEL)
@echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
@@ -1192,7 +1192,7 @@ distributekernel distributekernel.debug:
 .endfor
 .endif
 
-packagekernel:
+packagekernel: .PHONY
 .if defined(NO_ROOT)
 .if !defined(NO_INSTALLKERNEL)
cd ${DESTDIR}/${DISTDIR}/kernel; \
@@ -1237,7 +1237,7 @@ packagekernel:
 .endif
 .endif
 
-stagekernel:
+stagekernel: .PHONY
${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} distributekernel
 
 PORTSDIR?= /usr/ports
@@ -1251,29 +1251,29 @@ PKGSIGNKEY?=# empty
 .ORDER:create-packages create-kernel-packages
 .ORDER:create-packages sign-packages
 
-_pkgbootstrap:
+_pkgbootstrap: .PHONY
 .if !exists(${LOCALBASE}/sbin/pkg)
@env ASSUME_ALWAYS_YES=YES pkg bootstrap
 .endif
 
-packages:
+packages: .PHONY
${MAKE} -C ${.CURDIR} PKG_VERSION=${PKG_VERSION} real-packages
 
-package-pkg:
+package-pkg: .PHONY
rm -rf /tmp/ports.${TARGET} || :
env ${WMAKEENV:Q} SRCDIR=${.CURDIR} PORTSDIR=${PORTSDIR} 
REVISION=${REVISION} \
PKG_VERSION=${PKG_VERSION} REPODIR=${REPODIR} 
WSTAGEDIR=${WSTAGEDIR} \
sh ${.CURDIR}/release/scripts/make-pkg-package.sh
 
-real-packages: stage-packages create-packages sign-packages
+real-packages: stage-packages create-packages sign-packages .PHONY
 
-stage-packages:
+stage-packages: .PHONY
@mkdir -p ${REPODIR} ${WSTAGEDIR} ${KSTAGEDIR}
${_+_}@cd ${.CURDIR}; \
${MAKE} DESTDIR=${WSTAGEDIR} -DNO_ROOT -B stageworld ; \
${MAKE} DESTDIR=${KSTAGEDIR} -DNO_ROOT -B stagekernel
 
-create-packages:   _pkgbootstrap
+create-packages:   _pkgbootstrap .PHONY
@mkdir -p ${REPODIR}
${_+_}@cd ${.CURDIR}; \
${MAKE} DESTDIR=${WSTAGEDIR} \
@@ -1282,7 +1282,7 @@ create-packages:  _pkgbootstrap
PKG_VERSION=${PKG_VERSION} DISTDIR=kernel \
create-kernel-packages
 
-create-world-packages: _pkgbootstrap
+create-world-packages: _pkgbootstrap .PHONY
@rm -f ${WSTAGEDIR}/*.plist 2>/dev/null || :
@cd ${WSTAGEDIR} ; \
awk -f ${SRCDIR}/release/scripts/mtree-to-plist.awk \
@@ -1307,7 +1307,7 @@ create-world-packages:_pkgbootstrap
-o ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh 
config ABI)/${PKG_VERSION} ; \
done
 
-create-kernel-packages:_pkgbootstrap
+create-kernel-packages:_pk

svn commit: r298417 - head

2016-04-21 Thread Bryan Drewery
Author: bdrewery
Date: Thu Apr 21 16:30:28 2016
New Revision: 298417
URL: https://svnweb.freebsd.org/changeset/base/298417

Log:
  Remove redundant logic from the pkg-base merge.
  
  These will be set from the logic right above it.
  
  Reviewed by:  gjb
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Thu Apr 21 16:30:25 2016(r298416)
+++ head/Makefile.inc1  Thu Apr 21 16:30:28 2016(r298417)
@@ -195,10 +195,6 @@ VERSION=   FreeBSD ${REVISION}-${BRANCH:C/
 .endif
 
 .if !defined(PKG_VERSION)
-REVISION!= MK_AUTO_OBJ=no ${MAKE} -C ${SRCDIR}/release -V REVISION
-BRANCH!=   MK_AUTO_OBJ=no ${MAKE} -C ${SRCDIR}/release -V BRANCH
-SRCRELDATE!=   awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
-   ${SRCDIR}/sys/sys/param.h
 .if ${BRANCH:MSTABLE*} || ${BRANCH:MCURRENT*}
 TIMENOW=   %Y%m%d%H%M%S
 EXTRA_REVISION=.s${TIMENOW:gmtime}
___
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: r298418 - head/sys/boot

2016-04-21 Thread Allan Jude
Author: allanjude
Date: Thu Apr 21 16:32:48 2016
New Revision: 298418
URL: https://svnweb.freebsd.org/changeset/base/298418

Log:
  Add more guards to disable GELIBOOT by defining LOADER_NO_GELI_SUPPORT
  
  Reviewed by:  cem
  Sponsored by: ScaleEngine Inc.
  Differential Revision:https://reviews.freebsd.org/D6049

Modified:
  head/sys/boot/Makefile.amd64
  head/sys/boot/Makefile.i386

Modified: head/sys/boot/Makefile.amd64
==
--- head/sys/boot/Makefile.amd64Thu Apr 21 16:30:28 2016
(r298417)
+++ head/sys/boot/Makefile.amd64Thu Apr 21 16:32:48 2016
(r298418)
@@ -3,9 +3,12 @@
 SUBDIR+=   efi
 SUBDIR+=   libstand32
 SUBDIR+=   zfs
-SUBDIR+=   geli
 SUBDIR+=   userboot
 
+.if !defined(LOADER_NO_GELI_SUPPORT)
+SUBDIR+=   geli
+.endif
+
 .if ${MK_FORTH} != "no"
 SUBDIR+=   ficl32
 .endif

Modified: head/sys/boot/Makefile.i386
==
--- head/sys/boot/Makefile.i386 Thu Apr 21 16:30:28 2016(r298417)
+++ head/sys/boot/Makefile.i386 Thu Apr 21 16:32:48 2016(r298418)
@@ -3,4 +3,7 @@
 SUBDIR+=   efi
 SUBDIR+=   libstand32
 SUBDIR+=   zfs
+
+.if !defined(LOADER_NO_GELI_SUPPORT)
 SUBDIR+=   geli
+.endif
___
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: r298419 - head/sys/ofed/drivers/infiniband/core

2016-04-21 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Apr 21 16:33:42 2016
New Revision: 298419
URL: https://svnweb.freebsd.org/changeset/base/298419

Log:
  Fix for using IPv6 addresses with RDMA:
  
  IPv6 addresses has a scope ID which sometimes is stored in the
  "sin6_scope_id" field of "struct sockaddr_in6" and sometimes as part
  of the IPv6 address itself depending on the context. If the scope ID
  is not in the expected location, the IPv6 address lookups in the
  so-called GID table will fail. Some code factoring has been made to
  achieve a clean exit of the "addr_resolve" function via a common
  "done" label.
  
  Sponsored by: Mellanox Technologies
  Submitted by: Shani Michaeli 
  MFC after:1 week

Modified:
  head/sys/ofed/drivers/infiniband/core/addr.c

Modified: head/sys/ofed/drivers/infiniband/core/addr.c
==
--- head/sys/ofed/drivers/infiniband/core/addr.cThu Apr 21 16:32:48 
2016(r298418)
+++ head/sys/ofed/drivers/infiniband/core/addr.cThu Apr 21 16:33:42 
2016(r298419)
@@ -109,6 +109,14 @@ int rdma_copy_addr(struct rdma_dev_addr 
 }
 EXPORT_SYMBOL(rdma_copy_addr);
 
+#defineSCOPE_ID_CACHE(_scope_id, _addr6) do {  \
+   (_addr6)->sin6_addr.s6_addr[3] = (_scope_id);   \
+   (_addr6)->sin6_scope_id = 0; } while (0)
+
+#defineSCOPE_ID_RESTORE(_scope_id, _addr6) do {\
+   (_addr6)->sin6_scope_id = (_scope_id);  \
+   (_addr6)->sin6_addr.s6_addr[3] = 0; } while (0)
+
 int rdma_translate_ip(struct sockaddr *addr, struct rdma_dev_addr *dev_addr,
  u16 *vlan_id)
 {
@@ -144,12 +152,18 @@ int rdma_translate_ip(struct sockaddr *a
struct sockaddr_in6 *sin6;
struct ifaddr *ifa;
in_port_t port;
+   uint32_t scope_id;
 
sin6 = (struct sockaddr_in6 *)addr;
port = sin6->sin6_port;
sin6->sin6_port = 0;
+   scope_id = sin6->sin6_scope_id;
+   if (IN6_IS_SCOPE_LINKLOCAL(&sin6->sin6_addr))
+   SCOPE_ID_CACHE(scope_id, sin6);
ifa = ifa_ifwithaddr(addr);
sin6->sin6_port = port;
+   if (IN6_IS_SCOPE_LINKLOCAL(&sin6->sin6_addr))
+   SCOPE_ID_RESTORE(scope_id, sin6);
if (ifa == NULL) {
ret = -ENODEV;
break;
@@ -161,6 +175,8 @@ int rdma_translate_ip(struct sockaddr *a
break;
}
 #endif
+   default:
+   break;
}
return ret;
 }
@@ -203,7 +219,12 @@ static int addr_resolve(struct sockaddr 
struct ifaddr *ifa;
struct ifnet *ifp;
struct rtentry *rte;
+#if defined(INET) || defined(INET6)
in_port_t port;
+#endif
+#ifdef INET6
+   uint32_t scope_id;
+#endif
u_char edst[MAX_ADDR_LEN];
int multi;
int bcast;
@@ -219,6 +240,13 @@ static int addr_resolve(struct sockaddr 
sin6 = NULL;
ifp = NULL;
rte = NULL;
+   ifa = NULL;
+   ifp = NULL;
+   memset(edst, 0, sizeof(edst));
+#ifdef INET6
+   scope_id = -1U;
+#endif
+
switch (dst_in->sa_family) {
 #ifdef INET
case AF_INET:
@@ -236,6 +264,22 @@ static int addr_resolve(struct sockaddr 
port = sin->sin_port;
sin->sin_port = 0;
memset(&sin->sin_zero, 0, sizeof(sin->sin_zero));
+
+   /*
+* If we have a source address to use look it
+* up first and verify that it is a local
+* interface:
+*/
+   ifa = ifa_ifwithaddr(src_in);
+   sin->sin_port = port;
+   if (ifa == NULL) {
+   error = ENETUNREACH;
+   goto done;
+   }
+   ifp = ifa->ifa_ifp;
+   ifa_free(ifa);
+   if (bcast || multi)
+   goto mcast;
}
break;
 #endif
@@ -244,42 +288,55 @@ static int addr_resolve(struct sockaddr 
sin6 = (struct sockaddr_in6 *)dst_in;
if (IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
multi = 1;
+   if (IN6_IS_SCOPE_LINKLOCAL(&sin6->sin6_addr)) {
+   /*
+* The IB address comparison fails if the
+* scope ID is set and not part of the addr:
+*/
+   scope_id = sin6->sin6_scope_id;
+   if (scope_id < 256)
+

svn commit: r298420 - head/sys/geom

2016-04-21 Thread Alan Somers
Author: asomers
Date: Thu Apr 21 16:43:15 2016
New Revision: 298420
URL: https://svnweb.freebsd.org/changeset/base/298420

Log:
  Notify userspace listeners when geom disk attributes have changed
  
  sys/geom/geom_disk.c:
disk_attr_changed(): Generate a devctl event of type GEOM: for
every call.
  
  MFC after:4 weeks
  Sponsored by: Spectra Logic Corp
  Differential Revision:https://reviews.freebsd.org/D5952

Modified:
  head/sys/geom/geom_disk.c

Modified: head/sys/geom/geom_disk.c
==
--- head/sys/geom/geom_disk.c   Thu Apr 21 16:33:42 2016(r298419)
+++ head/sys/geom/geom_disk.c   Thu Apr 21 16:43:15 2016(r298420)
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -839,11 +840,14 @@ disk_attr_changed(struct disk *dp, const
 {
struct g_geom *gp;
struct g_provider *pp;
+   char devnamebuf[128];
 
gp = dp->d_geom;
if (gp != NULL)
LIST_FOREACH(pp, &gp->provider, provider)
(void)g_attr_changed(pp, attr, flag);
+   snprintf(devnamebuf, 128, "devname=%s%d", dp->d_name, dp->d_unit);
+   devctl_notify("GEOM", "disk", attr, devnamebuf);
 }
 
 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: r298421 - head

2016-04-21 Thread Bryan Drewery
Author: bdrewery
Date: Thu Apr 21 16:43:36 2016
New Revision: 298421
URL: https://svnweb.freebsd.org/changeset/base/298421

Log:
  Add more missing .PHONY
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Thu Apr 21 16:43:15 2016(r298420)
+++ head/Makefile.inc1  Thu Apr 21 16:43:36 2016(r298421)
@@ -660,7 +660,7 @@ _libraries:
${_+_}cd ${.CURDIR}; \
${WMAKE} -DNO_FSCHG MK_HTML=no -DNO_LINT MK_MAN=no \
MK_PROFILE=no MK_TESTS=no MK_TESTS_SUPPORT=${MK_TESTS} libraries
-everything:
+everything: .PHONY
@echo
@echo "--"
@echo ">>> stage 4.3: building everything"
@@ -679,7 +679,7 @@ WMAKE_TGTS+=everything
 WMAKE_TGTS+=   build${libcompat}
 .endif
 
-buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
+buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue .PHONY
 .ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
 
 buildworld_prologue: .PHONY
@@ -717,8 +717,8 @@ buildenv: .PHONY
|| true
 
 TOOLCHAIN_TGTS=${WMAKE_TGTS:Neverything:Nbuild${libcompat}}
-toolchain: ${TOOLCHAIN_TGTS}
-kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
+toolchain: ${TOOLCHAIN_TGTS} .PHONY
+kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries} .PHONY
 
 #
 # installcheck
@@ -824,7 +824,7 @@ DEBUG_DISTRIBUTIONS+=   base ${EXTRA_DISTR
 
 MTREE_MAGIC?=  mtree 2.0
 
-distributeworld installworld stageworld: _installcheck_world
+distributeworld installworld stageworld: _installcheck_world .PHONY
mkdir -p ${INSTALLTMP}
progs=$$(for prog in ${ITOOLS}; do \
if progpath=`which $$prog`; then \
___
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: r298423 - head

2016-04-21 Thread Bryan Drewery
Author: bdrewery
Date: Thu Apr 21 16:50:45 2016
New Revision: 298423
URL: https://svnweb.freebsd.org/changeset/base/298423

Log:
  Fix unset variables from r298417.
  
  Pointyhat to: bdrewery
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Thu Apr 21 16:49:04 2016(r298422)
+++ head/Makefile.inc1  Thu Apr 21 16:50:45 2016(r298423)
@@ -185,24 +185,33 @@ OSRELDATE=0
 .endif
 
 # Set VERSION for CTFMERGE to use via the default CTFFLAGS=-L VERSION.
-.if !defined(VERSION)
-REVISION!= MK_AUTO_OBJ=no ${MAKE} -C ${SRCDIR}/release -V REVISION
-BRANCH!=   MK_AUTO_OBJ=no ${MAKE} -C ${SRCDIR}/release -V BRANCH
+.if !defined(_REVISION)
+_REVISION!=MK_AUTO_OBJ=no ${MAKE} -C ${SRCDIR}/release -V REVISION
+.export _REVISION
+.endif
+.if !defined(_BRANCH)
+_BRANCH!=  MK_AUTO_OBJ=no ${MAKE} -C ${SRCDIR}/release -V BRANCH
+.export _BRANCH
+.endif
+.if !defined(SRCRELDATE)
 SRCRELDATE!=   awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
${SRCDIR}/sys/sys/param.h
-VERSION=   FreeBSD ${REVISION}-${BRANCH:C/-p[0-9]+$//} ${TARGET_ARCH} 
${SRCRELDATE}
+.export SRCRELDATE
+.endif
+.if !defined(VERSION)
+VERSION=   FreeBSD ${_REVISION}-${_BRANCH:C/-p[0-9]+$//} ${TARGET_ARCH} 
${SRCRELDATE}
 .export VERSION
 .endif
 
 .if !defined(PKG_VERSION)
-.if ${BRANCH:MSTABLE*} || ${BRANCH:MCURRENT*}
+.if ${_BRANCH:MSTABLE*} || ${_BRANCH:MCURRENT*}
 TIMENOW=   %Y%m%d%H%M%S
 EXTRA_REVISION=.s${TIMENOW:gmtime}
 .endif
-.if ${BRANCH:M*-p*}
-EXTRA_REVISION=_${BRANCH:C/.*-p([0-9]+$)/\1/}
+.if ${_BRANCH:M*-p*}
+EXTRA_REVISION=_${_BRANCH:C/.*-p([0-9]+$)/\1/}
 .endif
-PKG_VERSION=   ${REVISION}${EXTRA_REVISION}
+PKG_VERSION=   ${_REVISION}${EXTRA_REVISION}
 .endif
 
 KNOWN_ARCHES?= aarch64/arm64 \
@@ -1257,7 +1266,7 @@ packages: .PHONY
 
 package-pkg: .PHONY
rm -rf /tmp/ports.${TARGET} || :
-   env ${WMAKEENV:Q} SRCDIR=${.CURDIR} PORTSDIR=${PORTSDIR} 
REVISION=${REVISION} \
+   env ${WMAKEENV:Q} SRCDIR=${.CURDIR} PORTSDIR=${PORTSDIR} 
REVISION=${_REVISION} \
PKG_VERSION=${PKG_VERSION} REPODIR=${REPODIR} 
WSTAGEDIR=${WSTAGEDIR} \
sh ${.CURDIR}/release/scripts/make-pkg-package.sh
 
___
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: r298422 - in head: release/arm sys/arm/allwinner sys/arm/allwinner/a20 sys/arm/allwinner/a31 sys/arm/conf sys/boot/fdt/dts/arm sys/modules/dtb/allwinner

2016-04-21 Thread Jared McNeill
Author: jmcneill
Date: Thu Apr 21 16:49:04 2016
New Revision: 298422
URL: https://svnweb.freebsd.org/changeset/base/298422

Log:
  Replace the A20 kernel config with a generic ALLWINNER kernel config that
  supports A20, A31, and A31S. Adds support for the BananaPi M2 (A31S) board.
  
  Submitted by: Emmanuel Vadot 
  Reviewed by:  jmcneill
  Differential Revision:https://reviews.freebsd.org/D5580

Added:
  head/sys/arm/allwinner/a31/files.a31   (contents, props changed)
  head/sys/arm/allwinner/a31/std.a31   (contents, props changed)
  head/sys/arm/allwinner/aw_if_dwc.c
 - copied unchanged from r298421, head/sys/arm/allwinner/a20/a20_if_dwc.c
  head/sys/arm/allwinner/std.allwinner   (contents, props changed)
  head/sys/arm/conf/ALLWINNER
 - copied, changed from r298421, head/sys/arm/conf/A20
  head/sys/boot/fdt/dts/arm/bananapim2.dts   (contents, props changed)
Deleted:
  head/sys/arm/allwinner/a20/a20_if_dwc.c
  head/sys/arm/conf/A20
Modified:
  head/release/arm/BANANAPI.conf
  head/release/arm/CUBIEBOARD2.conf
  head/sys/arm/allwinner/a10_padconf.c
  head/sys/arm/allwinner/a20/a20_padconf.c
  head/sys/arm/allwinner/a20/files.a20
  head/sys/arm/allwinner/a31/a31_padconf.c
  head/sys/arm/allwinner/a31/a31s_padconf.c
  head/sys/arm/allwinner/files.allwinner
  head/sys/modules/dtb/allwinner/Makefile

Modified: head/release/arm/BANANAPI.conf
==
--- head/release/arm/BANANAPI.conf  Thu Apr 21 16:43:36 2016
(r298421)
+++ head/release/arm/BANANAPI.conf  Thu Apr 21 16:49:04 2016
(r298422)
@@ -7,7 +7,7 @@ EMBEDDEDBUILD=1
 EMBEDDED_TARGET="arm"
 EMBEDDED_TARGET_ARCH="armv6"
 EMBEDDEDPORTS="sysutils/u-boot-bananapi"
-KERNEL="A20"
+KERNEL="ALLWINNER"
 WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x4200"
 IMAGE_SIZE="1G"
 PART_SCHEME="MBR"

Modified: head/release/arm/CUBIEBOARD2.conf
==
--- head/release/arm/CUBIEBOARD2.conf   Thu Apr 21 16:43:36 2016
(r298421)
+++ head/release/arm/CUBIEBOARD2.conf   Thu Apr 21 16:49:04 2016
(r298422)
@@ -7,7 +7,7 @@ EMBEDDEDBUILD=1
 EMBEDDED_TARGET="arm"
 EMBEDDED_TARGET_ARCH="armv6"
 EMBEDDEDPORTS="sysutils/u-boot-cubieboard2"
-KERNEL="A20"
+KERNEL="ALLWINNER"
 WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x4200"
 IMAGE_SIZE="1G"
 PART_SCHEME="MBR"

Modified: head/sys/arm/allwinner/a10_padconf.c
==
--- head/sys/arm/allwinner/a10_padconf.cThu Apr 21 16:43:36 2016
(r298421)
+++ head/sys/arm/allwinner/a10_padconf.cThu Apr 21 16:49:04 2016
(r298422)
@@ -35,6 +35,8 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
+#ifdef SOC_ALLWINNER_A10
+
 const static struct allwinner_pins a10_pins[] = {
{"PA0",  0, 0,  {"gpio_in", "gpio_out", "emac", "spi1", "uart2", NULL, 
NULL, NULL}},
{"PA1",  0, 1,  {"gpio_in", "gpio_out", "emac", "spi1", "uart2", NULL, 
NULL, NULL}},
@@ -225,3 +227,5 @@ const struct allwinner_padconf a10_padco
.npins = sizeof(a10_pins) / sizeof(struct allwinner_pins),
.pins = a10_pins,
 };
+
+#endif /* SOC_ALLWINNER_A10 */

Modified: head/sys/arm/allwinner/a20/a20_padconf.c
==
--- head/sys/arm/allwinner/a20/a20_padconf.cThu Apr 21 16:43:36 2016
(r298421)
+++ head/sys/arm/allwinner/a20/a20_padconf.cThu Apr 21 16:49:04 2016
(r298422)
@@ -35,6 +35,8 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
+#ifdef SOC_ALLWINNER_A20
+
 const static struct allwinner_pins a20_pins[] = {
{"PA0",  0, 0,  {"gpio_in", "gpio_out", "emac", "spi1", "uart2", 
"gmac", NULL, NULL}},
{"PA1",  0, 1,  {"gpio_in", "gpio_out", "emac", "spi1", "uart2", 
"gmac", NULL, NULL}},
@@ -225,3 +227,5 @@ const struct allwinner_padconf a20_padco
.npins = sizeof(a20_pins) / sizeof(struct allwinner_pins),
.pins = a20_pins,
 };
+
+#endif /* SOC_ALLWINNER_A20 */

Modified: head/sys/arm/allwinner/a20/files.a20
==
--- head/sys/arm/allwinner/a20/files.a20Thu Apr 21 16:43:36 2016
(r298421)
+++ head/sys/arm/allwinner/a20/files.a20Thu Apr 21 16:49:04 2016
(r298422)
@@ -1,5 +1,3 @@
 # $FreeBSD$
 
 arm/allwinner/a20/a20_padconf.cstandard
-arm/allwinner/aw_mp.c  optionalsmp
-arm/allwinner/a20/a20_if_dwc.c optionaldwc

Modified: head/sys/arm/allwinner/a31/a31_padconf.c
==
--- head/sys/arm/allwinner/a31/a31_padconf.cThu Apr 21 16:43:36 2016
(r298421)
+++ head/sys/arm/allwinner/a31/a31_padconf.cThu Apr 21 16:49:04 2016
(r298422)
@@ -35,6 +35,8 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
+#ifdef SOC_ALLWINN

Re: svn commit: r298420 - head/sys/geom

2016-04-21 Thread Ngie Cooper
On Thu, Apr 21, 2016 at 9:43 AM, Alan Somers  wrote:
> Author: asomers
> Date: Thu Apr 21 16:43:15 2016
> New Revision: 298420
> URL: https://svnweb.freebsd.org/changeset/base/298420
>
> Log:
>   Notify userspace listeners when geom disk attributes have changed
>
>   sys/geom/geom_disk.c:
> disk_attr_changed(): Generate a devctl event of type GEOM: for
> every call.
>
>   MFC after:4 weeks
>   Sponsored by: Spectra Logic Corp
>   Differential Revision:https://reviews.freebsd.org/D5952
>
> Modified:
>   head/sys/geom/geom_disk.c
>
> Modified: head/sys/geom/geom_disk.c
> ==
> --- head/sys/geom/geom_disk.c   Thu Apr 21 16:33:42 2016(r298419)
> +++ head/sys/geom/geom_disk.c   Thu Apr 21 16:43:15 2016(r298420)
> @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -839,11 +840,14 @@ disk_attr_changed(struct disk *dp, const
>  {
> struct g_geom *gp;
> struct g_provider *pp;
> +   char devnamebuf[128];

Why 128? Also, why not sbuf?

> gp = dp->d_geom;
> if (gp != NULL)
> LIST_FOREACH(pp, &gp->provider, provider)
> (void)g_attr_changed(pp, attr, flag);
> +   snprintf(devnamebuf, 128, "devname=%s%d", dp->d_name, dp->d_unit);

Why not sizeof(devnamebuf) ?

> +   devctl_notify("GEOM", "disk", attr, devnamebuf);
>  }
>
>  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"


Re: svn commit: r298420 - head/sys/geom

2016-04-21 Thread Ngie Cooper
On Thu, Apr 21, 2016 at 10:08 AM, Ngie Cooper  wrote:
> On Thu, Apr 21, 2016 at 9:43 AM, Alan Somers  wrote:
>> Author: asomers
>> Date: Thu Apr 21 16:43:15 2016
>> New Revision: 298420
>> URL: https://svnweb.freebsd.org/changeset/base/298420
>>
>> Log:
>>   Notify userspace listeners when geom disk attributes have changed
>>
>>   sys/geom/geom_disk.c:
>> disk_attr_changed(): Generate a devctl event of type GEOM: for
>> every call.
>>
>>   MFC after:4 weeks
>>   Sponsored by: Spectra Logic Corp
>>   Differential Revision:https://reviews.freebsd.org/D5952
>>
>> Modified:
>>   head/sys/geom/geom_disk.c
>>
>> Modified: head/sys/geom/geom_disk.c
>> ==
>> --- head/sys/geom/geom_disk.c   Thu Apr 21 16:33:42 2016(r298419)
>> +++ head/sys/geom/geom_disk.c   Thu Apr 21 16:43:15 2016(r298420)
>> @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
>>  #include 
>>  #include 
>>  #include 
>> +#include 
>>  #include 
>>  #include 
>>  #include 
>> @@ -839,11 +840,14 @@ disk_attr_changed(struct disk *dp, const
>>  {
>> struct g_geom *gp;
>> struct g_provider *pp;
>> +   char devnamebuf[128];
>
> Why 128? Also, why not sbuf?
>
>> gp = dp->d_geom;
>> if (gp != NULL)
>> LIST_FOREACH(pp, &gp->provider, provider)
>> (void)g_attr_changed(pp, attr, flag);
>> +   snprintf(devnamebuf, 128, "devname=%s%d", dp->d_name, dp->d_unit);
>
> Why not sizeof(devnamebuf) ?

Also: this doesn't NUL terminate devnamebuf; it really should
(otherwise, boom... crash in geom)...
___
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: r298412 - head/sys/ofed/drivers/infiniband/core

2016-04-21 Thread Ngie Cooper
On Thu, Apr 21, 2016 at 9:04 AM, Hans Petter Selasky
 wrote:
> Author: hselasky
> Date: Thu Apr 21 16:04:58 2016
> New Revision: 298412
> URL: https://svnweb.freebsd.org/changeset/base/298412
>
> Log:
>   Fix for resolving mac address when the destination address is a gateway.
>   Remove some dead code while at it.
>
>   Sponsored by: Mellanox Technologies
>   MFC after:1 week
>
> Modified:
>   head/sys/ofed/drivers/infiniband/core/addr.c
>
> Modified: head/sys/ofed/drivers/infiniband/core/addr.c
> ==
> --- head/sys/ofed/drivers/infiniband/core/addr.cThu Apr 21 15:38:28 
> 2016(r298411)
> +++ head/sys/ofed/drivers/infiniband/core/addr.cThu Apr 21 16:04:58 
> 2016(r298412)
> @@ -333,17 +333,18 @@ mcast:
> switch (dst_in->sa_family) {
>  #ifdef INET
> case AF_INET:
> -   error = arpresolve(ifp, is_gw, NULL, dst_in, edst, NULL);
> +   error = arpresolve(ifp, is_gw, NULL,
> +   is_gw ? rte->rt_gateway : dst_in, edst, NULL);
> break;
>  #endif
>  #ifdef INET6
> case AF_INET6:
> -   error = nd6_resolve(ifp, is_gw, NULL, dst_in, edst, NULL);
> +   error = nd6_resolve(ifp, is_gw, NULL,
> +   is_gw ? rte->rt_gateway : dst_in, edst, NULL);
> break;
>  #endif
> default:
> -   /* XXX: Shouldn't happen. */
> -   error = -EINVAL;
> +   break;
> }
> RTFREE(rte);
> if (error == 0) {

Please put the "deadcode" back. It will crash now if it's given an
invalid address family (or none are configured in the kernel) when it
tries to do the memcpy below.
___
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: r298412 - head/sys/ofed/drivers/infiniband/core

2016-04-21 Thread Hans Petter Selasky

On 04/21/16 19:12, Ngie Cooper wrote:

Please put the "deadcode" back. It will crash now if it's given an
invalid address family (or none are configured in the kernel) when it
tries to do the memcpy below.


If you look a few lines up in the file, not the patch, you'll see that 
there already is a switch case which catches this.


OK?

--HPS
___
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: r298420 - head/sys/geom

2016-04-21 Thread Alan Somers
On Thu, Apr 21, 2016 at 11:09 AM, Ngie Cooper  wrote:

> On Thu, Apr 21, 2016 at 10:08 AM, Ngie Cooper 
> wrote:
> > On Thu, Apr 21, 2016 at 9:43 AM, Alan Somers 
> wrote:
> >> Author: asomers
> >> Date: Thu Apr 21 16:43:15 2016
> >> New Revision: 298420
> >> URL: https://svnweb.freebsd.org/changeset/base/298420
> >>
> >> Log:
> >>   Notify userspace listeners when geom disk attributes have changed
> >>
> >>   sys/geom/geom_disk.c:
> >> disk_attr_changed(): Generate a devctl event of type
> GEOM: for
> >> every call.
> >>
> >>   MFC after:4 weeks
> >>   Sponsored by: Spectra Logic Corp
> >>   Differential Revision:https://reviews.freebsd.org/D5952
> >>
> >> Modified:
> >>   head/sys/geom/geom_disk.c
> >>
> >> Modified: head/sys/geom/geom_disk.c
> >>
> ==
> >> --- head/sys/geom/geom_disk.c   Thu Apr 21 16:33:42 2016
> (r298419)
> >> +++ head/sys/geom/geom_disk.c   Thu Apr 21 16:43:15 2016
> (r298420)
> >> @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
> >>  #include 
> >>  #include 
> >>  #include 
> >> +#include 
> >>  #include 
> >>  #include 
> >>  #include 
> >> @@ -839,11 +840,14 @@ disk_attr_changed(struct disk *dp, const
> >>  {
> >> struct g_geom *gp;
> >> struct g_provider *pp;
> >> +   char devnamebuf[128];
> >
> > Why 128? Also, why not sbuf?
> >
> >> gp = dp->d_geom;
> >> if (gp != NULL)
> >> LIST_FOREACH(pp, &gp->provider, provider)
> >> (void)g_attr_changed(pp, attr, flag);
> >> +   snprintf(devnamebuf, 128, "devname=%s%d", dp->d_name,
> dp->d_unit);
> >
> > Why not sizeof(devnamebuf) ?
>
> Also: this doesn't NUL terminate devnamebuf; it really should
> (otherwise, boom... crash in geom)...
>

snprintf(3) says "The output is always null-terminated." and it looks like
the kernel version does the same thing at subr_prf.c:560.  Am I missing
something?
___
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: r298420 - head/sys/geom

2016-04-21 Thread Hans Petter Selasky

On 04/21/16 19:26, Alan Somers wrote:

On Thu, Apr 21, 2016 at 11:09 AM, Ngie Cooper  wrote:


On Thu, Apr 21, 2016 at 10:08 AM, Ngie Cooper 
wrote:

On Thu, Apr 21, 2016 at 9:43 AM, Alan Somers 

  {
 struct g_geom *gp;
 struct g_provider *pp;
+   char devnamebuf[128];


Why 128? Also, why not sbuf?


 gp = dp->d_geom;
 if (gp != NULL)
 LIST_FOREACH(pp, &gp->provider, provider)
 (void)g_attr_changed(pp, attr, flag);
+   snprintf(devnamebuf, 128, "devname=%s%d", dp->d_name,

dp->d_unit);


Why not sizeof(devnamebuf) ?


Also: this doesn't NUL terminate devnamebuf; it really should
(otherwise, boom... crash in geom)...



snprintf(3) says "The output is always null-terminated." and it looks like
the kernel version does the same thing at subr_prf.c:560.  Am I missing
something?



Hi,

The code is correct, though it is good practice to use sizeof() like 
Ngie suggests or define the size of the buffer like a macro.


grep -rE "snprintf.*sizeof" /usr/src/sys/dev

--HPS
___
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: r298424 - in head/sys/dev/usb: . quirk

2016-04-21 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Apr 21 17:45:37 2016
New Revision: 298424
URL: https://svnweb.freebsd.org/changeset/base/298424

Log:
  Add new USB quirk.
  
  Submitted by: Naram Qashat 
  PR:   208642
  MFC after:1 week

Modified:
  head/sys/dev/usb/quirk/usb_quirk.c
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/quirk/usb_quirk.c
==
--- head/sys/dev/usb/quirk/usb_quirk.c  Thu Apr 21 16:50:45 2016
(r298423)
+++ head/sys/dev/usb/quirk/usb_quirk.c  Thu Apr 21 17:45:37 2016
(r298424)
@@ -136,6 +136,8 @@ static struct usb_quirk_entry usb_quirks
USB_QUIRK(CORSAIR, K60, 0x, 0x, UQ_KBD_BOOTPROTO),
/* Quirk for Corsair Vengeance K70 keyboard */
USB_QUIRK(CORSAIR, K70, 0x, 0x, UQ_KBD_BOOTPROTO),
+   /* Quirk for Corsair STRAFE Gaming keyboard */
+   USB_QUIRK(CORSAIR, STRAFE, 0x, 0x, UQ_KBD_BOOTPROTO),
/* umodem(4) device quirks */
USB_QUIRK(METRICOM, RICOCHET_GS, 0x100, 0x100, UQ_ASSUME_CM_OVER_DATA),
USB_QUIRK(SANYO, SCP4900, 0x000, 0x000, UQ_ASSUME_CM_OVER_DATA),

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsThu Apr 21 16:50:45 2016(r298423)
+++ head/sys/dev/usb/usbdevsThu Apr 21 17:45:37 2016(r298424)
@@ -1510,6 +1510,7 @@ product COREGA FETHER_USB_TXC 0x9601  FEt
 /* Corsair products */
 product CORSAIR K600x0a60  Corsair Vengeance K60 keyboard
 product CORSAIR K700x1b09  Corsair Vengeance K70 keyboard
+product CORSAIR STRAFE 0x1b15  Cossair STRAFE Gaming keyboard
 
 /* Creative products */
 product CREATIVE NOMAD_II  0x1002  Nomad II MP3 player
___
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: r298412 - head/sys/ofed/drivers/infiniband/core

2016-04-21 Thread Juli Mallett
On Thu, Apr 21, 2016 at 10:22 AM, Hans Petter Selasky  wrote:
> On 04/21/16 19:12, Ngie Cooper wrote:
>>
>> Please put the "deadcode" back. It will crash now if it's given an
>> invalid address family (or none are configured in the kernel) when it
>> tries to do the memcpy below.
>
>
> If you look a few lines up in the file, not the patch, you'll see that there
> already is a switch case which catches this.
>
> OK?

Then there should be an assertion or something else of that sort (I
forget if we have a __builtin_unreachable()-alike macro in the kernel;
the lint(1)y NOTREACHED isn't as nice as actual code) so that it is
apparent to a human that this case cannot be reached.  The presence of
a do-nothing default case is not typically indicative of unreachable
code.
___
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: r298412 - head/sys/ofed/drivers/infiniband/core

2016-04-21 Thread Hans Petter Selasky

On 04/21/16 19:59, Pedro Giffuni wrote:



On 21/04/2016 12:52, Juli Mallett wrote:

On Thu, Apr 21, 2016 at 10:22 AM, Hans Petter Selasky
 wrote:

On 04/21/16 19:12, Ngie Cooper wrote:


Hi,


Then there should be an assertion or something else of that sort (I
forget if we have a __builtin_unreachable()-alike macro in the kernel;
the lint(1)y NOTREACHED isn't as nice as actual code) so that it is
apparent to a human that this case cannot be reached.  The presence of
a do-nothing default case is not typically indicative of unreachable
code.


We do have __unreachable() in cdefs.h

It should work with both GCC and clang.

Pedro.



I don't see anyone using __unreachable() yet in the kernel. Do you 
recommend it over a KASSERT() ?


--HPS

___
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: r298412 - head/sys/ofed/drivers/infiniband/core

2016-04-21 Thread Pedro Giffuni



On 21/04/2016 12:52, Juli Mallett wrote:

On Thu, Apr 21, 2016 at 10:22 AM, Hans Petter Selasky  wrote:

On 04/21/16 19:12, Ngie Cooper wrote:

Please put the "deadcode" back. It will crash now if it's given an
invalid address family (or none are configured in the kernel) when it
tries to do the memcpy below.


If you look a few lines up in the file, not the patch, you'll see that there
already is a switch case which catches this.

OK?

Then there should be an assertion or something else of that sort (I
forget if we have a __builtin_unreachable()-alike macro in the kernel;
the lint(1)y NOTREACHED isn't as nice as actual code) so that it is
apparent to a human that this case cannot be reached.  The presence of
a do-nothing default case is not typically indicative of unreachable
code.


We do have __unreachable() in cdefs.h

It should work with both GCC and clang.

Pedro.

___
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: r298219 - head/share/mk

2016-04-21 Thread Konstantin Belousov
On Thu, Apr 21, 2016 at 09:13:00AM -0700, Bryan Drewery wrote:
> On 4/19/16 5:15 AM, Konstantin Belousov wrote:
> > On Mon, Apr 18, 2016 at 06:14:02PM +, Bryan Drewery wrote:
> >> Author: bdrewery
> >> Date: Mon Apr 18 18:14:02 2016
> >> New Revision: 298219
> >> URL: https://svnweb.freebsd.org/changeset/base/298219
> >>
> >> Log:
> >>   Cause an error during 'make install' if trying to compile with CC.
> >>   
> >>   This is limited to src-tree builds, meaning not extended to ports or 
> >> other
> >>   out-of-tree builds.
> >>   
> >>   This will help ensure that read-only OBJDIRS will be respected at 
> >> install-time
> >>   by causing a more consistent failure for those who don't use a read-only
> >>   OBJDIR.  It also will cause Jenkins to yell.  This is a better solution 
> >> than
> >>   trying to see CC=false as has been attempted and discussed before.
> >>   
> >>   Of course this is only relevant for files generated by CC.
> >>   
> >>   Disable this for META_MODE since it will detect the CFLAGS/command
> >>   change and force a rebuild.
> >>   
> >>   Sponsored by:EMC / Isilon Storage Division
> >>
> >> Modified:
> >>   head/share/mk/bsd.sys.mk
> >>
> >> Modified: head/share/mk/bsd.sys.mk
> >> ==
> >> --- head/share/mk/bsd.sys.mk   Mon Apr 18 18:13:58 2016
> >> (r298218)
> >> +++ head/share/mk/bsd.sys.mk   Mon Apr 18 18:14:02 2016
> >> (r298219)
> >> @@ -178,6 +178,13 @@ ACFLAGS+= ${ACFLAGS.${.IMPSRC:T}}
> >>  CFLAGS+=  ${CFLAGS.${.IMPSRC:T}}
> >>  CXXFLAGS+=${CXXFLAGS.${.IMPSRC:T}}
> >>  
> >> +.if defined(SRCTOP)
> >> +# Prevent rebuilding during install to support read-only objdirs.
> >> +.if make(install) && empty(.MAKE.MODE:Mmeta)
> >> +CFLAGS+=  ERROR-tried-to-rebuild-during-make-install
> >> +.endif
> >> +.endif
> >> +
> >>  # Tell bmake not to mistake standard targets for things to be searched for
> >>  # or expect to ever be up-to-date.
> >>  PHONY_NOTMAIN = analyze afterdepend afterinstall all beforedepend 
> >> beforeinstall \
> > 
> > It seems to cause the following behaviour:
> > make buildenv
> > cd lib/libthr
> > # make DEBUG_FLAGS=-g WITHOUT_TESTS=yes all install
> 
> By the way, since r295646 it should be safe to use -j here. Let me know
> if you run into trouble with it.
You mean, that install -j does the right thing now ?  Thanks.

> 
> > cc   -O2 -pipe   -DPTHREAD_KERNEL 
> > -I/usr/home/kostik/work/build/bsd/DEV/src/lib/libthr/../libc/include 
> > -I/usr/home/kostik/work/build/bsd/DEV/src/lib/libthr/thread  
> > -I/usr/home/kostik/work/build/bsd/DEV/src/lib/libthr/../../include 
> > -I/usr/home/kostik/work/build/bsd/DEV/src/lib/libthr/arch/amd64/include 
> > -I/usr/home/kostik/work/build/bsd/DEV/src/lib/libthr/sys 
> > -I/usr/home/kostik/work/build/bsd/DEV/src/lib/libthr/../../libexec/rtld-elf 
> > -I/usr/home/kostik/work/build/bsd/DEV/src/lib/libthr/../../libexec/rtld-elf/amd64
> >  -I/usr/home/kostik/work/build/bsd/DEV/src/lib/libthr/../libthread_db 
> > -Winline -fexceptions -D_PTHREAD_FORCED_UNWIND -D_PTHREADS_INVARIANTS 
> > -mno-mmx -mno-sse -mno-avx -g -MD -MP -MF.depend.thr_init.o -MTthr_init.o 
> > -std=gnu99 -Wsystem-headers -Werror -Wall -Wno-format-y2k -W 
> > -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes 
> > -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body 
> > -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-comp
 ar
>  e
>  -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function 
> -Wno-enum-conversion -Wno-unused-local-typedef  -Qunused-arguments  
> ERROR-tried-to-rebuild-during-make-install -c 
> /usr/home/kostik/work/build/bsd/DEV/src/lib/libthr/thread/thr_init.c -o 
> thr_init.o
> > cc: error: no such file or directory: 
> > 'ERROR-tried-to-rebuild-during-make-install'
> > *** Error code 1
> > 
> > Stop.
> > make[3]: stopped in /usr/home/kostik/work/build/bsd/DEV/src/lib/libthr
> > 
> > Doing separate steps for all and install targets work, but before, it also
> > worked and was convenient to list sequential targets on the make command
> > line.
> > 
> 
> Fixed in r298413.

Yes, make all install worked.

Still, I do not think that the revision would help for any other target
used in-line with install.  I believe it is sometimes useful, but more
rare than all install idiom.
___
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: r298219 - head/share/mk

2016-04-21 Thread Bryan Drewery
On 4/21/16 11:19 AM, Konstantin Belousov wrote:
> On Thu, Apr 21, 2016 at 09:13:00AM -0700, Bryan Drewery wrote:
>> On 4/19/16 5:15 AM, Konstantin Belousov wrote:
>>> On Mon, Apr 18, 2016 at 06:14:02PM +, Bryan Drewery wrote:
 Author: bdrewery
 Date: Mon Apr 18 18:14:02 2016
 New Revision: 298219
 URL: https://svnweb.freebsd.org/changeset/base/298219

 Log:
   Cause an error during 'make install' if trying to compile with CC.
   
   This is limited to src-tree builds, meaning not extended to ports or 
 other
   out-of-tree builds.
   
   This will help ensure that read-only OBJDIRS will be respected at 
 install-time
   by causing a more consistent failure for those who don't use a read-only
   OBJDIR.  It also will cause Jenkins to yell.  This is a better solution 
 than
   trying to see CC=false as has been attempted and discussed before.
   
   Of course this is only relevant for files generated by CC.
   
   Disable this for META_MODE since it will detect the CFLAGS/command
   change and force a rebuild.
   
   Sponsored by:EMC / Isilon Storage Division

 Modified:
   head/share/mk/bsd.sys.mk

 Modified: head/share/mk/bsd.sys.mk
 ==
 --- head/share/mk/bsd.sys.mk   Mon Apr 18 18:13:58 2016
 (r298218)
 +++ head/share/mk/bsd.sys.mk   Mon Apr 18 18:14:02 2016
 (r298219)
 @@ -178,6 +178,13 @@ ACFLAGS+= ${ACFLAGS.${.IMPSRC:T}}
  CFLAGS+=  ${CFLAGS.${.IMPSRC:T}}
  CXXFLAGS+=${CXXFLAGS.${.IMPSRC:T}}
  
 +.if defined(SRCTOP)
 +# Prevent rebuilding during install to support read-only objdirs.
 +.if make(install) && empty(.MAKE.MODE:Mmeta)
 +CFLAGS+=  ERROR-tried-to-rebuild-during-make-install
 +.endif
 +.endif
 +
  # Tell bmake not to mistake standard targets for things to be searched for
  # or expect to ever be up-to-date.
  PHONY_NOTMAIN = analyze afterdepend afterinstall all beforedepend 
 beforeinstall \
>>>
>>> It seems to cause the following behaviour:
>>> make buildenv
>>> cd lib/libthr
>>> # make DEBUG_FLAGS=-g WITHOUT_TESTS=yes all install
>>
>> By the way, since r295646 it should be safe to use -j here. Let me know
>> if you run into trouble with it.
> You mean, that install -j does the right thing now ?  Thanks.

I mean 'make -j all install' should build in parallel before installing.

> 
>>
>>> cc   -O2 -pipe   -DPTHREAD_KERNEL 
>>> -I/usr/home/kostik/work/build/bsd/DEV/src/lib/libthr/../libc/include 
>>> -I/usr/home/kostik/work/build/bsd/DEV/src/lib/libthr/thread  
>>> -I/usr/home/kostik/work/build/bsd/DEV/src/lib/libthr/../../include 
>>> -I/usr/home/kostik/work/build/bsd/DEV/src/lib/libthr/arch/amd64/include 
>>> -I/usr/home/kostik/work/build/bsd/DEV/src/lib/libthr/sys 
>>> -I/usr/home/kostik/work/build/bsd/DEV/src/lib/libthr/../../libexec/rtld-elf 
>>> -I/usr/home/kostik/work/build/bsd/DEV/src/lib/libthr/../../libexec/rtld-elf/amd64
>>>  -I/usr/home/kostik/work/build/bsd/DEV/src/lib/libthr/../libthread_db 
>>> -Winline -fexceptions -D_PTHREAD_FORCED_UNWIND -D_PTHREADS_INVARIANTS 
>>> -mno-mmx -mno-sse -mno-avx -g -MD -MP -MF.depend.thr_init.o -MTthr_init.o 
>>> -std=gnu99 -Wsystem-headers -Werror -Wall -Wno-format-y2k -W 
>>> -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes 
>>> -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body 
>>> -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-comp
 a
r
>>  e
>>  -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function 
>> -Wno-enum-conversion -Wno-unused-local-typedef  -Qunused-arguments  
>> ERROR-tried-to-rebuild-during-make-install -c 
>> /usr/home/kostik/work/build/bsd/DEV/src/lib/libthr/thread/thr_init.c -o 
>> thr_init.o
>>> cc: error: no such file or directory: 
>>> 'ERROR-tried-to-rebuild-during-make-install'
>>> *** Error code 1
>>>
>>> Stop.
>>> make[3]: stopped in /usr/home/kostik/work/build/bsd/DEV/src/lib/libthr
>>>
>>> Doing separate steps for all and install targets work, but before, it also
>>> worked and was convenient to list sequential targets on the make command
>>> line.
>>>
>>
>> Fixed in r298413.
> 
> Yes, make all install worked.
> 
> Still, I do not think that the revision would help for any other target
> used in-line with install.  I believe it is sometimes useful, but more
> rare than all install idiom.
> 

Yes it won't work if you do something like 'make foo.o install' or 'make
progname install' etc.  I am likely going to rework this to be a flag
passed in installworld to activate it rather than checking for
make(install).

-- 
Regards,
Bryan Drewery
___
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.or

Re: svn commit: r298412 - head/sys/ofed/drivers/infiniband/core

2016-04-21 Thread Pedro Giffuni



On 21/04/2016 13:12, Hans Petter Selasky wrote:

On 04/21/16 19:59, Pedro Giffuni wrote:



On 21/04/2016 12:52, Juli Mallett wrote:

On Thu, Apr 21, 2016 at 10:22 AM, Hans Petter Selasky
 wrote:

On 04/21/16 19:12, Ngie Cooper wrote:


Hi,


Then there should be an assertion or something else of that sort (I
forget if we have a __builtin_unreachable()-alike macro in the kernel;
the lint(1)y NOTREACHED isn't as nice as actual code) so that it is
apparent to a human that this case cannot be reached.  The presence of
a do-nothing default case is not typically indicative of unreachable
code.


We do have __unreachable() in cdefs.h

It should work with both GCC and clang.

Pedro.



I don't see anyone using __unreachable() yet in the kernel. Do you 
recommend it over a KASSERT() ?




It's a rather recent addition (I added it after checking NetBSD's cdefs).

It is meant mostly for the compiler/static analyzers.

From the clang documentation:
"The __builtin_unreachable() builtin has completely undefined behavior. 
Since it has undefined behavior, it is a statement that it is never 
reached and the optimizer can take advantage of this to produce better 
code. This builtin takes no arguments and produces a void result."


There was some discussion before it was introduced about turning
it into an assertion, but I recall it was not possible.

hth,

Pedro.
___
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: r298425 - head/sys/dev/acpica

2016-04-21 Thread John Baldwin
Author: jhb
Date: Thu Apr 21 18:27:05 2016
New Revision: 298425
URL: https://svnweb.freebsd.org/changeset/base/298425

Log:
  Queue the CPU-probing task after all acpi_cpu devices are attached.
  
  Eventually with earlier AP startup this code will change to call the
  startup function synchronously instead of queueing the task.  Moving
  the time we queue the task should be a no-op since taskqueue threads
  don't start executing tasks until much later, but this reduces the diff
  with the earlier AP startup patches.
  
  Sponsored by: Netflix

Modified:
  head/sys/dev/acpica/acpi_cpu.c

Modified: head/sys/dev/acpica/acpi_cpu.c
==
--- head/sys/dev/acpica/acpi_cpu.c  Thu Apr 21 17:45:37 2016
(r298424)
+++ head/sys/dev/acpica/acpi_cpu.c  Thu Apr 21 18:27:05 2016
(r298425)
@@ -355,9 +355,6 @@ acpi_cpu_attach(device_t dev)
cpu_sysctl_tree = SYSCTL_ADD_NODE(&cpu_sysctl_ctx,
SYSCTL_CHILDREN(acpi_sc->acpi_sysctl_tree), OID_AUTO, "cpu",
CTLFLAG_RD, 0, "node for CPU children");
-
-   /* Queue post cpu-probing task handler */
-   AcpiOsExecute(OSL_NOTIFY_HANDLER, acpi_cpu_startup, NULL);
 }
 
 /*
@@ -423,17 +420,27 @@ acpi_cpu_postattach(void *unused __unuse
 device_t *devices;
 int err;
 int i, n;
+int attached;
 
 err = devclass_get_devices(acpi_cpu_devclass, &devices, &n);
 if (err != 0) {
printf("devclass_get_devices(acpi_cpu_devclass) failed\n");
return;
 }
+attached = 0;
+for (i = 0; i < n; i++)
+   if (device_is_attached(devices[i]))
+   attached = 1;
 for (i = 0; i < n; i++)
bus_generic_probe(devices[i]);
 for (i = 0; i < n; i++)
bus_generic_attach(devices[i]);
 free(devices, M_TEMP);
+
+if (attached) {
+   /* Queue post cpu-probing task handler */
+   AcpiOsExecute(OSL_NOTIFY_HANDLER, acpi_cpu_startup, NULL);
+}
 }
 
 SYSINIT(acpi_cpu, SI_SUB_CONFIGURE, SI_ORDER_MIDDLE,
___
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: r298412 - head/sys/ofed/drivers/infiniband/core

2016-04-21 Thread Pedro Giffuni via svn-src-head



On 21/04/2016 13:25, Pedro Giffuni wrote:



On 21/04/2016 13:12, Hans Petter Selasky wrote:

On 04/21/16 19:59, Pedro Giffuni wrote:



On 21/04/2016 12:52, Juli Mallett wrote:

On Thu, Apr 21, 2016 at 10:22 AM, Hans Petter Selasky
 wrote:

On 04/21/16 19:12, Ngie Cooper wrote:


Hi,


Then there should be an assertion or something else of that sort (I
forget if we have a __builtin_unreachable()-alike macro in the kernel;
the lint(1)y NOTREACHED isn't as nice as actual code) so that it is
apparent to a human that this case cannot be reached.  The presence of
a do-nothing default case is not typically indicative of unreachable
code.


We do have __unreachable() in cdefs.h

It should work with both GCC and clang.

Pedro.



I don't see anyone using __unreachable() yet in the kernel. Do you 
recommend it over a KASSERT() ?




It's a rather recent addition (I added it after checking NetBSD's cdefs).

It is meant mostly for the compiler/static analyzers.

From the clang documentation:
"The __builtin_unreachable() builtin has completely undefined 
behavior. Since it has undefined behavior, it is a statement that it 
is never reached and the optimizer can take advantage of this to 
produce better code. This builtin takes no arguments and produces a 
void result."




Replying to myself with the better description[1]:

"__builtin_unreachable is used to indicate that a specific point in the 
program cannot be reached, even if the compiler might otherwise think it 
can. This is useful to improve optimization and eliminates certain 
warnings. "


Pedro.

[1]
http://clang.llvm.org/docs/LanguageExtensions.html#builtin-functions
___
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: r298412 - head/sys/ofed/drivers/infiniband/core

2016-04-21 Thread Pedro Giffuni



On 21/04/2016 13:25, Pedro Giffuni wrote:



On 21/04/2016 13:12, Hans Petter Selasky wrote:

On 04/21/16 19:59, Pedro Giffuni wrote:



On 21/04/2016 12:52, Juli Mallett wrote:

On Thu, Apr 21, 2016 at 10:22 AM, Hans Petter Selasky
 wrote:

On 04/21/16 19:12, Ngie Cooper wrote:


Hi,


Then there should be an assertion or something else of that sort (I
forget if we have a __builtin_unreachable()-alike macro in the kernel;
the lint(1)y NOTREACHED isn't as nice as actual code) so that it is
apparent to a human that this case cannot be reached.  The presence of
a do-nothing default case is not typically indicative of unreachable
code.


We do have __unreachable() in cdefs.h

It should work with both GCC and clang.

Pedro.



I don't see anyone using __unreachable() yet in the kernel. Do you 
recommend it over a KASSERT() ?




It's a rather recent addition (I added it after checking NetBSD's cdefs).

It is meant mostly for the compiler/static analyzers.

From the clang documentation:
"The __builtin_unreachable() builtin has completely undefined 
behavior. Since it has undefined behavior, it is a statement that it 
is never reached and the optimizer can take advantage of this to 
produce better code. This builtin takes no arguments and produces a 
void result."




Replying to myself with the better description[1]:

"__builtin_unreachable is used to indicate that a specific point in the 
program cannot be reached, even if the compiler might otherwise think it 
can. This is useful to improve optimization and eliminates certain 
warnings. "


Pedro.

[1]
http://clang.llvm.org/docs/LanguageExtensions.html#builtin-functions
___
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: r298426 - head/sys/dev/fdc

2016-04-21 Thread John Baldwin
Author: jhb
Date: Thu Apr 21 18:37:36 2016
New Revision: 298426
URL: https://svnweb.freebsd.org/changeset/base/298426

Log:
  Adjust the fdc worker thread startup to work when APs are started earlier.
  
  - Enable the commented out locking in fd_probe().  The worker thread
should not be running yet (even after these changes), but better to be
safe than sorry.
  - Defer starting the worker thread until after the child drives have been
probed.  The worker thread startup is moved into a fdc_start_worker()
thread that the various front ends call at the end of attach.  As a
side effect this fixes a few edge cases that weren't shutting down the
worker thread if attach encountered a late failure.
  - When executing the initial reset requested by attach in the worker
thread, use DELAY() instead of a tsleep() if cold is set.
  
  Tested by:Howard Su 
  Sponsored by: Netflix

Modified:
  head/sys/dev/fdc/fdc.c
  head/sys/dev/fdc/fdc_acpi.c
  head/sys/dev/fdc/fdc_cbus.c
  head/sys/dev/fdc/fdc_isa.c
  head/sys/dev/fdc/fdc_pccard.c
  head/sys/dev/fdc/fdcvar.h

Modified: head/sys/dev/fdc/fdc.c
==
--- head/sys/dev/fdc/fdc.c  Thu Apr 21 18:27:05 2016(r298425)
+++ head/sys/dev/fdc/fdc.c  Thu Apr 21 18:37:36 2016(r298426)
@@ -953,7 +953,10 @@ fdc_worker(struct fdc_data *fdc)
if (fdc->flags & FDC_NEEDS_RESET) {
fdc->flags &= ~FDC_NEEDS_RESET;
fdc_reset(fdc);
-   tsleep(fdc, PRIBIO, "fdcrst", hz);
+   if (cold)
+   DELAY(100);
+   else
+   tsleep(fdc, PRIBIO, "fdcrst", hz);
/* Discard results */
for (i = 0; i < 4; i++)
fdc_sense_int(fdc, &st0, &cyl);
@@ -2055,14 +2058,21 @@ fdc_attach(device_t dev)
 #endif
bioq_init(&fdc->head);
 
-   kproc_create(fdc_thread, fdc, &fdc->fdc_thread, 0, 0,
-   "fdc%d", device_get_unit(dev));
-
settle = hz / 8;
 
return (0);
 }
 
+void
+fdc_start_worker(device_t dev)
+{
+   struct  fdc_data *fdc;
+
+   fdc = device_get_softc(dev);
+   kproc_create(fdc_thread, fdc, &fdc->fdc_thread, 0, 0,
+   "fdc%d", device_get_unit(dev));
+}
+
 int
 fdc_hints_probe(device_t dev)
 {
@@ -2155,9 +2165,8 @@ fd_probe(device_t dev)
return (ENXIO);
 
 #ifndef PC98
-/*
mtx_lock(&fdc->fdc_mtx);
-*/
+
/* select it */
fd_select(fd);
fd_motor(fd, 1);
@@ -2200,9 +2209,7 @@ fd_probe(device_t dev)
 
fd_motor(fd, 0);
fdc->fd = NULL;
-/*
mtx_unlock(&fdc->fdc_mtx);
-*/
 
if ((flags & FD_NO_PROBE) == 0 &&
(st0 & NE7_ST0_EC) != 0) /* no track 0 -> no drive present */

Modified: head/sys/dev/fdc/fdc_acpi.c
==
--- head/sys/dev/fdc/fdc_acpi.c Thu Apr 21 18:27:05 2016(r298425)
+++ head/sys/dev/fdc/fdc_acpi.c Thu Apr 21 18:37:36 2016(r298426)
@@ -135,6 +135,9 @@ fdc_acpi_attach(device_t dev)
obj = buf.Pointer;
error = fdc_acpi_probe_children(bus, dev, obj->Buffer.Pointer);
 
+   if (error == 0)
+   fdc_start_worker(dev);
+
 out:
if (buf.Pointer)
free(buf.Pointer, M_TEMP);

Modified: head/sys/dev/fdc/fdc_cbus.c
==
--- head/sys/dev/fdc/fdc_cbus.c Thu Apr 21 18:27:05 2016(r298425)
+++ head/sys/dev/fdc/fdc_cbus.c Thu Apr 21 18:37:36 2016(r298426)
@@ -150,7 +150,9 @@ fdc_cbus_attach(device_t dev)
error = fdc_attach(dev);
if (error == 0)
error = fdc_hints_probe(dev);
-   if (error)
+   if (error == 0)
+   fdc_start_worker(dev);
+   else
fdc_release_resources(fdc);
return (error);
 }

Modified: head/sys/dev/fdc/fdc_isa.c
==
--- head/sys/dev/fdc/fdc_isa.c  Thu Apr 21 18:27:05 2016(r298425)
+++ head/sys/dev/fdc/fdc_isa.c  Thu Apr 21 18:37:36 2016(r298426)
@@ -190,7 +190,9 @@ fdc_isa_attach(device_t dev)
error = fdc_attach(dev);
if (error == 0)
error = fdc_hints_probe(dev);
-   if (error)
+   if (error == 0)
+   fdc_start_worker(dev);
+   else
fdc_release_resources(fdc);
return (error);
 }

Modified: head/sys/dev/fdc/fdc_pccard.c
==
--- head/sys/dev/fdc/fdc_pccard.c   Thu Apr 21 18:27:05 2016
(r298425)
+++ head/sys/dev/fdc/fdc_pccard.c   Thu Apr 21 18:37:36 2016
(r298426)
@@ -108,7 +108,9 @@ fdc_pccard_attach(device_t dev)
device_set_flags(child, 0x24);
error = bus_gene

Re: svn commit: r298426 - head/sys/dev/fdc

2016-04-21 Thread Hans Petter Selasky

On 04/21/16 20:37, John Baldwin wrote:

-   tsleep(fdc, PRIBIO, "fdcrst", hz);
+   if (cold)
+   DELAY(100);
+   else
+   tsleep(fdc, PRIBIO, "fdcrst", hz);


Hi,

pause() and pause_sbt() does exactly this, checking for "cold" and using 
DELAY().


--HPS
___
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: r298428 - head/sys/arm/broadcom/bcm2835

2016-04-21 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Thu Apr 21 18:58:06 2016
New Revision: 298428
URL: https://svnweb.freebsd.org/changeset/base/298428

Log:
  Use proper type of tag in bcm2835_mbox_fb_init
  
  bcm2835_mbox_fb_init sets configuration so SET_VIRTUAL_OFFSET should be used
  instead of GET_VIRTUAL_OFFSET
  
  Submitted by: Sylvain Garrigues 

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_mbox.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_mbox.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_mbox.cThu Apr 21 18:44:53 
2016(r298427)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_mbox.cThu Apr 21 18:58:06 
2016(r298428)
@@ -501,7 +501,7 @@ bcm2835_mbox_fb_init(struct bcm2835_fb_c
BCM2835_MBOX_INIT_TAG(&msg.virtual_w_h, SET_VIRTUAL_W_H);
msg.virtual_w_h.body.req.width = fb->vxres;
msg.virtual_w_h.body.req.height = fb->vyres;
-   BCM2835_MBOX_INIT_TAG(&msg.offset, GET_VIRTUAL_OFFSET);
+   BCM2835_MBOX_INIT_TAG(&msg.offset, SET_VIRTUAL_OFFSET);
msg.offset.body.req.x = fb->xoffset;
msg.offset.body.req.y = fb->yoffset;
BCM2835_MBOX_INIT_TAG(&msg.depth, SET_DEPTH);
___
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: r298431 - in head/sys: cam/ata cam/scsi dev/advansys dev/ae dev/aic dev/fb dev/hwpmc dev/le dev/rndtest dev/uart mips/nlm mips/rmi/dev/nlge netgraph netgraph/atm security/audit

2016-04-21 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Apr 21 19:40:10 2016
New Revision: 298431
URL: https://svnweb.freebsd.org/changeset/base/298431

Log:
  sys: use our nitems() macro when param.h is available.
  
  This should cover all the remaining cases in the kernel.
  
  Discussed in: freebsd-current

Modified:
  head/sys/cam/ata/ata_da.c
  head/sys/cam/scsi/scsi_all.c
  head/sys/cam/scsi/scsi_cd.c
  head/sys/cam/scsi/scsi_da.c
  head/sys/cam/scsi/scsi_sa.c
  head/sys/cam/scsi/scsi_xpt.c
  head/sys/cam/scsi/smp_all.c
  head/sys/dev/advansys/adv_isa.c
  head/sys/dev/advansys/advlib.c
  head/sys/dev/ae/if_ae.c
  head/sys/dev/aic/aic.c
  head/sys/dev/aic/aic_cbus.c
  head/sys/dev/aic/aic_isa.c
  head/sys/dev/fb/creator.c
  head/sys/dev/fb/fb.c
  head/sys/dev/fb/machfb.c
  head/sys/dev/fb/vesa.c
  head/sys/dev/fb/vga.c
  head/sys/dev/hwpmc/hwpmc_amd.c
  head/sys/dev/hwpmc/hwpmc_mips24k.c
  head/sys/dev/hwpmc/hwpmc_mips74k.c
  head/sys/dev/hwpmc/hwpmc_octeon.c
  head/sys/dev/le/if_le_isa.c
  head/sys/dev/le/if_le_lebuffer.c
  head/sys/dev/le/if_le_ledma.c
  head/sys/dev/rndtest/rndtest.c
  head/sys/dev/uart/uart_kbd_sun.c
  head/sys/mips/nlm/board.c
  head/sys/mips/rmi/dev/nlge/if_nlge.c
  head/sys/netgraph/atm/ng_atm.c
  head/sys/netgraph/ng_gif_demux.c
  head/sys/netgraph/ng_iface.c
  head/sys/netgraph/ng_socket.c
  head/sys/security/audit/bsm_fcntl.c
  head/sys/security/audit/bsm_socket_type.c

Modified: head/sys/cam/ata/ata_da.c
==
--- head/sys/cam/ata/ata_da.c   Thu Apr 21 19:25:33 2016(r298430)
+++ head/sys/cam/ata/ata_da.c   Thu Apr 21 19:40:10 2016(r298431)
@@ -1431,7 +1431,7 @@ adaregister(struct cam_periph *periph, v
 */
match = cam_quirkmatch((caddr_t)&cgd->ident_data,
   (caddr_t)ada_quirk_table,
-  sizeof(ada_quirk_table)/sizeof(*ada_quirk_table),
+  nitems(ada_quirk_table),
   sizeof(*ada_quirk_table), ata_identify_match);
if (match != NULL)
softc->quirks = ((struct ada_quirk_entry *)match)->quirks;

Modified: head/sys/cam/scsi/scsi_all.c
==
--- head/sys/cam/scsi/scsi_all.cThu Apr 21 19:25:33 2016
(r298430)
+++ head/sys/cam/scsi/scsi_all.cThu Apr 21 19:40:10 2016
(r298431)
@@ -154,7 +154,7 @@ static struct scsi_op_quirk_entry scsi_o
 * feel free to change this quirk entry.
 */
{T_CDROM, SIP_MEDIA_REMOVABLE, "PLEXTOR", "CD-ROM PX*", "*"},
-   sizeof(plextor_cd_ops)/sizeof(struct op_table_entry),
+   nitems(plextor_cd_ops),
plextor_cd_ops
}
 };
@@ -645,8 +645,7 @@ scsi_op_desc(u_int16_t opcode, struct sc
 
match = cam_quirkmatch((caddr_t)inq_data,
   (caddr_t)scsi_op_quirk_table,
-  sizeof(scsi_op_quirk_table)/
-  sizeof(*scsi_op_quirk_table),
+  nitems(scsi_op_quirk_table),
   sizeof(*scsi_op_quirk_table),
   scsi_inquiry_match);
}
@@ -655,7 +654,7 @@ scsi_op_desc(u_int16_t opcode, struct sc
table[0] = ((struct scsi_op_quirk_entry *)match)->op_table;
num_ops[0] = ((struct scsi_op_quirk_entry *)match)->num_ops;
table[1] = scsi_op_codes;
-   num_ops[1] = sizeof(scsi_op_codes)/sizeof(scsi_op_codes[0]);
+   num_ops[1] = nitems(scsi_op_codes);
num_tables = 2;
} else {
/*  
@@ -666,7 +665,7 @@ scsi_op_desc(u_int16_t opcode, struct sc
return("Vendor Specific Command");
 
table[0] = scsi_op_codes;
-   num_ops[0] = sizeof(scsi_op_codes)/sizeof(scsi_op_codes[0]);
+   num_ops[0] = nitems(scsi_op_codes);
num_tables = 1;
}
 
@@ -921,7 +920,7 @@ static struct scsi_sense_quirk_entry sen
 */
{T_DIRECT, SIP_MEDIA_FIXED, "QUANTUM", "FIREBALL S*", "*"},
/*num_sense_keys*/0,
-   sizeof(quantum_fireball_entries)/sizeof(struct asc_table_entry),
+   nitems(quantum_fireball_entries),
/*sense key entries*/NULL,
quantum_fireball_entries
},
@@ -932,7 +931,7 @@ static struct scsi_sense_quirk_entry sen
 */
{T_DIRECT, SIP_MEDIA_REMOVABLE, "SONY", "SMO-*", "*"},
/*num_sense_keys*/0,
-   sizeof(sony_mo_entries)/sizeof(struct asc_table_entry),
+   nitems(sony_mo_entries),
/*sense key entries*/NULL,
sony_mo_entries
},
@@ -942,7 +941,7 @@ static struct scsi_sens

svn commit: r298432 - head/sys/dev/aic

2016-04-21 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Apr 21 19:48:28 2016
New Revision: 298432
URL: https://svnweb.freebsd.org/changeset/base/298432

Log:
  Redundant parenthesis from r298431.

Modified:
  head/sys/dev/aic/aic_isa.c

Modified: head/sys/dev/aic/aic_isa.c
==
--- head/sys/dev/aic/aic_isa.c  Thu Apr 21 19:40:10 2016(r298431)
+++ head/sys/dev/aic/aic_isa.c  Thu Apr 21 19:48:28 2016(r298432)
@@ -57,7 +57,8 @@ static int aic_isa_probe(device_t);
 static int aic_isa_attach(device_t);
 
 static u_int aic_isa_ports[] = { 0x340, 0x140 };
-#defineAIC_ISA_NUMPORTS (nitems(aic_isa_ports))
+
+#defineAIC_ISA_NUMPORTS nitems(aic_isa_ports)
 #defineAIC_ISA_PORTSIZE 0x20
 
 static struct isa_pnp_id aic_ids[] = {
___
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: r298433 - in head/sys: amd64/amd64 arm/arm arm/at91 arm/cavium/cns11xx arm/mv arm/xscale/i8134x arm/xscale/ixp425 arm/xscale/pxa arm64/arm64 boot/common boot/mips/beri/loader boot/zfs d...

2016-04-21 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Apr 21 19:57:40 2016
New Revision: 298433
URL: https://svnweb.freebsd.org/changeset/base/298433

Log:
  sys: use our roundup2/rounddown2() macros when param.h is available.
  
  rounddown2 tends to produce longer lines than the original code
  and when the code has a high indentation level it was not really
  advantageous to do the replacement.
  
  This tries to strike a balance between readability using the macros
  and flexibility of having the expressions, so not everything is
  converted.

Modified:
  head/sys/amd64/amd64/amd64_mem.c
  head/sys/amd64/amd64/pmap.c
  head/sys/arm/arm/elf_trampoline.c
  head/sys/arm/arm/pmap-v4.c
  head/sys/arm/at91/at91_machdep.c
  head/sys/arm/cavium/cns11xx/econa_machdep.c
  head/sys/arm/mv/mv_common.c
  head/sys/arm/xscale/i8134x/crb_machdep.c
  head/sys/arm/xscale/i8134x/i81342_pci.c
  head/sys/arm/xscale/i8134x/i81342_space.c
  head/sys/arm/xscale/ixp425/avila_machdep.c
  head/sys/arm/xscale/pxa/pxa_machdep.c
  head/sys/arm64/arm64/pmap.c
  head/sys/boot/common/module.c
  head/sys/boot/mips/beri/loader/arch.c
  head/sys/boot/zfs/zfs.c
  head/sys/dev/adb/adb_mouse.c
  head/sys/dev/agp/agp_nvidia.c
  head/sys/dev/bce/if_bce.c
  head/sys/dev/cxgbe/common/t4_hw.c
  head/sys/dev/en/midway.c
  head/sys/dev/exca/exca.c
  head/sys/dev/fatm/if_fatm.c
  head/sys/dev/hatm/if_hatm.c
  head/sys/dev/hptmv/gui_lib.c
  head/sys/dev/mpr/mpr.c
  head/sys/dev/mps/mps.c
  head/sys/dev/pccbb/pccbb.c
  head/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c
  head/sys/dev/sym/sym_hipd.c
  head/sys/dev/ti/if_ti.c
  head/sys/dev/usb/usb_busdma.c
  head/sys/dev/vt/hw/efifb/efifb.c
  head/sys/fs/ext2fs/ext2_lookup.c
  head/sys/geom/bde/g_bde_crypt.c
  head/sys/geom/part/g_part_bsd64.c
  head/sys/i386/i386/i686_mem.c
  head/sys/i386/i386/minidump_machdep.c
  head/sys/i386/i386/sys_machdep.c
  head/sys/i386/svr4/svr4_machdep.c
  head/sys/kern/imgact_elf.c
  head/sys/kern/init_main.c
  head/sys/kern/kern_linker.c
  head/sys/kern/sysv_sem.c
  head/sys/kern/sysv_shm.c
  head/sys/kern/vfs_bio.c
  head/sys/mips/cavium/octopci.c
  head/sys/mips/mips/tlb.c
  head/sys/mips/mips/trap.c
  head/sys/mips/rmi/dev/sec/rmilib.c
  head/sys/mips/sibyte/sb_zbpci.c
  head/sys/net/bpf.c
  head/sys/net80211/ieee80211_freebsd.c
  head/sys/powerpc/aim/mmu_oea.c
  head/sys/powerpc/aim/mmu_oea64.c
  head/sys/powerpc/booke/pmap.c
  head/sys/powerpc/powerpc/machdep.c
  head/sys/ufs/ffs/ffs_softdep.c
  head/sys/ufs/ufs/ufs_dirhash.c
  head/sys/ufs/ufs/ufs_lookup.c
  head/sys/vm/phys_pager.c
  head/sys/vm/vm_page.c
  head/sys/vm/vm_phys.c
  head/sys/x86/iommu/intel_gas.c

Modified: head/sys/amd64/amd64/amd64_mem.c
==
--- head/sys/amd64/amd64/amd64_mem.cThu Apr 21 19:48:28 2016
(r298432)
+++ head/sys/amd64/amd64/amd64_mem.cThu Apr 21 19:57:40 2016
(r298433)
@@ -383,7 +383,7 @@ amd64_mrstoreone(void *arg)
/* mask/active register */
if (mrd->mr_flags & MDF_ACTIVE) {
msrv = MTRR_PHYSMASK_VALID |
-   (~(mrd->mr_len - 1) & mtrr_physmask);
+   rounddown2(mtrr_physmask, mrd->mr_len);
} else {
msrv = 0;
}

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Thu Apr 21 19:48:28 2016(r298432)
+++ head/sys/amd64/amd64/pmap.c Thu Apr 21 19:57:40 2016(r298433)
@@ -496,7 +496,7 @@ pmap_kmem_choose(vm_offset_t addr)
 {
vm_offset_t newaddr = addr;
 
-   newaddr = (addr + (NBPDR - 1)) & ~(NBPDR - 1);
+   newaddr = roundup2(addr, NBPDR);
return (newaddr);
 }
 

Modified: head/sys/arm/arm/elf_trampoline.c
==
--- head/sys/arm/arm/elf_trampoline.c   Thu Apr 21 19:48:28 2016
(r298432)
+++ head/sys/arm/arm/elf_trampoline.c   Thu Apr 21 19:57:40 2016
(r298433)
@@ -675,8 +675,8 @@ __start(void)
curaddr = (void*)((unsigned int)curaddr & 0xfff0);
 #ifdef KZIP
if (*kernel == 0x1f && kernel[1] == 0x8b) {
-   pt_addr = (((int)&_end + KERNSIZE + 0x100) &
-   ~(L1_TABLE_SIZE - 1)) + L1_TABLE_SIZE;
+   pt_addr = L1_TABLE_SIZE +
+   rounddown2((int)&_end + KERNSIZE + 0x100, L1_TABLE_SIZE);
 
 #ifdef CPU_ARM9
/* So that idcache_wbinv works; */
@@ -710,7 +710,7 @@ __start(void)
(unsigned int)curaddr,
(unsigned int)&func_end, 0);
dst = (void *)(((vm_offset_t)dst & ~3));
-   pt_addr = ((unsigned int)dst &~(L1_TABLE_SIZE - 1)) + L1_TABLE_SIZE;
+   pt_addr = L1_TABLE_SIZE + rounddown2((unsigned int)dst, L1_TABLE_SIZE);
setup_pagetables(pt_addr, (vm_paddr_t)curaddr,
(vm_paddr_t)curaddr + 0x1000, 0);
sp = p

svn commit: r298434 - head/lib/msun/tests

2016-04-21 Thread Garrett Cooper
Author: ngie
Date: Thu Apr 21 19:59:55 2016
New Revision: 298434
URL: https://svnweb.freebsd.org/changeset/base/298434

Log:
  Completely disable fmaxmin_test (follow up to r297952)
  
  COMPILER_TYPE/COMPILER_VERSION doesn't get passed down properly at
  buildworld/installworld with older build hosts
  
  MFC after: never
  PR: 208703, 208963
  Reported by: Jenkins
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/lib/msun/tests/Makefile

Modified: head/lib/msun/tests/Makefile
==
--- head/lib/msun/tests/MakefileThu Apr 21 19:57:40 2016
(r298433)
+++ head/lib/msun/tests/MakefileThu Apr 21 19:59:55 2016
(r298434)
@@ -53,9 +53,15 @@ TAP_TESTS_C+=exponential_test
 TAP_TESTS_C+=  fenv_test
 TAP_TESTS_C+=  fma_test
 # clang 3.8.0 fails always fails this test. See: bug 208703
-.if ! (${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} == 30800)
-TAP_TESTS_C+=  fmaxmin_test
-.endif
+#
+# XXX: depending on this compiler version check doesn't work at
+# buildworld/installworld time, which results in jenkins failures (bug 208963)
+# because the build is run on a 10.x instance, which has an older clang
+# compiler.
+#
+#.if ! (${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} == 30800)
+#TAP_TESTS_C+= fmaxmin_test
+#.endif
 TAP_TESTS_C+=  ilogb_test
 TAP_TESTS_C+=  invtrig_test
 TAP_TESTS_C+=  invctrig_test
___
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: r298435 - in head/sys: cam/scsi dev/ae dev/digi dev/ed i386/i386

2016-04-21 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Apr 21 20:30:38 2016
New Revision: 298435
URL: https://svnweb.freebsd.org/changeset/base/298435

Log:
  Yet more redundant parenthesis from r298431.
  
  Mea culpa.

Modified:
  head/sys/cam/scsi/scsi_all.c
  head/sys/dev/ae/if_ae.c
  head/sys/dev/digi/digi_isa.c
  head/sys/dev/ed/if_ed_hpp.c
  head/sys/i386/i386/i686_mem.c

Modified: head/sys/cam/scsi/scsi_all.c
==
--- head/sys/cam/scsi/scsi_all.cThu Apr 21 19:59:55 2016
(r298434)
+++ head/sys/cam/scsi/scsi_all.cThu Apr 21 20:30:38 2016
(r298435)
@@ -4702,7 +4702,7 @@ scsi_sense_desc_sbuf(struct sbuf *sb, st
 {
int i;
 
-   for (i = 0; i < (nitems(scsi_sense_printers)); i++) {
+   for (i = 0; i < nitems(scsi_sense_printers); i++) {
struct scsi_sense_desc_printer *printer;
 
printer = &scsi_sense_printers[i];
@@ -7285,8 +7285,7 @@ struct scsi_attrib_table_entry *
 scsi_get_attrib_entry(uint32_t id)
 {
return (scsi_find_attrib_entry(scsi_mam_attr_table,
-   nitems(scsi_mam_attr_table),
-   id));
+   nitems(scsi_mam_attr_table), id));
 }
 
 int

Modified: head/sys/dev/ae/if_ae.c
==
--- head/sys/dev/ae/if_ae.c Thu Apr 21 19:59:55 2016(r298434)
+++ head/sys/dev/ae/if_ae.c Thu Apr 21 20:30:38 2016(r298435)
@@ -85,7 +85,7 @@ static struct ae_dev {
{ VENDORID_ATTANSIC, DEVICEID_ATTANSIC_L2,
"Attansic Technology Corp, L2 FastEthernet" },
 };
-#defineAE_DEVS_COUNT (nitems(ae_devs))
+#defineAE_DEVS_COUNT nitems(ae_devs)
 
 static struct resource_spec ae_res_spec_mem[] = {
{ SYS_RES_MEMORY,   PCIR_BAR(0),RF_ACTIVE },

Modified: head/sys/dev/digi/digi_isa.c
==
--- head/sys/dev/digi/digi_isa.cThu Apr 21 19:59:55 2016
(r298434)
+++ head/sys/dev/digi/digi_isa.cThu Apr 21 20:30:38 2016
(r298435)
@@ -68,7 +68,7 @@ static u_long digi_validmem[] = {
0xf600, 0xf700, 0xf800, 0xf900, 0xfa00, 0xfb00,
0xfc00, 0xfd00, 0xfe00, 0xff00
 };
-#defineDIGI_NVALIDMEM  (nitems(digi_validmem))
+#defineDIGI_NVALIDMEM  nitems(digi_validmem)
 
 static u_char *
 digi_isa_setwin(struct digi_softc *sc, unsigned int addr)

Modified: head/sys/dev/ed/if_ed_hpp.c
==
--- head/sys/dev/ed/if_ed_hpp.c Thu Apr 21 19:59:55 2016(r298434)
+++ head/sys/dev/ed/if_ed_hpp.c Thu Apr 21 20:30:38 2016(r298435)
@@ -214,7 +214,7 @@ ed_probe_HP_pclanp(device_t dev, int por
 * Check for impossible IRQ.
 */
 
-   if (irq >= (nitems(ed_hpp_intr_val)))
+   if (irq >= nitems(ed_hpp_intr_val))
return (ENXIO);
 
/* 

Modified: head/sys/i386/i386/i686_mem.c
==
--- head/sys/i386/i386/i686_mem.c   Thu Apr 21 19:59:55 2016
(r298434)
+++ head/sys/i386/i386/i686_mem.c   Thu Apr 21 20:30:38 2016
(r298435)
@@ -113,7 +113,7 @@ static int i686_mtrrtomrt[] = {
MDF_WRITEBACK
 };
 
-#defineMTRRTOMRTLEN (nitems(i686_mtrrtomrt))
+#defineMTRRTOMRTLEN nitems(i686_mtrrtomrt)
 
 static int
 i686_mtrr2mrt(int val)
___
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: r298436 - head/sys/dev/urtwn

2016-04-21 Thread Andriy Voskoboinyk
Author: avos
Date: Thu Apr 21 20:34:38 2016
New Revision: 298436
URL: https://svnweb.freebsd.org/changeset/base/298436

Log:
  urtwn: optimize rate lookup in the urtwn_ra_init()
  
  Replace loop with switch statement (rate2ridx())
  (should be noop).
  
  Tested with RTL8188EU / RTL8188CUS, STA mode.
  
  Reviewed by:  adrian
  Differential Revision:https://reviews.freebsd.org/D4848 (rebased)

Modified:
  head/sys/dev/urtwn/if_urtwn.c
  head/sys/dev/urtwn/if_urtwnreg.h

Modified: head/sys/dev/urtwn/if_urtwn.c
==
--- head/sys/dev/urtwn/if_urtwn.c   Thu Apr 21 20:30:38 2016
(r298435)
+++ head/sys/dev/urtwn/if_urtwn.c   Thu Apr 21 20:34:38 2016
(r298436)
@@ -1944,6 +1944,32 @@ urtwn_r88e_read_rom(struct urtwn_softc *
return (0);
 }
 
+static __inline uint8_t
+rate2ridx(uint8_t rate)
+{
+   if (rate & IEEE80211_RATE_MCS) {
+   /* 11n rates start at idx 12 */
+   return ((rate & 0xf) + 12);
+   }
+   switch (rate) {
+   /* 11g */
+   case 12:return 4;
+   case 18:return 5;
+   case 24:return 6;
+   case 36:return 7;
+   case 48:return 8;
+   case 72:return 9;
+   case 96:return 10;
+   case 108:   return 11;
+   /* 11b */
+   case 2: return 0;
+   case 4: return 1;
+   case 11:return 2;
+   case 22:return 3;
+   default:return URTWN_RIDX_UNKNOWN;
+   }
+}
+
 /*
  * Initialize rate adaptation in firmware.
  */
@@ -1956,8 +1982,8 @@ urtwn_ra_init(struct urtwn_softc *sc)
struct ieee80211_rateset *rs, *rs_ht;
struct r92c_fw_cmd_macid_cfg cmd;
uint32_t rates, basicrates;
-   uint8_t mode;
-   int maxrate, maxbasicrate, error, i, j;
+   uint8_t mode, ridx;
+   int maxrate, maxbasicrate, error, i;
 
ni = ieee80211_ref_node(vap->iv_bss);
rs = &ni->ni_rates;
@@ -1970,19 +1996,16 @@ urtwn_ra_init(struct urtwn_softc *sc)
/* This is for 11bg */
for (i = 0; i < rs->rs_nrates; i++) {
/* Convert 802.11 rate to HW rate index. */
-   for (j = 0; j < nitems(ridx2rate); j++)
-   if ((rs->rs_rates[i] & IEEE80211_RATE_VAL) ==
-   ridx2rate[j])
-   break;
-   if (j == nitems(ridx2rate)) /* Unknown rate, skip. */
+   ridx = rate2ridx(IEEE80211_RV(rs->rs_rates[i]));
+   if (ridx == URTWN_RIDX_UNKNOWN) /* Unknown rate, skip. */
continue;
-   rates |= 1 << j;
-   if (j > maxrate)
-   maxrate = j;
+   rates |= 1 << ridx;
+   if (ridx > maxrate)
+   maxrate = ridx;
if (rs->rs_rates[i] & IEEE80211_RATE_BASIC) {
-   basicrates |= 1 << j;
-   if (j > maxbasicrate)
-   maxbasicrate = j;
+   basicrates |= 1 << ridx;
+   if (ridx > maxbasicrate)
+   maxbasicrate = ridx;
}
}
 
@@ -1992,12 +2015,12 @@ urtwn_ra_init(struct urtwn_softc *sc)
if ((rs_ht->rs_rates[i] & 0x7f) > 0xf)
continue;
/* 11n rates start at index 12 */
-   j = ((rs_ht->rs_rates[i]) & 0xf) + 12;
-   rates |= (1 << j);
+   ridx = ((rs_ht->rs_rates[i]) & 0xf) + 12;
+   rates |= (1 << ridx);
 
/* Guard against the rate table being oddly ordered */
-   if (j > maxrate)
-   maxrate = j;
+   if (ridx > maxrate)
+   maxrate = ridx;
}
}
 
@@ -2802,32 +2825,6 @@ urtwn_r88e_get_rssi(struct urtwn_softc *
return (rssi);
 }
 
-static __inline uint8_t
-rate2ridx(uint8_t rate)
-{
-   if (rate & IEEE80211_RATE_MCS) {
-   /* 11n rates start at idx 12 */
-   return ((rate & 0xf) + 12);
-   }
-   switch (rate) {
-   /* 11g */
-   case 12:return 4;
-   case 18:return 5;
-   case 24:return 6;
-   case 36:return 7;
-   case 48:return 8;
-   case 72:return 9;
-   case 96:return 10;
-   case 108:   return 11;
-   /* 11b */
-   case 2: return 0;
-   case 4: return 1;
-   case 11:return 2;
-   case 22:return 3;
-   default:return 0;
-   }
-}
-
 static int
 urtwn_tx_data(struct urtwn_softc *sc, struct ieee80211_node *ni,
 struct mbuf *m, struct urtwn_data *data)

Modified: head/sys/dev/urtwn/if_urtw

svn commit: r298437 - head/contrib/llvm/tools/clang/tools/driver

2016-04-21 Thread Dimitry Andric
Author: dim
Date: Thu Apr 21 20:37:53 2016
New Revision: 298437
URL: https://svnweb.freebsd.org/changeset/base/298437

Log:
  Revert r298147 (temporary workaround for LLVM PR 26999) in preparation
  for committing the final upstream fix.

Modified:
  head/contrib/llvm/tools/clang/tools/driver/cc1as_main.cpp

Modified: head/contrib/llvm/tools/clang/tools/driver/cc1as_main.cpp
==
--- head/contrib/llvm/tools/clang/tools/driver/cc1as_main.cpp   Thu Apr 21 
20:34:38 2016(r298436)
+++ head/contrib/llvm/tools/clang/tools/driver/cc1as_main.cpp   Thu Apr 21 
20:37:53 2016(r298437)
@@ -200,7 +200,7 @@ bool AssemblerInvocation::CreateFromArgs
   // Any DebugInfoKind implies GenDwarfForAssembly.
   Opts.GenDwarfForAssembly = Args.hasArg(OPT_debug_info_kind_EQ);
   Opts.CompressDebugSections = Args.hasArg(OPT_compress_debug_sections);
-  Opts.DwarfVersion = getLastArgIntValue(Args, OPT_dwarf_version_EQ, 2, Diags);
+  Opts.DwarfVersion = getLastArgIntValue(Args, OPT_dwarf_version_EQ, 0, Diags);
   Opts.DwarfDebugFlags = Args.getLastArgValue(OPT_dwarf_debug_flags);
   Opts.DwarfDebugProducer = Args.getLastArgValue(OPT_dwarf_debug_producer);
   Opts.DebugCompilationDir = Args.getLastArgValue(OPT_fdebug_compilation_dir);
___
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: r298438 - head/contrib/llvm/tools/clang/lib/Driver

2016-04-21 Thread Dimitry Andric
Author: dim
Date: Thu Apr 21 20:38:10 2016
New Revision: 298438
URL: https://svnweb.freebsd.org/changeset/base/298438

Log:
  Pull r266775 from upstream clang trunk (by Douglas Katzman):
  
Pass dwarf-version to cc1as.
  
Fix PR26999 - crashing in cc1as with any '*bsd' target.
  
  This should fix possible crashes when using -g in combination with
  -save-temps.

Modified:
  head/contrib/llvm/tools/clang/lib/Driver/Tools.cpp

Modified: head/contrib/llvm/tools/clang/lib/Driver/Tools.cpp
==
--- head/contrib/llvm/tools/clang/lib/Driver/Tools.cpp  Thu Apr 21 20:37:53 
2016(r298437)
+++ head/contrib/llvm/tools/clang/lib/Driver/Tools.cpp  Thu Apr 21 20:38:10 
2016(r298438)
@@ -6061,6 +6061,12 @@ void ClangAs::ConstructJob(Compilation &
   // FIXME: Stop lying and consume only the appropriate driver flags
   Args.ClaimAllArgs(options::OPT_W_Group);
 
+  // Assemblers that want to know the dwarf version can't assume a value,
+  // since the defaulting logic resides in the driver. Put in something
+  // reasonable now, in case a subsequent "-Wa,-g" changes it.
+  RenderDebugEnablingArgs(Args, CmdArgs, CodeGenOptions::NoDebugInfo,
+  getToolChain().GetDefaultDwarfVersion(),
+  llvm::DebuggerKind::Default);
   CollectArgsForIntegratedAssembler(C, Args, CmdArgs,
 getToolChain().getDriver());
 
___
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: r298420 - head/sys/geom

2016-04-21 Thread Ngie Cooper (yaneurabeya)

> On Apr 21, 2016, at 10:26, Alan Somers  wrote:
> 
> 
> 
> On Thu, Apr 21, 2016 at 11:09 AM, Ngie Cooper  wrote:
> On Thu, Apr 21, 2016 at 10:08 AM, Ngie Cooper  wrote:
> > On Thu, Apr 21, 2016 at 9:43 AM, Alan Somers  wrote:
> >> Author: asomers
> >> Date: Thu Apr 21 16:43:15 2016
> >> New Revision: 298420
> >> URL: https://svnweb.freebsd.org/changeset/base/298420
> >>
> >> Log:
> >>   Notify userspace listeners when geom disk attributes have changed
> >>
> >>   sys/geom/geom_disk.c:
> >> disk_attr_changed(): Generate a devctl event of type GEOM: 
> >> for
> >> every call.
> >>
> >>   MFC after:4 weeks
> >>   Sponsored by: Spectra Logic Corp
> >>   Differential Revision:https://reviews.freebsd.org/D5952
> >>
> >> Modified:
> >>   head/sys/geom/geom_disk.c
> >>
> >> Modified: head/sys/geom/geom_disk.c
> >> ==
> >> --- head/sys/geom/geom_disk.c   Thu Apr 21 16:33:42 2016(r298419)
> >> +++ head/sys/geom/geom_disk.c   Thu Apr 21 16:43:15 2016(r298420)
> >> @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
> >>  #include 
> >>  #include 
> >>  #include 
> >> +#include 
> >>  #include 
> >>  #include 
> >>  #include 
> >> @@ -839,11 +840,14 @@ disk_attr_changed(struct disk *dp, const
> >>  {
> >> struct g_geom *gp;
> >> struct g_provider *pp;
> >> +   char devnamebuf[128];
> >
> > Why 128? Also, why not sbuf?
> >
> >> gp = dp->d_geom;
> >> if (gp != NULL)
> >> LIST_FOREACH(pp, &gp->provider, provider)
> >> (void)g_attr_changed(pp, attr, flag);
> >> +   snprintf(devnamebuf, 128, "devname=%s%d", dp->d_name, dp->d_unit);
> >
> > Why not sizeof(devnamebuf) ?
> 
> Also: this doesn't NUL terminate devnamebuf; it really should
> (otherwise, boom... crash in geom)...
> 
> snprintf(3) says "The output is always null-terminated." and it looks like 
> the kernel version does the same thing at subr_prf.c:560.  Am I missing 
> something?

Derp. Forgot that NUL termination occurs with snprintf as long as the buffer 
size is specified and is correct. Please ignore this part..
___
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: r298439 - head/sys/geom

2016-04-21 Thread Alan Somers
Author: asomers
Date: Thu Apr 21 21:13:41 2016
New Revision: 298439
URL: https://svnweb.freebsd.org/changeset/base/298439

Log:
  DRY on buffer sizes.  Update to r298420.
  
  sys/geom/geom_disk.c:
In disk_attr_changed, don't repeat a buffer size.
  
  Reported by: ngie, hselasky
  MFC after:4 weeks
  X-MFC-With:   298420
  Sponsored by: Spectra Logic Corp

Modified:
  head/sys/geom/geom_disk.c

Modified: head/sys/geom/geom_disk.c
==
--- head/sys/geom/geom_disk.c   Thu Apr 21 20:38:10 2016(r298438)
+++ head/sys/geom/geom_disk.c   Thu Apr 21 21:13:41 2016(r298439)
@@ -846,7 +846,8 @@ disk_attr_changed(struct disk *dp, const
if (gp != NULL)
LIST_FOREACH(pp, &gp->provider, provider)
(void)g_attr_changed(pp, attr, flag);
-   snprintf(devnamebuf, 128, "devname=%s%d", dp->d_name, dp->d_unit);
+   snprintf(devnamebuf, sizeof(devnamebuf), "devname=%s%d", dp->d_name,
+   dp->d_unit);
devctl_notify("GEOM", "disk", attr, devnamebuf);
 }
 
___
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: r298440 - head/usr.bin/sed

2016-04-21 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Apr 21 21:30:51 2016
New Revision: 298440
URL: https://svnweb.freebsd.org/changeset/base/298440

Log:
  kernel: use our nitems() macro when it is available through param.h.
  
  No functional change, only trivial cases are done in this sweep,
  
  Discussed in: freebsd-current

Modified:
  head/usr.bin/sed/compile.c

Modified: head/usr.bin/sed/compile.c
==
--- head/usr.bin/sed/compile.c  Thu Apr 21 21:13:41 2016(r298439)
+++ head/usr.bin/sed/compile.c  Thu Apr 21 21:30:51 2016(r298440)
@@ -160,10 +160,10 @@ compile_stream(struct s_command **link)
char re[_POSIX2_LINE_MAX + 1];
int naddr;  /* Number of addresses */
 
-   stack = 0;
+   stack = NULL;
for (;;) {
if ((p = cu_fgets(lbuf, sizeof(lbuf), NULL)) == NULL) {
-   if (stack != 0)
+   if (stack != NULL)
errx(1, "%lu: %s: unexpected EOF (pending }'s)",
linenum, fname);
return (link);
@@ -203,9 +203,9 @@ semicolon:  EATSPACE();
p = compile_addr(p, cmd->a2);
EATSPACE();
} else
-   cmd->a2 = 0;
+   cmd->a2 = NULL;
} else
-   cmd->a1 = cmd->a2 = 0;
+   cmd->a1 = cmd->a2 = NULL;
 
 nonsel:/* Now parse the command */
if (!*p)
@@ -241,7 +241,7 @@ nonsel: /* Now parse the command */
 * group is really just a noop.
 */
cmd->nonsel = 1;
-   if (stack == 0)
+   if (stack == NULL)
errx(1, "%lu: %s: unexpected }", linenum, 
fname);
cmd2 = stack;
stack = cmd2->next;
___
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: r298440 - head/usr.bin/sed

2016-04-21 Thread Pedro Giffuni

Oops wrong log message

It's supposed to be:

sed: use NULL instead of zero for pointers.

On 04/21/16 16:30, Pedro F. Giffuni wrote:

Author: pfg
Date: Thu Apr 21 21:30:51 2016
New Revision: 298440
URL: https://svnweb.freebsd.org/changeset/base/298440

Log:
  kernel: use our nitems() macro when it is available through param.h.

  No functional change, only trivial cases are done in this sweep,

  Discussed in: freebsd-current

Modified:
  head/usr.bin/sed/compile.c

Modified: head/usr.bin/sed/compile.c
==
--- head/usr.bin/sed/compile.c  Thu Apr 21 21:13:41 2016(r298439)
+++ head/usr.bin/sed/compile.c  Thu Apr 21 21:30:51 2016(r298440)
@@ -160,10 +160,10 @@ compile_stream(struct s_command **link)
char re[_POSIX2_LINE_MAX + 1];
int naddr;  /* Number of addresses */

-   stack = 0;
+   stack = NULL;
for (;;) {
if ((p = cu_fgets(lbuf, sizeof(lbuf), NULL)) == NULL) {
-   if (stack != 0)
+   if (stack != NULL)
errx(1, "%lu: %s: unexpected EOF (pending }'s)",
linenum, fname);
return (link);
@@ -203,9 +203,9 @@ semicolon:  EATSPACE();
p = compile_addr(p, cmd->a2);
EATSPACE();
} else
-   cmd->a2 = 0;
+   cmd->a2 = NULL;
} else
-   cmd->a1 = cmd->a2 = 0;
+   cmd->a1 = cmd->a2 = NULL;

 nonsel:/* Now parse the command */
if (!*p)
@@ -241,7 +241,7 @@ nonsel: /* Now parse the command */
 * group is really just a noop.
 */
cmd->nonsel = 1;
-   if (stack == 0)
+   if (stack == NULL)
errx(1, "%lu: %s: unexpected }", linenum, 
fname);
cmd2 = stack;
stack = cmd2->next;


___
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: r298408 - head/sys/netinet

2016-04-21 Thread Jonathan T. Looney
On 4/21/16, 11:06 AM, "owner-src-committ...@freebsd.org on behalf of Jonathan 
T. Looney"  
wrote:

>Author: jtl
>Date: Thu Apr 21 15:06:53 2016
>New Revision: 298408
>URL: https://svnweb.freebsd.org/changeset/base/298408
>
>Log:
>  Prevent underflows in tp->snd_wnd if the remote side ACKs more than
>  tp->snd_wnd. This can happen, for example, when the remote side responds to
>  a window probe by ACKing the one byte it contains.
>  
>  Differential Revision:   https://reviews.freebsd.org/D5625
>  Reviewed by: hiren
>  Obtained from:   Juniper Networks (earlier version)
>  MFC after:   2 weeks
>  Sponsored by:Juniper Networks

This should also have said:

Submitted by: srushti.g...@gmail.com (earlier version)

Jonathan


>
>Modified:
>  head/sys/netinet/tcp_input.c
>
>Modified: head/sys/netinet/tcp_input.c
>==
>--- head/sys/netinet/tcp_input.c   Thu Apr 21 15:02:57 2016
>(r298407)
>+++ head/sys/netinet/tcp_input.c   Thu Apr 21 15:06:53 2016
>(r298408)
>@@ -2754,6 +2754,9 @@ process_ACK:
>   INP_WLOCK_ASSERT(tp->t_inpcb);
> 
>   acked = BYTES_THIS_ACK(tp, th);
>+  KASSERT(acked >= 0, ("%s: acked unexepectedly negative "
>+  "(tp->snd_una=%u, th->th_ack=%u, tp=%p, m=%p)", __func__,
>+  tp->snd_una, th->th_ack, tp, m));
>   TCPSTAT_INC(tcps_rcvackpack);
>   TCPSTAT_ADD(tcps_rcvackbyte, acked);
> 
>@@ -2823,13 +2826,19 @@ process_ACK:
> 
>   SOCKBUF_LOCK(&so->so_snd);
>   if (acked > sbavail(&so->so_snd)) {
>-  tp->snd_wnd -= sbavail(&so->so_snd);
>+  if (tp->snd_wnd >= sbavail(&so->so_snd))
>+  tp->snd_wnd -= sbavail(&so->so_snd);
>+  else
>+  tp->snd_wnd = 0;
>   mfree = sbcut_locked(&so->so_snd,
>   (int)sbavail(&so->so_snd));
>   ourfinisacked = 1;
>   } else {
>   mfree = sbcut_locked(&so->so_snd, acked);
>-  tp->snd_wnd -= acked;
>+  if (tp->snd_wnd >= (u_long) acked)
>+  tp->snd_wnd -= acked;
>+  else
>+  tp->snd_wnd = 0;
>   ourfinisacked = 0;
>   }
>   /* NB: sowwakeup_locked() does an implicit unlock. */
>
>




___
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: r298441 - head/sbin/fsck_msdosfs

2016-04-21 Thread Marcelo Araujo
Author: araujo
Date: Fri Apr 22 03:32:14 2016
New Revision: 298441
URL: https://svnweb.freebsd.org/changeset/base/298441

Log:
  Use macro MAX() from sys/param.h.
  
  MFC after:2 weeks.

Modified:
  head/sbin/fsck_msdosfs/dir.c

Modified: head/sbin/fsck_msdosfs/dir.c
==
--- head/sbin/fsck_msdosfs/dir.cThu Apr 21 21:30:51 2016
(r298440)
+++ head/sbin/fsck_msdosfs/dir.cFri Apr 22 03:32:14 2016
(r298441)
@@ -223,7 +223,7 @@ resetDosDirSection(struct bootblock *boo
b1 = boot->bpbRootDirEnts * 32;
b2 = boot->bpbSecPerClust * boot->bpbBytesPerSec;
 
-   if ((buffer = malloc(len = b1 > b2 ? b1 : b2)) == NULL) {
+   if ((buffer = malloc(len = MAX(b1, b2))) == NULL) {
perr("No space for directory buffer (%zu)", len);
return FSFATAL;
}
___
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: r298442 - head/usr.bin/netstat

2016-04-21 Thread Marcelo Araujo
Author: araujo
Date: Fri Apr 22 03:37:27 2016
New Revision: 298442
URL: https://svnweb.freebsd.org/changeset/base/298442

Log:
  Use macro MAX() from sys/param.h.
  
  MFC after:2 weeks.

Modified:
  head/usr.bin/netstat/sctp.c

Modified: head/usr.bin/netstat/sctp.c
==
--- head/usr.bin/netstat/sctp.c Fri Apr 22 03:32:14 2016(r298441)
+++ head/usr.bin/netstat/sctp.c Fri Apr 22 03:37:27 2016(r298442)
@@ -349,7 +349,7 @@ sctp_process_tcb(struct xsctp_tcb *xstcb
xo_open_list("address");
xl = LIST_FIRST(&xladdr_head);
xr = LIST_FIRST(&xraddr_head);
-   x_max = (xl_total > xr_total) ? xl_total : xr_total;
+   x_max = MAX(xl_total, xr_total);
for (i = 0; i < x_max; i++) {
xo_open_instance("address");
 
___
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: r298443 - head/usr.bin/stat

2016-04-21 Thread Marcelo Araujo
Author: araujo
Date: Fri Apr 22 03:43:06 2016
New Revision: 298443
URL: https://svnweb.freebsd.org/changeset/base/298443

Log:
  Use macro MAX() from sys/param.h.
  
  MFC after:2 weeks.

Modified:
  head/usr.bin/stat/stat.c

Modified: head/usr.bin/stat/stat.c
==
--- head/usr.bin/stat/stat.cFri Apr 22 03:37:27 2016(r298442)
+++ head/usr.bin/stat/stat.cFri Apr 22 03:43:06 2016(r298443)
@@ -1025,7 +1025,7 @@ format1(const struct stat *st,
 *
 * Nanoseconds: long.
 */
-   (void)snprintf(tmp, sizeof(tmp), "%dld", prec > 9 ? 9 : prec);
+   (void)snprintf(tmp, sizeof(tmp), "%dld", MAX(9, prec));
(void)strcat(lfmt, tmp);
 
/*
___
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: r298444 - head/usr.bin/vmstat

2016-04-21 Thread Marcelo Araujo
Author: araujo
Date: Fri Apr 22 03:46:57 2016
New Revision: 298444
URL: https://svnweb.freebsd.org/changeset/base/298444

Log:
  Use MIN() macro from sys/param.h.
  
  MFC after:2 weeks.

Modified:
  head/usr.bin/vmstat/vmstat.c

Modified: head/usr.bin/vmstat/vmstat.c
==
--- head/usr.bin/vmstat/vmstat.cFri Apr 22 03:43:06 2016
(r298443)
+++ head/usr.bin/vmstat/vmstat.cFri Apr 22 03:46:57 2016
(r298444)
@@ -884,7 +884,7 @@ printhdr(int maxid, u_long cpumask)
 {
int i, num_shown;
 
-   num_shown = (num_selected < maxshowdevs) ? num_selected : maxshowdevs;
+   num_shown = MIN(num_selected, maxshowdevs);
if (hflag) {
xo_emit("{T:procs}  {T:memory}   {T:/page%*s}", 19, "");
} else {
___
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: r298445 - head/usr.sbin/moused

2016-04-21 Thread Marcelo Araujo
Author: araujo
Date: Fri Apr 22 03:55:33 2016
New Revision: 298445
URL: https://svnweb.freebsd.org/changeset/base/298445

Log:
  Use macro MAX() from sys/param.h.
  
  MFC after:2 weeks.

Modified:
  head/usr.sbin/moused/moused.c

Modified: head/usr.sbin/moused/moused.c
==
--- head/usr.sbin/moused/moused.c   Fri Apr 22 03:46:57 2016
(r298444)
+++ head/usr.sbin/moused/moused.c   Fri Apr 22 03:55:33 2016
(r298445)
@@ -2986,7 +2986,7 @@ pnpgets(char *buf)
 connect_idle:
 
 /* we may still have something in the buffer */
-return ((i > 0) ? i : 0);
+return (MAX(i, 0));
 }
 
 static int
___
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: r298446 - in head/sys/dev/hyperv: include netvsc storvsc utilities vmbus

2016-04-21 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Apr 22 05:01:43 2016
New Revision: 298446
URL: https://svnweb.freebsd.org/changeset/base/298446

Log:
  hyperv: Update copyright to 2016 for the files Microsoft changed in 2016
  
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6039

Modified:
  head/sys/dev/hyperv/include/hyperv.h
  head/sys/dev/hyperv/netvsc/hv_net_vsc.c
  head/sys/dev/hyperv/netvsc/hv_net_vsc.h
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  head/sys/dev/hyperv/netvsc/hv_rndis.h
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.h
  head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
  head/sys/dev/hyperv/utilities/hv_heartbeat.c
  head/sys/dev/hyperv/utilities/hv_kvp.c
  head/sys/dev/hyperv/utilities/hv_kvp.h
  head/sys/dev/hyperv/utilities/hv_shutdown.c
  head/sys/dev/hyperv/utilities/hv_timesync.c
  head/sys/dev/hyperv/utilities/hv_util.c
  head/sys/dev/hyperv/utilities/hv_util.h
  head/sys/dev/hyperv/vmbus/hv_channel.c
  head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
  head/sys/dev/hyperv/vmbus/hv_connection.c
  head/sys/dev/hyperv/vmbus/hv_et.c
  head/sys/dev/hyperv/vmbus/hv_hv.c
  head/sys/dev/hyperv/vmbus/hv_ring_buffer.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h

Modified: head/sys/dev/hyperv/include/hyperv.h
==
--- head/sys/dev/hyperv/include/hyperv.hFri Apr 22 03:55:33 2016
(r298445)
+++ head/sys/dev/hyperv/include/hyperv.hFri Apr 22 05:01:43 2016
(r298446)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2009-2012 Microsoft Corp.
+ * Copyright (c) 2009-2012,2016 Microsoft Corp.
  * Copyright (c) 2012 NetApp Inc.
  * Copyright (c) 2012 Citrix Inc.
  * All rights reserved.

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Apr 22 03:55:33 2016
(r298445)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Apr 22 05:01:43 2016
(r298446)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2009-2012 Microsoft Corp.
+ * Copyright (c) 2009-2012,2016 Microsoft Corp.
  * Copyright (c) 2010-2012 Citrix Inc.
  * Copyright (c) 2012 NetApp Inc.
  * All rights reserved.

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Apr 22 03:55:33 2016
(r298445)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Apr 22 05:01:43 2016
(r298446)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2009-2012 Microsoft Corp.
+ * Copyright (c) 2009-2012,2016 Microsoft Corp.
  * Copyright (c) 2010-2012 Citrix Inc.
  * Copyright (c) 2012 NetApp Inc.
  * All rights reserved.

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Fri Apr 22 03:55:33 
2016(r298445)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Fri Apr 22 05:01:43 
2016(r298446)
@@ -1,6 +1,6 @@
 /*-
  * Copyright (c) 2010-2012 Citrix Inc.
- * Copyright (c) 2009-2012 Microsoft Corp.
+ * Copyright (c) 2009-2012,2016 Microsoft Corp.
  * Copyright (c) 2012 NetApp Inc.
  * All rights reserved.
  *

Modified: head/sys/dev/hyperv/netvsc/hv_rndis.h
==
--- head/sys/dev/hyperv/netvsc/hv_rndis.h   Fri Apr 22 03:55:33 2016
(r298445)
+++ head/sys/dev/hyperv/netvsc/hv_rndis.h   Fri Apr 22 05:01:43 2016
(r298446)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2009-2012 Microsoft Corp.
+ * Copyright (c) 2009-2012,2016 Microsoft Corp.
  * Copyright (c) 2010-2012 Citrix Inc.
  * Copyright (c) 2012 NetApp Inc.
  * All rights reserved.

Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
==
--- head/sys/dev/hyperv/netvsc/hv_rndis_filter.cFri Apr 22 03:55:33 
2016(r298445)
+++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.cFri Apr 22 05:01:43 
2016(r298446)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2009-2012 Microsoft Corp.
+ * Copyright (c) 2009-2012,2016 Microsoft Corp.
  * Copyright (c) 2010-2012 Citrix Inc.
  * Copyright (c) 2012 NetApp Inc.
  * All rights reserved.

Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.h
==
--- head/sys/dev/hyperv/netvsc/hv_rndis_filter.hFri Apr 22 03:55:33 
2016(r298445)
+++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.hFri Apr 22 05:01:43 
2016(r298446)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2009-2012 Microsoft Corp.
+ * Copyright (c) 2009-2012,2016 Microsoft Corp.
  * Copyright (c) 2010-2012 C

svn commit: r298447 - head/usr.sbin/pmccontrol

2016-04-21 Thread Marcelo Araujo
Author: araujo
Date: Fri Apr 22 05:07:59 2016
New Revision: 298447
URL: https://svnweb.freebsd.org/changeset/base/298447

Log:
  Use macro MAX() from sys/param.h.
  
  MFC after:2 weeks.

Modified:
  head/usr.sbin/pmccontrol/pmccontrol.c

Modified: head/usr.sbin/pmccontrol/pmccontrol.c
==
--- head/usr.sbin/pmccontrol/pmccontrol.c   Fri Apr 22 05:01:43 2016
(r298446)
+++ head/usr.sbin/pmccontrol/pmccontrol.c   Fri Apr 22 05:07:59 2016
(r298447)
@@ -141,7 +141,7 @@ pmcc_do_enable_disable(struct pmcc_op_li
err(EX_OSERR,
"Unable to determine the number of PMCs in CPU %d",
c);
-   npmc = t > npmc ? t : npmc;
+   npmc = MAX(t, npmc);
}
 
if (npmc == 0)
___
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: r298448 - head/contrib/bsnmp/snmpd

2016-04-21 Thread Garrett Cooper
Author: ngie
Date: Fri Apr 22 05:14:12 2016
New Revision: 298448
URL: https://svnweb.freebsd.org/changeset/base/298448

Log:
  Don't leak `string` in parse_define(..) when a macro has been found
  and the parser token != TOK_ASSIGN
  
  MFC after: 1 week
  CID: 1007187, 1007188
  Reported by: Coverity
  Obtained from: Isilon OneFS (part of r445479)
  Submitted by: Miles Ohlrich 
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/contrib/bsnmp/snmpd/config.c

Modified: head/contrib/bsnmp/snmpd/config.c
==
--- head/contrib/bsnmp/snmpd/config.c   Fri Apr 22 05:07:59 2016
(r298447)
+++ head/contrib/bsnmp/snmpd/config.c   Fri Apr 22 05:14:12 2016
(r298448)
@@ -1150,7 +1150,8 @@ parse_define(const char *varname)
free(m->value);
m->value = string;
m->length = length;
-   }
+   } else
+   free(string);
}
 
token = TOK_EOL;
___
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: r298449 - head/sys/dev/hyperv/vmbus

2016-04-21 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Apr 22 05:15:59 2016
New Revision: 298449
URL: https://svnweb.freebsd.org/changeset/base/298449

Log:
  hyperv/et: Make Hyper-V event timer a device.
  
  Submitted by: Jun Su 
  Reviewed by:  sephe, Dexuan Cui 
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D5957

Modified:
  head/sys/dev/hyperv/vmbus/hv_et.c
  head/sys/dev/hyperv/vmbus/hv_hv.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c

Modified: head/sys/dev/hyperv/vmbus/hv_et.c
==
--- head/sys/dev/hyperv/vmbus/hv_et.c   Fri Apr 22 05:14:12 2016
(r298448)
+++ head/sys/dev/hyperv/vmbus/hv_et.c   Fri Apr 22 05:15:59 2016
(r298449)
@@ -28,6 +28,9 @@
 __FBSDID("$FreeBSD$");
 
 #include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -40,8 +43,7 @@ __FBSDID("$FreeBSD$");
 #define HV_MAX_DELTA_TICKS 0xLL
 #define HV_MIN_DELTA_TICKS 1LL
 
-static struct eventtimer et;
-static uint64_t periodticks[MAXCPU];
+static struct eventtimer *et;
 
 static inline uint64_t
 sbintime2tick(sbintime_t time)
@@ -62,10 +64,6 @@ hv_et_start(struct eventtimer *et, sbint
timer_cfg.auto_enable = 1;
timer_cfg.sintx = HV_VMBUS_TIMER_SINT;
 
-   periodticks[curcpu] = sbintime2tick(periodtime);
-   if (firsttime == 0)
-   firsttime = periodtime;
-
current = rdmsr(HV_X64_MSR_TIME_REF_COUNT);
current += sbintime2tick(firsttime);
 
@@ -87,45 +85,77 @@ hv_et_stop(struct eventtimer *et)
 void
 hv_et_intr(struct trapframe *frame)
 {
-   union hv_timer_config timer_cfg;
struct trapframe *oldframe;
struct thread *td;
 
-   if (periodticks[curcpu] != 0) {
-   uint64_t tick = sbintime2tick(periodticks[curcpu]);
-   timer_cfg.as_uint64 = rdmsr(HV_X64_MSR_STIMER0_CONFIG);
-   timer_cfg.enable = 0;
-   timer_cfg.auto_enable = 1;
-   timer_cfg.periodic = 1;
-   periodticks[curcpu] = 0;
-
-   wrmsr(HV_X64_MSR_STIMER0_CONFIG, timer_cfg.as_uint64);
-   wrmsr(HV_X64_MSR_STIMER0_COUNT, tick);
-   }
-
-   if (et.et_active) {
+   if (et->et_active) {
td = curthread;
td->td_intr_nesting_level++;
oldframe = td->td_intr_frame;
td->td_intr_frame = frame;
-   et.et_event_cb(&et, et.et_arg);
+   et->et_event_cb(et, et->et_arg);
td->td_intr_frame = oldframe;
td->td_intr_nesting_level--;
}
 }
 
-void
-hv_et_init(void)
+static void
+hv_et_identify (driver_t *driver, device_t parent)
+{
+   if (device_find_child(parent, "hv_et", -1) != NULL)
+   return;
+
+   device_add_child(parent, "hv_et", -1);
+}
+
+static int
+hv_et_probe(device_t dev)
+{
+   device_set_desc(dev, "Hyper-V event timer");
+
+   return (BUS_PROBE_NOWILDCARD);
+}
+
+static int
+hv_et_attach(device_t dev)
+{
+   /* XXX: need allocate SINT and remove global et */
+   et = device_get_softc(dev);
+
+   et->et_name = "Hyper-V";
+   et->et_flags = ET_FLAGS_ONESHOT | ET_FLAGS_PERCPU;
+   et->et_quality = 1000;
+   et->et_frequency = HV_TIMER_FREQUENCY;
+   et->et_min_period = HV_MIN_DELTA_TICKS * ((1LL << 32) / 
HV_TIMER_FREQUENCY);
+   et->et_max_period = HV_MAX_DELTA_TICKS * ((1LL << 32) / 
HV_TIMER_FREQUENCY);
+   et->et_start = hv_et_start;
+   et->et_stop = hv_et_stop;
+   et->et_priv = dev;
+
+   return (et_register(et));
+}
+
+static int
+hv_et_detach(device_t dev)
 {
-   et.et_name = "HyperV";
-   et.et_flags = ET_FLAGS_ONESHOT | ET_FLAGS_PERCPU | ET_FLAGS_PERIODIC;
-   et.et_quality = 1000;
-   et.et_frequency = HV_TIMER_FREQUENCY;
-   et.et_min_period = (1LL << 32) / HV_TIMER_FREQUENCY;
-   et.et_max_period = HV_MAX_DELTA_TICKS * ((1LL << 32) / 
HV_TIMER_FREQUENCY);
-   et.et_start = hv_et_start;
-   et.et_stop = hv_et_stop;
-   et.et_priv = &et;
-   et_register(&et);
+   return (et_deregister(et));
 }
 
+static device_method_t hv_et_methods[] = {
+   DEVMETHOD(device_identify,  hv_et_identify),
+   DEVMETHOD(device_probe, hv_et_probe),
+   DEVMETHOD(device_attach,hv_et_attach),
+   DEVMETHOD(device_detach,hv_et_detach),
+
+   DEVMETHOD_END
+};
+
+static driver_t hv_et_driver = {
+   "hv_et",
+   hv_et_methods,
+   sizeof(struct eventtimer)
+};
+
+static devclass_t hv_et_devclass;
+DRIVER_MODULE(hv_et, vmbus, hv_et_driver, hv_et_devclass, NULL, 0);
+MODULE_VERSION(hv_et, 1);

Modified: head/sys/dev/hyperv/vmbus/hv_hv.c
==
--- head/sys/dev/hyperv/vmbus/hv_hv.c   Fri Apr 22 05:14:12 2016
(r298448)
+++ head/sys/dev/hyperv/vmbus/hv_hv.c   Fri 

svn commit: r298450 - head/contrib/bsnmp/gensnmptree

2016-04-21 Thread Garrett Cooper
Author: ngie
Date: Fri Apr 22 05:24:15 2016
New Revision: 298450
URL: https://svnweb.freebsd.org/changeset/base/298450

Log:
  Simplify always evaluated branch (`e != NULL`)
  
  - xalloc(..) ensures that e will be non-null via malloc + err.
  - `e` is already dereferenced above, so logically it's impossible
to hit the lower test without crashing if it was indeed NULL.
  
  MFC after: 3 days
  CID: 1007408
  Reported by: Coverity
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/contrib/bsnmp/gensnmptree/gensnmptree.c

Modified: head/contrib/bsnmp/gensnmptree/gensnmptree.c
==
--- head/contrib/bsnmp/gensnmptree/gensnmptree.cFri Apr 22 05:15:59 
2016(r298449)
+++ head/contrib/bsnmp/gensnmptree/gensnmptree.cFri Apr 22 05:24:15 
2016(r298450)
@@ -743,10 +743,8 @@ parse_type(enum tok *tok, struct type *t
report("need value for ENUM/BITS");
if (gettoken() != TOK_STR)
report("need string in ENUM/BITS");
-   if (e != NULL) {
-   e->name = savetok();
-   TAILQ_INSERT_TAIL(&t->enums, e, link);
-   }
+   e->name = savetok();
+   TAILQ_INSERT_TAIL(&t->enums, e, link);
if ((*tok = gettoken()) == TOK_EOF)
report("unexpected EOF in ENUM/BITS");
} while (*tok != ')');
___
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: r298451 - head/usr.sbin/bsnmpd/tools/libbsnmptools

2016-04-21 Thread Garrett Cooper
Author: ngie
Date: Fri Apr 22 05:52:40 2016
New Revision: 298451
URL: https://svnweb.freebsd.org/changeset/base/298451

Log:
  Don't use `entry` after free in the "already in lists" case
  
  Return with 0 as it isn't an error.
  
  MFC after: 1 week
  CID: 1006085
  Reported by: Coverity
  Obtained from: Isilon OneFS (part of r493633)
  Submitted by: Thor Steingrimsson 
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpimport.c

Modified: head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpimport.c
==
--- head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpimport.c  Fri Apr 22 
05:24:15 2016(r298450)
+++ head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpimport.c  Fri Apr 22 
05:52:40 2016(r298451)
@@ -693,6 +693,7 @@ snmp_import_table(struct snmp_toolinfo *
/* Same entry already present in lists. */
free(entry->string);
free(entry);
+   return (0);
}
 
(void) snmp_import_update_table(ENTRY_INDEX, entry);
___
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: r298452 - head/usr.sbin/bsnmpd/tools/libbsnmptools

2016-04-21 Thread Garrett Cooper
Author: ngie
Date: Fri Apr 22 06:01:11 2016
New Revision: 298452
URL: https://svnweb.freebsd.org/changeset/base/298452

Log:
  Don't try to free `string` (stack allocated char[])
  
  Fix minor style with warnx call while in the neighborhood
  
  MFC after: 1 week
  CID: 1009683
  Reported by: Coverity, gcc 5.x
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c

Modified: head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c
==
--- head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c   Fri Apr 22 
05:52:40 2016(r298451)
+++ head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c   Fri Apr 22 
06:01:11 2016(r298452)
@@ -1079,10 +1079,9 @@ snmp_oid2asn_oid(struct snmp_toolinfo *s
strlcpy(string, str, i + 1);
string[i] = '\0';
if (snmp_lookup_enumoid(snmptoolctx, &obj, string) < 0) {
-   warnx("Unknown string - %s",string);
+   warnx("Unknown string - %s", string);
return (NULL);
}
-   free(string);
}
 
asn_append_oid(oid, &(obj.val.var));
___
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: r298453 - head/usr.bin/xlint/lint1

2016-04-21 Thread Marcelo Araujo
Author: araujo
Date: Fri Apr 22 06:23:23 2016
New Revision: 298453
URL: https://svnweb.freebsd.org/changeset/base/298453

Log:
  Use roundup2() macro from sys/param.h.
  
  MFC after:2 weeks.

Modified:
  head/usr.bin/xlint/lint1/decl.c

Modified: head/usr.bin/xlint/lint1/decl.c
==
--- head/usr.bin/xlint/lint1/decl.c Fri Apr 22 06:01:11 2016
(r298452)
+++ head/usr.bin/xlint/lint1/decl.c Fri Apr 22 06:23:23 2016
(r298453)
@@ -1105,7 +1105,7 @@ align(int al, int len)
if (al > dcs->d_stralign)
dcs->d_stralign = al;
 
-   no = (dcs->d_offset + (al - 1)) & ~(al - 1);
+   no = roundup2(dcs->d_offset, al);
if (len == 0 || dcs->d_offset + len > no)
dcs->d_offset = 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"


svn commit: r298454 - head/usr.sbin/bhyve

2016-04-21 Thread Marcelo Araujo
Author: araujo
Date: Fri Apr 22 06:25:32 2016
New Revision: 298454
URL: https://svnweb.freebsd.org/changeset/base/298454

Log:
  Use MIN()/MAX() macros from sys/param.h.
  
  Reviewed by:  grehan
  Differential Revision:https://reviews.freebsd.org/D6054

Modified:
  head/usr.sbin/bhyve/fwctl.c
  head/usr.sbin/bhyve/pci_ahci.c

Modified: head/usr.sbin/bhyve/fwctl.c
==
--- head/usr.sbin/bhyve/fwctl.c Fri Apr 22 06:23:23 2016(r298453)
+++ head/usr.sbin/bhyve/fwctl.c Fri Apr 22 06:25:32 2016(r298454)
@@ -348,7 +348,7 @@ fwctl_request_data(uint32_t value)
 
/* Make sure remaining size is >= 0 */
rinfo.req_size -= sizeof(uint32_t);
-   remlen = (rinfo.req_size > 0) ? rinfo.req_size: 0;
+   remlen = MAX(rinfo.req_size, 0);
 
(*rinfo.req_op->op_data)(value, remlen);
 

Modified: head/usr.sbin/bhyve/pci_ahci.c
==
--- head/usr.sbin/bhyve/pci_ahci.c  Fri Apr 22 06:23:23 2016
(r298453)
+++ head/usr.sbin/bhyve/pci_ahci.c  Fri Apr 22 06:25:32 2016
(r298454)
@@ -741,7 +741,7 @@ read_prdt(struct ahci_port *p, int slot,
 
dbcsz = (prdt->dbc & DBCMASK) + 1;
ptr = paddr_guest2host(ahci_ctx(p->pr_sc), prdt->dba, dbcsz);
-   sublen = len < dbcsz ? len : dbcsz;
+   sublen = MIN(len, dbcsz);
memcpy(to, ptr, sublen);
len -= sublen;
to += sublen;
@@ -847,7 +847,7 @@ write_prdt(struct ahci_port *p, int slot
 
dbcsz = (prdt->dbc & DBCMASK) + 1;
ptr = paddr_guest2host(ahci_ctx(p->pr_sc), prdt->dba, dbcsz);
-   sublen = len < dbcsz ? len : dbcsz;
+   sublen = MIN(len, dbcsz);
memcpy(ptr, from, sublen);
len -= sublen;
from += sublen;
___
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: r298455 - head/sys/arm/include

2016-04-21 Thread Svatopluk Kraus
Author: skra
Date: Fri Apr 22 06:26:45 2016
New Revision: 298455
URL: https://svnweb.freebsd.org/changeset/base/298455

Log:
  Add four functions which check a virtual address for stage 1 privileged
  (PL1) and unprivileged (PL0) read/write access. As cp15 virtual to
  physical address translation operations are used, interrupts must be
  disabled to get consistent result when they are called.
  
  These functions should be used only in very specific occasions like
  during abort handling or kernel debugging. One of them is going to be
  used in pmap_fault(). However, complete function set is added. It cost
  nothing, as they are inlined.
  
  While here, fix comment of #endif.
  
  Reviewed by:  kib

Modified:
  head/sys/arm/include/cpu-v6.h

Modified: head/sys/arm/include/cpu-v6.h
==
--- head/sys/arm/include/cpu-v6.h   Fri Apr 22 06:25:32 2016
(r298454)
+++ head/sys/arm/include/cpu-v6.h   Fri Apr 22 06:26:45 2016
(r298455)
@@ -181,6 +181,8 @@ _RF0(cp15_actlr_get, CP15_ACTLR(%0))
 _WF1(cp15_actlr_set, CP15_ACTLR(%0))
 _WF1(cp15_ats1cpr_set, CP15_ATS1CPR(%0))
 _WF1(cp15_ats1cpw_set, CP15_ATS1CPW(%0))
+_WF1(cp15_ats1cur_set, CP15_ATS1CUR(%0))
+_WF1(cp15_ats1cuw_set, CP15_ATS1CUW(%0))
 _RF0(cp15_par_get, CP15_PAR(%0))
 _RF0(cp15_sctlr_get, CP15_SCTLR(%0))
 
@@ -581,6 +583,52 @@ cp15_ttbr_set(uint32_t reg)
isb();
tlb_flush_all_ng_local();
 }
-#endif /* _KERNEL */
+
+/*
+ * Functions for address checking:
+ *
+ *  cp15_ats1cpr_check() ... check stage 1 privileged (PL1) read access
+ *  cp15_ats1cpw_check() ... check stage 1 privileged (PL1) write access
+ *  cp15_ats1cur_check() ... check stage 1 unprivileged (PL0) read access
+ *  cp15_ats1cuw_check() ... check stage 1 unprivileged (PL0) write access
+ *
+ * They must be called while interrupts are disabled to get consistent result.
+ */
+static __inline int
+cp15_ats1cpr_check(vm_offset_t addr)
+{
+
+   cp15_ats1cpr_set(addr);
+   isb();
+   return (cp15_par_get() & 0x01 ? EFAULT : 0);
+}
+
+static __inline int
+cp15_ats1cpw_check(vm_offset_t addr)
+{
+
+   cp15_ats1cpw_set(addr);
+   isb();
+   return (cp15_par_get() & 0x01 ? EFAULT : 0);
+}
+
+static __inline int
+cp15_ats1cur_check(vm_offset_t addr)
+{
+
+   cp15_ats1cur_set(addr);
+   isb();
+   return (cp15_par_get() & 0x01 ? EFAULT : 0);
+}
+
+static __inline int
+cp15_ats1cuw_check(vm_offset_t addr)
+{
+
+   cp15_ats1cuw_set(addr);
+   isb();
+   return (cp15_par_get() & 0x01 ? EFAULT : 0);
+}
+#endif /* !__ARM_ARCH < 6 */
 
 #endif /* !MACHINE_CPU_V6_H */
___
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: r298457 - in head/sys/arm: arm include

2016-04-21 Thread Svatopluk Kraus
Author: skra
Date: Fri Apr 22 06:32:27 2016
New Revision: 298457
URL: https://svnweb.freebsd.org/changeset/base/298457

Log:
  Don't use atomic operations for page table entries and handle access
  and R/W emulation aborts under pmap lock.
  
  There were two reasons for using of atomic operations:
  (1) the pmap code is based on i386 one where they are used,
  (2) there was an idea that access and R/W emulation aborts should be
  handled as quick as possible, without pmap locking.
  
  However, the atomic operations in i386 pmap code are used only because
  page table entries may be modified by hardware. At the beginning, we
  were not sure that it's the only reason. So even if arm hardware does
  not modify them, we did not risk to not use them at that time. Further,
  it turns out after some testing that using of pmap lock for access and
  R/W emulation aborts does not bring any extra cost and there was no
  measurable difference. Thus, we have decided finally to use pmap lock
  for all operations on page table entries and so, there is no reason for
  atomic operations on them. This makes the code cleaner and safer.
  
  This decision introduce a question if it's safe to use pmap lock for
  access and R/W emulation aborts. Anyhow, there may happen two cases in
  general:
  (A) Aborts while the pmap lock is locked already - this should not
  happen as pmap lock is not recursive. However, under pmap lock only
  internal kernel data should be accessed and such data should be mapped
  with A bit set and NM bit cleared. If double abort happens, then
  a mapping of data which has caused it must be fixed.
  (B) Aborts while another lock(s) is/are locked - this already can
  happen. There is no difference here if it's either access or R/W
  emulation abort, or if it's some other abort.
  
  Reviewed by:  kib

Modified:
  head/sys/arm/arm/pmap-v6.c
  head/sys/arm/include/pmap_var.h

Modified: head/sys/arm/arm/pmap-v6.c
==
--- head/sys/arm/arm/pmap-v6.c  Fri Apr 22 06:29:49 2016(r298456)
+++ head/sys/arm/arm/pmap-v6.c  Fri Apr 22 06:32:27 2016(r298457)
@@ -3230,7 +3230,6 @@ pmap_promote_pte1(pmap_t pmap, pt1_entry
 * within a 1MB page.
 */
fpte2p = pmap_pte2_quick(pmap, pte1_trunc(va));
-setpte1:
fpte2 = pte2_load(fpte2p);
if ((fpte2 & ((PTE2_FRAME & PTE1_OFFSET) | PTE2_A | PTE2_V)) !=
(PTE2_A | PTE2_V)) {
@@ -3249,16 +3248,9 @@ setpte1:
/*
 * When page is not modified, PTE2_RO can be set without
 * a TLB invalidation.
-*
-* Note: When modified bit is being set, then in hardware case,
-*   the TLB entry is re-read (updated) from PT2, and in
-*   software case (abort), the PTE2 is read from PT2 and
-*   TLB flushed if changed. The following cmpset() solves
-*   any race with setting this bit in both cases.
 */
-   if (!pte2_cmpset(fpte2p, fpte2, fpte2 | PTE2_RO))
-   goto setpte1;
fpte2 |= PTE2_RO;
+   pte2_store(fpte2p, fpte2);
}
 
/*
@@ -3269,7 +3261,6 @@ setpte1:
fpte2_fav = (fpte2 & (PTE2_FRAME | PTE2_A | PTE2_V));
fpte2_fav += PTE1_SIZE - PTE2_SIZE; /* examine from the end */
for (pte2p = fpte2p + NPTE2_IN_PT2 - 1; pte2p > fpte2p; pte2p--) {
-setpte2:
pte2 = pte2_load(pte2p);
if ((pte2 & (PTE2_FRAME | PTE2_A | PTE2_V)) != fpte2_fav) {
pmap_pte1_p_failures++;
@@ -3282,9 +3273,8 @@ setpte2:
 * When page is not modified, PTE2_RO can be set
 * without a TLB invalidation. See note above.
 */
-   if (!pte2_cmpset(pte2p, pte2, pte2 | PTE2_RO))
-   goto setpte2;
pte2 |= PTE2_RO;
+   pte2_store(pte2p, pte2);
pteva = pte1_trunc(va) | (pte2 & PTE1_OFFSET &
PTE2_FRAME);
CTR3(KTR_PMAP, "%s: protect for va %#x in pmap %p",
@@ -4655,7 +4645,7 @@ pmap_protect_pte1(pmap_t pmap, pt1_entry
PMAP_LOCK_ASSERT(pmap, MA_OWNED);
KASSERT((sva & PTE1_OFFSET) == 0,
("%s: sva is not 1mpage aligned", __func__));
-retry:
+
opte1 = npte1 = pte1_load(pte1p);
if (pte1_is_managed(opte1)) {
eva = sva + PTE1_SIZE;
@@ -4676,8 +4666,7 @@ retry:
 */
 
if (npte1 != opte1) {
-   if (!pte1_cmpset(pte1p, opte1, npte1))
-   goto retry;
+   pte1_store(pte1p, npte1);
pmap_tlb_flush(pmap, sva);
}
 }
@@ -4779,7 +4768,7 @@ resume:
for (pte2p = pmap_pte2_quick(pmap, sva); sva != nextva; pte2p++,

svn commit: r298458 - head/sys/ofed/drivers/infiniband/ulp/ipoib

2016-04-21 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Apr 22 06:33:06 2016
New Revision: 298458
URL: https://svnweb.freebsd.org/changeset/base/298458

Log:
  Add missing set of the current VNET when inputting IP packets in IPoIB.
  
  This fixes a kernel panic when using IPoIB with VIMAGE and infiniband.
  
  PR:   208957
  Sponsored by: Mellanox Technologies
  Tested by:Justin Clift 
  MFC after:1 week

Modified:
  head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c

Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c
==
--- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c   Fri Apr 22 
06:32:27 2016(r298457)
+++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c   Fri Apr 22 
06:33:06 2016(r298458)
@@ -481,6 +481,8 @@ void ipoib_cm_handle_rx_wc(struct ipoib_
int has_srq;
u_short proto;
 
+   CURVNET_SET_QUIET(dev->if_vnet);
+
ipoib_dbg_data(priv, "cm recv completion: id %d, status: %d\n",
   wr_id, wc->status);
 
@@ -496,7 +498,7 @@ void ipoib_cm_handle_rx_wc(struct ipoib_
} else
ipoib_warn(priv, "cm recv completion event with wrid %d 
(> %d)\n",
   wr_id, ipoib_recvq_size);
-   return;
+   goto done;
}
 
p = wc->qp->qp_context;
@@ -520,7 +522,7 @@ void ipoib_cm_handle_rx_wc(struct ipoib_
queue_work(ipoib_workqueue, 
&priv->cm.rx_reap_task);
spin_unlock(&priv->lock);
}
-   return;
+   goto done;
}
}
 
@@ -579,6 +581,9 @@ repost:
   "for buf %d\n", wr_id);
}
}
+done:
+   CURVNET_RESTORE();
+   return;
 }
 
 static inline int post_send(struct ipoib_dev_priv *priv,
___
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: r298459 - head/sys/ofed/drivers/infiniband/core

2016-04-21 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Apr 22 06:39:07 2016
New Revision: 298459
URL: https://svnweb.freebsd.org/changeset/base/298459

Log:
  Add KASSERT() and set error code in dead code case to help static code
  analysis tools.
  
  Suggested by: ngie@
  Sponsored by: Mellanox Technologies
  MFC after:1 week

Modified:
  head/sys/ofed/drivers/infiniband/core/addr.c

Modified: head/sys/ofed/drivers/infiniband/core/addr.c
==
--- head/sys/ofed/drivers/infiniband/core/addr.cFri Apr 22 06:33:06 
2016(r298458)
+++ head/sys/ofed/drivers/infiniband/core/addr.cFri Apr 22 06:39:07 
2016(r298459)
@@ -404,6 +404,8 @@ mcast:
break;
 #endif
default:
+   KASSERT(0, ("rdma_addr_resolve: Unreachable"));
+   error = EINVAL;
break;
}
RTFREE(rte);
___
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: r298459 - head/sys/ofed/drivers/infiniband/core

2016-04-21 Thread Ngie Cooper (yaneurabeya)

> On Apr 21, 2016, at 23:39, Hans Petter Selasky  wrote:
> 
> Author: hselasky
> Date: Fri Apr 22 06:39:07 2016
> New Revision: 298459
> URL: https://svnweb.freebsd.org/changeset/base/298459
> 
> Log:
>  Add KASSERT() and set error code in dead code case to help static code
>  analysis tools.
> 
>  Suggested by:ngie@
>  Sponsored by:Mellanox Technologies
>  MFC after:   1 week
> 
> Modified:
>  head/sys/ofed/drivers/infiniband/core/addr.c
> 
> Modified: head/sys/ofed/drivers/infiniband/core/addr.c
> ==
> --- head/sys/ofed/drivers/infiniband/core/addr.c  Fri Apr 22 06:33:06 
> 2016(r298458)
> +++ head/sys/ofed/drivers/infiniband/core/addr.c  Fri Apr 22 06:39:07 
> 2016(r298459)
> @@ -404,6 +404,8 @@ mcast:
>   break;
> #endif
>   default:
> + KASSERT(0, ("rdma_addr_resolve: Unreachable"));
> + error = EINVAL;
>   break;
>   }
>   RTFREE(rte);

Thanks :)!
___
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: r298460 - head/sys/arm/arm

2016-04-21 Thread Svatopluk Kraus
Author: skra
Date: Fri Apr 22 06:42:50 2016
New Revision: 298460
URL: https://svnweb.freebsd.org/changeset/base/298460

Log:
  Fix duplicate TLB entries issue during section promotion/demotion.
  Such situation is defined as UNPREDICTABLE by arm arm manual.
  
  This patch fixes all explicit TLB fetches which could cause this issue
  and speculative TLB fetches for sections mapped in user address space.
  Speculative TLB fetches for sections mapped in kernel address space are
  not fixed yet as the break-before-make approach must be implemented for
  kernel mappings too. This means that promoted/demoted section will be
  unmapped for a while. Either kernel stack the promotion/demotion is
  being done on or L1 page table(s) which must be modified may be mapped
  by this section. Thus the fix will not be so simple like for userland
  mappings.
  
  The issue was detectable only on Cortex-A8 platforms and only very
  rarely. It was reported few times. First, it was by Mikael Urankar
  in June 2015. He helped to identify the mechanism of this issue, but
  we were not sure how to fix it correctly until now.
  
  PR:   208381
  Reported by:  Mikael Urankar (mikael.urankar at gmail.com)
  Reviewed by:  kib

Modified:
  head/sys/arm/arm/pmap-v6.c

Modified: head/sys/arm/arm/pmap-v6.c
==
--- head/sys/arm/arm/pmap-v6.c  Fri Apr 22 06:39:07 2016(r298459)
+++ head/sys/arm/arm/pmap-v6.c  Fri Apr 22 06:42:50 2016(r298460)
@@ -1531,6 +1531,14 @@ static u_long pmap_pte1_promotions;
 SYSCTL_ULONG(_vm_pmap_pte1, OID_AUTO, promotions, CTLFLAG_RD,
 &pmap_pte1_promotions, 0, "1MB page promotions");
 
+static u_long pmap_pte1_kern_demotions;
+SYSCTL_ULONG(_vm_pmap_pte1, OID_AUTO, kern_demotions, CTLFLAG_RD,
+&pmap_pte1_kern_demotions, 0, "1MB page kernel demotions");
+
+static u_long pmap_pte1_kern_promotions;
+SYSCTL_ULONG(_vm_pmap_pte1, OID_AUTO, kern_promotions, CTLFLAG_RD,
+&pmap_pte1_kern_promotions, 0, "1MB page kernel promotions");
+
 static __inline ttb_entry_t
 pmap_ttb_get(pmap_t pmap)
 {
@@ -3198,6 +3206,166 @@ pmap_pv_insert_pte1(pmap_t pmap, vm_offs
return (FALSE);
 }
 
+static inline void
+pmap_tlb_flush_pte1(pmap_t pmap, vm_offset_t va, pt1_entry_t npte1)
+{
+
+   /* Kill all the small mappings or the big one only. */
+   if (pte1_is_section(npte1))
+   pmap_tlb_flush_range(pmap, pte1_trunc(va), PTE1_SIZE);
+   else
+   pmap_tlb_flush(pmap, pte1_trunc(va));
+}
+
+/*
+ *  Update kernel pte1 on all pmaps.
+ *
+ *  The following function is called only on one cpu with disabled interrupts.
+ *  In SMP case, smp_rendezvous_cpus() is used to stop other cpus. This way
+ *  nobody can invoke explicit hardware table walk during the update of pte1.
+ *  Unsolicited hardware table walk can still happen, invoked by speculative
+ *  data or instruction prefetch or even by speculative hardware table walk.
+ *
+ *  The break-before-make approach should be implemented here. However, it's
+ *  not so easy to do that for kernel mappings as it would be unhappy to unmap
+ *  itself unexpectedly but voluntarily.
+ */
+static void
+pmap_update_pte1_kernel(vm_offset_t va, pt1_entry_t npte1)
+{
+   pmap_t pmap;
+   pt1_entry_t *pte1p;
+
+   /*
+* Get current pmap. Interrupts should be disabled here
+* so PCPU_GET() is done atomically.
+*/
+   pmap = PCPU_GET(curpmap);
+   if (pmap == NULL)
+   pmap = kernel_pmap;
+
+   /*
+* (1) Change pte1 on current pmap.
+* (2) Flush all obsolete TLB entries on current CPU.
+* (3) Change pte1 on all pmaps.
+* (4) Flush all obsolete TLB entries on all CPUs in SMP case.
+*/
+
+   pte1p = pmap_pte1(pmap, va);
+   pte1_store(pte1p, npte1);
+
+   /* Kill all the small mappings or the big one only. */
+   if (pte1_is_section(npte1)) {
+   pmap_pte1_kern_promotions++;
+   tlb_flush_range_local(pte1_trunc(va), PTE1_SIZE);
+   } else {
+   pmap_pte1_kern_demotions++;
+   tlb_flush_local(pte1_trunc(va));
+   }
+
+   /*
+* In SMP case, this function is called when all cpus are at smp
+* rendezvous, so there is no need to use 'allpmaps_lock' lock here.
+* In UP case, the function is called with this lock locked.
+*/
+   LIST_FOREACH(pmap, &allpmaps, pm_list) {
+   pte1p = pmap_pte1(pmap, va);
+   pte1_store(pte1p, npte1);
+   }
+
+#ifdef SMP
+   /* Kill all the small mappings or the big one only. */
+   if (pte1_is_section(npte1))
+   tlb_flush_range(pte1_trunc(va), PTE1_SIZE);
+   else
+   tlb_flush(pte1_trunc(va));
+#endif
+}
+
+#ifdef SMP
+struct pte1_action {
+   vm_offset_t va;
+   pt1_entry_t npte1;
+   u_int update;   /* CPU that updates the PTE1 */
+};