svn commit: r315829 - head/share/man/man9

2017-03-23 Thread Ngie Cooper
Author: ngie
Date: Thu Mar 23 07:36:38 2017
New Revision: 315829
URL: https://svnweb.freebsd.org/changeset/base/315829

Log:
  Try polishing up iflib manpages a bit (basically all the low hanging fruit)
  
  igor:
  - Fix typos.
  - Delete trailing whitespace.
  
  manlint:
  - Use .Fo/.Fc/.Fa when describing functions.
  - Use .Xr.
  - Fill in SEE ALSO section.
  - Fix .Dt use: the section was specified incorrectly and the name
had a lowercase character.
  - Continue new sentences on new lines.
  
  Miscellaneous:
  - Remove unnecessary quotes around "SEE ALSO" section headers.
  - Sprinkle .Dv use in spots with constants.
  
  Reported by:  igor, make manlint
  Sponsored by: Dell EMC Isilon

Modified:
  head/share/man/man9/iflibdd.9
  head/share/man/man9/iflibdi.9
  head/share/man/man9/iflibtxrx.9

Modified: head/share/man/man9/iflibdd.9
==
--- head/share/man/man9/iflibdd.9   Thu Mar 23 06:55:32 2017
(r315828)
+++ head/share/man/man9/iflibdd.9   Thu Mar 23 07:36:38 2017
(r315829)
@@ -1,6 +1,6 @@
 .\" $FreeBSD$
-.Dd January 27, 2017
-.Dt IFlIBDD(9)
+.Dd March 23, 2017
+.Dt IFLIBDD 9
 .Os
 .Sh NAME
 .Nm iflibdd
@@ -10,110 +10,215 @@
 .Ss "Soft Queue Setup and Teardown Functions"
 .Ss "Mandatory Functions"
 .Ft int
-.Fn ifdi_queues_alloc "if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, int 
nqs"
-.Ft int
-.Fn ifdi_queues_free "if_ctx_t ctx"
+.Fo ifdi_queues_alloc
+.Fa "if_ctx_t ctx"
+.Fa "caddr_t *vaddrs"
+.Fa "uint64_t *paddrs"
+.Fa "int nqs"
+.Fc
+.Ft int
+.Fo ifdi_queues_free
+.Fa "if_ctx_t ctx"
+.Fc
 .Ss "Optional Functions"
 .Ft int
-.Fn ifdi_txq_setup "if_ctx_t ctx, uint16_t qid"
-.Ft int
-.Fn ifdi_rxq_setup "if_ctx_t ctx, uint16_t qid"
+.Fo ifdi_txq_setup
+.Fa "if_ctx_t ctx"
+.Fa "uint16_t qid"
+.Fc
+.Ft int
+.Fo ifdi_rxq_setup
+.Fa "if_ctx_t ctx"
+.Fa "uint16_t qid"
+.Fc
 .Ss "Device Setup and Teardown Functions"
 .Ss "Mandatory Functions"
 .Ft int
-.Fn ifdi_attach_pre "if_ctx_t ctx"
-.Ft int
-.Fn ifdi_attach_post "if_ctx_t ctx"
-.Ft int
-.Fn ifdi_detach "if_ctx_t ctx"
+.Fo ifdi_attach_pre
+.Fa "if_ctx_t ctx"
+.Fc
+.Ft int
+.Fo ifdi_attach_post
+.Fa "if_ctx_t ctx"
+.Fc
+.Ft int
+.Fo ifdi_detach
+.Fa "if_ctx_t ctx"
+.Fc
 .Ss "Optional Functions"
 .Ft void
-.Fn ifdi_vlan_register "if_ctx_t ctx, uint16_t vtag"
-.Ft void
-.Fn ifdi_vlan_unregister "if_ctx_t ctx, uint16_t vtag"
-.Ft int
-.Fn ifdi_suspend "if_ctx_t ctx"
-.Ft int
-.Fn ifdi_resume "if_ctx_t ctx"
+.Fo ifdi_vlan_register
+.Fa "if_ctx_t ctx"
+.Fa "uint16_t vtag"
+.Fc
+.Ft void
+.Fo ifdi_vlan_unregister
+.Fa "if_ctx_t ctx"
+.Fa "uint16_t vtag"
+.Fc
+.Ft int
+.Fo ifdi_suspend
+.Fa "if_ctx_t ctx"
+.Fc
+.Ft int
+.Fo ifdi_resume
+.Fa "if_ctx_t ctx"
+.Fc
 .Ss "Device Configuration Functions"
 .Ss "Mandatory Functions"
 .Ft void
-.Fn ifdi_init "if_ctx_t ctx"
-.Ft void
-.Fn ifdi_stop "if_ctx_t ctx"
-.Ft void
-.Fn ifdi_multi_set "if_ctx_t ctx"
-.Ft int
-.Fn ifdi_mtu_set "if_ctx_t ctx, uint32_t mtu"
-.Ft void
-.Fn ifdi_media_status "if_ctx_t ctx, struct ifmediareq *ifr"
-.Ft int
-.Fn ifdi_media_change "if_ctx_t ctx"
-.Ft void
-.Fn ifdi_promisc_set "if_ctx_t ctx, int flags"
+.Fo ifdi_init
+.Fa "if_ctx_t ctx"
+.Fc
+.Ft void
+.Fo ifdi_stop
+.Fa "if_ctx_t ctx"
+.Fc
+.Ft void
+.Fo ifdi_multi_set
+.Fa "if_ctx_t ctx"
+.Fc
+.Ft int
+.Fo ifdi_mtu_set
+.Fa "if_ctx_t ctx"
+.Fa "uint32_t mtu"
+.Fc
+.Ft void
+.Fo ifdi_media_status
+.Fa "if_ctx_t ctx"
+.Fa "struct ifmediareq *ifr"
+.Fc
+.Ft int
+.Fo ifdi_media_change
+.Fa "if_ctx_t ctx"
+.Fc
+.Ft void
+.Fo ifdi_promisc_set
+.Fa "if_ctx_t ctx"
+.Fa "int flags"
+.Fc
 .Ft uint64_t
-.Fn ifdi_get_counter "if_ctx_t ctx, ift_counter cnt"
-.Ft void
-.Fn ifdi_update_admin_status "if_ctx_t ctx"
+.Fo ifdi_get_counter
+.Fa "if_ctx_t ctx"
+.Fa "ift_counter cnt"
+.Fc
+.Ft void
+.Fo ifdi_update_admin_status
+.Fa "if_ctx_t ctx"
+.Fc
 .Ss "Optional Functions"
 .Ft void
-.Fn ifdi_media_set "if_ctx_t ctx"
+.Fo ifdi_media_set
+.Fa "if_ctx_t ctx"
+.Fc
 .Ss "Interrupt enable/disable"
 .Ss "Mandatory Functions"
 .Ft void
-.Fn ifdi_intr_enable "if_ctx_t ctx"
-.Ft void
-.Fn ifdi_queue_intr_enable "if_ctx_t ctx, uint16_t qid"
-.Ft void
-.Fn ifdi_intr_disable "if_ctx_t ctx"
+.Fo ifdi_intr_enable
+.Fa "if_ctx_t ctx"
+.Fc
+.Ft void
+.Fo ifdi_queue_intr_enable
+.Fa "if_ctx_t ctx"
+.Fa "uint16_t qid"
+.Fc
+.Ft void
+.Fo ifdi_intr_disable
+.Fa "if_ctx_t ctx"
+.Fc
 .Ss IOV Support
 .Ft init
-.Fn iov_init "if_ctx_t, uint16_t num_vfs, const nvlist_t *params"
-.Ft void
-.Fn iov_uinit "if_ctx_t ctx"
-.Ft void
-.Fn ifdi_vflr_handle "if_ctx_t ctx"
-.Ft int
-.Fn ifdi_vf_add "if_ctx_t ctx, uint16_t vfnum, const nvlist_t *params"
+.Fo iov_init
+.Fa "if_ctx_t ctx"
+.Fa "uint16_t num_vfs"
+.Fa "const nvlist_t *params"
+.Fc
+.Ft void
+.Fo iov_uinit
+.Fa "if_ctx_t ctx"
+.Fc
+.Ft void
+.Fo ifdi_vflr_handle
+.Fa "if_ctx_t ctx"
+.Fc
+.Ft int
+.Fo ifdi_vf_add
+.Fa "if_ctx_t ctx"
+.Fa "uint16_t vfnum"
+.Fa "const nvlist_t *params"
+.Fc
 .Ss "Optional Functions"
 .F

Re: svn commit: r315701 - in head/sys: amd64/cloudabi32 amd64/cloudabi64 arm/cloudabi32 arm64/cloudabi64 i386/cloudabi32

2017-03-23 Thread Ed Schouten
Hi Kostik,

2017-03-23 0:00 GMT+01:00 Konstantin Belousov :
> On Wed, Mar 22, 2017 at 03:16:24PM +0100, Ed Schouten wrote:
>> Similarly, I seem to remember CloudABI's brandinfos set compat_3_brand
>> for a similar reason: it seems to be required by imgact_elf.c. Would
>> we also want to change that?
>
> Could you please try this ?

Thanks! I just gave the patch a try, but the comparison added to
imgact_elf.c now causes the brandinfo to be skipped entirely. Attached
is a patch that does work for me.

-- 
Ed Schouten 
Nuxi, 's-Hertogenbosch, the Netherlands
KvK-nr.: 62051717
Index: sys/amd64/cloudabi32/cloudabi32_sysvec.c
===
--- sys/amd64/cloudabi32/cloudabi32_sysvec.c(revision 315828)
+++ sys/amd64/cloudabi32/cloudabi32_sysvec.c(working copy)
@@ -227,6 +227,5 @@
.brand  = ELFOSABI_CLOUDABI,
.machine= EM_386,
.sysvec = &cloudabi32_elf_sysvec,
-   .compat_3_brand = "CloudABI",
.flags  = BI_BRAND_ONLY_STATIC,
 };
Index: sys/amd64/cloudabi64/cloudabi64_sysvec.c
===
--- sys/amd64/cloudabi64/cloudabi64_sysvec.c(revision 315828)
+++ sys/amd64/cloudabi64/cloudabi64_sysvec.c(working copy)
@@ -213,5 +213,4 @@
.machine= EM_X86_64,
.sysvec = &cloudabi64_elf_sysvec,
.flags  = BI_CAN_EXEC_DYN | BI_BRAND_ONLY_STATIC,
-   .compat_3_brand = "CloudABI",
 };
Index: sys/arm/cloudabi32/cloudabi32_sysvec.c
===
--- sys/arm/cloudabi32/cloudabi32_sysvec.c  (revision 315828)
+++ sys/arm/cloudabi32/cloudabi32_sysvec.c  (working copy)
@@ -189,6 +189,5 @@
.brand  = ELFOSABI_CLOUDABI,
.machine= EM_ARM,
.sysvec = &cloudabi32_elf_sysvec,
-   .compat_3_brand = "CloudABI",
.flags  = BI_BRAND_ONLY_STATIC,
 };
Index: sys/arm64/cloudabi64/cloudabi64_sysvec.c
===
--- sys/arm64/cloudabi64/cloudabi64_sysvec.c(revision 315828)
+++ sys/arm64/cloudabi64/cloudabi64_sysvec.c(working copy)
@@ -182,5 +182,4 @@
.machine= EM_AARCH64,
.sysvec = &cloudabi64_elf_sysvec,
.flags  = BI_CAN_EXEC_DYN | BI_BRAND_ONLY_STATIC,
-   .compat_3_brand = "CloudABI",
 };
Index: sys/i386/cloudabi32/cloudabi32_sysvec.c
===
--- sys/i386/cloudabi32/cloudabi32_sysvec.c (revision 315828)
+++ sys/i386/cloudabi32/cloudabi32_sysvec.c (working copy)
@@ -200,6 +200,5 @@
.brand  = ELFOSABI_CLOUDABI,
.machine= EM_386,
.sysvec = &cloudabi32_elf_sysvec,
-   .compat_3_brand = "CloudABI",
.flags  = BI_BRAND_ONLY_STATIC,
 };
