Re: svn commit: r311952 - head/sys/ddb

2017-01-15 Thread Julian Elischer

On 16/01/2017 11:53 AM, Bruce Evans wrote:

On Sun, 15 Jan 2017, Adrian Chadd wrote:


hah, i took this, then life got in the way. :)

Bruce - what do you think of
https://bz-attachments.freebsd.org/attachment.cgi?id=138881 ?


Also https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=184987 .

I think it is hard to read and review since it is not in the mail.
After fetching it and quoting it:


review it in the review page and just send a link in the email.. 
that's what it's for.




X diff -r 91820d9948e0 -r 13f40d577646 sys/kern/tty_ttydisc.c
X --- a/sys/kern/tty_ttydisc.cFri Feb 22 09:45:32 2013 +0100
X +++ b/sys/kern/tty_ttydisc.cTue Dec 17 23:03:17 2013 +0100
X @@ -448,6 +448,9 @@
X  if (tp->t_flags & TF_ZOMBIE)
X  return (EIO);
X X +if (tp->t_termios.c_lflag & FLUSHO)
X +return (0);
X +

This seems to be far too simple.  As pointed out in the PR thread, it
is missing at least the clearing of uio_resid.

   (BTW, returns for TF_ZOMBIE and IO_NDELAY tend to have the opposite
   problem.  The tend to reduce uio_resid to count i/o that they have
   not done.  They should just return an error like the above return
   for TF_ZOMBIE does.  Upper layers are supposed to translate this
   error to success if any i/o has been done.  Upper layers often get
   this wrong, and my fixes currently do too much compensation in lower
   layers.)

The old tty driver has squillions of FLUSHO checks for output not 
involving
uio.  Mostly for echo of input.  However, any input (and other 
operations?)

normally turns of FLUSHO, so this is hard to see.

To see if this works compatibly now, try typing 111^O2.  ^O should be
echoed as ^O^R followed by reprinting the line according to the 
implicit

VREPRINT (^R).  This should cancel FLUSHO, so the 2 is just echoed on
the new line.  However ^O instead of 2 should just cancel FLUSHO. So
^O^O should be equivalent to ^R except it prints ^O before ^R.

It is wrong for FLUSHO to have any effect except in modes where 
VDISCARD

has an effect.  VDISCARD seems to be conditional on precisely
!EXTPROC && IEXTEN.  Its inactivity in other modes should be 
implemented
by forcing it off on certain mode changes.  The old tty driver 
forces it

off in squillions of places, perhaps including all mode changes for
simplicity.  There would be a problem if stty(1) could actually set it,
since then invalid settings like "raw flusho" would be allowed. 
Clearing

it after all mode changes would prevent stty actually setting it.


X  /*
X   * We don't need to check whether the process is the foreground
X   * process group or if we have a carrier. This is already done
X @@ -881,6 +884,14 @@
X X  /* Special control characters that are implementation 
dependent. */