Index: sys/kern/imgact_elf.c
===
--- sys/kern/imgact_elf.c   (revision 315828)
+++ sys/kern/imgact_elf.c   (working copy)
@@ -312,8 +312,9 @@
continue;
if (hdr->e_machine == bi->machine &&
(hdr->e_ident[EI_OSABI] == bi->brand ||
+   (bi->compat_3_brand != NULL &&
strcmp((const char *)&hdr->e_ident[OLD_EI_BRAND],
-   bi->compat_3_brand) == 0)) {
+   bi->compat_3_brand) == 0))) {
/* Looks good, but give brand a chance to veto */
if (!bi->header_supported ||
bi->header_supported(imgp)) {
___
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: r315843 - head/sys/arm/nvidia

2017-03-23 Thread Michal Meloun
Author: mmel
Date: Thu Mar 23 08:15:11 2017
New Revision: 315843
URL: https://svnweb.freebsd.org/changeset/base/315843

Log:
  Revert r315800, it was committed with invalid (unsaved) commit log.

Modified:
  head/sys/arm/nvidia/tegra_sdhci.c

Modified: head/sys/arm/nvidia/tegra_sdhci.c
==
--- head/sys/arm/nvidia/tegra_sdhci.c   Thu Mar 23 08:14:41 2017
(r315842)
+++ head/sys/arm/nvidia/tegra_sdhci.c   Thu Mar 23 08:15:11 2017
(r315843)
@@ -459,9 +459,9 @@ static device_method_t tegra_sdhci_metho
 };
 
 static devclass_t tegra_sdhci_devclass;
-static DEFINE_CLASS_0(sdhci, tegra_sdhci_driver, tegra_sdhci_methods,
+static DEFINE_CLASS_0(sdhci_tegra, tegra_sdhci_driver, tegra_sdhci_methods,
 sizeof(struct tegra_sdhci_softc));
 DRIVER_MODULE(sdhci_tegra, simplebus, tegra_sdhci_driver, tegra_sdhci_devclass,
 NULL, NULL);
 MODULE_DEPEND(sdhci_tegra, sdhci, 1, 1, 1);
-MMC_DECLARE_BRIDGE(sdhci);
+MMC_DECLARE_BRIDGE(sdhci_tegra);
___
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: r315845 - head/sys/arm/nvidia

2017-03-23 Thread Michal Meloun
Author: mmel
Date: Thu Mar 23 08:16:53 2017
New Revision: 315845
URL: https://svnweb.freebsd.org/changeset/base/315845

Log:
  Restore original (pre r315760) naming for Tegra SDHCI device.
  
  Newbus handles multiple equally named device classes without problems,
  so there is no reason to use slightly cryptic "_shdci" for them.
  In contrast, the driver module name must be unique, so "_shdci"
  is the right name for it.

Modified:
  head/sys/arm/nvidia/tegra_sdhci.c

Modified: head/sys/arm/nvidia/tegra_sdhci.c
==
--- head/sys/arm/nvidia/tegra_sdhci.c   Thu Mar 23 08:16:29 2017
(r315844)
+++ head/sys/arm/nvidia/tegra_sdhci.c   Thu Mar 23 08:16:53 2017
(r315845)
@@ -459,9 +459,9 @@ static device_method_t tegra_sdhci_metho
 };
 
 static devclass_t tegra_sdhci_devclass;
-static DEFINE_CLASS_0(sdhci_tegra, tegra_sdhci_driver, tegra_sdhci_methods,
+static DEFINE_CLASS_0(sdhci, tegra_sdhci_driver, tegra_sdhci_methods,
 sizeof(struct tegra_sdhci_softc));
 DRIVER_MODULE(sdhci_tegra, simplebus, tegra_sdhci_driver, tegra_sdhci_devclass,
 NULL, NULL);
 MODULE_DEPEND(sdhci_tegra, sdhci, 1, 1, 1);
-MMC_DECLARE_BRIDGE(sdhci_tegra);
+MMC_DECLARE_BRIDGE(sdhci);
___
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: r315850 - head/sys/boot/forth

2017-03-23 Thread Dag-Erling Smørgrav
Author: des
Date: Thu Mar 23 08:34:30 2017
New Revision: 315850
URL: https://svnweb.freebsd.org/changeset/base/315850

Log:
  The original author abused Nd (one-line description, used by makewhatis)
  for its side effect of producing an en-dash.  This broke whatis with
  newer versions of mdocml.  Use \(en instead.
  
  MFC after:1 week

Modified:
  head/sys/boot/forth/beastie.4th.8

Modified: head/sys/boot/forth/beastie.4th.8
==
--- head/sys/boot/forth/beastie.4th.8   Thu Mar 23 08:22:27 2017
(r315849)
+++ head/sys/boot/forth/beastie.4th.8   Thu Mar 23 08:34:30 2017
(r315850)
@@ -34,9 +34,9 @@
 The file that goes by the name of
 .Nm
 is a set of commands designed to draw the ASCII art FreeBSD mascot
-.Nd known simply as
-.Ic beastie
-.Nd to the right of the boot loader menu.
+\(en known simply as
+.Em beastie
+\(en to the right of the boot loader menu.
 The commands of
 .Nm
 by themselves are not enough for most uses.
___
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: r315851 - in head/sys: kern sys

2017-03-23 Thread Andriy Gapon
Author: avg
Date: Thu Mar 23 08:57:04 2017
New Revision: 315851
URL: https://svnweb.freebsd.org/changeset/base/315851

Log:
  move thread switch tracing from mi_switch to sched_switch
  
  This is done so that the thread state changes during the switch
  are not confused with the thread state changes reported when the thread
  spins on a lock.
  
  Here is an example, three consecutive entries for the same thread (from top to
  bottom):
  
KTRGRAPH group:"thread", id:"zio_write_intr_3 tid 100260", state:"sleep", 
attributes: prio:84, wmesg:"-", lockname:"(null)"
KTRGRAPH group:"thread", id:"zio_write_intr_3 tid 100260", 
state:"spinning", attributes: lockname:"sched lock 1"
KTRGRAPH group:"thread", id:"zio_write_intr_3 tid 100260", state:"running", 
attributes: none
  
  The above trace could leave an impression that the final state of
  the thread was "running".
  After this change the sleep state will be reported after the "spinning"
  and "running" states reported for the sched lock.
  
  Reviewed by:  jhb, markj
  MFC after:1 week
  Sponsored by: Panzura
  Differential Revision: https://reviews.freebsd.org/D9961

Modified:
  head/sys/kern/kern_synch.c
  head/sys/kern/sched_4bsd.c
  head/sys/kern/sched_ule.c
  head/sys/sys/proc.h

Modified: head/sys/kern/kern_synch.c
==
--- head/sys/kern/kern_synch.c  Thu Mar 23 08:34:30 2017(r315850)
+++ head/sys/kern/kern_synch.c  Thu Mar 23 08:57:04 2017(r315851)
@@ -66,13 +66,6 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-#defineKTDSTATE(td)
\
-   (((td)->td_inhibitors & TDI_SLEEPING) != 0 ? "sleep"  : \
-   ((td)->td_inhibitors & TDI_SUSPENDED) != 0 ? "suspended" :  \
-   ((td)->td_inhibitors & TDI_SWAPPED) != 0 ? "swapped" :  \
-   ((td)->td_inhibitors & TDI_LOCK) != 0 ? "blocked" : \
-   ((td)->td_inhibitors & TDI_IWAIT) != 0 ? "iwait" : "yielding")
-
 static void synch_setup(void *dummy);
 SYSINIT(synch_setup, SI_SUB_KICK_SCHEDULER, SI_ORDER_FIRST, synch_setup,
 NULL);
@@ -437,20 +430,8 @@ mi_switch(int flags, struct thread *newt
PCPU_SET(switchticks, ticks);
CTR4(KTR_PROC, "mi_switch: old thread %ld (td_sched %p, pid %ld, %s)",
td->td_tid, td_get_sched(td), td->td_proc->p_pid, td->td_name);
-#if (KTR_COMPILE & KTR_SCHED) != 0
-   if (TD_IS_IDLETHREAD(td))
-   KTR_STATE1(KTR_SCHED, "thread", sched_tdname(td), "idle",
-   "prio:%d", td->td_priority);
-   else
-   KTR_STATE3(KTR_SCHED, "thread", sched_tdname(td), KTDSTATE(td),
-   "prio:%d", td->td_priority, "wmesg:\"%s\"", td->td_wmesg,
-   "lockname:\"%s\"", td->td_lockname);
-#endif
SDT_PROBE0(sched, , , preempt);
sched_switch(td, newtd, flags);
-   KTR_STATE1(KTR_SCHED, "thread", sched_tdname(td), "running",
-   "prio:%d", td->td_priority);
-
CTR4(KTR_PROC, "mi_switch: new thread %ld (td_sched %p, pid %ld, %s)",
td->td_tid, td_get_sched(td), td->td_proc->p_pid, td->td_name);
 

Modified: head/sys/kern/sched_4bsd.c
==
--- head/sys/kern/sched_4bsd.c  Thu Mar 23 08:34:30 2017(r315850)
+++ head/sys/kern/sched_4bsd.c  Thu Mar 23 08:57:04 2017(r315851)
@@ -1013,6 +1013,16 @@ sched_switch(struct thread *td, struct t
MPASS(newtd->td_lock == &sched_lock);
}
 
+#if (KTR_COMPILE & KTR_SCHED) != 0
+   if (TD_IS_IDLETHREAD(td))
+   KTR_STATE1(KTR_SCHED, "thread", sched_tdname(td), "idle",
+   "prio:%d", td->td_priority);
+   else
+   KTR_STATE3(KTR_SCHED, "thread", sched_tdname(td), KTDSTATE(td),
+   "prio:%d", td->td_priority, "wmesg:\"%s\"", td->td_wmesg,
+   "lockname:\"%s\"", td->td_lockname);
+#endif
+
if (td != newtd) {
 #ifdef HWPMC_HOOKS
if (PMC_PROC_IS_USING_PMCS(td->td_proc))
@@ -1061,6 +1071,9 @@ sched_switch(struct thread *td, struct t
} else
SDT_PROBE0(sched, , , remain__cpu);
 
+   KTR_STATE1(KTR_SCHED, "thread", sched_tdname(td), "running",
+   "prio:%d", td->td_priority);
+
 #ifdef SMP
if (td->td_flags & TDF_IDLETD)
CPU_SET(PCPU_GET(cpuid), &idle_cpus_mask);

Modified: head/sys/kern/sched_ule.c
==
--- head/sys/kern/sched_ule.c   Thu Mar 23 08:34:30 2017(r315850)
+++ head/sys/kern/sched_ule.c   Thu Mar 23 08:57:04 2017(r315851)
@@ -1938,6 +1938,17 @@ sched_switch(struct thread *td, struct t
mtx = thread_lock_block(td);
tdq_load_rem(tdq, td);
}
+
+#if (KTR_COMPILE & KTR_SCHED) != 0
+   if (TD_IS_IDLETHREAD(td))
+   KTR_

svn commit: r315852 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2017-03-23 Thread Andriy Gapon
Author: avg
Date: Thu Mar 23 08:59:17 2017
New Revision: 315852
URL: https://svnweb.freebsd.org/changeset/base/315852

Log:
  zfs: add zio_buf_alloc_nowait and use it in vdev_queue_aggregate
  
  This way we can avoid blocking the whole queue in the low memory
  situations.  It's better to sacrifice some I/O performance by not doing
  the aggregation than to add an indefinite wait for more memory.
  
  Reviewed by:  smh
  MFC after:2 weeks
  Sponsored by: Panzura
  Differential Revision: https://reviews.freebsd.org/D

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h   Thu Mar 
23 08:57:04 2017(r315851)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h   Thu Mar 
23 08:59:17 2017(r315852)
@@ -567,6 +567,7 @@ extern zio_t *zio_unique_parent(zio_t *c
 extern void zio_add_child(zio_t *pio, zio_t *cio);
 
 extern void *zio_buf_alloc(size_t size);
+extern void *zio_buf_alloc_nowait(size_t size);
 extern void zio_buf_free(void *buf, size_t size);
 extern void *zio_data_buf_alloc(size_t size);
 extern void zio_data_buf_free(void *buf, size_t size);

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.cThu Mar 
23 08:57:04 2017(r315851)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.cThu Mar 
23 08:59:17 2017(r315852)
@@ -647,6 +647,7 @@ static zio_t *
 vdev_queue_aggregate(vdev_queue_t *vq, zio_t *zio)
 {
zio_t *first, *last, *aio, *dio, *mandatory, *nio;
+   void *abuf;
uint64_t maxgap = 0;
uint64_t size;
boolean_t stretch;
@@ -755,8 +756,12 @@ vdev_queue_aggregate(vdev_queue_t *vq, z
size = IO_SPAN(first, last);
ASSERT3U(size, <=, zfs_vdev_aggregation_limit);
 
+   abuf = zio_buf_alloc_nowait(size);
+   if (abuf == NULL)
+   return (NULL);
+
aio = zio_vdev_delegated_io(first->io_vd, first->io_offset,
-   zio_buf_alloc(size), size, first->io_type, zio->io_priority,
+   abuf, size, first->io_type, zio->io_priority,
flags | ZIO_FLAG_DONT_CACHE | ZIO_FLAG_DONT_QUEUE,
vdev_queue_agg_io_done, NULL);
aio->io_timestamp = first->io_timestamp;

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c   Thu Mar 23 
08:57:04 2017(r315851)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c   Thu Mar 23 
08:59:17 2017(r315852)
@@ -272,18 +272,33 @@ zio_fini(void)
  * useful to inspect ZFS metadata, but if possible, we should avoid keeping
  * excess / transient data in-core during a crashdump.
  */
-void *
-zio_buf_alloc(size_t size)
+static void *
+zio_buf_alloc_impl(size_t size, boolean_t canwait)
 {
size_t c = (size - 1) >> SPA_MINBLOCKSHIFT;
int flags = zio_exclude_metadata ? KM_NODEBUG : 0;
 
VERIFY3U(c, <, SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT);
 
-   if (zio_use_uma)
-   return (kmem_cache_alloc(zio_buf_cache[c], KM_PUSHPAGE));
-   else
-   return (kmem_alloc(size, KM_SLEEP|flags));
+   if (zio_use_uma) {
+   return (kmem_cache_alloc(zio_buf_cache[c],
+   canwait ? KM_PUSHPAGE : KM_NOSLEEP));
+   } else {
+   return (kmem_alloc(size,
+   (canwait ? KM_SLEEP : KM_NOSLEEP) | flags));
+   }
+}
+
+void *
+zio_buf_alloc(size_t size)
+{
+   return (zio_buf_alloc_impl(size, B_TRUE));
+}
+
+void *
+zio_buf_alloc_nowait(size_t size)
+{
+   return (zio_buf_alloc_impl(size, B_FALSE));
 }
 
 /*
___
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: r315701 - in head/sys: amd64/cloudabi32 amd64/cloudabi64 arm/cloudabi32 arm64/cloudabi64 i386/cloudabi32

2017-03-23 Thread Konstantin Belousov
On Thu, Mar 23, 2017 at 08:43:20AM +0100, Ed Schouten wrote:
> Hi Kostik,
> 
> 2017-03-23 0:00 GMT+01:00 Konstantin Belousov :
> > On Wed, Mar 22, 2017 at 03:16:24PM +0100, Ed Schouten wrote:
> >> Similarly, I seem to remember CloudABI's brandinfos set compat_3_brand
> >> for a similar reason: it seems to be required by imgact_elf.c. Would
> >> we also want to change that?
> >
> > Could you please try this ?
> 
> Thanks! I just gave the patch a try, but the comparison added to
> imgact_elf.c now causes the brandinfo to be skipped entirely. Attached
> is a patch that does work for me.

Could you provide me with i386 and amd64 cloudabi hello world binaries ?
And, might be, an instruction how to run them, if non-trivial.
___
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: r315853 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2017-03-23 Thread Andriy Gapon
Author: avg
Date: Thu Mar 23 09:13:21 2017
New Revision: 315853
URL: https://svnweb.freebsd.org/changeset/base/315853

Log:
  zfs_putpages: use TXG_WAIT
  
  Explicit looping using TXG_NOWAIT is more verbose and may harm performance
  under heavy load because of multiple waits.
  
  MFC after:1 week

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Mar 
23 08:59:17 2017(r315852)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Mar 
23 09:13:21 2017(r315853)
@@ -4712,19 +4712,13 @@ zfs_putpages(struct vnode *vp, vm_page_t
goto out;
}
 
-top:
tx = dmu_tx_create(zfsvfs->z_os);
dmu_tx_hold_write(tx, zp->z_id, off, len);
 
dmu_tx_hold_sa(tx, zp->z_sa_hdl, B_FALSE);
zfs_sa_upgrade_txholds(tx, zp);
-   err = dmu_tx_assign(tx, TXG_NOWAIT);
+   err = dmu_tx_assign(tx, TXG_WAIT);
if (err != 0) {
-   if (err == ERESTART) {
-   dmu_tx_wait(tx);
-   dmu_tx_abort(tx);
-   goto top;
-   }
dmu_tx_abort(tx);
goto out;
}
___
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: r315856 - in head/sys/compat/linuxkpi/common: include/linux src

2017-03-23 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Mar 23 10:48:10 2017
New Revision: 315856
URL: https://svnweb.freebsd.org/changeset/base/315856

Log:
  Add support for ratelimited printouts in the LinuxKPI.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/device.h
  head/sys/compat/linuxkpi/common/include/linux/kernel.h
  head/sys/compat/linuxkpi/common/src/linux_compat.c

Modified: head/sys/compat/linuxkpi/common/include/linux/device.h
==
--- head/sys/compat/linuxkpi/common/include/linux/device.h  Thu Mar 23 
10:43:29 2017(r315855)
+++ head/sys/compat/linuxkpi/common/include/linux/device.h  Thu Mar 23 
10:48:10 2017(r315856)
@@ -144,6 +144,18 @@ show_class_attr_string(struct class *cla
 #definedev_printk(lvl, dev, fmt, ...)  
\
device_printf((dev)->bsddev, fmt, ##__VA_ARGS__)
 
+#definedev_err_ratelimited(dev, ...) do {  \
+   static time_t __ratelimited;\
+   if (linux_ratelimited(&__ratelimited))  \
+   dev_err(dev, __VA_ARGS__);  \
+} while (0)
+
+#definedev_warn_ratelimited(dev, ...) do { \
+   static time_t __ratelimited;\
+   if (linux_ratelimited(&__ratelimited))  \
+   dev_warn(dev, __VA_ARGS__); \
+} while (0)
+
 static inline void *
 dev_get_drvdata(const struct device *dev)
 {

Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h
==
--- head/sys/compat/linuxkpi/common/include/linux/kernel.h  Thu Mar 23 
10:43:29 2017(r315855)
+++ head/sys/compat/linuxkpi/common/include/linux/kernel.h  Thu Mar 23 
10:48:10 2017(r315856)
@@ -224,6 +224,11 @@ scnprintf(char *buf, size_t size, const 
log_once(LOG_INFO, pr_fmt(fmt), ##__VA_ARGS__)
 #define pr_cont(fmt, ...) \
printk(KERN_CONT fmt, ##__VA_ARGS__)
+#definepr_warn_ratelimited(...) do {   \
+   static time_t __ratelimited;\
+   if (linux_ratelimited(&__ratelimited))  \
+   pr_warning(__VA_ARGS__);\
+} while (0)
 
 #ifndef WARN
 #defineWARN(condition, ...) ({ \
@@ -331,4 +336,6 @@ abs64(int64_t x)
return (x < 0 ? -x : x);
 }
 
+extern bool linux_ratelimited(time_t *);
+
 #endif /* _LINUX_KERNEL_H_ */

Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c
==
--- head/sys/compat/linuxkpi/common/src/linux_compat.c  Thu Mar 23 10:43:29 
2017(r315855)
+++ head/sys/compat/linuxkpi/common/src/linux_compat.c  Thu Mar 23 10:48:10 
2017(r315856)
@@ -1484,6 +1484,20 @@ __unregister_chrdev(unsigned int major, 
 bool linux_cpu_has_clflush;
 #endif
 
+bool
+linux_ratelimited(time_t *ptime)
+{
+   /* make sure uptime is not zero by OR'ing bit 31 */
+   time_t curr = time_uptime | (1U << 31);
+
+   /* check if one or more seconds have passed */
+   if (*ptime != curr) {
+   *ptime = curr;
+   return (1);
+   }
+   return (0);
+}
+
 static void
 linux_compat_init(void *arg)
 {
___
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: r315857 - head/sys/cam/scsi

2017-03-23 Thread Alexander Motin
Author: mav
Date: Thu Mar 23 10:50:45 2017
New Revision: 315857
URL: https://svnweb.freebsd.org/changeset/base/315857

Log:
  Remove "UNMAPPED" messages printed on da periph attach.
  
  I think this message is not very useful for end user.  Also its formatting
  does not match other messages printed at that time.  Those who really need
  this information can always find it in `camcontrol negotiate daX -v`.
  
  MFC after:2 weeks

Modified:
  head/sys/cam/scsi/scsi_da.c

Modified: head/sys/cam/scsi/scsi_da.c
==
--- head/sys/cam/scsi/scsi_da.c Thu Mar 23 10:48:10 2017(r315856)
+++ head/sys/cam/scsi/scsi_da.c Thu Mar 23 10:50:45 2017(r315857)
@@ -2546,7 +2546,6 @@ daregister(struct cam_periph *periph, vo
if ((cpi.hba_misc & PIM_UNMAPPED) != 0) {
softc->unmappedio = 1;
softc->disk->d_flags |= DISKFLAG_UNMAPPED_BIO;
-   xpt_print(periph->path, "UNMAPPED\n");
}
cam_strvis(softc->disk->d_descr, cgd->inq_data.vendor,
sizeof(cgd->inq_data.vendor), sizeof(softc->disk->d_descr));
___
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: r315850 - head/sys/boot/forth

2017-03-23 Thread Bruce Evans

On Thu, 23 Mar 2017, [UTF-8] Dag-Erling Sm??rgrav wrote:


Log:
 The original author abused Nd (one-line description, used by makewhatis)
 for its side effect of producing an en-dash.  This broke whatis with
 newer versions of mdocml.  Use \(en instead.


Nd (or is it mumble-dash?) is broken for all man pages.  Old man renders
the dash for Nd as 2 hyphens in ascii.  New man renders it as 1 hyphen in
ascii.  postscript output is even more broken.  Old man renders the dash
for Nd as an especially wide one.  New man still seems to render it as 1
hyphen, and hyphens are especially narrow in postscript output for new
man (they are 1.5 to 2 times narrower than with old man, and that is with
a larger font for the smaller hyphens).  Altogther, the dash for Nd is
about 4 times larger with old man after adjusting for the font size
(about 3 average characters wide instead of 3/4).

Whatever the dash for Nd is, it shouldn't look like a hyphen.

I compared the output of "man ls.1 | col -bx".  The diffs were too large
due to different policies for splitting lines, but this and 2 other known
bugs were obvious (the others are sentence breaks after complicated sentence
terminations like ".)", and -width not working giving misformatted tables
and lists).  Different justification was even more obvious.  -Tascii uses
hyphens to split long lines with old man only, and this allows perfect
right justification in postscript output for old man only.  New man
apparently doesn't try to right justify for -Tps any more than with -Tascii.

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: r315858 - head/sys/dev/aacraid

2017-03-23 Thread Andriy Gapon
Author: avg
Date: Thu Mar 23 11:59:17 2017
New Revision: 315858
URL: https://svnweb.freebsd.org/changeset/base/315858

Log:
  aacraid: rework r315083 for a clean build with and without AACRAID_DEBUG
  
  r315083 essentially reverted r263954 which was made for a good reason,
  but didn't take into account AACRAID_DEBUG.
  Now both types of build should be clean.
  
  MFC after:5 days
  No MFC to:stable/10

Modified:
  head/sys/dev/aacraid/aacraid_cam.c

Modified: head/sys/dev/aacraid/aacraid_cam.c
==
--- head/sys/dev/aacraid/aacraid_cam.c  Thu Mar 23 10:50:45 2017
(r315857)
+++ head/sys/dev/aacraid/aacraid_cam.c  Thu Mar 23 11:59:17 2017
(r315858)
@@ -243,13 +243,11 @@ static int
 aac_cam_probe(device_t dev)
 {
struct aac_cam *camsc;
-   struct aac_softc *sc;
 
camsc = (struct aac_cam *)device_get_softc(dev);
if (!camsc->inf)
return (0);
-   sc = camsc->inf->aac_sc;
-   fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
+   fwprintf(camsc->inf->aac_sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
return (0);
 }
 
@@ -1136,11 +1134,9 @@ static void
 aac_container_complete(struct aac_command *cm)
 {
union   ccb *ccb;
-   struct  aac_softc *sc;
u_int32_t status;
 
-   sc = cm->cm_sc;
-   fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
+   fwprintf(cm->cm_sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
ccb = cm->cm_ccb;
status = ((u_int32_t *)cm->cm_fib->data)[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: r315701 - in head/sys: amd64/cloudabi32 amd64/cloudabi64 arm/cloudabi32 arm64/cloudabi64 i386/cloudabi32

2017-03-23 Thread Konstantin Belousov
On Thu, Mar 23, 2017 at 08:43:20AM +0100, Ed Schouten wrote:
> Thanks! I just gave the patch a try, but the comparison added to
> imgact_elf.c now causes the brandinfo to be skipped entirely. Attached
> is a patch that does work for me.
> 
> Index: sys/kern/imgact_elf.c
> ===
> --- sys/kern/imgact_elf.c (revision 315828)
> +++ sys/kern/imgact_elf.c (working copy)
> @@ -312,8 +312,9 @@
>   continue;
>   if (hdr->e_machine == bi->machine &&
>   (hdr->e_ident[EI_OSABI] == bi->brand ||
> + (bi->compat_3_brand != NULL &&
>   strcmp((const char *)&hdr->e_ident[OLD_EI_BRAND],
> - bi->compat_3_brand) == 0)) {
> + bi->compat_3_brand) == 0))) {
>   /* Looks good, but give brand a chance to veto */
>   if (!bi->header_supported ||
>   bi->header_supported(imgp)) {

This looks fine, please 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: r315859 - head/sys/compat/linuxkpi/common/include/asm

2017-03-23 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Mar 23 13:28:16 2017
New Revision: 315859
URL: https://svnweb.freebsd.org/changeset/base/315859

Log:
  Function macros are preferred in the LinuxKPI.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/asm/atomic.h

Modified: head/sys/compat/linuxkpi/common/include/asm/atomic.h
==
--- head/sys/compat/linuxkpi/common/include/asm/atomic.hThu Mar 23 
11:59:17 2017(r315858)
+++ head/sys/compat/linuxkpi/common/include/asm/atomic.hThu Mar 23 
13:28:16 2017(r315859)
@@ -191,7 +191,7 @@ atomic_cmpxchg(atomic_t *v, int old, int
__ret;  \
 })
 
-#definecmpxchg_relaxed cmpxchg
+#definecmpxchg_relaxed(...)cmpxchg(__VA_ARGS__)
 
 #definexchg(ptr, v) ({ \
__typeof(*(ptr)) __ret; \
___
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: r315860 - head/sys/kern

2017-03-23 Thread Ed Schouten
Author: ed
Date: Thu Mar 23 14:09:45 2017
New Revision: 315860
URL: https://svnweb.freebsd.org/changeset/base/315860

Log:
  Don't require the presence of the compat_3_brand.
  
  The existing ELF image activator requires the brandinfo to provide such
  a string unconditionally, even if the executable format in question
  doesn't use this type of branding. Skip matching when it's a null
  pointer.
  
  Reviewed by:  kib
  MFC after:2 weeks

Modified:
  head/sys/kern/imgact_elf.c

Modified: head/sys/kern/imgact_elf.c
==
--- head/sys/kern/imgact_elf.c  Thu Mar 23 13:28:16 2017(r315859)
+++ head/sys/kern/imgact_elf.c  Thu Mar 23 14:09:45 2017(r315860)
@@ -312,8 +312,9 @@ __elfN(get_brandinfo)(struct image_param
continue;
if (hdr->e_machine == bi->machine &&
(hdr->e_ident[EI_OSABI] == bi->brand ||
+   (bi->compat_3_brand != NULL &&
strcmp((const char *)&hdr->e_ident[OLD_EI_BRAND],
-   bi->compat_3_brand) == 0)) {
+   bi->compat_3_brand) == 0))) {
/* Looks good, but give brand a chance to veto */
if (!bi->header_supported ||
bi->header_supported(imgp)) {
___
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: r315861 - in head/sys: amd64/cloudabi32 amd64/cloudabi64 arm/cloudabi32 arm64/cloudabi64 i386/cloudabi32

2017-03-23 Thread Ed Schouten
Author: ed
Date: Thu Mar 23 14:12:21 2017
New Revision: 315861
URL: https://svnweb.freebsd.org/changeset/base/315861

Log:
  Stop providing the compat_3_brand.
  
  As of r315860, the ELF image activator works fine for CloudABI without it.
  
  Reviewed by:  kib
  MFC after:2 weeks

Modified:
  head/sys/amd64/cloudabi32/cloudabi32_sysvec.c
  head/sys/amd64/cloudabi64/cloudabi64_sysvec.c
  head/sys/arm/cloudabi32/cloudabi32_sysvec.c
  head/sys/arm64/cloudabi64/cloudabi64_sysvec.c
  head/sys/i386/cloudabi32/cloudabi32_sysvec.c

Modified: head/sys/amd64/cloudabi32/cloudabi32_sysvec.c
==
--- head/sys/amd64/cloudabi32/cloudabi32_sysvec.c   Thu Mar 23 14:09:45 
2017(r315860)
+++ head/sys/amd64/cloudabi32/cloudabi32_sysvec.c   Thu Mar 23 14:12:21 
2017(r315861)
@@ -227,6 +227,5 @@ Elf32_Brandinfo cloudabi32_brand = {
.brand  = ELFOSABI_CLOUDABI,
.machine= EM_386,
.sysvec = &cloudabi32_elf_sysvec,
-   .compat_3_brand = "CloudABI",
.flags  = BI_BRAND_ONLY_STATIC,
 };

Modified: head/sys/amd64/cloudabi64/cloudabi64_sysvec.c
==
--- head/sys/amd64/cloudabi64/cloudabi64_sysvec.c   Thu Mar 23 14:09:45 
2017(r315860)
+++ head/sys/amd64/cloudabi64/cloudabi64_sysvec.c   Thu Mar 23 14:12:21 
2017(r315861)
@@ -213,5 +213,4 @@ Elf64_Brandinfo cloudabi64_brand = {
.machine= EM_X86_64,
.sysvec = &cloudabi64_elf_sysvec,
.flags  = BI_CAN_EXEC_DYN | BI_BRAND_ONLY_STATIC,
-   .compat_3_brand = "CloudABI",
 };

Modified: head/sys/arm/cloudabi32/cloudabi32_sysvec.c
==
--- head/sys/arm/cloudabi32/cloudabi32_sysvec.c Thu Mar 23 14:09:45 2017
(r315860)
+++ head/sys/arm/cloudabi32/cloudabi32_sysvec.c Thu Mar 23 14:12:21 2017
(r315861)
@@ -189,6 +189,5 @@ Elf32_Brandinfo cloudabi32_brand = {
.brand  = ELFOSABI_CLOUDABI,
.machine= EM_ARM,
.sysvec = &cloudabi32_elf_sysvec,
-   .compat_3_brand = "CloudABI",
.flags  = BI_BRAND_ONLY_STATIC,
 };

Modified: head/sys/arm64/cloudabi64/cloudabi64_sysvec.c
==
--- head/sys/arm64/cloudabi64/cloudabi64_sysvec.c   Thu Mar 23 14:09:45 
2017(r315860)
+++ head/sys/arm64/cloudabi64/cloudabi64_sysvec.c   Thu Mar 23 14:12:21 
2017(r315861)
@@ -182,5 +182,4 @@ Elf64_Brandinfo cloudabi64_brand = {
.machine= EM_AARCH64,
.sysvec = &cloudabi64_elf_sysvec,
.flags  = BI_CAN_EXEC_DYN | BI_BRAND_ONLY_STATIC,
-   .compat_3_brand = "CloudABI",
 };

Modified: head/sys/i386/cloudabi32/cloudabi32_sysvec.c
==
--- head/sys/i386/cloudabi32/cloudabi32_sysvec.cThu Mar 23 14:09:45 
2017(r315860)
+++ head/sys/i386/cloudabi32/cloudabi32_sysvec.cThu Mar 23 14:12:21 
2017(r315861)
@@ -200,6 +200,5 @@ Elf32_Brandinfo cloudabi32_brand = {
.brand  = ELFOSABI_CLOUDABI,
.machine= EM_386,
.sysvec = &cloudabi32_elf_sysvec,
-   .compat_3_brand = "CloudABI",
.flags  = BI_BRAND_ONLY_STATIC,
 };
___
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: r315862 - head/lib/libcasper/libcasper

2017-03-23 Thread Robert Watson
Author: rwatson
Date: Thu Mar 23 14:35:21 2017
New Revision: 315862
URL: https://svnweb.freebsd.org/changeset/base/315862

Log:
  In libcasper, prefer to send a function index or service name over the IPC
  channel to a zygote process, rather than sending a function pointer or
  service pointer.  This avoids transfering pointers between address spaces,
  which while robust in this case (due to the zygote being forked() from the
  parent) is not generally a good idea, especially in the presence of
  increasingly popular control-flow integrity and pointer protection
  mitigation schemes.  With this change, ping(8) and other sandboxed tools
  using libcasper for DNS resolution now work on architectures with tagged
  memory again.
  
  Reviewed by:  oshogbo
  MFC after:1 week
  Sponsored by: DARPA, AFRL

Modified:
  head/lib/libcasper/libcasper/libcasper_service.c
  head/lib/libcasper/libcasper/zygote.c
  head/lib/libcasper/libcasper/zygote.h

Modified: head/lib/libcasper/libcasper/libcasper_service.c
==
--- head/lib/libcasper/libcasper/libcasper_service.cThu Mar 23 14:12:21 
2017(r315861)
+++ head/lib/libcasper/libcasper/libcasper_service.cThu Mar 23 14:35:21 
2017(r315862)
@@ -1,11 +1,16 @@
 /*-
  * Copyright (c) 2012 The FreeBSD Foundation
  * Copyright (c) 2015 Mariusz Zaborski 
+ * Copyright (c) 2017 Robert N. M. Watson
  * All rights reserved.
  *
  * This software was developed by Pawel Jakub Dawidek under sponsorship from
  * the FreeBSD Foundation.
  *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -130,18 +135,25 @@ casper_limit(const nvlist_t *oldlimits, 
return (0);
 }
 
-static void
+void
 service_execute(int chanfd)
 {
+   struct casper_service *casserv;
struct service *service;
+   const char *servname;
nvlist_t *nvl;
int procfd;
 
nvl = nvlist_recv(chanfd, 0);
if (nvl == NULL)
exit(1);
-   service = (struct service *)(uintptr_t)nvlist_take_number(nvl,
-   "service");
+   if (!nvlist_exists_string(nvl, "service"))
+   exit(1);
+   servname = nvlist_get_string(nvl, "service");
+   casserv = service_find(servname);
+   if (casserv == NULL)
+   exit(1);
+   service = casserv->cs_service;
procfd = nvlist_take_descriptor(nvl, "procfd");
nvlist_destroy(nvl);
 
@@ -172,12 +184,11 @@ casper_command(const char *cmd, const nv
if (!casper_allowed_service(limits, servname))
return (ENOTCAPABLE);
 
-   if (zygote_clone(service_execute, &chanfd, &procfd) == -1)
+   if (zygote_clone_service_execute(&chanfd, &procfd) == -1)
return (errno);
 
nvl = nvlist_create(0);
-   nvlist_add_number(nvl, "service",
-   (uint64_t)(uintptr_t)casserv->cs_service);
+   nvlist_add_string(nvl, "service", servname);
nvlist_move_descriptor(nvl, "procfd", procfd);
if (nvlist_send(chanfd, nvl) == -1) {
error = errno;

Modified: head/lib/libcasper/libcasper/zygote.c
==
--- head/lib/libcasper/libcasper/zygote.c   Thu Mar 23 14:12:21 2017
(r315861)
+++ head/lib/libcasper/libcasper/zygote.c   Thu Mar 23 14:35:21 2017
(r315862)
@@ -1,11 +1,16 @@
 /*-
  * Copyright (c) 2012 The FreeBSD Foundation
  * Copyright (c) 2015 Mariusz Zaborski 
- * All rights reserved.
+ * Copyright (c) 2017 Robert N. M. Watson
  *
  * This software was developed by Pawel Jakub Dawidek under sponsorship from
  * the FreeBSD Foundation.
  *
+ * All rights reserved.
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -50,8 +55,10 @@ __FBSDID("$FreeBSD$");
 /* Zygote info. */
 static int zygote_sock = -1;
 
+#defineZYGOTE_SERVICE_EXECUTE  1
+
 int
-zygote_clone(zygote_func_t *func, int *chanfdp, int *procfdp)
+zygote_clone(uint64_t funcidx, int *chanfdp, int *procfdp)
 {
nvlist_t *nvl;
int error;
@@ -63,7 +70,7 @@ zygote_clone(zygote_func_t *func, int *c
}
 
nvl = nvlist_create(0);
-   nvlist_add_number(nvl, "func", (uint64_t)(uintptr_t)func);
+   nvlist_add_number(nvl, "funcidx", funcidx);
nvl = nvlist_xfer(zygote_sock,

Re: svn commit: r315856 - in head/sys/compat/linuxkpi/common: include/linux src

2017-03-23 Thread Conrad Meyer
On Thu, Mar 23, 2017 at 3:48 AM, Hans Petter Selasky
 wrote:
> Author: hselasky
> Date: Thu Mar 23 10:48:10 2017
> New Revision: 315856
> URL: https://svnweb.freebsd.org/changeset/base/315856
>
> Log:
>   Add support for ratelimited printouts in the LinuxKPI.
>
> ...
 --- head/sys/compat/linuxkpi/common/include/linux/kernel.h  Thu
Mar 23 10:43:29 2017(r315855)
> +++ head/sys/compat/linuxkpi/common/include/linux/kernel.h  Thu Mar 23 
> 10:48:10 2017(r315856)
> @@ -224,6 +224,11 @@ scnprintf(char *buf, size_t size, const
> log_once(LOG_INFO, pr_fmt(fmt), ##__VA_ARGS__)
>  #define pr_cont(fmt, ...) \
> printk(KERN_CONT fmt, ##__VA_ARGS__)
> +#definepr_warn_ratelimited(...) do {   \
> +   static time_t __ratelimited;\
> +   if (linux_ratelimited(&__ratelimited))  \
> +   pr_warning(__VA_ARGS__);\
> +} while (0)
>
>  #ifndef WARN
>  #defineWARN(condition, ...) ({ \
> @@ -331,4 +336,6 @@ abs64(int64_t x)
> return (x < 0 ? -x : x);
>  }
>
> +extern bool linux_ratelimited(time_t *);
> +
>  #endif /* _LINUX_KERNEL_H_ */
>
> Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c
> ==
> --- head/sys/compat/linuxkpi/common/src/linux_compat.c  Thu Mar 23 10:43:29 
> 2017(r315855)
> +++ head/sys/compat/linuxkpi/common/src/linux_compat.c  Thu Mar 23 10:48:10 
> 2017(r315856)
> @@ -1484,6 +1484,20 @@ __unregister_chrdev(unsigned int major,
>  bool linux_cpu_has_clflush;
>  #endif
>
> +bool
> +linux_ratelimited(time_t *ptime)
> +{
> +   /* make sure uptime is not zero by OR'ing bit 31 */
> +   time_t curr = time_uptime | (1U << 31);
> +
> +   /* check if one or more seconds have passed */
> +   if (*ptime != curr) {
> +   *ptime = curr;
> +   return (1);
> +   }
> +   return (0);
> +}
> +


Hi Hans,

Is there any reason to use this hand-rolled thing to limit ratelimited
logging instead of ppsratecheck()?

Best,
Conrad
___
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: r315856 - in head/sys/compat/linuxkpi/common: include/linux src

2017-03-23 Thread Hans Petter Selasky

On 03/23/17 16:21, Conrad Meyer wrote:


Hi Hans,

Is there any reason to use this hand-rolled thing to limit ratelimited
logging instead of ppsratecheck()?


I can convert the code into using ppsratecheck(). I wasn't aware about 
that function.


--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: r315863 - head/sys/compat/linuxkpi/common/include/linux

2017-03-23 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Mar 23 16:01:51 2017
New Revision: 315863
URL: https://svnweb.freebsd.org/changeset/base/315863

Log:
  Add proper error checking for the string to number conversion
  functions in the LinuxKPI.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/kernel.h

Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h
==
--- head/sys/compat/linuxkpi/common/include/linux/kernel.h  Thu Mar 23 
14:35:21 2017(r315862)
+++ head/sys/compat/linuxkpi/common/include/linux/kernel.h  Thu Mar 23 
16:01:51 2017(r315863)
@@ -256,11 +256,98 @@ scnprintf(char *buf, size_t size, const 
   
 #defineARRAY_SIZE(x)   (sizeof(x) / sizeof((x)[0]))
 
-#definesimple_strtoul(...) strtoul(__VA_ARGS__)
-#definesimple_strtol(...) strtol(__VA_ARGS__)
-#definekstrtol(a,b,c) ({*(c) = strtol(a,0,b); 0;})
-#definekstrtoint(a,b,c) ({*(c) = strtol(a,0,b); 0;})
-#definekstrtouint(a,b,c) ({*(c) = strtol(a,0,b); 0;})
+static inline unsigned long long
+simple_strtoull(const char *cp, char **endp, unsigned int base)
+{
+   return (strtouq(cp, endp, base));
+}
+
+static inline long long
+simple_strtoll(const char *cp, char **endp, unsigned int base)
+{
+   return (strtoq(cp, endp, base));
+}
+
+static inline unsigned long
+simple_strtoul(const char *cp, char **endp, unsigned int base)
+{
+   return (strtoul(cp, endp, base));
+}
+
+static inline long
+simple_strtol(const char *cp, char **endp, unsigned int base)
+{
+   return (strtol(cp, endp, base));
+}
+
+static inline int
+kstrtoul(const char *cp, unsigned int base, unsigned long *res)
+{
+   char *end;
+
+   *res = strtoul(cp, &end, base);
+
+   if (*cp == 0 || *end != 0)
+   return (-EINVAL);
+   return (0);
+}
+
+static inline int
+kstrtol(const char *cp, unsigned int base, long *res)
+{
+   char *end;
+
+   *res = strtol(cp, &end, base);
+
+   if (*cp == 0 || *end != 0)
+   return (-EINVAL);
+   return (0);
+}
+
+static inline int
+kstrtoint(const char *cp, unsigned int base, int *res)
+{
+   char *end;
+   long temp;
+
+   *res = temp = strtol(cp, &end, base);
+
+   if (*cp == 0 || *end != 0)
+   return (-EINVAL);
+   if (temp != (int)temp)
+   return (-ERANGE);
+   return (0);
+}
+
+static inline int
+kstrtouint(const char *cp, unsigned int base, unsigned int *res)
+{
+   char *end;
+   unsigned long temp;
+
+   *res = temp = strtoul(cp, &end, base);
+
+   if (*cp == 0 || *end != 0)
+   return (-EINVAL);
+   if (temp != (unsigned int)temp)
+   return (-ERANGE);
+   return (0);
+}
+
+static inline int
+kstrtou32(const char *cp, unsigned int base, u32 *res)
+{
+   char *end;
+   unsigned long temp;
+
+   *res = temp = strtoul(cp, &end, base);
+
+   if (*cp == 0 || *end != 0)
+   return (-EINVAL);
+   if (temp != (u32)temp)
+   return (-ERANGE);
+   return (0);
+}
 
 #define min(x, y)  ((x) < (y) ? (x) : (y))
 #define max(x, y)  ((x) > (y) ? (x) : (y))
___
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: r315864 - in head/sys/compat/linuxkpi/common: include/linux src

2017-03-23 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Mar 23 16:23:55 2017
New Revision: 315864
URL: https://svnweb.freebsd.org/changeset/base/315864

Log:
  Use ppsratecheck() for ratelimiting in the LinuxKPI.
  
  Suggested by: cem @
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/device.h
  head/sys/compat/linuxkpi/common/include/linux/kernel.h
  head/sys/compat/linuxkpi/common/src/linux_compat.c

Modified: head/sys/compat/linuxkpi/common/include/linux/device.h
==
--- head/sys/compat/linuxkpi/common/include/linux/device.h  Thu Mar 23 
16:01:51 2017(r315863)
+++ head/sys/compat/linuxkpi/common/include/linux/device.h  Thu Mar 23 
16:23:55 2017(r315864)
@@ -145,13 +145,13 @@ show_class_attr_string(struct class *cla
device_printf((dev)->bsddev, fmt, ##__VA_ARGS__)
 
 #definedev_err_ratelimited(dev, ...) do {  \
-   static time_t __ratelimited;\
+   static linux_ratelimit_t __ratelimited; \
if (linux_ratelimited(&__ratelimited))  \
dev_err(dev, __VA_ARGS__);  \
 } while (0)
 
 #definedev_warn_ratelimited(dev, ...) do { \
-   static time_t __ratelimited;\
+   static linux_ratelimit_t __ratelimited; \
if (linux_ratelimited(&__ratelimited))  \
dev_warn(dev, __VA_ARGS__); \
 } while (0)

Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h
==
--- head/sys/compat/linuxkpi/common/include/linux/kernel.h  Thu Mar 23 
16:01:51 2017(r315863)
+++ head/sys/compat/linuxkpi/common/include/linux/kernel.h  Thu Mar 23 
16:23:55 2017(r315864)
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -225,7 +226,7 @@ scnprintf(char *buf, size_t size, const 
 #define pr_cont(fmt, ...) \
printk(KERN_CONT fmt, ##__VA_ARGS__)
 #definepr_warn_ratelimited(...) do {   \
-   static time_t __ratelimited;\
+   static linux_ratelimit_t __ratelimited; \
if (linux_ratelimited(&__ratelimited))  \
pr_warning(__VA_ARGS__);\
 } while (0)
@@ -423,6 +424,15 @@ abs64(int64_t x)
return (x < 0 ? -x : x);
 }
 
-extern bool linux_ratelimited(time_t *);
+typedef struct linux_ratelimit {
+   struct timeval lasttime;
+   int counter;
+} linux_ratelimit_t;
+
+static inline bool
+linux_ratelimited(linux_ratelimit_t *rl)
+{
+   return (ppsratecheck(&rl->lasttime, &rl->counter, 1));
+}
 
 #endif /* _LINUX_KERNEL_H_ */

Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c
==
--- head/sys/compat/linuxkpi/common/src/linux_compat.c  Thu Mar 23 16:01:51 
2017(r315863)
+++ head/sys/compat/linuxkpi/common/src/linux_compat.c  Thu Mar 23 16:23:55 
2017(r315864)
@@ -1484,20 +1484,6 @@ __unregister_chrdev(unsigned int major, 
 bool linux_cpu_has_clflush;
 #endif
 
-bool
-linux_ratelimited(time_t *ptime)
-{
-   /* make sure uptime is not zero by OR'ing bit 31 */
-   time_t curr = time_uptime | (1U << 31);
-
-   /* check if one or more seconds have passed */
-   if (*ptime != curr) {
-   *ptime = curr;
-   return (1);
-   }
-   return (0);
-}
-
 static void
 linux_compat_init(void *arg)
 {
___
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: r315850 - head/sys/boot/forth

2017-03-23 Thread Conrad Meyer
On Thu, Mar 23, 2017 at 4:21 AM, Bruce Evans  wrote:
> On Thu, 23 Mar 2017, [UTF-8] Dag-Erling Smørgrav wrote:
>
>> Log:
>>  The original author abused Nd (one-line description, used by makewhatis)
>>  for its side effect of producing an en-dash.  This broke whatis with
>>  newer versions of mdocml.  Use \(en instead.
>
>
> Nd (or is it mumble-dash?) is broken for all man pages.  Old man renders
> the dash for Nd as 2 hyphens in ascii.  New man renders it as 1 hyphen in
> ascii.  postscript output is even more broken.  Old man renders the dash
> for Nd as an especially wide one.  New man still seems to render it as 1
> hyphen, and hyphens are especially narrow in postscript output for new
> man (they are 1.5 to 2 times narrower than with old man, and that is with
> a larger font for the smaller hyphens).  Altogther, the dash for Nd is
> about 4 times larger with old man after adjusting for the font size
> (about 3 average characters wide instead of 3/4).
>
> Whatever the dash for Nd is, it shouldn't look like a hyphen.

Yep.  In this context an 'em' dash should be used instead of an 'en'
dash.  Theoretically, there also should not be spaces around the
dashes.  I'm not sure that's easy to do in manual pages, though.

http://www.thepunctuationguide.com/em-dash.html
http://www.thepunctuationguide.com/en-dash.html

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

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

2017-03-23 Thread Roman Divacky
On Thu, Mar 23, 2017 at 02:36:51AM +, Warner Losh wrote:
> Author: imp
> Date: Thu Mar 23 02:36:51 2017
> New Revision: 315773
> URL: https://svnweb.freebsd.org/changeset/base/315773
> 
> Log:
>   Implement quote escaping. String values may now contain " if you
>   it is preceded by \.
>   
>   foo="I \"like\" C++"
>   
>   gives the value 'I "like" C++' to the variable 'foo'. If a character
>   other than " follows the \, both the \ and that character are passed
>   through.
>   
>   Differential Revision: https://reviews.freebsd.org/D6286
>   Sponsored by: Netflix
> 
> Modified:
>   head/sbin/devd/devd.cc
>   head/sbin/devd/devd.hh
> 
> Modified: head/sbin/devd/devd.cc
> ==
> --- head/sbin/devd/devd.ccThu Mar 23 02:33:27 2017(r315772)
> +++ head/sbin/devd/devd.ccThu Mar 23 02:36:51 2017(r315773)
> @@ -411,6 +411,32 @@ var_list::is_set(const string &var) cons
>   return (_vars.find(var) != _vars.end());
>  }
>  
> +/** fix_value
> + *
> + * Removes quoted characters that have made it this far. \" are
> + * converted to ". For all other characters, both \ and following
> + * character. So the string 'fre\:\"' is translated to 'fred\:"'.
> + */
> +const std::string &
> +var_list::fix_value(const std::string &val) const
> +{
> + char *tmp, *dst;
> + const char *src;
> + std::string *rv;
> +
> + dst = tmp = new char[val.length()];
> + src = val.c_str();
> + while (*src) {
> + if (*src == '\\' && src[1] == '"')
> + src++;
> + else
> + *dst++ = *src++;
> + }
> + rv = new string(tmp);
> + delete tmp;
> + return *rv;
> +}

Can the temporary char[] be stack allocated? Also, when returning a reference to
a heap allocated string who is responsible for freeing it? Perhaps you can just
return std::string and let the compiler optimize it?

Roman
___
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: r315866 - in head/sys: dev/bhnd/nvram mips/broadcom

2017-03-23 Thread Landon J. Fuller
Author: landonf
Date: Thu Mar 23 19:29:12 2017
New Revision: 315866
URL: https://svnweb.freebsd.org/changeset/base/315866

Log:
  [mips/broadcom]: Early boot NVRAM support
  
  Add support for early boot access to NVRAM variables, using a new
  bhnd_nvram_data_getvar_direct() API to support zero-allocation direct
  reading of NVRAM variables from a bhnd_nvram_io instance backed by the
  CFE NVRAM device.
  
  Approved by:  adrian (mentor)
  Differential Revision:https://reviews.freebsd.org/D9913

Modified:
  head/sys/dev/bhnd/nvram/bhnd_nvram_data.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcmraw.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcmvar.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_btxt.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom_subr.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_spromvar.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_tlv.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_datavar.h
  head/sys/dev/bhnd/nvram/bhnd_sprom.c
  head/sys/mips/broadcom/bcm_machdep.c
  head/sys/mips/broadcom/bcm_machdep.h
  head/sys/mips/broadcom/bcm_nvram_cfe.c
  head/sys/mips/broadcom/bcm_nvram_cfevar.h

Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data.c
==
--- head/sys/dev/bhnd/nvram/bhnd_nvram_data.c   Thu Mar 23 17:11:34 2017
(r315865)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram_data.c   Thu Mar 23 19:29:12 2017
(r315866)
@@ -228,6 +228,41 @@ bhnd_nvram_data_probe_classes(struct bhn
 }
 
 /**
+ * Read a variable directly from @p io and decode as @p type.
+ * 
+ * This may be used to perform reading of NVRAM variables during the very
+ * early boot process, prior to the availability of the kernel allocator.
+ *
+ * @param  cls An NVRAM class capable of parsing @p io.
+ * @param  io  NVRAM data to be parsed.
+ * @param  nameThe raw name of the variable to be fetched,
+ * including any device path (/pci/1/1/varname) or
+ * alias prefix (0:varname).
+ * @param[out] buf On success, the requested value will be written
+ * to this buffer. This argment may be NULL if
+ * the value is not desired.
+ * @param[in,out]  len The capacity of @p buf. On success, will be set
+ * to the actual size of the requested value.
+ * @param  typeThe data type to be written to @p buf.
+ *
+ * @retval 0   success
+ * @retval ENOMEM  If @p buf is non-NULL and a buffer of @p len is too
+ * small to hold the requested value.
+ * @retval ENOENT  If @p name is not found in @p io.
+ * @retval EFTYPE  If the variable data cannot be coerced to @p type.
+ * @retval ERANGE  If value coercion would overflow @p type.
+ * @retval non-zeroIf parsing @p io otherwise fails, a regular unix error
+ * code will be returned.
+ */
+int
+bhnd_nvram_data_getvar_direct(bhnd_nvram_data_class *cls,
+struct bhnd_nvram_io *io, const char *name, void *buf, size_t *len,
+bhnd_nvram_type type)
+{
+   return (cls->op_getvar_direct(io, name, buf, len, type));
+}
+
+/**
  * Allocate and initialize a new instance of data class @p cls, copying and
  * parsing NVRAM data from @p io.
  *

Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data.h
==
--- head/sys/dev/bhnd/nvram/bhnd_nvram_data.h   Thu Mar 23 17:11:34 2017
(r315865)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram_data.h   Thu Mar 23 19:29:12 2017
(r315866)
@@ -105,6 +105,11 @@ int bhnd_nvram_data_probe_classes(
 bhnd_nvram_data_class *classes[],
 size_t num_classes);
 
+int bhnd_nvram_data_getvar_direct(
+bhnd_nvram_data_class *cls,
+struct bhnd_nvram_io *io, const char *name,
+void *buf, size_t *len, bhnd_nvram_type type);
+
 int bhnd_nvram_data_new(bhnd_nvram_data_class *cls,
 struct bhnd_nvram_data **nv,
   struct bhnd_nvram_io *io);

Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c
==
--- head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c   Thu Mar 23 17:11:34 
2017(r315865)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c   Thu Mar 23 19:29:12 
2017(r315866)
@@ -144,9 +144,229 @@ bhnd_nvram_bcm_probe(struct bhnd_nvram_i
if (le32toh(hdr.magic) != BCM_NVRAM_MAGIC)
return (ENXIO);
 
+   if (le32toh(hdr.size) > bhnd_nvram_io

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

2017-03-23 Thread Ian Lepore
On Thu, 2017-03-23 at 19:58 +0100, Roman Divacky wrote:
> On Thu, Mar 23, 2017 at 02:36:51AM +, Warner Losh wrote:
> > 
> > Author: imp
> > Date: Thu Mar 23 02:36:51 2017
> > New Revision: 315773
> > URL: https://svnweb.freebsd.org/changeset/base/315773
> > 
> > Log:
> >   Implement quote escaping. String values may now contain " if you
> >   it is preceded by \.
> >   
> >   foo="I \"like\" C++"
> >   
> >   gives the value 'I "like" C++' to the variable 'foo'. If a
> > character
> >   other than " follows the \, both the \ and that character are
> > passed
> >   through.
> >   
> >   Differential Revision: https://reviews.freebsd.org/D6286
> >   Sponsored by: Netflix
> > 
> > Modified:
> >   head/sbin/devd/devd.cc
> >   head/sbin/devd/devd.hh
> > 
> > Modified: head/sbin/devd/devd.cc
> > ===
> > ===
> > --- head/sbin/devd/devd.cc  Thu Mar 23 02:33:27 2017(
> > r315772)
> > +++ head/sbin/devd/devd.cc  Thu Mar 23 02:36:51 2017(
> > r315773)
> > @@ -411,6 +411,32 @@ var_list::is_set(const string &var) cons
> >     return (_vars.find(var) != _vars.end());
> >  }
> >  
> > +/** fix_value
> > + *
> > + * Removes quoted characters that have made it this far. \" are
> > + * converted to ". For all other characters, both \ and following
> > + * character. So the string 'fre\:\"' is translated to 'fred\:"'.
> > + */
> > +const std::string &
> > +var_list::fix_value(const std::string &val) const
> > +{
> > +   char *tmp, *dst;
> > +   const char *src;
> > +   std::string *rv;
> > +
> > +   dst = tmp = new char[val.length()];
> > +   src = val.c_str();
> > +   while (*src) {
> > +   if (*src == '\\' && src[1] == '"')
> > +   src++;
> > +   else
> > +   *dst++ = *src++;
> > +   }
> > +   rv = new string(tmp);
> > +   delete tmp;
> > +   return *rv;
> > +}
> Can the temporary char[] be stack allocated? Also, when returning a
> reference to
> a heap allocated string who is responsible for freeing it? Perhaps
> you can just
> return std::string and let the compiler optimize it?
> 
> Roman
> 

Returning a reference to a new'd string is not good.

IMO, the implementation of the function should take into account the
idea that embedded escaped quotes are rare.  The function should be
optimized for readability and the common case of simply copying the
string unmodified, something like:


std::string
var_list::fix_value(const std::string &val) const
{
std::string rv(val);
std::string::size_type pos(0);

while ((pos = rv.find("\\\"", pos)) != rv.npos) {
rv.erase(pos, 1);
}
return (rv);
}

-- 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: r315867 - head/sys/i386/i386

2017-03-23 Thread Gleb Smirnoff
Author: glebius
Date: Thu Mar 23 19:54:41 2017
New Revision: 315867
URL: https://svnweb.freebsd.org/changeset/base/315867

Log:
  Remove Solaris 2.6 syscalls selector.
  
  Discussed with:   kib

Modified:
  head/sys/i386/i386/machdep.c

Modified: head/sys/i386/i386/machdep.c
==
--- head/sys/i386/i386/machdep.cThu Mar 23 19:29:12 2017
(r315866)
+++ head/sys/i386/i386/machdep.cThu Mar 23 19:54:41 2017
(r315867)
@@ -2449,7 +2449,6 @@ init386(int first)
/* XXX does this work? */
/* XXX yes! */
ldt[LBSDICALLS_SEL] = ldt[LSYS5CALLS_SEL];
-   ldt[LSOL26CALLS_SEL] = ldt[LSYS5CALLS_SEL];
 
/* transfer to user mode */
 
___
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: r315869 - head/sys/dev/isp

2017-03-23 Thread Alexander Motin
Author: mav
Date: Thu Mar 23 21:11:55 2017
New Revision: 315869
URL: https://svnweb.freebsd.org/changeset/base/315869

Log:
  Remove write-only crn field from struct isp_pcmd.
  
  MFC after:2 weeks

Modified:
  head/sys/dev/isp/isp_freebsd.c
  head/sys/dev/isp/isp_freebsd.h

Modified: head/sys/dev/isp/isp_freebsd.c
==
--- head/sys/dev/isp/isp_freebsd.c  Thu Mar 23 20:23:00 2017
(r315868)
+++ head/sys/dev/isp/isp_freebsd.c  Thu Mar 23 21:11:55 2017
(r315869)
@@ -731,7 +731,6 @@ isp_free_pcmd(ispsoftc_t *isp, union ccb
if (ISP_PCMD(ccb)) {
 #ifdef ISP_TARGET_MODE
PISP_PCMD(ccb)->datalen = 0;
-   PISP_PCMD(ccb)->crn = 0;
 #endif
PISP_PCMD(ccb)->next = isp->isp_osinfo.pcmd_free;
isp->isp_osinfo.pcmd_free = ISP_PCMD(ccb);
@@ -4209,7 +4208,6 @@ isp_fcp_next_crn(ispsoftc_t *isp, uint8_
}
if (nxp->crnseed == 0)
nxp->crnseed = 1;
-   PISP_PCMD(cmd)->crn = nxp->crnseed;
*crnp = nxp->crnseed++;
return (0);
 }

Modified: head/sys/dev/isp/isp_freebsd.h
==
--- head/sys/dev/isp/isp_freebsd.h  Thu Mar 23 20:23:00 2017
(r315868)
+++ head/sys/dev/isp/isp_freebsd.h  Thu Mar 23 21:11:55 2017
(r315869)
@@ -176,7 +176,6 @@ struct isp_pcmd {
struct ispsoftc *   isp;/* containing isp */
struct callout  wdog;   /* watchdog timer */
uint32_tdatalen;/* data length for this command 
(target mode only) */
-   uint8_t crn;/* command reference number */
 };
 #defineISP_PCMD(ccb)   (ccb)->ccb_h.spriv_ptr1
 #definePISP_PCMD(ccb)  ((struct isp_pcmd *)ISP_PCMD(ccb))
___
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: r315870 - head/sys/dev/isp

2017-03-23 Thread Alexander Motin
Author: mav
Date: Thu Mar 23 21:18:10 2017
New Revision: 315870
URL: https://svnweb.freebsd.org/changeset/base/315870

Log:
  isp field in struct isp_pcmd is also unused.
  
  MFC after:2 weeks

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

Modified: head/sys/dev/isp/isp_freebsd.h
==
--- head/sys/dev/isp/isp_freebsd.h  Thu Mar 23 21:11:55 2017
(r315869)
+++ head/sys/dev/isp/isp_freebsd.h  Thu Mar 23 21:18:10 2017
(r315870)
@@ -173,7 +173,6 @@ typedef struct tstate {
 struct isp_pcmd {
struct isp_pcmd *   next;
bus_dmamap_tdmap;   /* dma map for this command */
-   struct ispsoftc *   isp;/* containing isp */
struct callout  wdog;   /* watchdog timer */
uint32_tdatalen;/* data length for this command 
(target mode only) */
 };
___
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: r315653 - in head: lib/libstand sys/boot/common sys/boot/i386/libi386

2017-03-23 Thread Kurt Lidl

On 3/21/17 11:53 AM, Toomas Soome wrote:



On 21. märts 2017, at 17:15, Ian Lepore  wrote:

On Tue, 2017-03-21 at 15:35 +0300, Slawa Olhovchenkov wrote:

On Mon, Mar 20, 2017 at 10:20:17PM +, Toomas Soome wrote:



Author: tsoome
Date: Mon Mar 20 22:20:17 2017
New Revision: 315653
URL: https://svnweb.freebsd.org/changeset/base/315653

Log:
  loader: verify the value from dhcp.interface-mtu and use snprintf
to set mtu

  Since the uset can set dhcp.interface-mtu, we need to try to
validate the
  value. So we verify if the conversion to int is successful and we
will not
  allow to set value greater than max IPv4 packet size.

+   tmp > USHRT_MAX) {
+   printf("%s: bad value:
\"%s\", "
+   "ignoring\n",
+   "dhcp.interface-mtu",
val);

===
USHRT_MAX   Maximum value for an object of type unsigned short
int
65535 (216-1) or greater*

* the actual value depends on the particular system and library
implementation, but shall reflect the limits of these types in the
target platform.
===

I mean IF_MAXMTU more correct.



The context here is libstand; because it is standalone by design, the
code doesn't have access to IF_MAXMTU or other kernel/userland
constants.  There is also no question that a short is 16 bits or that
USHRT_MAX will be anything other than 65535 in that environment.  If
some platform did appear that had a different-sized short by default,
we would add whatever flags are necessary to force it back to 16 bits
in src/share/mk/bsd.stand.mk.




Also note the “upper” value is entirely fictional - we felt we need
to  pick some “sane” default, with current (common 1Gb/s) ethernet hardware
you will be in trouble long before reaching that value;)


All the world is not an VAX, nor is every network Ethernet.

HIPPI, not that you see much of it nowadays, had a MTU for
switched networks of 65280 (64K - 216 bytes of overhead).
Using USHRT_MAX is exactly the right thing here.

-Kurt


___
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: r315871 - in head: contrib/ntp contrib/ntp/adjtimed contrib/ntp/clockstuff contrib/ntp/html contrib/ntp/include contrib/ntp/include/isc contrib/ntp/kernel contrib/ntp/kernel/sys contrib...

2017-03-23 Thread Xin LI
Author: delphij
Date: Thu Mar 23 22:06:06 2017
New Revision: 315871
URL: https://svnweb.freebsd.org/changeset/base/315871

Log:
  MFV r315791: ntp 4.2.8p10.

Added:
  head/contrib/ntp/sntp/harden/
 - copied from r315791, vendor/ntp/dist/sntp/harden/
  head/contrib/ntp/sntp/m4/ntp_harden.m4
 - copied unchanged from r315791, vendor/ntp/dist/sntp/m4/ntp_harden.m4
  head/contrib/ntp/sntp/scripts/genHardFlags
 - copied unchanged from r315791, vendor/ntp/dist/sntp/scripts/genHardFlags
Deleted:
  head/contrib/ntp/compile
  head/contrib/ntp/config.guess
  head/contrib/ntp/config.sub
  head/contrib/ntp/depcomp
  head/contrib/ntp/install-sh
  head/contrib/ntp/ltmain.sh
  head/contrib/ntp/missing
  head/contrib/ntp/sntp/compile
  head/contrib/ntp/sntp/config.guess
  head/contrib/ntp/sntp/config.sub
  head/contrib/ntp/sntp/depcomp
  head/contrib/ntp/sntp/install-sh
  head/contrib/ntp/sntp/ltmain.sh
  head/contrib/ntp/sntp/missing
  head/contrib/ntp/tests/
  head/contrib/ntp/ylwrap
Modified:
  head/contrib/ntp/COPYRIGHT
  head/contrib/ntp/ChangeLog
  head/contrib/ntp/CommitLog
  head/contrib/ntp/Makefile.in
  head/contrib/ntp/NEWS
  head/contrib/ntp/aclocal.m4
  head/contrib/ntp/adjtimed/Makefile.am
  head/contrib/ntp/adjtimed/Makefile.in
  head/contrib/ntp/clockstuff/Makefile.am
  head/contrib/ntp/clockstuff/Makefile.in
  head/contrib/ntp/config.h.in
  head/contrib/ntp/configure
  head/contrib/ntp/configure.ac
  head/contrib/ntp/html/copyright.html
  head/contrib/ntp/include/Makefile.in
  head/contrib/ntp/include/isc/Makefile.in
  head/contrib/ntp/include/libssl_compat.h
  head/contrib/ntp/include/ntp_crypto.h
  head/contrib/ntp/include/ntp_fp.h
  head/contrib/ntp/include/ntp_md5.h
  head/contrib/ntp/include/ntp_stdlib.h
  head/contrib/ntp/include/ntpd.h
  head/contrib/ntp/include/ssl_applink.c
  head/contrib/ntp/kernel/Makefile.in
  head/contrib/ntp/kernel/sys/Makefile.in
  head/contrib/ntp/lib/isc/inet_pton.c
  head/contrib/ntp/libntp/Makefile.am
  head/contrib/ntp/libntp/Makefile.in
  head/contrib/ntp/libntp/a_md5encrypt.c
  head/contrib/ntp/libntp/audio.c
  head/contrib/ntp/libntp/authkeys.c
  head/contrib/ntp/libntp/emalloc.c
  head/contrib/ntp/libntp/libssl_compat.c
  head/contrib/ntp/libntp/ntp_intres.c
  head/contrib/ntp/libntp/recvbuff.c
  head/contrib/ntp/libntp/ssl_init.c
  head/contrib/ntp/libntp/statestr.c
  head/contrib/ntp/libntp/work_fork.c
  head/contrib/ntp/libparse/Makefile.am
  head/contrib/ntp/libparse/Makefile.in
  head/contrib/ntp/libparse/clk_trimtsip.c
  head/contrib/ntp/libparse/gpstolfp.c
  head/contrib/ntp/ntpd/Makefile.am
  head/contrib/ntp/ntpd/Makefile.in
  head/contrib/ntp/ntpd/invoke-ntp.conf.texi
  head/contrib/ntp/ntpd/invoke-ntp.keys.texi
  head/contrib/ntp/ntpd/invoke-ntpd.texi
  head/contrib/ntp/ntpd/ntp.conf.5man
  head/contrib/ntp/ntpd/ntp.conf.5mdoc
  head/contrib/ntp/ntpd/ntp.conf.html
  head/contrib/ntp/ntpd/ntp.conf.man.in
  head/contrib/ntp/ntpd/ntp.conf.mdoc.in
  head/contrib/ntp/ntpd/ntp.keys.5man
  head/contrib/ntp/ntpd/ntp.keys.5mdoc
  head/contrib/ntp/ntpd/ntp.keys.html
  head/contrib/ntp/ntpd/ntp.keys.man.in
  head/contrib/ntp/ntpd/ntp.keys.mdoc.in
  head/contrib/ntp/ntpd/ntp_config.c
  head/contrib/ntp/ntpd/ntp_control.c
  head/contrib/ntp/ntpd/ntp_crypto.c
  head/contrib/ntp/ntpd/ntp_io.c
  head/contrib/ntp/ntpd/ntp_loopfilter.c
  head/contrib/ntp/ntpd/ntp_parser.c
  head/contrib/ntp/ntpd/ntp_parser.h
  head/contrib/ntp/ntpd/ntp_peer.c
  head/contrib/ntp/ntpd/ntp_proto.c
  head/contrib/ntp/ntpd/ntp_restrict.c
  head/contrib/ntp/ntpd/ntp_scanner.c
  head/contrib/ntp/ntpd/ntpd-opts.c
  head/contrib/ntp/ntpd/ntpd-opts.h
  head/contrib/ntp/ntpd/ntpd.1ntpdman
  head/contrib/ntp/ntpd/ntpd.1ntpdmdoc
  head/contrib/ntp/ntpd/ntpd.c
  head/contrib/ntp/ntpd/ntpd.html
  head/contrib/ntp/ntpd/ntpd.man.in
  head/contrib/ntp/ntpd/ntpd.mdoc.in
  head/contrib/ntp/ntpd/refclock_datum.c
  head/contrib/ntp/ntpd/refclock_gpsdjson.c
  head/contrib/ntp/ntpd/refclock_jjy.c
  head/contrib/ntp/ntpd/refclock_mx4200.c
  head/contrib/ntp/ntpd/refclock_nmea.c
  head/contrib/ntp/ntpd/refclock_oncore.c
  head/contrib/ntp/ntpd/refclock_parse.c
  head/contrib/ntp/ntpdate/Makefile.am
  head/contrib/ntp/ntpdate/Makefile.in
  head/contrib/ntp/ntpdate/ntpdate.c
  head/contrib/ntp/ntpdc/Makefile.am
  head/contrib/ntp/ntpdc/Makefile.in
  head/contrib/ntp/ntpdc/invoke-ntpdc.texi
  head/contrib/ntp/ntpdc/ntpdc-opts.c
  head/contrib/ntp/ntpdc/ntpdc-opts.h
  head/contrib/ntp/ntpdc/ntpdc.1ntpdcman
  head/contrib/ntp/ntpdc/ntpdc.1ntpdcmdoc
  head/contrib/ntp/ntpdc/ntpdc.c
  head/contrib/ntp/ntpdc/ntpdc.html
  head/contrib/ntp/ntpdc/ntpdc.man.in
  head/contrib/ntp/ntpdc/ntpdc.mdoc.in
  head/contrib/ntp/ntpdc/ntpdc_ops.c
  head/contrib/ntp/ntpq/Makefile.am
  head/contrib/ntp/ntpq/Makefile.in
  head/contrib/ntp/ntpq/invoke-ntpq.texi
  head/contrib/ntp/ntpq/libntpq.c
  head/contrib/ntp/ntpq/ntpq-opts.c
  head/contrib/ntp/ntpq/ntpq-opts.h
  head/contrib/ntp/ntpq/ntpq-subs.c
  head/contrib/ntp/ntpq/ntpq.1

svn commit: r315872 - head/sys/dev/bhnd/bcma

2017-03-23 Thread Landon J. Fuller
Author: landonf
Date: Thu Mar 23 22:12:14 2017
New Revision: 315872
URL: https://svnweb.freebsd.org/changeset/base/315872

Log:
  Add a workaround for the BCM4706's dangling core region EROM entries.
  
  Approved by:  adrian (mentor, implicit)

Modified:
  head/sys/dev/bhnd/bcma/bcma_erom.c

Modified: head/sys/dev/bhnd/bcma/bcma_erom.c
==
--- head/sys/dev/bhnd/bcma/bcma_erom.c  Thu Mar 23 22:06:06 2017
(r315871)
+++ head/sys/dev/bhnd/bcma/bcma_erom.c  Thu Mar 23 22:12:14 2017
(r315872)
@@ -1344,6 +1344,19 @@ bcma_erom_next_corecfg(struct bcma_erom 
goto failed;
}
 
+   /*
+* Seek to the next core entry (if any), skipping any dangling/invalid
+* region entries.
+* 
+* On the BCM4706, the EROM entry for the memory controller core
+* (0x4bf/0x52E) contains a dangling/unused slave wrapper port region
+* descriptor.
+*/
+   if ((error = bcma_erom_seek_next(erom, BCMA_EROM_ENTRY_TYPE_CORE))) {
+   if (error != ENOENT)
+   goto failed;
+   }
+
*result = cfg;
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: r315873 - head/sys/dev/bhnd/cores/chipc

2017-03-23 Thread Landon J. Fuller
Author: landonf
Date: Thu Mar 23 22:14:08 2017
New Revision: 315873
URL: https://svnweb.freebsd.org/changeset/base/315873

Log:
  Add Northstar/BCM4706 core ID for ChipCommon.
  
  Approved by:  adrian (mentor, implicit)

Modified:
  head/sys/dev/bhnd/cores/chipc/chipc.c

Modified: head/sys/dev/bhnd/cores/chipc/chipc.c
==
--- head/sys/dev/bhnd/cores/chipc/chipc.c   Thu Mar 23 22:12:14 2017
(r315872)
+++ head/sys/dev/bhnd/cores/chipc/chipc.c   Thu Mar 23 22:14:08 2017
(r315873)
@@ -69,6 +69,7 @@ static struct bhnd_device_quirk chipc_qu
 /* Supported device identifiers */
 static const struct bhnd_device chipc_devices[] = {
BHND_DEVICE(BCM, CC, NULL, chipc_quirks),
+   BHND_DEVICE(BCM, 4706_CC, NULL, chipc_quirks),
BHND_DEVICE_END
 };
 
___
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: r315653 - in head: lib/libstand sys/boot/common sys/boot/i386/libi386

2017-03-23 Thread Rodney W. Grimes
> On 3/21/17 11:53 AM, Toomas Soome wrote:
> >
> >> On 21. m?rts 2017, at 17:15, Ian Lepore  wrote:
> >>
> >> On Tue, 2017-03-21 at 15:35 +0300, Slawa Olhovchenkov wrote:
> >>> On Mon, Mar 20, 2017 at 10:20:17PM +, Toomas Soome wrote:
> >>>
> 
>  Author: tsoome
>  Date: Mon Mar 20 22:20:17 2017
>  New Revision: 315653
>  URL: https://svnweb.freebsd.org/changeset/base/315653
> 
>  Log:
>    loader: verify the value from dhcp.interface-mtu and use snprintf
>  to set mtu
> 
>    Since the uset can set dhcp.interface-mtu, we need to try to
>  validate the
>    value. So we verify if the conversion to int is successful and we
>  will not
>    allow to set value greater than max IPv4 packet size.
> 
>  +tmp > USHRT_MAX) {
>  +printf("%s: bad value:
>  \"%s\", "
>  +"ignoring\n",
>  +"dhcp.interface-mtu",
>  val);
> >>> ===
> >>> USHRT_MAX Maximum value for an object of type unsigned short
> >>> int
> >>> 65535 (216-1) or greater*
> >>>
> >>> * the actual value depends on the particular system and library
> >>> implementation, but shall reflect the limits of these types in the
> >>> target platform.
> >>> ===
> >>>
> >>> I mean IF_MAXMTU more correct.
> >>>
> >>
> >> The context here is libstand; because it is standalone by design, the
> >> code doesn't have access to IF_MAXMTU or other kernel/userland
> >> constants.  There is also no question that a short is 16 bits or that
> >> USHRT_MAX will be anything other than 65535 in that environment.  If
> >> some platform did appear that had a different-sized short by default,
> >> we would add whatever flags are necessary to force it back to 16 bits
> >> in src/share/mk/bsd.stand.mk.
> >>
> >
> >
> > Also note the ?upper? value is entirely fictional - we felt we need
> > to  pick some ?sane? default, with current (common 1Gb/s) ethernet hardware
> > you will be in trouble long before reaching that value;)
> 
> All the world is not an VAX, nor is every network Ethernet.
> 
> HIPPI, not that you see much of it nowadays, had a MTU for
> switched networks of 65280 (64K - 216 bytes of overhead).
> Using USHRT_MAX is exactly the right thing here.

USHRT_MAX _could_ easily be >16 bits in the not too distant future,
though this code doesnt seem to be able to include the proper header
to get to a proper define it should probably just localally #define
it to be 65535 to avoid the breakage 10 years from now.

> -Kurt
-- 
Rod Grimes rgri...@freebsd.org
___
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: r315876 - in head: contrib/libarchive/libarchive contrib/libarchive/libarchive/test contrib/libarchive/tar contrib/libarchive/tar/test contrib/libarchive/test_utils lib/libarchive lib/l...

2017-03-23 Thread Martin Matuska
Author: mm
Date: Fri Mar 24 00:02:12 2017
New Revision: 315876
URL: https://svnweb.freebsd.org/changeset/base/315876

Log:
  MFV r315875:
  Sync libarchive with vendor.
  
  Vendor changes (FreeBSD-related):
  - store extended attributes with extattr_set_link() if no fd is provided
  - add extended attribute tests to libarchive and bsdtar
  - fix tar's test_option_acls
  - support the UF_HIDDEN file flag
  
  X-MFC with:   315636

Added:
  head/contrib/libarchive/libarchive/archive_platform_xattr.h
 - copied unchanged from r315875, 
vendor/libarchive/dist/libarchive/archive_platform_xattr.h
  head/contrib/libarchive/libarchive/test/test_xattr_platform.c
 - copied unchanged from r315875, 
vendor/libarchive/dist/libarchive/test/test_xattr_platform.c
  head/contrib/libarchive/tar/test/test_option_xattrs.c
 - copied unchanged from r315875, 
vendor/libarchive/dist/tar/test/test_option_xattrs.c
Modified:
  head/contrib/libarchive/libarchive/archive_entry.c
  head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c
  head/contrib/libarchive/libarchive/archive_write_disk_posix.c
  head/contrib/libarchive/tar/bsdtar.1
  head/contrib/libarchive/tar/test/test_option_acls.c
  head/contrib/libarchive/test_utils/test_common.h
  head/contrib/libarchive/test_utils/test_main.c
  head/lib/libarchive/config_freebsd.h
  head/lib/libarchive/tests/Makefile
  head/usr.bin/tar/tests/Makefile
Directory Properties:
  head/contrib/libarchive/   (props changed)

Modified: head/contrib/libarchive/libarchive/archive_entry.c
==
--- head/contrib/libarchive/libarchive/archive_entry.c  Thu Mar 23 23:44:31 
2017(r315875)
+++ head/contrib/libarchive/libarchive/archive_entry.c  Fri Mar 24 00:02:12 
2017(r315876)
@@ -1708,6 +1708,9 @@ static struct flag {
 #ifdef UF_COMPRESSED
{ "nocompressed",L"nocompressed",   UF_COMPRESSED,  0 },
 #endif
+#ifdef UF_HIDDEN
+   { "nohidden",   L"nohidden",UF_HIDDEN,  0 },
+#endif
 #if defined(FS_UNRM_FL)
 { "nouunlink", L"nouunlink",   FS_UNRM_FL, 0},
 #elif defined(EXT2_UNRM_FL)

Copied: head/contrib/libarchive/libarchive/archive_platform_xattr.h (from 
r315875, vendor/libarchive/dist/libarchive/archive_platform_xattr.h)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/contrib/libarchive/libarchive/archive_platform_xattr.h Fri Mar 24 
00:02:12 2017(r315876, copy of r315875, 
vendor/libarchive/dist/libarchive/archive_platform_xattr.h)
@@ -0,0 +1,41 @@
+/*-
+ * Copyright (c) 2017 Martin Matuska
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``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 AUTHOR(S) 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.
+ *
+ * $FreeBSD$
+ */
+
+/* !!ONLY FOR USE INTERNALLY TO LIBARCHIVE!! */
+
+#ifndef ARCHIVE_PLATFORM_XATTR_H_INCLUDED
+#define ARCHIVE_PLATFORM_XATTR_H_INCLUDED
+
+/*
+ * Determine if we support extended attributes
+ */
+#if ARCHIVE_XATTR_LINUX || ARCHIVE_XATTR_DARWIN || ARCHIVE_XATTR_FREEBSD || \
+ARCHIVE_XATTR_AIX
+#define ARCHIVE_XATTR_SUPPORT 1
+#endif
+
+#endif /* ARCHIVE_PLATFORM_XATTR_H_INCLUDED */

Modified: head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c
==
--- head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c  
Thu Mar 23 23:44:31 2017(r315875)
+++ head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c  
Fri Mar 24 00:02:12 2017(r315876)
@@ -423,12 +423,10 @@ setup_mac_metadata(struct archive_read_d
 }
 #endif
 
-#if (HAVE_FGETXATTR && HAVE_FLISTXATTR && HAVE_LISTXATTR && \
-HAVE_LLIS

svn commit: r315877 - head/sys/net

2017-03-23 Thread Ermal Luçi
Author: eri
Date: Fri Mar 24 00:55:16 2017
New Revision: 315877
URL: https://svnweb.freebsd.org/changeset/base/315877

Log:
  Correct handling of ALTQ with epair(4) interfaces but presenting that ALTQ(9) 
is supported.
  
  Approved by:  ae
  MFC after:2 weeks

Modified:
  head/sys/net/if_epair.c

Modified: head/sys/net/if_epair.c
==
--- head/sys/net/if_epair.c Fri Mar 24 00:02:12 2017(r315876)
+++ head/sys/net/if_epair.c Fri Mar 24 00:55:16 2017(r315877)
@@ -831,7 +831,8 @@ epair_clone_create(struct if_clone *ifc,
ifp->if_start = epair_start;
ifp->if_ioctl = epair_ioctl;
ifp->if_init  = epair_init;
-   ifp->if_snd.ifq_maxlen = ifqmaxlen;
+   if_setsendqlen(ifp, ifqmaxlen);
+   if_setsendqready(ifp);
/* Assign a hopefully unique, locally administered etheraddr. */
eaddr[0] = 0x02;
eaddr[3] = (ifp->if_index >> 8) & 0xff;
@@ -857,7 +858,8 @@ epair_clone_create(struct if_clone *ifc,
ifp->if_start = epair_start;
ifp->if_ioctl = epair_ioctl;
ifp->if_init  = epair_init;
-   ifp->if_snd.ifq_maxlen = ifqmaxlen;
+   if_setsendqlen(ifp, ifqmaxlen);
+   if_setsendqready(ifp);
/* We need to play some tricks here for the second interface. */
strlcpy(name, epairname, len);
error = if_clone_create(name, len, (caddr_t)scb);
___
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: r315878 - head/sys/dev/xen/netback

2017-03-23 Thread Kevin Lo
Author: kevlo
Date: Fri Mar 24 01:23:07 2017
New Revision: 315878
URL: https://svnweb.freebsd.org/changeset/base/315878

Log:
  Don't initialize if_output to ether_output(), ether_ifattach() does it for
  us already.  While here, remove NOTYET code since if_watchdog is no longer
  used.
  
  Reviewed by:  royger
  MFC after:3 days

Modified:
  head/sys/dev/xen/netback/netback.c

Modified: head/sys/dev/xen/netback/netback.c
==
--- head/sys/dev/xen/netback/netback.c  Fri Mar 24 00:55:16 2017
(r315877)
+++ head/sys/dev/xen/netback/netback.c  Fri Mar 24 01:23:07 2017
(r315878)
@@ -1232,11 +1232,7 @@ create_netdev(device_t dev)
if_initname(ifp, xnb->if_name,  IF_DUNIT_NONE);
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
ifp->if_ioctl = xnb_ioctl;
-   ifp->if_output = ether_output;
ifp->if_start = xnb_start;
-#ifdef notyet
-   ifp->if_watchdog = xnb_watchdog;
-#endif
ifp->if_init = xnb_ifinit;
ifp->if_mtu = ETHERMTU;
ifp->if_snd.ifq_maxlen = NET_RX_RING_SIZE - 1;
___
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: r315879 - head/sys/powerpc/mpc85xx

2017-03-23 Thread Justin Hibbits
Author: jhibbits
Date: Fri Mar 24 01:30:18 2017
New Revision: 315879
URL: https://svnweb.freebsd.org/changeset/base/315879

Log:
  Switch qoriq_gpio over to using ofw_bus_search_compatible
  
  This will make it easier to add more compatibility strings in the future, if
  necessary.

Modified:
  head/sys/powerpc/mpc85xx/qoriq_gpio.c

Modified: head/sys/powerpc/mpc85xx/qoriq_gpio.c
==
--- head/sys/powerpc/mpc85xx/qoriq_gpio.c   Fri Mar 24 01:23:07 2017
(r315878)
+++ head/sys/powerpc/mpc85xx/qoriq_gpio.c   Fri Mar 24 01:30:18 2017
(r315879)
@@ -215,13 +215,18 @@ qoriq_gpio_pin_toggle(device_t dev, uint
return (0);
 }
 
+static struct ofw_compat_data gpio_matches[] = {
+{"fsl,qoriq-gpio", 1},
+{"fsl,pq3-gpio", 1},
+{"fsl,mpc8572-gpio", 1},
+{0, 0}
+};
+
 static int
 qoriq_gpio_probe(device_t dev)
 {
 
-   if (!ofw_bus_is_compatible(dev, "fsl,qoriq-gpio") &&
-   !ofw_bus_is_compatible(dev, "fsl,pq3-gpio") &&
-   !ofw_bus_is_compatible(dev, "fsl,mpc8572-gpio"))
+   if (ofw_bus_search_compatible(dev, gpio_matches)->ocd_data == 0)
return (ENXIO);
 
device_set_desc(dev, "Freescale QorIQ GPIO driver");
___
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: r315880 - head/sys/powerpc/mpc85xx

2017-03-23 Thread Justin Hibbits
Author: jhibbits
Date: Fri Mar 24 01:52:10 2017
New Revision: 315880
URL: https://svnweb.freebsd.org/changeset/base/315880

Log:
  Don't bother checking core version
  
  We already constrain by SoC, so there's no need to check the core version, 
too.

Modified:
  head/sys/powerpc/mpc85xx/mpc85xx_gpio.c

Modified: head/sys/powerpc/mpc85xx/mpc85xx_gpio.c
==
--- head/sys/powerpc/mpc85xx/mpc85xx_gpio.c Fri Mar 24 01:30:18 2017
(r315879)
+++ head/sys/powerpc/mpc85xx/mpc85xx_gpio.c Fri Mar 24 01:52:10 2017
(r315880)
@@ -179,7 +179,6 @@ mpc85xx_gpio_pin_toggle(device_t dev, ui
 static int
 mpc85xx_gpio_probe(device_t dev)
 {
-   uint16_t vers;
uint32_t svr;
 
if (!ofw_bus_status_okay(dev))
@@ -188,16 +187,6 @@ mpc85xx_gpio_probe(device_t dev)
if (!ofw_bus_is_compatible(dev, "gpio"))
return (ENXIO);
 
-   vers = mfpvr() >> 16;
-   switch (vers) {
-   case FSL_E500v1:
-   case FSL_E500v2:
-   case FSL_E500mc:
-   break;
-   default:
-   return (ENXIO);
-   }
-
svr = mfspr(SPR_SVR);
switch (SVR_VER(svr)) {
case SVR_MPC8533:
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

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

This revision caused devd a little gas. It failed to start moused for usb 
attached mice (ums0 & ums1) to my latpop and nut failed to recognize my USB 
connected UPS on a server.  downstairs due to a permission issue which nut 
provides a devd.conf file with:

chgrp uucp /dev/$cdev; chmod g+rw /dev/$cdev


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

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


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