X  if (CMP_FLAG(l, IEXTEN)) {
X +/* Discard (^O) */

Style bug.  This comment is missing a "." and does less than echo 
the code.
The code doesn't hard-code VDISCARD as ^O, and it is unclear whether 
the

comment applies to the previous or the next line (except it is further
from echoing the previous line).

X +if (CMP_CC(VDISCARD, c)) {
X +if (!(tp->t_termios.c_lflag & FLUSHO))

Style bug.  This file elsewhere always uses the funky style of explicit
comparison of (sets of ) flags with 0.

X +ttyoutq_write_nofrag(>t_outq, "^O", 2);

This also hard-codes ^O.  The old driver echos the actual discard 
character
using ttyecho(c, tp).  I don't know if the funky rules for quoting 
control
characters apply in this case, but ttyecho() has to be quite 
complicated to

handle general cases.

X +tp->t_termios.c_lflag ^= FLUSHO;

The old driver adds an implicit VREPRINT char here if the input 
queue is
nonempty.  This usually results in echoing ^O^R and reprinting the 
line.


X +return(0);
X +}
X +

Otherwise, the action here is identical with the old driver.

X  /* Accept the next character as literal. */
X  if (CMP_CC(VLNEXT, c)) {
X  if (CMP_FLAG(l, ECHO)) {

The old driver needs 23 lines mentioning FLUSHO to keep it mostly 
clear.

These are:
- 3 in compat code (still there)
- 3 here
- 1 clear whenever restarting output at the end of interrupt input 
(most

  cases interrupt input)
- 4 checks in ttyoutput() which is used manly for echoing.  1 at the
  beginning would be simpler, but the checks are more or less before
  each putc() and there are many inconsistences for counting characters
  and the column position from the complications
- 1 clear in ttioctl() in 1 case of turning 1 type of flow control 
back on.
  Buggy, since FLUSHO should not be affected by flow control except 
by the

  xon char being treated as an ordinary char for canceling VDISCARD.
- 1 clear in ttioctl() for the same flow control done by TIOCSTART
- 1 check for ordinary writes as in this patch
- 2 in comments
- 2 more checks in the loop for ordinary writes.  Some checks are 
necessary,
  but these are misplaced.  FLUSHO can 

Re: svn commit: r311952 - head/sys/ddb

2017-01-15 Thread Bruce Evans

On Sun, 15 Jan 2017, Adrian Chadd wrote:


hah, i took this, then life got in the way. :)

Bruce - what do you think of
https://bz-attachments.freebsd.org/attachment.cgi?id=138881 ?


Also https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=184987 .

I think it is hard to read and review since it is not in the mail.
After fetching it and quoting it:

X diff -r 91820d9948e0 -r 13f40d577646 sys/kern/tty_ttydisc.c
X --- a/sys/kern/tty_ttydisc.c  Fri Feb 22 09:45:32 2013 +0100
X +++ b/sys/kern/tty_ttydisc.c  Tue Dec 17 23:03:17 2013 +0100
X @@ -448,6 +448,9 @@
X   if (tp->t_flags & TF_ZOMBIE)
X   return (EIO);
X 
X +	if (tp->t_termios.c_lflag & FLUSHO)

X + return (0);
X +

This seems to be far too simple.  As pointed out in the PR thread, it
is missing at least the clearing of uio_resid.

   (BTW, returns for TF_ZOMBIE and IO_NDELAY tend to have the opposite
   problem.  The tend to reduce uio_resid to count i/o that they have
   not done.  They should just return an error like the above return
   for TF_ZOMBIE does.  Upper layers are supposed to translate this
   error to success if any i/o has been done.  Upper layers often get
   this wrong, and my fixes currently do too much compensation in lower
   layers.)

The old tty driver has squillions of FLUSHO checks for output not involving
uio.  Mostly for echo of input.  However, any input (and other operations?)
normally turns of FLUSHO, so this is hard to see.

To see if this works compatibly now, try typing 111^O2.  ^O should be
echoed as ^O^R followed by reprinting the line according to the implicit
VREPRINT (^R).  This should cancel FLUSHO, so the 2 is just echoed on
the new line.  However ^O instead of 2 should just cancel FLUSHO.  So
^O^O should be equivalent to ^R except it prints ^O before ^R.

It is wrong for FLUSHO to have any effect except in modes where VDISCARD
has an effect.  VDISCARD seems to be conditional on precisely
!EXTPROC && IEXTEN.  Its inactivity in other modes should be implemented
by forcing it off on certain mode changes.  The old tty driver forces it
off in squillions of places, perhaps including all mode changes for
simplicity.  There would be a problem if stty(1) could actually set it,
since then invalid settings like "raw flusho" would be allowed.  Clearing
it after all mode changes would prevent stty actually setting it.


X   /*
X* We don't need to check whether the process is the foreground
X* process group or if we have a carrier. This is already done
X @@ -881,6 +884,14 @@
X 
X  	/* Special control characters that are implementation dependent. */

X   if (CMP_FLAG(l, IEXTEN)) {
X + /* Discard (^O) */

Style bug.  This comment is missing a "." and does less than echo the code.
The code doesn't hard-code VDISCARD as ^O, and it is unclear whether the
comment applies to the previous or the next line (except it is further
from echoing the previous line).

X + if (CMP_CC(VDISCARD, c)) {
X + if (!(tp->t_termios.c_lflag & FLUSHO))

Style bug.  This file elsewhere always uses the funky style of explicit
comparison of (sets of ) flags with 0.

X + ttyoutq_write_nofrag(>t_outq, "^O", 2);

This also hard-codes ^O.  The old driver echos the actual discard character
using ttyecho(c, tp).  I don't know if the funky rules for quoting control
characters apply in this case, but ttyecho() has to be quite complicated to
handle general cases.

X + tp->t_termios.c_lflag ^= FLUSHO;

The old driver adds an implicit VREPRINT char here if the input queue is
nonempty.  This usually results in echoing ^O^R and reprinting the line.

X + return(0);
X + }
X +

Otherwise, the action here is identical with the old driver.

X   /* Accept the next character as literal. */
X   if (CMP_CC(VLNEXT, c)) {
X   if (CMP_FLAG(l, ECHO)) {

The old driver needs 23 lines mentioning FLUSHO to keep it mostly clear.
These are:
- 3 in compat code (still there)
- 3 here
- 1 clear whenever restarting output at the end of interrupt input (most
  cases interrupt input)
- 4 checks in ttyoutput() which is used manly for echoing.  1 at the
  beginning would be simpler, but the checks are more or less before
  each putc() and there are many inconsistences for counting characters
  and the column position from the complications
- 1 clear in ttioctl() in 1 case of turning 1 type of flow control back on.
  Buggy, since FLUSHO should not be affected by flow control except by the
  xon char being treated as an ordinary char for canceling VDISCARD.
- 1 clear in ttioctl() for the same flow control done by TIOCSTART
- 1 check for ordinary writes as in this patch
- 2 in comments
- 2 more checks in the loop for ordinary writes.  Some checks are necessary,
  but these are misplaced.  FLUSHO can change underneath when we unlock to
  do the i/o, so it must be re-checked when we 

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

2017-01-15 Thread Ian Lepore
Author: ian
Date: Mon Jan 16 03:11:30 2017
New Revision: 312251
URL: https://svnweb.freebsd.org/changeset/base/312251

Log:
  Remove a bit of armv6 support that didn't get deleted when this file was
  split from trap.c into trap-v4.c and trap-v6.c.

Modified:
  head/sys/arm/arm/trap-v4.c

Modified: head/sys/arm/arm/trap-v4.c
==
--- head/sys/arm/arm/trap-v4.c  Mon Jan 16 03:03:47 2017(r312250)
+++ head/sys/arm/arm/trap-v4.c  Mon Jan 16 03:11:30 2017(r312251)
@@ -139,11 +139,7 @@ static const struct data_abort data_abor
{dab_align, "Alignment Fault 3"},
{dab_buserr,"External Linefetch Abort (S)"},
{NULL,  "Translation Fault (S)"},
-#if (ARM_MMU_V6 + ARM_MMU_V7) != 0
-   {NULL,  "Translation Flag Fault"},
-#else
{dab_buserr,"External Linefetch Abort (P)"},
-#endif
{NULL,  "Translation Fault (P)"},
{dab_buserr,"External Non-Linefetch Abort (S)"},
{NULL,  "Domain Fault (S)"},
___
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: r312250 - in head: share/man/man4 sys/dev/alc sys/dev/pci

2017-01-15 Thread Sepherosa Ziehau
Author: sephe
Date: Mon Jan 16 03:03:47 2017
New Revision: 312250
URL: https://svnweb.freebsd.org/changeset/base/312250

Log:
  alc: Add Killer E2500 support
  
  Reviewed by:  jhb, yongari
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D9058

Modified:
  head/share/man/man4/alc.4
  head/sys/dev/alc/if_alc.c
  head/sys/dev/alc/if_alcreg.h
  head/sys/dev/pci/pci.c

Modified: head/share/man/man4/alc.4
==
--- head/share/man/man4/alc.4   Mon Jan 16 01:38:34 2017(r312249)
+++ head/share/man/man4/alc.4   Mon Jan 16 03:03:47 2017(r312250)
@@ -124,6 +124,8 @@ Atheros AR8172 PCI Express Fast Ethernet
 Killer E2200 Gigabit Ethernet controller
 .It
 Killer E2400 Gigabit Ethernet controller
+.It
+Killer E2500 Gigabit Ethernet controller
 .El
 .Sh LOADER TUNABLES
 Tunables can be set at the

Modified: head/sys/dev/alc/if_alc.c
==
--- head/sys/dev/alc/if_alc.c   Mon Jan 16 01:38:34 2017(r312249)
+++ head/sys/dev/alc/if_alc.c   Mon Jan 16 03:03:47 2017(r312250)
@@ -123,6 +123,8 @@ static struct alc_ident alc_ident_table[
"Killer E2200 Gigabit Ethernet" },
{ VENDORID_ATHEROS, DEVICEID_ATHEROS_E2400, 9 * 1024,
"Killer E2400 Gigabit Ethernet" },
+   { VENDORID_ATHEROS, DEVICEID_ATHEROS_E2500, 9 * 1024,
+   "Killer E2500 Gigabit Ethernet" },
{ 0, 0, 0, NULL}
 };
 
@@ -1083,6 +1085,7 @@ alc_phy_down(struct alc_softc *sc)
case DEVICEID_ATHEROS_AR8161:
case DEVICEID_ATHEROS_E2200:
case DEVICEID_ATHEROS_E2400:
+   case DEVICEID_ATHEROS_E2500:
case DEVICEID_ATHEROS_AR8162:
case DEVICEID_ATHEROS_AR8171:
case DEVICEID_ATHEROS_AR8172:
@@ -1402,6 +1405,7 @@ alc_attach(device_t dev)
switch (sc->alc_ident->deviceid) {
case DEVICEID_ATHEROS_E2200:
case DEVICEID_ATHEROS_E2400:
+   case DEVICEID_ATHEROS_E2500:
sc->alc_flags |= ALC_FLAG_E2X00;
/* FALLTHROUGH */
case DEVICEID_ATHEROS_AR8161:
@@ -1480,7 +1484,8 @@ alc_attach(device_t dev)
if (alc_dma_burst[sc->alc_dma_wr_burst] > 1024)
sc->alc_dma_wr_burst = 3;
/*
-* Force maximum payload size to 128 bytes for E2200/E2400.
+* Force maximum payload size to 128 bytes for
+* E2200/E2400/E2500.
 * Otherwise it triggers DMA write error.
 */
if ((sc->alc_flags & ALC_FLAG_E2X00) != 0)

Modified: head/sys/dev/alc/if_alcreg.h
==
--- head/sys/dev/alc/if_alcreg.hMon Jan 16 01:38:34 2017
(r312249)
+++ head/sys/dev/alc/if_alcreg.hMon Jan 16 03:03:47 2017
(r312250)
@@ -50,6 +50,7 @@
 #defineDEVICEID_ATHEROS_AR8172 0x10A0
 #defineDEVICEID_ATHEROS_E2200  0xE091
 #defineDEVICEID_ATHEROS_E2400  0xE0A1
+#defineDEVICEID_ATHEROS_E2500  0xE0B1
 
 #defineATHEROS_AR8152_B_V100xC0
 #defineATHEROS_AR8152_B_V110xC1

Modified: head/sys/dev/pci/pci.c
==
--- head/sys/dev/pci/pci.c  Mon Jan 16 01:38:34 2017(r312249)
+++ head/sys/dev/pci/pci.c  Mon Jan 16 03:03:47 2017(r312250)
@@ -281,13 +281,14 @@ static const struct pci_quirk pci_quirks
{ 0x43851002, PCI_QUIRK_UNMAP_REG,  0x14,   0 },
 
/*
-* Atheros AR8161/AR8162/E2200/E2400 Ethernet controllers have a
-* bug that MSI interrupt does not assert if PCIM_CMD_INTxDIS bit
+* Atheros AR8161/AR8162/E2200/E2400/E2500 Ethernet controllers have
+* a bug that MSI interrupt does not assert if PCIM_CMD_INTxDIS bit
 * of the command register is set.
 */
{ 0x10911969, PCI_QUIRK_MSI_INTX_BUG,   0,  0 },
{ 0xE0911969, PCI_QUIRK_MSI_INTX_BUG,   0,  0 },
{ 0xE0A11969, PCI_QUIRK_MSI_INTX_BUG,   0,  0 },
+   { 0xE0B11969, PCI_QUIRK_MSI_INTX_BUG,   0,  0 },
{ 0x10901969, PCI_QUIRK_MSI_INTX_BUG,   0,  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"


Re: svn commit: r311952 - head/sys/ddb

2017-01-15 Thread Bruce Evans

On Sun, 15 Jan 2017, Slawa Olhovchenkov wrote:


On Sun, Jan 15, 2017 at 01:07:58PM +0800, Julian Elischer wrote:



the old DEC machines had (from memory) ^O  which dropped all pending
output.
Not so useful when there is 2MB of network buffers queued up to you,
but very useful on
and asr-33 teletype.


Now it useful too, on serial console.
^O processing be present years ago in FreeBSD, but removed at time of
tty code rewrite. As I know patch for restore exist, nobody
review/commit.


Urk.  I have fixes for hundreds of things broken in the rewrite, but didn't
notice this one.  The only fix I have near here is a partial one for funky
quoting of control characters according to ECHOK and ECHOKE.  ECHOK is a
POSIX feature and ECHOKE is a BSD feature.  The man page still docoments
the old behaviour.

Grepping for CCEQ (and its renaming to the worse name CMP_FLAG in the
rewrite) shows that the only other control character with lost support
is VDSUSP.

Zgrepping for VDISCARD and VDSUSP in /usr/share/man shows the following
bugs:
- VDISCARD and VDSUSP are listed but not described in any useful way in
  termios(4)
- VDSUSP (and dsusp) is listed but not described in any useful way in
  stty(1)
- VDISCARD (and discard) are not mentioned in stty(1).  However,
  'stty discard c' works, and stty's display of the discard character
  works.  stty's displays exactly the special characters that used to
  work.
- VDISCARD and VDSUSP are otherwise undocumented.
- FLUSHO in termios(4) and flusho in stty(1) are listed and described, but
  their close connection with VDISCARD is not mentioned (except stty says
  "being discarded").  FLUSHO is mostly an internal flag.  In the working
  version, It is normally toggled by VDISCARD but is cleared by other actions.
  It can also be controlled by an ioctl, and stty supports the ioctl.  But
  settings by stty are rarely useful since it is normally cleared by other
  The patch in the PR doesn't handle the other actions right.
  actions which stty can't control.

Partial fixes for ECHOKE and nearby things:

X Index: tty_ttydisc.c
X ===
X --- tty_ttydisc.c (revision 312117)
X +++ tty_ttydisc.c (working copy)
X @@ -798,6 +842,16 @@
X   }
X   } else {
X   /* Don't print spaces. */
X + /*
X +  * XXX broken if VERASE is disabled.  Can get here
X +  * then if ECHO is off and:
X +  * - for VERASE2 if that is not disabled
X +  * - for the buggy ECHOK/ECHOKE cases
X +  * - perhaps in other cases.
X +  * This routine is too generic.
X +  *
X +  * XXX the logic is not just non-printing of spaces.
X +  */
X   ttydisc_echo(tp, tp->t_termios.c_cc[VERASE], 0);
X   }
X   }
X @@ -993,7 +1049,30 @@
X   ttydisc_rubchar(tp);
X   return (0);
X   } else if (CMP_CC(VKILL, c)) {
X +#if 0
X + /*
X +  * XXX broken.  This doesn't even look at ECHOK or
X +  * ECHOKE (nothing does now), and it doesn't produce
X +  * the documented behaviour of ECHOK.  ECHOK exists
X +  * to be a non-erasing version of ECHOKE that uses
X +  * fewer terminal capabilities.  ECHOPRT is also
X +  * broken (never even looked at).
X +  */
X   while (ttydisc_rubchar(tp) == 0);
X +#else
X + if (CMP_FLAG(l, ECHOKE)) {
X + /* XXX too hard to fix. */
X + while (ttydisc_rubchar(tp) == 0)
X + ;
X + } else {
X + ttydisc_echo_force(tp, c, 0);
X + if (CMP_FLAG(l, ECHOK))
X + ttydisc_echo_force(tp, '\n', 0);
X + while (ttyinq_peekchar(>t_inq, ,
X + ) == 0)
X + ttyinq_unputchar(>t_inq);
X + }
X +#endif
X   return (0);
X   } else if (CMP_FLAG(l, IEXTEN)) {
X   if (CMP_CC(VWERASE, c)) {
X @@ -1021,12 +1100,13 @@
X 
X  parmrk:

X   if (CMP_FLAG(i, PARMRK)) {
X - /* Prepend 0xff 0x00 0x.. */
X + /* Prepend 0xff 0x00. */
X   ob[2] = c;
X   ol = 3;
X   quote = 1;
X   } else {
X - ob[0] = c;
X + /* Kill the character for read().  Keep it in c for echoing. */
X + ob[0] = '\0';
X   ol = 1;
X   }
X

Bruce
___
svn-src-head@freebsd.org 

Re: svn commit: r312234 - in head: sbin/camcontrol share/man/man4 share/man/man9 sys/arm/arm sys/arm/freescale/imx sys/arm/mv sys/cam sys/dev/bhnd sys/dev/fdt sys/dev/isp sys/dev/mmc sys/dev/mpt sys/d

2017-01-15 Thread Benjamin Kaduk
On Sun, Jan 15, 2017 at 11:54 AM, Conrad E. Meyer  wrote:

> Author: cem
> Date: Sun Jan 15 17:54:01 2017
> New Revision: 312234
> URL: https://svnweb.freebsd.org/changeset/base/312234
>
> Log:
>   "Buses" is the preferred plural of "bus"
>
>   Replace archaic "busses" with modern form "buses."
>
>
The link intending to support this assertion refers to the motor vehicle,
which does not necessarily have the same usage as the hardware nexus.  It
would have been nice to see some discussion on -doc or similar before
making a sweeping change like this, as I am not sure that the consensus of
our team is for the "buses" spelling in this usage.

-Ben


>   Intentionally excluded:
>   * Old/random drivers I didn't recognize
> * Old hardware in general
>   * Use of "busses" in code as identifiers
>
>   No functional change.
>
>   http://grammarist.com/spelling/buses-busses/
>
>   PR:   216099
>   Reported by:  bltsrc at mail.ru
>   Sponsored by: Dell EMC Isilon
>
>
___
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: r312236 - head/sys/net80211

2017-01-15 Thread Adrian Chadd
On 15 January 2017 at 11:56, Ian Lepore  wrote:

>
> What is the point of the !! in these macros?  The expressions already
> have boolean type (even in C++ where it matters) due to the ==.
>  Removing the !! would also make one level of parens redundant.

It's just a habit i picked up from linux-land. That way it really is
only 1 or 0, so things like debugging output and such make easier
sense.

It's also fixed a handful of bugs in the past (but I can't think of
exact cases right now) - primarily where other code expected 1 or 0
(for things like shifts into protocol fields) and the macro returns 0
or ${LARGEVAL}.



-adrian
___
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: r311952 - head/sys/ddb

2017-01-15 Thread Slawa Olhovchenkov
On Sun, Jan 15, 2017 at 10:46:35AM -0800, Adrian Chadd wrote:

> url? :)

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=184987
Assignee:   Adrian Chadd

> On 15 January 2017 at 06:45, Slawa Olhovchenkov  wrote:
> > On Sun, Jan 15, 2017 at 01:07:58PM +0800, Julian Elischer wrote:
> >
> >>
> >> the old DEC machines had (from memory) ^O  which dropped all pending
> >> output.
> >> Not so useful when there is 2MB of network buffers queued up to you,
> >> but very useful on
> >> and asr-33 teletype.
> >
> > Now it useful too, on serial console.
> > ^O processing be present years ago in FreeBSD, but removed at time of
> > tty code rewrite. As I know patch for restore exist, nobody
> > review/commit.
> >
> >
___
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: r312237 - head/sys/boot/efi/loader

2017-01-15 Thread Toomas Soome
Author: tsoome
Date: Sun Jan 15 20:03:13 2017
New Revision: 312237
URL: https://svnweb.freebsd.org/changeset/base/312237

Log:
  loader.efi: find_currdev() can leak memory
  
  The find_currdev() is using variable "copy" to store the reference to trimmed
  devpath pointer, if for some reason the efi_devpath_handle() fails, we will
  leak this copy.
  
  Also we can simplify the code there a bit.
  
  Reviewed by:  allanjude
  Approved by:  allanjude (mentor)
  Differential Revision:https://reviews.freebsd.org/D9191

Modified:
  head/sys/boot/efi/loader/main.c

Modified: head/sys/boot/efi/loader/main.c
==
--- head/sys/boot/efi/loader/main.c Sun Jan 15 19:49:47 2017
(r312236)
+++ head/sys/boot/efi/loader/main.c Sun Jan 15 20:03:13 2017
(r312237)
@@ -219,20 +219,19 @@ find_currdev(EFI_LOADED_IMAGE *img, stru
if (h == NULL)
break;
 
-   if (efi_handle_lookup(h, dev, unit, extra) == 0) {
-   if (copy != NULL)
-   free(copy);
+   free(copy);
+   copy = NULL;
+
+   if (efi_handle_lookup(h, dev, unit, extra) == 0)
return (0);
-   }
 
-   if (copy != NULL)
-   free(copy);
devpath = efi_lookup_devpath(h);
if (devpath != NULL) {
copy = efi_devpath_trim(devpath);
devpath = copy;
}
}
+   free(copy);
 
/* Try to fallback on first device */
if (devsw[0] != NULL) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r312236 - head/sys/net80211

2017-01-15 Thread Ian Lepore
On Sun, 2017-01-15 at 19:49 +, Adrian Chadd wrote:
> Author: adrian
> Date: Sun Jan 15 19:49:47 2017
> New Revision: 312236
> URL: https://svnweb.freebsd.org/changeset/base/312236
> 
> Log:
>   [net80211] add some more "is this XXX" macros for CTRL and DATA.
>   
>   There's already a macro for MGT.
> 
> Modified:
>   head/sys/net80211/ieee80211.h
> 
> Modified: head/sys/net80211/ieee80211.h
> =
> =
> --- head/sys/net80211/ieee80211.h Sun Jan 15 18:00:45 2017
> (r312235)
> +++ head/sys/net80211/ieee80211.h Sun Jan 15 19:49:47 2017
> (r312236)
> @@ -165,6 +165,12 @@ struct ieee80211_qosframe_addr4 {
>  #define  IEEE80211_IS_MGMT(wh)   
> \
>   (!! (((wh)->i_fc[0] & IEEE80211_FC0_TYPE_MASK)  
> \
>   == IEEE80211_FC0_TYPE_MGT))
> +#define  IEEE80211_IS_CTL(wh)
> \
> + (!! (((wh)->i_fc[0] & IEEE80211_FC0_TYPE_MASK)  
> \
> + == IEEE80211_FC0_TYPE_CTL))
> +#define  IEEE80211_IS_DATA(wh)   
> \
> + (!! (((wh)->i_fc[0] & IEEE80211_FC0_TYPE_MASK)  
> \
> + == IEEE80211_FC0_TYPE_DATA))
>  
>  #define  IEEE80211_FC0_QOSDATA \
>   (IEEE80211_FC0_TYPE_DATA|IEEE80211_FC0_SUBTYPE_QOS|IEEE80211
> _FC0_VERSION_0)
> 

What is the point of the !! in these macros?  The expressions already
have boolean type (even in C++ where it matters) due to the ==.
 Removing the !! would also make one level of parens redundant.

-- Ian
___
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: r312236 - head/sys/net80211

2017-01-15 Thread Adrian Chadd
Author: adrian
Date: Sun Jan 15 19:49:47 2017
New Revision: 312236
URL: https://svnweb.freebsd.org/changeset/base/312236

Log:
  [net80211] add some more "is this XXX" macros for CTRL and DATA.
  
  There's already a macro for MGT.

Modified:
  head/sys/net80211/ieee80211.h

Modified: head/sys/net80211/ieee80211.h
==
--- head/sys/net80211/ieee80211.h   Sun Jan 15 18:00:45 2017
(r312235)
+++ head/sys/net80211/ieee80211.h   Sun Jan 15 19:49:47 2017
(r312236)
@@ -165,6 +165,12 @@ struct ieee80211_qosframe_addr4 {
 #defineIEEE80211_IS_MGMT(wh)   \
(!! (((wh)->i_fc[0] & IEEE80211_FC0_TYPE_MASK)  \
== IEEE80211_FC0_TYPE_MGT))
+#defineIEEE80211_IS_CTL(wh)\
+   (!! (((wh)->i_fc[0] & IEEE80211_FC0_TYPE_MASK)  \
+   == IEEE80211_FC0_TYPE_CTL))
+#defineIEEE80211_IS_DATA(wh)   \
+   (!! (((wh)->i_fc[0] & IEEE80211_FC0_TYPE_MASK)  \
+   == IEEE80211_FC0_TYPE_DATA))
 
 #defineIEEE80211_FC0_QOSDATA \

(IEEE80211_FC0_TYPE_DATA|IEEE80211_FC0_SUBTYPE_QOS|IEEE80211_FC0_VERSION_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"


Re: svn commit: r311952 - head/sys/ddb

2017-01-15 Thread Adrian Chadd
url? :)

-a


On 15 January 2017 at 06:45, Slawa Olhovchenkov  wrote:
> On Sun, Jan 15, 2017 at 01:07:58PM +0800, Julian Elischer wrote:
>
>>
>> the old DEC machines had (from memory) ^O  which dropped all pending
>> output.
>> Not so useful when there is 2MB of network buffers queued up to you,
>> but very useful on
>> and asr-33 teletype.
>
> Now it useful too, on serial console.
> ^O processing be present years ago in FreeBSD, but removed at time of
> tty code rewrite. As I know patch for restore exist, nobody
> review/commit.
>
>
___
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: r312235 - in head/sys: amd64/vmm cam netinet/cc sys

2017-01-15 Thread Conrad E. Meyer
Author: cem
Date: Sun Jan 15 18:00:45 2017
New Revision: 312235
URL: https://svnweb.freebsd.org/changeset/base/312235

Log:
  Fix a variety of cosmetic typos and misspellings
  
  No functional change.
  
  PR:   216096, 216097, 216098, 216101, 216102, 216106, 216109, 216110
  Reported by:  Bulat 
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/amd64/vmm/vmm_host.h
  head/sys/cam/cam_compat.h
  head/sys/cam/cam_iosched.h
  head/sys/netinet/cc/cc.h
  head/sys/sys/buf_ring.h
  head/sys/sys/bus.h
  head/sys/sys/busdma_bufalloc.h
  head/sys/sys/devmap.h
  head/sys/sys/eventvar.h
  head/sys/sys/gtaskqueue.h
  head/sys/sys/ksem.h
  head/sys/sys/pipe.h
  head/sys/sys/sockopt.h
  head/sys/sys/taskqueue.h

Modified: head/sys/amd64/vmm/vmm_host.h
==
--- head/sys/amd64/vmm/vmm_host.h   Sun Jan 15 17:54:01 2017
(r312234)
+++ head/sys/amd64/vmm/vmm_host.h   Sun Jan 15 18:00:45 2017
(r312235)
@@ -30,7 +30,7 @@
 #define_VMM_HOST_H_
 
 #ifndef_KERNEL
-#error "no user-servicable parts inside"
+#error "no user-serviceable parts inside"
 #endif
 
 struct xsave_limits {

Modified: head/sys/cam/cam_compat.h
==
--- head/sys/cam/cam_compat.h   Sun Jan 15 17:54:01 2017(r312234)
+++ head/sys/cam/cam_compat.h   Sun Jan 15 18:00:45 2017(r312235)
@@ -31,7 +31,7 @@
 #ifndef _CAM_CAM_COMPAT_H
 #define _CAM_CAM_COMPAT_H
 
-/* No user-servicable parts in here. */
+/* No user-serviceable parts in here. */
 #ifdef _KERNEL
 
 int cam_compat_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag,

Modified: head/sys/cam/cam_iosched.h
==
--- head/sys/cam/cam_iosched.h  Sun Jan 15 17:54:01 2017(r312234)
+++ head/sys/cam/cam_iosched.h  Sun Jan 15 18:00:45 2017(r312235)
@@ -31,7 +31,7 @@
 #ifndef _CAM_CAM_IOSCHED_H
 #define _CAM_CAM_IOSCHED_H
 
-/* No user-servicable parts in here. */
+/* No user-serviceable parts in here. */
 #ifdef _KERNEL
 
 /* Forward declare all structs to keep interface thin */

Modified: head/sys/netinet/cc/cc.h
==
--- head/sys/netinet/cc/cc.hSun Jan 15 17:54:01 2017(r312234)
+++ head/sys/netinet/cc/cc.hSun Jan 15 18:00:45 2017(r312235)
@@ -52,7 +52,7 @@
 #define _NETINET_CC_CC_H_
 
 #if !defined(_KERNEL)
-#error "no user-servicable parts inside"
+#error "no user-serviceable parts inside"
 #endif
 
 /* Global CC vars. */

Modified: head/sys/sys/buf_ring.h
==
--- head/sys/sys/buf_ring.h Sun Jan 15 17:54:01 2017(r312234)
+++ head/sys/sys/buf_ring.h Sun Jan 15 18:00:45 2017(r312235)
@@ -250,16 +250,16 @@ buf_ring_advance_sc(struct buf_ring *br)
 
 /*
  * Used to return a buffer (most likely already there)
- * to the top od the ring. The caller should *not*
+ * to the top of the ring. The caller should *not*
  * have used any dequeue to pull it out of the ring
  * but instead should have used the peek() function.
  * This is normally used where the transmit queue
- * of a driver is full, and an mubf must be returned.
+ * of a driver is full, and an mbuf must be returned.
  * Most likely whats in the ring-buffer is what
  * is being put back (since it was not removed), but
  * sometimes the lower transmit function may have
  * done a pullup or other function that will have
- * changed it. As an optimzation we always put it
+ * changed it. As an optimization we always put it
  * back (since jhb says the store is probably cheaper),
  * if we have to do a multi-queue version we will need
  * the compare and an atomic.

Modified: head/sys/sys/bus.h
==
--- head/sys/sys/bus.h  Sun Jan 15 17:54:01 2017(r312234)
+++ head/sys/sys/bus.h  Sun Jan 15 18:00:45 2017(r312235)
@@ -662,7 +662,7 @@ voidbus_data_generation_update(void);
  * Some convenience defines for probe routines to return.  These are just
  * suggested values, and there's nothing magical about them.
  * BUS_PROBE_SPECIFIC is for devices that cannot be reprobed, and that no
- * possible other driver may exist (typically legacy drivers who don't fallow
+ * possible other driver may exist (typically legacy drivers who don't follow
  * all the rules, or special needs drivers).  BUS_PROBE_VENDOR is the
  * suggested value that vendor supplied drivers use.  This is for source or
  * binary drivers that are not yet integrated into the FreeBSD tree.  Its use
@@ -675,7 +675,7 @@ voidbus_data_generation_update(void);
  * supports the newer ones would return BUS_PROBE_DEFAULT.  BUS_PROBE_GENERIC
  * is for drivers that wish to have a generic form and a specialized form,

svn commit: r312234 - in head: sbin/camcontrol share/man/man4 share/man/man9 sys/arm/arm sys/arm/freescale/imx sys/arm/mv sys/cam sys/dev/bhnd sys/dev/fdt sys/dev/isp sys/dev/mmc sys/dev/mpt sys/de...

2017-01-15 Thread Conrad E. Meyer
Author: cem
Date: Sun Jan 15 17:54:01 2017
New Revision: 312234
URL: https://svnweb.freebsd.org/changeset/base/312234

Log:
  "Buses" is the preferred plural of "bus"
  
  Replace archaic "busses" with modern form "buses."
  
  Intentionally excluded:
  * Old/random drivers I didn't recognize
* Old hardware in general
  * Use of "busses" in code as identifiers
  
  No functional change.
  
  http://grammarist.com/spelling/buses-busses/
  
  PR:   216099
  Reported by:  bltsrc at mail.ru
  Sponsored by: Dell EMC Isilon

Modified:
  head/sbin/camcontrol/camcontrol.8
  head/sbin/camcontrol/camcontrol.c
  head/share/man/man4/ehci.4
  head/share/man/man4/iicbus.4
  head/share/man/man4/scsi.4
  head/share/man/man9/BUS_CONFIG_INTR.9
  head/share/man/man9/DEVICE_ATTACH.9
  head/share/man/man9/DEVICE_IDENTIFY.9
  head/share/man/man9/DRIVER_MODULE.9
  head/share/man/man9/bus_generic_attach.9
  head/share/man/man9/bus_generic_detach.9
  head/share/man/man9/bus_generic_new_pass.9
  head/share/man/man9/bus_generic_print_child.9
  head/share/man/man9/bus_generic_read_ivar.9
  head/share/man/man9/bus_generic_shutdown.9
  head/share/man/man9/bus_space.9
  head/share/man/man9/device.9
  head/share/man/man9/device_add_child.9
  head/share/man/man9/pci.9
  head/sys/arm/arm/ofw_machdep.c
  head/sys/arm/freescale/imx/imx6_ccm.c
  head/sys/arm/freescale/imx/imx6_machdep.c
  head/sys/arm/freescale/imx/imx_i2c.c
  head/sys/arm/mv/mv_pci.c
  head/sys/cam/cam_xpt.c
  head/sys/cam/cam_xpt_internal.h
  head/sys/dev/bhnd/bhnd.h
  head/sys/dev/fdt/simplebus.c
  head/sys/dev/isp/isp.c
  head/sys/dev/mmc/mmcreg.h
  head/sys/dev/mpt/mpt.c
  head/sys/dev/mpt/mpt.h
  head/sys/dev/mpt/mpt_raid.c
  head/sys/dev/pccbb/pccbb_pci.c
  head/sys/dev/pci/hostb_pci.c
  head/sys/dev/pci/pci.c
  head/sys/dev/pci/pci_private.h
  head/sys/dev/pci/pci_subr.c
  head/sys/dev/usb/usb_hub.c
  head/sys/kern/bus_if.m
  head/sys/kern/sched_ule.c
  head/sys/kern/subr_bus.c
  head/sys/sys/bus.h
  head/sys/x86/pci/pci_bus.c
  head/sys/x86/x86/mptable.c
  head/sys/x86/x86/nexus.c
  head/sys/xen/xenbus/xenbusb.c
  head/sys/xen/xenbus/xenbusb.h
  head/usr.sbin/mptutil/mpt_cam.c

Modified: head/sbin/camcontrol/camcontrol.8
==
--- head/sbin/camcontrol/camcontrol.8   Sun Jan 15 15:43:19 2017
(r312233)
+++ head/sbin/camcontrol/camcontrol.8   Sun Jan 15 17:54:01 2017
(r312234)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 6, 2017
+.Dd January 15, 2017
 .Dt CAMCONTROL 8
 .Os
 .Sh NAME
@@ -565,12 +565,12 @@ start bit set and the load/eject bit set
 Send the SCSI Start/Stop Unit (0x1B) command to the given device with the
 start bit cleared and the load/eject bit set.
 .It Ic rescan
-Tell the kernel to scan all busses in the system (with the
+Tell the kernel to scan all buses in the system (with the
 .Ar all
 argument), the given bus (XPT_SCAN_BUS), or bus:target:lun
 (XPT_SCAN_LUN) for new devices or devices that have gone away.
 The user
-may specify a scan of all busses, a single bus, or a lun.
+may specify a scan of all buses, a single bus, or a lun.
 Scanning all luns
 on a target is not supported.
 .It Ic reprobe
@@ -580,7 +580,7 @@ notify the upper layer,
 This includes sending the SCSI READ CAPACITY command and updating
 the disk size visible to the rest of the system.
 .It Ic reset
-Tell the kernel to reset all busses in the system (with the
+Tell the kernel to reset all buses in the system (with the
 .Ar all
 argument) or the given bus (XPT_RESET_BUS) by issuing a SCSI bus
 reset for that bus, or to reset the given bus:target:lun
@@ -2557,7 +2557,7 @@ write reallocation settings, among other
 .Pp
 .Dl camcontrol rescan all
 .Pp
-Rescan all SCSI busses in the system for devices that have been added,
+Rescan all SCSI buses in the system for devices that have been added,
 removed or changed.
 .Pp
 .Dl camcontrol rescan 0

Modified: head/sbin/camcontrol/camcontrol.c
==
--- head/sbin/camcontrol/camcontrol.c   Sun Jan 15 15:43:19 2017
(r312233)
+++ head/sbin/camcontrol/camcontrol.c   Sun Jan 15 17:54:01 2017
(r312234)
@@ -3179,8 +3179,8 @@ rescan_or_reset_bus(path_id_t bus, int r
/*
 * The right way to handle this is to modify the xpt so that it can
 * handle a wildcarded bus in a rescan or reset CCB.  At the moment
-* that isn't implemented, so instead we enumerate the busses and
-* send the rescan or reset to those busses in the case where the
+* that isn't implemented, so instead we enumerate the buses and
+* send the rescan or reset to those buses in the case where the
 * given bus is -1 (wildcard).  We don't send a rescan or reset
 * to the xpt bus; sending a rescan to the xpt bus is effectively a
 * no-op, sending a rescan to the xpt bus would result in a status of
@@ -8954,8 +8954,8 

Re: svn commit: r311952 - head/sys/ddb

2017-01-15 Thread Slawa Olhovchenkov
On Sun, Jan 15, 2017 at 01:07:58PM +0800, Julian Elischer wrote:

> 
> the old DEC machines had (from memory) ^O  which dropped all pending 
> output.
> Not so useful when there is 2MB of network buffers queued up to you, 
> but very useful on
> and asr-33 teletype.

Now it useful too, on serial console.
^O processing be present years ago in FreeBSD, but removed at time of
tty code rewrite. As I know patch for restore exist, nobody
review/commit.

___
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: r312232 - head/sys/cam/ctl

2017-01-15 Thread Alexander Motin
Author: mav
Date: Sun Jan 15 13:57:42 2017
New Revision: 312232
URL: https://svnweb.freebsd.org/changeset/base/312232

Log:
  Add under-/overrun support to IOCTL and CAM SIM frontends.
  
  MFC after:1 week

Modified:
  head/sys/cam/ctl/ctl_frontend_cam_sim.c
  head/sys/cam/ctl/ctl_frontend_ioctl.c

Modified: head/sys/cam/ctl/ctl_frontend_cam_sim.c
==
--- head/sys/cam/ctl/ctl_frontend_cam_sim.c Sun Jan 15 13:51:44 2017
(r312231)
+++ head/sys/cam/ctl/ctl_frontend_cam_sim.c Sun Jan 15 13:57:42 2017
(r312232)
@@ -304,10 +304,6 @@ cfcs_datamove(union ctl_io *io)
int ctl_watermark, cam_watermark;
int i, j;
 
-
-   cam_sg_offset = 0;
-   cam_sg_start = 0;
-
ccb = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr;
 
/*
@@ -330,6 +326,8 @@ cfcs_datamove(union ctl_io *io)
 
cam_sglist = (bus_dma_segment_t *)ccb->csio.data_ptr;
cam_sg_count = ccb->csio.sglist_cnt;
+   cam_sg_start = cam_sg_count;
+   cam_sg_offset = 0;
 
for (i = 0, len_seen = 0; i < cam_sg_count; i++) {
if ((len_seen + cam_sglist[i].ds_len) >=
@@ -422,9 +420,20 @@ cfcs_datamove(union ctl_io *io)
 
io->scsiio.ext_data_filled += len_copied;
 
+   /*
+* Report write underflow as error, since CTL and backends don't
+* really support it.
+*/
+   if ((io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_OUT &&
+   j < ctl_sg_count) {
+   io->io_hdr.port_status = 43;
+   } else
+
if ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS) {
io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = NULL;
io->io_hdr.flags |= CTL_FLAG_STATUS_SENT;
+   ccb->csio.resid = ccb->csio.dxfer_len -
+   io->scsiio.ext_data_filled;
ccb->ccb_h.status &= ~CAM_STATUS_MASK;
ccb->ccb_h.status |= CAM_REQ_CMP;
xpt_done(ccb);
@@ -453,6 +462,10 @@ cfcs_done(union ctl_io *io)
/*
 * Translate CTL status to CAM status.
 */
+   if (ccb->ccb_h.func_code == XPT_SCSI_IO) {
+   ccb->csio.resid = ccb->csio.dxfer_len -
+   io->scsiio.ext_data_filled;
+   }
ccb->ccb_h.status &= ~CAM_STATUS_MASK;
switch (io->io_hdr.status & CTL_STATUS_MASK) {
case CTL_SUCCESS:

Modified: head/sys/cam/ctl/ctl_frontend_ioctl.c
==
--- head/sys/cam/ctl/ctl_frontend_ioctl.c   Sun Jan 15 13:51:44 2017
(r312231)
+++ head/sys/cam/ctl/ctl_frontend_ioctl.c   Sun Jan 15 13:57:42 2017
(r312232)
@@ -143,16 +143,13 @@ ctl_ioctl_do_datamove(struct ctl_scsiio 
int ext_sglist_malloced;
int i, j;
 
-   ext_sglist_malloced = 0;
-   ext_sg_start = 0;
-   ext_offset = 0;
-
CTL_DEBUG_PRINT(("ctl_ioctl_do_datamove\n"));
 
/*
 * If this flag is set, fake the data transfer.
 */
if (ctsio->io_hdr.flags & CTL_FLAG_NO_DATAMOVE) {
+   ext_sglist_malloced = 0;
ctsio->ext_data_filled = ctsio->ext_data_len;
goto bailout;
}
@@ -165,7 +162,6 @@ ctl_ioctl_do_datamove(struct ctl_scsiio 
int len_seen;
 
ext_sglen = ctsio->ext_sg_entries * sizeof(*ext_sglist);
-
ext_sglist = (struct ctl_sg_entry *)malloc(ext_sglen, M_CTL,
   M_WAITOK);
ext_sglist_malloced = 1;
@@ -174,6 +170,8 @@ ctl_ioctl_do_datamove(struct ctl_scsiio 
goto bailout;
}
ext_sg_entries = ctsio->ext_sg_entries;
+   ext_sg_start = ext_sg_entries;
+   ext_offset = 0;
len_seen = 0;
for (i = 0; i < ext_sg_entries; i++) {
if ((len_seen + ext_sglist[i].len) >=
@@ -186,6 +184,7 @@ ctl_ioctl_do_datamove(struct ctl_scsiio 
}
} else {
ext_sglist = _entry;
+   ext_sglist_malloced = 0;
ext_sglist->addr = ctsio->ext_data_ptr;
ext_sglist->len = ctsio->ext_data_len;
ext_sg_entries = 1;
@@ -203,7 +202,6 @@ ctl_ioctl_do_datamove(struct ctl_scsiio 
kern_sg_entries = 1;
}
 
-
kern_watermark = 0;
ext_watermark = ext_offset;
len_copied = 0;
@@ -274,10 +272,16 @@ ctl_ioctl_do_datamove(struct ctl_scsiio 
 "kern_data_len = %d\n", ctsio->ext_data_len,
 ctsio->kern_data_len));
 
+   /*
+* Report write underflow as error, since CTL and backends don't
+* really support it.
+*/
+   if ((ctsio->io_hdr.flags & CTL_FLAG_DATA_MASK) == 

svn commit: r312231 - head/sys/cam/ctl

2017-01-15 Thread Alexander Motin
Author: mav
Date: Sun Jan 15 13:51:44 2017
New Revision: 312231
URL: https://svnweb.freebsd.org/changeset/base/312231

Log:
  When in kernel, map ctl_scsi_zero_io() to ctl_zero_io().
  
  MFC after:1 week

Modified:
  head/sys/cam/ctl/ctl_util.c
  head/sys/cam/ctl/ctl_util.h

Modified: head/sys/cam/ctl/ctl_util.c
==
--- head/sys/cam/ctl/ctl_util.c Sun Jan 15 13:40:14 2017(r312230)
+++ head/sys/cam/ctl/ctl_util.c Sun Jan 15 13:51:44 2017(r312231)
@@ -697,7 +697,6 @@ ctl_scsi_free_io(union ctl_io *io)
free(io);
 }
 
-#endif /* !_KERNEL */
 void
 ctl_scsi_zero_io(union ctl_io *io)
 {
@@ -707,11 +706,10 @@ ctl_scsi_zero_io(union ctl_io *io)
return;
 
pool_ref = io->io_hdr.pool;
-
memset(io, 0, sizeof(*io));
-
io->io_hdr.pool = pool_ref;
 }
+#endif /* !_KERNEL */
 
 const char *
 ctl_scsi_task_string(struct ctl_taskio *taskio)

Modified: head/sys/cam/ctl/ctl_util.h
==
--- head/sys/cam/ctl/ctl_util.h Sun Jan 15 13:40:14 2017(r312230)
+++ head/sys/cam/ctl/ctl_util.h Sun Jan 15 13:51:44 2017(r312231)
@@ -96,8 +96,10 @@ void ctl_scsi_maintenance_in(union ctl_i
 #ifndef _KERNEL
 union ctl_io *ctl_scsi_alloc_io(uint32_t initid);
 void ctl_scsi_free_io(union ctl_io *io);
-#endif /* !_KERNEL */
 void ctl_scsi_zero_io(union ctl_io *io);
+#else
+#definectl_scsi_zero_io(io)ctl_zero_io(io)
+#endif /* !_KERNEL */
 const char *ctl_scsi_task_string(struct ctl_taskio *taskio);
 void ctl_io_sbuf(union ctl_io *io, struct sbuf *sb);
 void ctl_io_error_sbuf(union ctl_io *io,
___
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: r312230 - head/share/skel

2017-01-15 Thread Jilles Tjoelker
Author: jilles
Date: Sun Jan 15 13:40:14 2017
New Revision: 312230
URL: https://svnweb.freebsd.org/changeset/base/312230

Log:
  skel: Do not set -o emacs in .shrc.
  
  sh has defaulted to 'set -o emacs' since FreeBSD 9.0. Therefore, do not set
  this again in .shrc, since that only serves to prevent invocations like
  'sh -o vi' and 'sh +o emacs' to have the intended effect.
  
  PR:   215958
  Submitted by: Andras Farkas
  MFC after:1 week

Modified:
  head/share/skel/dot.shrc

Modified: head/share/skel/dot.shrc
==
--- head/share/skel/dot.shrcSun Jan 15 12:58:14 2017(r312229)
+++ head/share/skel/dot.shrcSun Jan 15 13:40:14 2017(r312230)
@@ -13,10 +13,6 @@
 #
 # umask022
 
-# Enable the builtin emacs(1) command line editor in sh(1),
-# e.g. C-a -> beginning-of-line.
-set -o emacs
-
 # Uncomment this and comment the above to enable the builtin vi(1) command
 # line editor in sh(1), e.g. ESC to go into visual mode.
 # set -o vi
___
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: r312228 - head/sbin/camcontrol

2017-01-15 Thread Alexander Motin
Author: mav
Date: Sun Jan 15 12:24:23 2017
New Revision: 312228
URL: https://svnweb.freebsd.org/changeset/base/312228

Log:
  Make `camcontrol cmd ... -i ...` return only valid bytes.
  
  Previously code ignored resid field and returned extra zeroes in case of
  data underflow.  Now it returns only real bytes received from target.
  
  MFC after:2 weeks

Modified:
  head/sbin/camcontrol/camcontrol.c

Modified: head/sbin/camcontrol/camcontrol.c
==
--- head/sbin/camcontrol/camcontrol.c   Sun Jan 15 10:33:52 2017
(r312227)
+++ head/sbin/camcontrol/camcontrol.c   Sun Jan 15 12:24:23 2017
(r312228)
@@ -4150,7 +4150,7 @@ scsicmd(struct cam_device *device, int a
u_int8_t cdb[20];
u_int8_t atacmd[12];
struct get_hook hook;
-   int c, data_bytes = 0;
+   int c, data_bytes = 0, valid_bytes;
int cdb_len = 0;
int atacmd_len = 0;
int dmacmd = 0;
@@ -4454,16 +4454,20 @@ scsicmd(struct cam_device *device, int a
}
}
 
+   if (cdb_len)
+   valid_bytes = ccb->csio.dxfer_len - ccb->csio.resid;
+   else
+   valid_bytes = ccb->ataio.dxfer_len - ccb->ataio.resid;
if (((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP)
 && (arglist & CAM_ARG_CMD_IN)
-&& (data_bytes > 0)) {
+&& (valid_bytes > 0)) {
if (fd_data == 0) {
-   buff_decode_visit(data_ptr, data_bytes, datastr,
+   buff_decode_visit(data_ptr, valid_bytes, datastr,
  arg_put, NULL);
fprintf(stdout, "\n");
} else {
ssize_t amt_written;
-   int amt_to_write = data_bytes;
+   int amt_to_write = valid_bytes;
u_int8_t *buf_ptr = data_ptr;
 
for (amt_written = 0; (amt_to_write > 0) &&
@@ -4478,7 +4482,7 @@ scsicmd(struct cam_device *device, int a
} else if ((amt_written == 0)
&& (amt_to_write > 0)) {
warnx("only wrote %u bytes out of %u",
- data_bytes - amt_to_write, data_bytes);
+ valid_bytes - amt_to_write, valid_bytes);
}
}
}
___
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: r312226 - head/tests/sys/kern/acct

2017-01-15 Thread Ngie Cooper
Author: ngie
Date: Sun Jan 15 10:29:53 2017
New Revision: 312226
URL: https://svnweb.freebsd.org/changeset/base/312226

Log:
  Fix typo in r312216
  
  I meant to replace "exp" with "exponent", not "expected"
  
  MFC after:13 days
  Pointyhat to: ngie
  Submitted by: bde

Modified:
  head/tests/sys/kern/acct/Makefile

Modified: head/tests/sys/kern/acct/Makefile
==
--- head/tests/sys/kern/acct/Makefile   Sun Jan 15 10:24:45 2017
(r312225)
+++ head/tests/sys/kern/acct/Makefile   Sun Jan 15 10:29:53 2017
(r312226)
@@ -13,7 +13,7 @@ acct_test.o: convert.c
 
 convert.c: ${SRCTOP}/sys/kern/kern_acct.c
sed -n -e 's/log(/syslog(/g' \
-  -e 's/exp/expected/g' \
+  -e 's/exp/exponent/g' \
   -e '/FLOAT_CONVERSION_START/,/FLOAT_CONVERSION_END/p' ${.ALLSRC} 
>${.TARGET}.tmp
mv ${.TARGET}.tmp ${.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: r312224 - head/sys/dev/etherswitch/arswitch

2017-01-15 Thread Kristof Provost
Author: kp
Date: Sun Jan 15 10:21:25 2017
New Revision: 312224
URL: https://svnweb.freebsd.org/changeset/base/312224

Log:
  arswitch: Ensure the lock is always held when calling arswitch_modifyreg()
  
  arswitch_setled() and a number of _global_setup functions did not acquire the
  lock before calling arswitch_modifyreg(). With WITNESS enabled this would
  instantly panic.
  
  Discovered on a TPLink-3600:
  ("panic: mutex arswitch not owned at 
sys/dev/etherswitch/arswitch/arswitch_reg.c:236")
  
  Reviewed by:  adrian, kan
  Differential Revision:https://reviews.freebsd.org/D9187

Modified:
  head/sys/dev/etherswitch/arswitch/arswitch.c
  head/sys/dev/etherswitch/arswitch/arswitch_7240.c
  head/sys/dev/etherswitch/arswitch/arswitch_8316.c
  head/sys/dev/etherswitch/arswitch/arswitch_8327.c
  head/sys/dev/etherswitch/arswitch/arswitch_9340.c

Modified: head/sys/dev/etherswitch/arswitch/arswitch.c
==
--- head/sys/dev/etherswitch/arswitch/arswitch.cSun Jan 15 10:17:15 
2017(r312223)
+++ head/sys/dev/etherswitch/arswitch/arswitch.cSun Jan 15 10:21:25 
2017(r312224)
@@ -845,6 +845,7 @@ static int
 arswitch_setled(struct arswitch_softc *sc, int phy, int led, int style)
 {
int shift;
+   int err;
 
if (phy < 0 || phy > sc->numphys)
return EINVAL;
@@ -852,10 +853,15 @@ arswitch_setled(struct arswitch_softc *s
if (style < 0 || style > ETHERSWITCH_PORT_LED_MAX)
return (EINVAL);
 
+   ARSWITCH_LOCK(sc);
+
shift = ar8327_led_mapping[phy][led].shift;
-   return (arswitch_modifyreg(sc->sc_dev,
+   err = (arswitch_modifyreg(sc->sc_dev,
ar8327_led_mapping[phy][led].reg,
0x03 << shift, led_pattern_table[style] << shift));
+   ARSWITCH_UNLOCK(sc);
+
+   return (err);
 }
 
 static void

Modified: head/sys/dev/etherswitch/arswitch/arswitch_7240.c
==
--- head/sys/dev/etherswitch/arswitch/arswitch_7240.c   Sun Jan 15 10:17:15 
2017(r312223)
+++ head/sys/dev/etherswitch/arswitch/arswitch_7240.c   Sun Jan 15 10:21:25 
2017(r312224)
@@ -81,6 +81,8 @@ static int
 ar7240_hw_global_setup(struct arswitch_softc *sc)
 {
 
+   ARSWITCH_LOCK(sc);
+
/* Enable CPU port; disable mirror port */
arswitch_writereg(sc->sc_dev, AR8X16_REG_CPU_PORT,
AR8X16_CPU_PORT_EN | AR8X16_CPU_MIRROR_DIS);
@@ -103,6 +105,8 @@ ar7240_hw_global_setup(struct arswitch_s
arswitch_modifyreg(sc->sc_dev, AR8X16_REG_SERVICE_TAG,
AR8X16_SERVICE_TAG_MASK, 0);
 
+   ARSWITCH_UNLOCK(sc);
+
return (0);
 }
 

Modified: head/sys/dev/etherswitch/arswitch/arswitch_8316.c
==
--- head/sys/dev/etherswitch/arswitch/arswitch_8316.c   Sun Jan 15 10:17:15 
2017(r312223)
+++ head/sys/dev/etherswitch/arswitch/arswitch_8316.c   Sun Jan 15 10:21:25 
2017(r312224)
@@ -127,6 +127,8 @@ static int
 ar8316_hw_global_setup(struct arswitch_softc *sc)
 {
 
+   ARSWITCH_LOCK(sc);
+
arswitch_writereg(sc->sc_dev, 0x38, AR8X16_MAGIC);
 
/* Enable CPU port and disable mirror port. */
@@ -156,6 +158,7 @@ ar8316_hw_global_setup(struct arswitch_s
arswitch_modifyreg(sc->sc_dev, AR8X16_REG_SERVICE_TAG,
AR8X16_SERVICE_TAG_MASK, 0);
 
+   ARSWITCH_UNLOCK(sc);
return (0);
 }
 

Modified: head/sys/dev/etherswitch/arswitch/arswitch_8327.c
==
--- head/sys/dev/etherswitch/arswitch/arswitch_8327.c   Sun Jan 15 10:17:15 
2017(r312223)
+++ head/sys/dev/etherswitch/arswitch/arswitch_8327.c   Sun Jan 15 10:21:25 
2017(r312224)
@@ -708,6 +708,8 @@ ar8327_hw_global_setup(struct arswitch_s
 {
uint32_t t;
 
+   ARSWITCH_LOCK(sc);
+
/* enable CPU port and disable mirror port */
t = AR8327_FWD_CTRL0_CPU_PORT_EN |
AR8327_FWD_CTRL0_MIRROR_PORT;
@@ -741,6 +743,7 @@ ar8327_hw_global_setup(struct arswitch_s
/* GMAC0 (CPU), GMAC1..5 (PHYs), GMAC6 (CPU) */
sc->info.es_nports = 7;
 
+   ARSWITCH_UNLOCK(sc);
return (0);
 }
 

Modified: head/sys/dev/etherswitch/arswitch/arswitch_9340.c
==
--- head/sys/dev/etherswitch/arswitch/arswitch_9340.c   Sun Jan 15 10:17:15 
2017(r312223)
+++ head/sys/dev/etherswitch/arswitch/arswitch_9340.c   Sun Jan 15 10:21:25 
2017(r312224)
@@ -81,6 +81,8 @@ static int
 ar9340_hw_global_setup(struct arswitch_softc *sc)
 {
 
+   ARSWITCH_LOCK(sc);
+
/* Enable CPU port; disable mirror port */
arswitch_writereg(sc->sc_dev, AR8X16_REG_CPU_PORT,
AR8X16_CPU_PORT_EN | AR8X16_CPU_MIRROR_DIS);
@@ -142,6 +144,7 @@ 

Re: svn commit: r312216 - in head: sys/kern tests/sys/kern/acct

2017-01-15 Thread Bruce Evans

On Sun, 15 Jan 2017, Ngie Cooper wrote:


Log:
 Revert r312119 and reword the intent to fix -Wshadow issues
 between exp(3) and `exp` var.

 The approach taken previously was not ideal for multiple
 functional and stylistic reasons.

 Add to existing sed call in Makefile to replace `exp` with
 `exponent` instead.


Thanks.


Modified: head/tests/sys/kern/acct/Makefile
==
--- head/tests/sys/kern/acct/Makefile   Sun Jan 15 09:13:41 2017
(r312215)
+++ head/tests/sys/kern/acct/Makefile   Sun Jan 15 09:25:33 2017
(r312216)
@@ -13,6 +13,7 @@ acct_test.o: convert.c

convert.c: ${SRCTOP}/sys/kern/kern_acct.c
sed -n -e 's/log(/syslog(/g' \
+  -e 's/exp/expected/g' \
   -e '/FLOAT_CONVERSION_START/,/FLOAT_CONVERSION_END/p' ${.ALLSRC} 
>${.TARGET}.tmp
mv ${.TARGET}.tmp ${.TARGET}


Er, 'expected' is an unexpected spelling of 'exponent'.'.

'syslog' is a little dangerous too.  log(9) is declared in systm.h and
this renames it to syslog(9).  syslog(3) is declared in syslog.h.  The
functions have the same API, but that is not enough for safety.  Currently
the result is a redeclaration that -Wredundant-decls should complain about.
But any magic like the API being implemented as a macro would cause problems.

Bruce
___
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: r312217 - head

2017-01-15 Thread Ngie Cooper
Author: ngie
Date: Sun Jan 15 09:31:14 2017
New Revision: 312217
URL: https://svnweb.freebsd.org/changeset/base/312217

Log:
  Delete svn mergeinfo for r312193 so I can once again sync
  ^/projects/netbsd-tests-upstream-01-2017 with ^/head

Modified:
Directory Properties:
  head/   (props changed)
___
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: r312216 - in head: sys/kern tests/sys/kern/acct

2017-01-15 Thread Ngie Cooper (yaneurabeya)

> On Jan 15, 2017, at 01:25, Ngie Cooper  wrote:
> 
> Author: ngie
> Date: Sun Jan 15 09:25:33 2017
> New Revision: 312216
> URL: https://svnweb.freebsd.org/changeset/base/312216
> 
> Log:
>  Revert r312119 and reword the intent to fix -Wshadow issues

*rework. Bah...


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r312119 - head/sys/kern

2017-01-15 Thread Ngie Cooper (yaneurabeya)

> On Jan 14, 2017, at 22:49, Bruce Evans  wrote:
> 
> On Sat, 14 Jan 2017, Ngie Cooper wrote:
> 
>> Log:
>> encode_long, encode_timeval: mechanically replace `exp` with `exponent`
>> 
>> This helps fix a -Wshadow issue with exp(3) with tests/sys/acct/acct_test,
>> which include math.h, which in turn defines exp(3)
> 
> But kern_acct.c doesn't include math.h.
> 
> This messes up the kernel sources to simplify abusing them in tests.
> 
> The bug was only in the sed script in the makefile that translates
> kern_acct.c to convert.c.  It converts 'log(' to 'syslog(', but is missing
> conversion of the exp identifier to sysexp.
> 
>> ==
>> --- head/sys/kern/kern_acct.cSat Jan 14 05:02:53 2017
>> (r312118)
>> +++ head/sys/kern/kern_acct.cSat Jan 14 05:06:14 2017
>> (r312119)
>> @@ -469,8 +469,8 @@ static uint32_t
>> encode_timeval(struct timeval tv)
>> {
>>  int log2_s;
>> -int val, exp;   /* Unnormalized value and exponent */
>> -int norm_exp;   /* Normalized exponent */
>> +int val, exponent;  /* Unnormalized value and exponent */
>> +int norm_exponent;  /* Normalized exponent */
>>  int shift;
>> 
>>  /*
> 
> Now the bug is also bad style in the kernel sources.  The regexp was too
> simple and munged norm_exp too, but not the exp's in comments.  The
> comments are more banal than before now that they don't even expand 'exp'
> but just echo 'exponent'.
> 
>> ...
>> -return (((FLT_MAX_EXP - 1 + exp + norm_exp) << (FLT_MANT_DIG - 1)) |
>> +return (((FLT_MAX_EXP - 1 + exponent + norm_exponent) << (FLT_MANT_DIG 
>> - 1)) |
>>  ((shift > 0 ? val << shift : val >> -shift) & MANT_MASK));
> 
> Here the expansion also broke the formatting.
> 
> The details of the abuse in the test program are that acct_test.c includes
> math.h and then includes then convert.c which is nearly a copy of the kernel
> source file.  This takes clean include files and not enabling warnings
> about redundant declarations to have a chance of working.
> 
> I use a similar hack to test libm, and didn't have to mess up the sources
> too much to make the translation not too hard.  Files have to be copied
> just to make the include paths manageable, and to compile them all with
> the same CFLAGS since this is a performance test.  The most complicated
> parts are to avoid library functions because they might not match the
> sources or were compiled with different CFLAGS.  The sources are not well
> organized well enough for my preferred method of "cc ${CLAGS} *.c" to work.

Thank you for the concerns. I’ve modified the approach based on your 
recommendations above and submitted it as r312216.
-Ngie


signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r312216 - in head: sys/kern tests/sys/kern/acct

2017-01-15 Thread Ngie Cooper
Author: ngie
Date: Sun Jan 15 09:25:33 2017
New Revision: 312216
URL: https://svnweb.freebsd.org/changeset/base/312216

Log:
  Revert r312119 and reword the intent to fix -Wshadow issues
  between exp(3) and `exp` var.
  
  The approach taken previously was not ideal for multiple
  functional and stylistic reasons.
  
  Add to existing sed call in Makefile to replace `exp` with
  `exponent` instead.
  
  MFC after:13 days
  Requested by: bde

Modified:
  head/sys/kern/kern_acct.c
  head/tests/sys/kern/acct/Makefile
Directory Properties:
  head/   (props changed)

Modified: head/sys/kern/kern_acct.c
==
--- head/sys/kern/kern_acct.c   Sun Jan 15 09:13:41 2017(r312215)
+++ head/sys/kern/kern_acct.c   Sun Jan 15 09:25:33 2017(r312216)
@@ -469,8 +469,8 @@ static uint32_t
 encode_timeval(struct timeval tv)
 {
int log2_s;
-   int val, exponent;  /* Unnormalized value and exponent */
-   int norm_exponent;  /* Normalized exponent */
+   int val, exp;   /* Unnormalized value and exponent */
+   int norm_exp;   /* Normalized exponent */
int shift;
 
/*
@@ -481,7 +481,7 @@ encode_timeval(struct timeval tv)
if (tv.tv_sec == 0) {
if (tv.tv_usec == 0)
return (0);
-   exponent = 0;
+   exp = 0;
val = tv.tv_usec;
} else {
/*
@@ -490,24 +490,24 @@ encode_timeval(struct timeval tv)
 */
log2_s = fls(tv.tv_sec) - 1;
if (log2_s + LOG2_1M < CALC_BITS) {
-   exponent = 0;
+   exp = 0;
val = 100 * tv.tv_sec + tv.tv_usec;
} else {
-   exponent = log2_s + LOG2_1M - CALC_BITS;
+   exp = log2_s + LOG2_1M - CALC_BITS;
val = (unsigned int)(((uint64_t)100 * tv.tv_sec +
-   tv.tv_usec) >> exponent);
+   tv.tv_usec) >> exp);
}
}
/* Now normalize and pack the value into an IEEE-754 float. */
-   norm_exponent = fls(val) - 1;
-   shift = FLT_MANT_DIG - norm_exponent - 1;
+   norm_exp = fls(val) - 1;
+   shift = FLT_MANT_DIG - norm_exp - 1;
 #ifdef ACCT_DEBUG
printf("val=%d exp=%d shift=%d log2(val)=%d\n",
-   val, exponent, shift, norm_exponent);
-   printf("exp=%x mant=%x\n", FLT_MAX_EXP - 1 + exponent + norm_exponent,
+   val, exp, shift, norm_exp);
+   printf("exp=%x mant=%x\n", FLT_MAX_EXP - 1 + exp + norm_exp,
((shift > 0 ? (val << shift) : (val >> -shift)) & MANT_MASK));
 #endif
-   return (((FLT_MAX_EXP - 1 + exponent + norm_exponent) << (FLT_MANT_DIG 
- 1)) |
+   return (((FLT_MAX_EXP - 1 + exp + norm_exp) << (FLT_MANT_DIG - 1)) |
((shift > 0 ? val << shift : val >> -shift) & MANT_MASK));
 }
 
@@ -518,7 +518,7 @@ encode_timeval(struct timeval tv)
 static uint32_t
 encode_long(long val)
 {
-   int norm_exponent;  /* Normalized exponent */
+   int norm_exp;   /* Normalized exponent */
int shift;
 
if (val == 0)
@@ -529,15 +529,15 @@ encode_long(long val)
val);
val = LONG_MAX;
}
-   norm_exponent = fls(val) - 1;
-   shift = FLT_MANT_DIG - norm_exponent - 1;
+   norm_exp = fls(val) - 1;
+   shift = FLT_MANT_DIG - norm_exp - 1;
 #ifdef ACCT_DEBUG
printf("val=%d shift=%d log2(val)=%d\n",
-   val, shift, norm_exponent);
-   printf("exp=%x mant=%x\n", FLT_MAX_EXP - 1 + exp + norm_exponent,
+   val, shift, norm_exp);
+   printf("exp=%x mant=%x\n", FLT_MAX_EXP - 1 + exp + norm_exp,
((shift > 0 ? (val << shift) : (val >> -shift)) & MANT_MASK));
 #endif
-   return (((FLT_MAX_EXP - 1 + norm_exponent) << (FLT_MANT_DIG - 1)) |
+   return (((FLT_MAX_EXP - 1 + norm_exp) << (FLT_MANT_DIG - 1)) |
((shift > 0 ? val << shift : val >> -shift) & MANT_MASK));
 }
 

Modified: head/tests/sys/kern/acct/Makefile
==
--- head/tests/sys/kern/acct/Makefile   Sun Jan 15 09:13:41 2017
(r312215)
+++ head/tests/sys/kern/acct/Makefile   Sun Jan 15 09:25:33 2017
(r312216)
@@ -13,6 +13,7 @@ acct_test.o: convert.c
 
 convert.c: ${SRCTOP}/sys/kern/kern_acct.c
sed -n -e 's/log(/syslog(/g' \
+  -e 's/exp/expected/g' \
   -e '/FLOAT_CONVERSION_START/,/FLOAT_CONVERSION_END/p' ${.ALLSRC} 
>${.TARGET}.tmp
mv ${.TARGET}.tmp ${.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: r312215 - head/tests/sys/vfs

2017-01-15 Thread Ngie Cooper
Author: ngie
Date: Sun Jan 15 09:13:41 2017
New Revision: 312215
URL: https://svnweb.freebsd.org/changeset/base/312215

Log:
  Mark testcases which use cap_enter as expected failures until the
  PR is resolved so those of us that run the tests don't have the
  bogus failures counted against our overall results
  
  PR:   215690

Modified:
  head/tests/sys/vfs/lookup_cap_dotdot.c

Modified: head/tests/sys/vfs/lookup_cap_dotdot.c
==
--- head/tests/sys/vfs/lookup_cap_dotdot.c  Sun Jan 15 09:06:45 2017
(r312214)
+++ head/tests/sys/vfs/lookup_cap_dotdot.c  Sun Jan 15 09:13:41 2017
(r312215)
@@ -124,6 +124,8 @@ ATF_TC_BODY(lookup_cap_dotdot__basic, tc
cap_rights_init(, CAP_LOOKUP, CAP_READ);
ATF_REQUIRE(cap_rights_limit(dirfd, ) >= 0);
 
+   atf_tc_expect_signal(SIGABRT, "needs change done upstream in atf/kyua 
according to cem: bug 215690");
+
ATF_REQUIRE(cap_enter() >= 0);
 
ATF_REQUIRE_MSG(openat(dirfd, "d1/..", O_RDONLY) >= 0, "%s",
@@ -144,6 +146,8 @@ ATF_TC_BODY(lookup_cap_dotdot__advanced,
check_capsicum();
prepare_dotdot_tests();
 
+   atf_tc_expect_signal(SIGABRT, "needs change done upstream in atf/kyua 
according to cem: bug 215690");
+
cap_rights_init(, CAP_LOOKUP, CAP_READ);
ATF_REQUIRE(cap_rights_limit(dirfd, ) >= 0);
 
@@ -187,6 +191,8 @@ ATF_TC_BODY(capmode__negative, tc)
check_capsicum();
prepare_dotdot_tests();
 
+   atf_tc_expect_signal(SIGABRT, "needs change done upstream in atf/kyua 
according to cem: bug 215690");
+
ATF_REQUIRE(cap_enter() == 0);
 
/* open() not permitted in capability mode */
@@ -225,6 +231,8 @@ ATF_TC_BODY(lookup_cap_dotdot__negative,
cap_rights_init(, CAP_LOOKUP, CAP_READ);
ATF_REQUIRE(cap_rights_limit(dirfd, ) >= 0);
 
+   atf_tc_expect_signal(SIGABRT, "needs change done upstream in atf/kyua 
according to cem: bug 215690");
+
ATF_REQUIRE(cap_enter() >= 0);
 
ATF_REQUIRE_ERRNO(ENOTCAPABLE, openat(dirfd, "..", O_RDONLY) < 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: r312214 - head/release/tools

2017-01-15 Thread Colin Percival
Author: cperciva
Date: Sun Jan 15 09:06:45 2017
New Revision: 312214
URL: https://svnweb.freebsd.org/changeset/base/312214

Log:
  Enable IPv6 networking on Amazon EC2.
  
  MFC after:1 week

Modified:
  head/release/tools/ec2.conf

Modified: head/release/tools/ec2.conf
==
--- head/release/tools/ec2.conf Sun Jan 15 09:05:26 2017(r312213)
+++ head/release/tools/ec2.conf Sun Jan 15 09:06:45 2017(r312214)
@@ -6,7 +6,7 @@
 # Packages to install into the image we're creating.  This is a deliberately
 # minimalist set, providing only the packages necessary to bootstrap further
 # package installation as specified via EC2 user-data.
-export VM_EXTRA_PACKAGES="ec2-scripts firstboot-freebsd-update firstboot-pkgs"
+export VM_EXTRA_PACKAGES="ec2-scripts firstboot-freebsd-update firstboot-pkgs 
dual-dhclient"
 
 # Set to a list of third-party software to enable in rc.conf(5).
 export VM_RC_LIST="ec2_configinit ec2_fetchkey ec2_ephemeralswap 
ec2_loghostkey firstboot_freebsd_update firstboot_pkgs"
@@ -39,8 +39,9 @@ vm_extra_pre_umount() {
# time; expand our filesystem to fill the disk.
echo 'growfs_enable="YES"' >> ${DESTDIR}/etc/rc.conf
 
-   # EC2 instances use DHCP to get their network configuration.
-   echo 'ifconfig_DEFAULT="SYNCDHCP"' >> ${DESTDIR}/etc/rc.conf
+   # EC2 instances use DHCP to get their network configuration.  IPv6
+   # requires accept_rtadv.
+   echo 'ifconfig_DEFAULT="SYNCDHCP accept_rtadv"' >> 
${DESTDIR}/etc/rc.conf
 
# Unless the system has been configured via EC2 user-data, the user
# will need to SSH in to do anything.
@@ -51,6 +52,10 @@ vm_extra_pre_umount() {
# via EC2 user-data.
echo 'firstboot_pkgs_list="awscli"' >> ${DESTDIR}/etc/rc.conf
 
+   # Enable IPv6 on all interfaces, and use DHCP on both IPv4 and IPv6.
+   echo 'ipv6_activate_all_interfaces="YES"' >> ${DESTDIR}/etc/rc.conf
+   echo 'dhclient_program="/usr/local/sbin/dual-dhclient"' >> 
${DESTDIR}/etc/rc.conf
+
# The EC2 console is output-only, so while printing a backtrace can
# be useful, there's no point dropping into a debugger or waiting
# for a keypress.
___
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: r312213 - head/lib/msun/tests

2017-01-15 Thread Ngie Cooper
Author: ngie
Date: Sun Jan 15 09:05:26 2017
New Revision: 312213
URL: https://svnweb.freebsd.org/changeset/base/312213

Log:
  Turn COMPILER_VERSION/COMPILER_TYPE make check into a compile-time check
  of the clang version
  
  This works around breakage on ^/stable/10 when running installworld from
  a ^/stable/10 host where the test wouldn't be compiled on the first
  go-around and would be missing when make installworld is run.
  
  MFC after:1 week
  PR:   208703
  Reported by:  emaste
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/msun/tests/Makefile
  head/lib/msun/tests/fmaxmin_test.c

Modified: head/lib/msun/tests/Makefile
==
--- head/lib/msun/tests/MakefileSun Jan 15 08:05:00 2017
(r312212)
+++ head/lib/msun/tests/MakefileSun Jan 15 09:05:26 2017
(r312213)
@@ -55,10 +55,7 @@ TAP_TESTS_C+=ctrig_test
 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
 TAP_TESTS_C+=  ilogb2_test
 TAP_TESTS_C+=  invtrig_test
 TAP_TESTS_C+=  invctrig_test

Modified: head/lib/msun/tests/fmaxmin_test.c
==
--- head/lib/msun/tests/fmaxmin_test.c  Sun Jan 15 08:05:00 2017
(r312212)
+++ head/lib/msun/tests/fmaxmin_test.c  Sun Jan 15 09:05:26 2017
(r312213)
@@ -86,6 +86,8 @@ testall_r(long double big, long double s
return (ok);
 }
 
+const char *comment = NULL;
+
 /*
  * Test all the functions: fmaxf, fmax, fmaxl, fminf, fmin, and fminl,
  * in all rounding modes and with the arguments in different orders.
@@ -107,10 +109,17 @@ testall(int testnum, long double big, lo
break;
}
}
-   printf("%sok %d - big = %.20Lg, small = %.20Lg\n",
-  (i == 4) ? "" : "not ", testnum, big, small);
+   printf("%sok %d - big = %.20Lg, small = %.20Lg%s\n",
+  (i == 4) ? "" : "not ", testnum, big, small,
+  comment == NULL ? "" : comment);
 }
 
+/* Clang 3.8.0+ fails the invariants for testcase 6, 7, 10, and 11. */
+#if defined(__clang__) && \
+(__clang_major__ >= 3 && __clang_minor__ >= 8 && __clang_patchlevel__ >= 0)
+#defineaffected_by_bug_208703
+#endif
+
 int
 main(int argc, char *argv[])
 {
@@ -122,15 +131,23 @@ main(int argc, char *argv[])
testall(3, nextafterf(42.0, INFINITY), 42.0);
testall(4, -5.0, -5.0);
testall(5, -3.0, -4.0);
+#ifdef affected_by_bug_208703
+   comment = "# TODO: testcase 6-7 fails invariant with clang 3.8+ (bug 
208703)";
+#endif
testall(6, 1.0, NAN);
testall(7, INFINITY, NAN);
+   comment = NULL;
testall(8, INFINITY, 1.0);
testall(9, -3.0, -INFINITY);
testall(10, 3.0, -INFINITY);
+#ifdef affected_by_bug_208703
+   comment = "# TODO: testcase 11-12 fails invariant with clang 3.8+ (bug 
208703)";
+#endif
testall(11, NAN, NAN);
 
/* This test isn't strictly required to work by C99. */
testall(12, 0.0, -0.0);
+   comment = NULL;
 
return (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: r312212 - head/sys/sys

2017-01-15 Thread Conrad E. Meyer
Author: cem
Date: Sun Jan 15 08:05:00 2017
New Revision: 312212
URL: https://svnweb.freebsd.org/changeset/base/312212

Log:
  Fix a minor typo (Seiral)
  
  PR:   216095
  Reported by:  

Modified:
  head/sys/sys/ata.h

Modified: head/sys/sys/ata.h
==
--- head/sys/sys/ata.h  Sun Jan 15 06:35:00 2017(r312211)
+++ head/sys/sys/ata.h  Sun Jan 15 08:05:00 2017(r312212)
@@ -682,7 +682,7 @@ struct atapi_sense {
 #defineATA_IDL_ATA_STRINGS 0x05/* ATA Strings */
 #defineATA_IDL_SECURITY0x06/* Security */
 #defineATA_IDL_PARALLEL_ATA0x07/* Parallel ATA */
-#defineATA_IDL_SERIAL_ATA  0x08/* Seiral ATA */
+#defineATA_IDL_SERIAL_ATA  0x08/* Serial ATA */
 #defineATA_IDL_ZDI 0x09/* Zoned Device Information */
 
 struct ata_gp_log_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"