svn commit: r275636 - head/sys/ofed/include/linux

2014-12-09 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Dec  9 08:56:01 2014
New Revision: 275636
URL: https://svnweb.freebsd.org/changeset/base/275636

Log:
  Move OFED init a bit earlier so that PXE boot works.
  
  MFC after:3 days
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/ofed/include/linux/module.h

Modified: head/sys/ofed/include/linux/module.h
==
--- head/sys/ofed/include/linux/module.hTue Dec  9 07:55:37 2014
(r275635)
+++ head/sys/ofed/include/linux/module.hTue Dec  9 08:56:01 2014
(r275636)
@@ -49,9 +49,9 @@
 #defineEXPORT_SYMBOL_GPL(name)
 
 /* OFED pre-module initialization */
-#defineSI_SUB_OFED_PREINIT (SI_SUB_KTHREAD_INIT - 2)
+#defineSI_SUB_OFED_PREINIT (SI_SUB_ROOT_CONF - 2)
 /* OFED default module initialization */
-#defineSI_SUB_OFED_MODINIT (SI_SUB_KTHREAD_INIT - 1)
+#defineSI_SUB_OFED_MODINIT (SI_SUB_ROOT_CONF - 1)
 
 #include 
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r275637 - head/sys/kern

2014-12-09 Thread Konstantin Belousov
Author: kib
Date: Tue Dec  9 09:36:28 2014
New Revision: 275637
URL: https://svnweb.freebsd.org/changeset/base/275637

Log:
  Apply chunk forgotten in r275620.  Remove local variable for real.
  
  CID:  1257462
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cTue Dec  9 08:56:01 2014(r275636)
+++ head/sys/kern/vfs_subr.cTue Dec  9 09:36:28 2014(r275637)
@@ -1788,7 +1788,6 @@ sched_sync(void)
int last_work_seen;
int net_worklist_len;
int syncer_final_iter;
-   int first_printf;
int error;
 
last_work_seen = 0;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r275638 - in head/sys: fs/msdosfs kern

2014-12-09 Thread Konstantin Belousov
Author: kib
Date: Tue Dec  9 10:00:47 2014
New Revision: 275638
URL: https://svnweb.freebsd.org/changeset/base/275638

Log:
  Do not call VFS_SYNC() before VFS_UNMOUNT() for forced unmount.
  
  Since VFS does not/cannot stop writes, sync might run indefinitely, or
  be a wrong thing to do at all.  E. g. NFS ignores VFS_SYNC() for
  forced unmounts, since non-responding server does not allow sync to
  finish.  On the other hand, filesystems can and do stop writes using
  fs-specific facilities, and should already fully flush caches in
  VFS_UNMOUNT() due to the race.
  
  Adjust msdosfs tp sync in unmount for forced call, to accomodate the
  new behaviour.  Note that it is still racy, since writes are not
  stopped.
  
  Discussed with:   avg, bjk, mckusick
  Reported and tested by:   pho
  Sponsored by: The FreeBSD Foundation
  MFC after:3 weeks

Modified:
  head/sys/fs/msdosfs/msdosfs_vfsops.c
  head/sys/kern/vfs_mount.c

Modified: head/sys/fs/msdosfs/msdosfs_vfsops.c
==
--- head/sys/fs/msdosfs/msdosfs_vfsops.cTue Dec  9 09:36:28 2014
(r275637)
+++ head/sys/fs/msdosfs/msdosfs_vfsops.cTue Dec  9 10:00:47 2014
(r275638)
@@ -797,11 +797,15 @@ msdosfs_unmount(struct mount *mp, int mn
int error, flags;
 
flags = 0;
-   if (mntflags & MNT_FORCE)
+   error = msdosfs_sync(mp, MNT_WAIT);
+   if ((mntflags & MNT_FORCE) != 0) {
flags |= FORCECLOSE;
+   } else if (error != 0) {
+   return (error);
+   }
error = vflush(mp, 0, flags, curthread);
-   if (error && error != ENXIO)
-   return error;
+   if (error != 0 && error != ENXIO)
+   return (error);
pmp = VFSTOMSDOSFS(mp);
if ((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0) {
error = markvoldirty(pmp, 0);

Modified: head/sys/kern/vfs_mount.c
==
--- head/sys/kern/vfs_mount.c   Tue Dec  9 09:36:28 2014(r275637)
+++ head/sys/kern/vfs_mount.c   Tue Dec  9 10:00:47 2014(r275638)
@@ -1305,8 +1305,8 @@ dounmount(mp, flags, td)
}
vput(fsrootvp);
}
-   if (((mp->mnt_flag & MNT_RDONLY) ||
-(error = VFS_SYNC(mp, MNT_WAIT)) == 0) || (flags & MNT_FORCE) != 0)
+   if ((mp->mnt_flag & MNT_RDONLY) != 0 || (flags & MNT_FORCE) != 0 ||
+   (error = VFS_SYNC(mp, MNT_WAIT)) == 0)
error = VFS_UNMOUNT(mp, flags);
vn_finished_write(mp);
/*
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2014-12-09 Thread Andrew Turner
Author: andrew
Date: Tue Dec  9 10:21:31 2014
New Revision: 275639
URL: https://svnweb.freebsd.org/changeset/base/275639

Log:
  Include sys/kernel.h to pick up the definition of hz. subr_syscall.c uses
  it after r275616.
  
  X-MFC with:   r275616

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

Modified: head/sys/arm/arm/syscall.c
==
--- head/sys/arm/arm/syscall.c  Tue Dec  9 10:00:47 2014(r275638)
+++ head/sys/arm/arm/syscall.c  Tue Dec  9 10:21:31 2014(r275639)
@@ -84,6 +84,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r275640 - head/sys/dev/virtio/mmio

2014-12-09 Thread Andrew Turner
Author: andrew
Date: Tue Dec  9 10:31:35 2014
New Revision: 275640
URL: https://svnweb.freebsd.org/changeset/base/275640

Log:
  Update the virtio driver to work on the ARM AArch64 Foundation Model.
  There are two main parts to get it to work, 1) most of the register
  accesses need to be word sized, other than the config register which
  needs to be byte aligned, and 2) we don't need the platform driver
  for this to work on the Foundation Model, allow it to be NULL.
  
  Differential Revision:https://reviews.freebsd.org/D1240
  Reviewed by:  bryanv
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/virtio/mmio/virtio_mmio.c

Modified: head/sys/dev/virtio/mmio/virtio_mmio.c
==
--- head/sys/dev/virtio/mmio/virtio_mmio.c  Tue Dec  9 10:21:31 2014
(r275639)
+++ head/sys/dev/virtio/mmio/virtio_mmio.c  Tue Dec  9 10:31:35 2014
(r275640)
@@ -1,11 +1,15 @@
 /*-
  * Copyright (c) 2014 Ruslan Bukin 
+ * Copyright (c) 2014 The FreeBSD Foundation
  * All rights reserved.
  *
  * This software was developed by SRI International and the University of
  * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
  * ("CTSRD"), as part of the DARPA CRASH research programme.
  *
+ * Portions of this software were developed by Andrew Turner
+ * under sponsorship from the FreeBSD Foundation.
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -131,15 +135,24 @@ static void   vtmmio_vq_intr(void *);
 /*
  * I/O port read/write wrappers.
  */
-#define vtmmio_write_config_1(sc, o, v) \
-   bus_write_1((sc)->res[0], (o), (v)); \
-   VIRTIO_MMIO_NOTE(sc->platform, (o))
-#define vtmmio_write_config_2(sc, o, v) \
-   bus_write_2((sc)->res[0], (o), (v)); \
-   VIRTIO_MMIO_NOTE(sc->platform, (o))
-#define vtmmio_write_config_4(sc, o, v) \
-   bus_write_4((sc)->res[0], (o), (v)); \
-   VIRTIO_MMIO_NOTE(sc->platform, (o))
+#define vtmmio_write_config_1(sc, o, v)\
+do {   \
+   bus_write_1((sc)->res[0], (o), (v));\
+   if (sc->platform != NULL)   \
+   VIRTIO_MMIO_NOTE(sc->platform, (o));\
+} while (0)
+#define vtmmio_write_config_2(sc, o, v)\
+do {   \
+   bus_write_2((sc)->res[0], (o), (v));\
+   if (sc->platform != NULL)   \
+   VIRTIO_MMIO_NOTE(sc->platform, (o));\
+} while (0)
+#define vtmmio_write_config_4(sc, o, v)\
+do {   \
+   bus_write_4((sc)->res[0], (o), (v));\
+   if (sc->platform != NULL)   \
+   VIRTIO_MMIO_NOTE(sc->platform, (o));\
+} while (0)
 
 #define vtmmio_read_config_1(sc, o) \
bus_read_1((sc)->res[0], (o))
@@ -200,11 +213,13 @@ vtmmio_setup_intr(device_t dev, enum int
 
sc = device_get_softc(dev);
 
-   err = VIRTIO_MMIO_SETUP_INTR(sc->platform, sc->dev,
-   vtmmio_vq_intr, sc);
-   if (err == 0) {
-   /* Okay we have backend-specific interrupts */
-   return (0);
+   if (sc->platform != NULL) {
+   err = VIRTIO_MMIO_SETUP_INTR(sc->platform, sc->dev,
+   vtmmio_vq_intr, sc);
+   if (err == 0) {
+   /* Okay we have backend-specific interrupts */
+   return (0);
+   }
}
 
rid = 0;
@@ -473,8 +488,8 @@ vtmmio_alloc_virtqueues(device_t dev, in
struct vq_alloc_info *info;
struct vtmmio_softc *sc;
struct virtqueue *vq;
+   uint32_t size;
int idx, error;
-   uint16_t size;
 
sc = device_get_softc(dev);
 
@@ -492,8 +507,10 @@ vtmmio_alloc_virtqueues(device_t dev, in
vqx = &sc->vtmmio_vqs[idx];
info = &vq_info[idx];
 
+   vtmmio_write_config_4(sc, VIRTIO_MMIO_QUEUE_SEL, idx);
+
vtmmio_select_virtqueue(sc, idx);
-   size = vtmmio_read_config_2(sc, VIRTIO_MMIO_QUEUE_NUM);
+   size = vtmmio_read_config_4(sc, VIRTIO_MMIO_QUEUE_NUM_MAX);
 
error = virtqueue_alloc(dev, idx, size,
VIRTIO_MMIO_VRING_ALIGN, 0xUL, info, &vq);
@@ -503,6 +520,10 @@ vtmmio_alloc_virtqueues(device_t dev, in
idx, error);
break;
}
+
+   vtmmio_write_config_4(sc, VIRTIO_MMIO_QUEUE_NUM, size);
+   vtmmio_write_config_4(sc, VIRTIO_MMIO_QUEUE_ALIGN,
+   VIRTIO_MMIO_VRING_ALIGN);
 #if 0
device_printf(dev, "vir

svn commit: r275641 - head/sys/x86/xen

2014-12-09 Thread Roger Pau Monné
Author: royger
Date: Tue Dec  9 11:12:24 2014
New Revision: 275641
URL: https://svnweb.freebsd.org/changeset/base/275641

Log:
  xen: notify ACPI about SCI override
  
  If the SCI is remapped to a non-ISA global interrupt notify the ACPI
  subsystem about the override.
  
  Reported by: David P. Discher 
  Sponsored by: Citrix Systems R&D

Modified:
  head/sys/x86/xen/pvcpu_enum.c

Modified: head/sys/x86/xen/pvcpu_enum.c
==
--- head/sys/x86/xen/pvcpu_enum.c   Tue Dec  9 10:31:35 2014
(r275640)
+++ head/sys/x86/xen/pvcpu_enum.c   Tue Dec  9 11:12:24 2014
(r275641)
@@ -91,6 +91,15 @@ madt_parse_interrupt_override(ACPI_MADT_
 
madt_parse_interrupt_values(intr, &trig, &pol);
 
+   /* Remap the IRQ if it is mapped to a different interrupt vector. */
+   if (intr->SourceIrq != intr->GlobalIrq && intr->GlobalIrq > 15 &&
+   intr->SourceIrq == AcpiGbl_FADT.SciInterrupt)
+   /*
+* If the SCI is remapped to a non-ISA global interrupt,
+* then override the vector we use to setup.
+*/
+   acpi_OverrideInterruptLevel(intr->GlobalIrq);
+
/* Register the IRQ with the polarity and trigger mode found. */
xen_register_pirq(intr->GlobalIrq, trig, pol);
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r275644 - head/gnu/usr.bin/gdb/kgdb

2014-12-09 Thread Dmitry Chagin
Author: dchagin
Date: Tue Dec  9 14:21:43 2014
New Revision: 275644
URL: https://svnweb.freebsd.org/changeset/base/275644

Log:
  Skip calling CPU_ISSET for NOCPU as a short period of time we can have
  td_oncpu is NOCPU for thread in TDS_RUNNING state.
  
  Differential Revision:https://reviews.freebsd.org/D1283
  Reviewed by:  jhb
  MFC after:1 Month

Modified:
  head/gnu/usr.bin/gdb/kgdb/kthr.c

Modified: head/gnu/usr.bin/gdb/kgdb/kthr.c
==
--- head/gnu/usr.bin/gdb/kgdb/kthr.cTue Dec  9 11:52:36 2014
(r275643)
+++ head/gnu/usr.bin/gdb/kgdb/kthr.cTue Dec  9 14:21:43 2014
(r275644)
@@ -96,7 +96,7 @@ kgdb_thr_add_procs(uintptr_t paddr)
kt->kaddr = addr;
if (td.td_tid == dumptid)
kt->pcb = dumppcb;
-   else if (td.td_state == TDS_RUNNING &&
+   else if (td.td_oncpu != NOCPU &&
CPU_ISSET(td.td_oncpu, &stopped_cpus))
kt->pcb = kgdb_trgt_core_pcb(td.td_oncpu);
else
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r275645 - head/sys/fs/ext2fs

2014-12-09 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Dec  9 14:56:00 2014
New Revision: 275645
URL: https://svnweb.freebsd.org/changeset/base/275645

Log:
  ext2fs: Fix old out-of-bounds access.
  
  Overrunning buffer pointed to by (caddr_t)&oip->i_db[0] of 48 bytes by
  passing it to a function which accesses it at byte offset 59 using
  argument 60UL.
  
  The issue was inherited from an older FFS implementation and
  fixed there with by merging UFS2 in r98542. We follow the
  FFS fix.
  
  Discussed with:   bde
  CID:  1007665
  MFC after:3 days

Modified:
  head/sys/fs/ext2fs/ext2_inode.c

Modified: head/sys/fs/ext2fs/ext2_inode.c
==
--- head/sys/fs/ext2fs/ext2_inode.c Tue Dec  9 14:21:43 2014
(r275644)
+++ head/sys/fs/ext2fs/ext2_inode.c Tue Dec  9 14:56:00 2014
(r275645)
@@ -224,14 +224,18 @@ ext2_truncate(struct vnode *vp, off_t le
 * will be returned to the free list.  lastiblock values are also
 * normalized to -1 for calls to ext2_indirtrunc below.
 */
-   bcopy((caddr_t)&oip->i_db[0], (caddr_t)oldblks, sizeof(oldblks));
-   for (level = TRIPLE; level >= SINGLE; level--)
+   for (level = TRIPLE; level >= SINGLE; level--) {
+   oldblks[NDADDR + level] = oip->i_ib[level];
if (lastiblock[level] < 0) {
oip->i_ib[level] = 0;
lastiblock[level] = -1;
}
-   for (i = NDADDR - 1; i > lastblock; i--)
-   oip->i_db[i] = 0;
+   }
+   for (i = 0; i < NDADDR; i++) {
+   oldblks[i] = oip->i_db[i];
+   if (i > lastblock)
+   oip->i_db[i] = 0;
+   }
oip->i_flag |= IN_CHANGE | IN_UPDATE;
allerror = ext2_update(ovp, !DOINGASYNC(ovp));
 
@@ -241,8 +245,14 @@ ext2_truncate(struct vnode *vp, off_t le
 * Note that we save the new block configuration so we can check it
 * when we are done.
 */
-   bcopy((caddr_t)&oip->i_db[0], (caddr_t)newblks, sizeof(newblks));
-   bcopy((caddr_t)oldblks, (caddr_t)&oip->i_db[0], sizeof(oldblks));
+   for (i = 0; i < NDADDR; i++) {
+   newblks[i] = oip->i_db[i];
+   oip->i_db[i] = oldblks[i];
+   }
+   for (i = 0; i < NIADDR; i++) {
+   newblks[NDADDR + i] = oip->i_ib[i];
+   oip->i_ib[i] = oldblks[NDADDR + i];
+   }
oip->i_size = osize;
error = vtruncbuf(ovp, cred, length, (int)fs->e2fs_bsize);
if (error && (allerror == 0))
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r275646 - in head/sys/dev/usb: . wlan

2014-12-09 Thread Mark Peek
Author: mp
Date: Tue Dec  9 15:26:04 2014
New Revision: 275646
URL: https://svnweb.freebsd.org/changeset/base/275646

Log:
  Rename NETGEAR WG111V2_2 to WG111V1_2 to reflect external naming.
  
  Reviewed by:  kevlo

Modified:
  head/sys/dev/usb/usbdevs
  head/sys/dev/usb/wlan/if_upgt.c

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsTue Dec  9 14:56:00 2014(r275645)
+++ head/sys/dev/usb/usbdevsTue Dec  9 15:26:04 2014(r275646)
@@ -3195,7 +3195,7 @@ product NETGEAR EA101X0x1002  Ethernet
 product NETGEAR FA101  0x1020  Ethernet 10/100, USB1.1
 product NETGEAR FA120  0x1040  USB 2.0 Ethernet
 product NETGEAR M4100  0x1100  M4100/M5300/M7100 series switch
-product NETGEAR WG111V2_2  0x4240  PrismGT USB 2.0 WLAN
+product NETGEAR WG111V1_2  0x4240  PrismGT USB 2.0 WLAN
 product NETGEAR WG111V30x4260  WG111v3
 product NETGEAR WG111U 0x4300  WG111U
 product NETGEAR WG111U_NF  0x4301  WG111U (no firmware)

Modified: head/sys/dev/usb/wlan/if_upgt.c
==
--- head/sys/dev/usb/wlan/if_upgt.c Tue Dec  9 14:56:00 2014
(r275645)
+++ head/sys/dev/usb/wlan/if_upgt.c Tue Dec  9 15:26:04 2014
(r275646)
@@ -182,7 +182,7 @@ static const STRUCT_USB_HOST_ID upgt_dev
UPGT_DEV(FSC,   E5400),
UPGT_DEV(GLOBESPAN, PRISM_GT_1),
UPGT_DEV(GLOBESPAN, PRISM_GT_2),
-   UPGT_DEV(NETGEAR,   WG111V2_2),
+   UPGT_DEV(NETGEAR,   WG111V1_2),
UPGT_DEV(INTERSIL,  PRISM_GT),
UPGT_DEV(SMC,   2862WG),
UPGT_DEV(USR,   USR5422),
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r275647 - in head/sys: arm/altera/socfpga arm/conf boot/fdt/dts/arm dev/beri/virtio dev/beri/virtio/network dev/virtio/mmio

2014-12-09 Thread Ruslan Bukin
Author: br
Date: Tue Dec  9 16:39:21 2014
New Revision: 275647
URL: https://svnweb.freebsd.org/changeset/base/275647

Log:
  o Add BERI Virtio Networking Frontend (if_vtbe)
  o Move similar block/networking methods to common file
  o Follow r275640 and correct MMIO registers width
  o Pass value to MMIO platform_note method.
  
  Sponsored by: DARPA, AFRL

Added:
  head/sys/dev/beri/virtio/network/
  head/sys/dev/beri/virtio/network/if_vtbe.c   (contents, props changed)
Modified:
  head/sys/arm/altera/socfpga/files.socfpga
  head/sys/arm/conf/SOCKIT-BERI
  head/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts
  head/sys/dev/beri/virtio/virtio.c
  head/sys/dev/beri/virtio/virtio.h
  head/sys/dev/beri/virtio/virtio_block.c
  head/sys/dev/beri/virtio/virtio_mmio_platform.c
  head/sys/dev/beri/virtio/virtio_mmio_platform.h
  head/sys/dev/virtio/mmio/virtio_mmio.c
  head/sys/dev/virtio/mmio/virtio_mmio_if.m

Modified: head/sys/arm/altera/socfpga/files.socfpga
==
--- head/sys/arm/altera/socfpga/files.socfpga   Tue Dec  9 15:26:04 2014
(r275646)
+++ head/sys/arm/altera/socfpga/files.socfpga   Tue Dec  9 16:39:21 2014
(r275647)
@@ -26,5 +26,6 @@ dev/mmc/host/dwmmc.c  optional dwmmc
 # BERI specific
 dev/beri/beri_ring.c   optional beri_ring
 dev/beri/beri_mem.coptional beri_mem
-dev/beri/virtio/virtio.c   optional beri_vtblk
+dev/beri/virtio/virtio.c   optional beri_vtblk | vtbe
 dev/beri/virtio/virtio_block.c optional beri_vtblk
+dev/beri/virtio/network/if_vtbe.c  optional vtbe

Modified: head/sys/arm/conf/SOCKIT-BERI
==
--- head/sys/arm/conf/SOCKIT-BERI   Tue Dec  9 15:26:04 2014
(r275646)
+++ head/sys/arm/conf/SOCKIT-BERI   Tue Dec  9 16:39:21 2014
(r275647)
@@ -123,6 +123,7 @@ device  spibus
 device beri_ring
 device beri_mem
 device beri_vtblk
+device vtbe
 device altera_pio
 
 # Ethernet

Modified: head/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts
==
--- head/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts   Tue Dec  9 15:26:04 
2014(r275646)
+++ head/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts   Tue Dec  9 16:39:21 
2014(r275647)
@@ -39,7 +39,8 @@
compatible = "altr,socfpga-cyclone5", "altr,socfpga";
 
memreserve = < 0x 0x1000 >, /* SMP trampoline */
-< 0x1000 0x1000 >; /* virtio block */
+< 0x1000 0x1000 >, /* virtio block */
+< 0x2000 0x1000 >; /* virtio net */
 
memory {
device_type = "memory";
@@ -111,6 +112,15 @@
pio-recv = <&pio0>;
pio-send = <&pio1>;
beri-mem = <&beri_mem0>;
+   status = "disabled";
+   };
+
+   beri_vtnet: vtnet@2000 {
+   compatible = "sri-cambridge,beri-vtnet";
+   reg = <0x2000 0x1000>;
+   pio-recv = <&pio0>;
+   pio-send = <&pio1>;
+   beri-mem = <&beri_mem0>;
status = "okay";
};
 

Added: head/sys/dev/beri/virtio/network/if_vtbe.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/beri/virtio/network/if_vtbe.c  Tue Dec  9 16:39:21 2014
(r275647)
@@ -0,0 +1,655 @@
+/*-
+ * Copyright (c) 2014 Ruslan Bukin 
+ * 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:
+ * 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLA

svn commit: r275649 - in head/sys: conf dev/xen/pci x86/xen xen

2014-12-09 Thread Roger Pau Monné
Author: royger
Date: Tue Dec  9 18:03:25 2014
New Revision: 275649
URL: https://svnweb.freebsd.org/changeset/base/275649

Log:
  xen: create a new PCI bus override
  
  When running as a Xen PVH Dom0 we need to add custom buses that override
  some of the functionality present in the ACPI PCI Bus and the PCI Bus. We
  currently override the ACPI PCI Bus, but not the PCI Bus, so add a new
  override for the PCI Bus and share the generic functions between them.
  
  Reported by: David P. Discher 
  Sponsored by: Citrix Systems R&D
  
  conf/files.amd64:
   - Add the new files.
  
  x86/xen/xen_pci_bus.c:
   - Generic file that contains the PCI overrides so they can be used by the
 several PCI specific buses.
  
  xen/xen_pci.h:
   - Prototypes for the generic overried functions.
  
  dev/xen/pci/xen_pci.c:
   - Xen specific override for the PCI bus.
  
  dev/xen/pci/xen_acpi_pci.c:
   - Xen specific override for the ACPI PCI bus.

Added:
  head/sys/dev/xen/pci/
  head/sys/dev/xen/pci/xen_acpi_pci.c   (contents, props changed)
  head/sys/dev/xen/pci/xen_pci.c   (contents, props changed)
  head/sys/x86/xen/xen_pci_bus.c
 - copied, changed from r275647, head/sys/x86/xen/xen_pci.c
  head/sys/xen/xen_pci.h   (contents, props changed)
Deleted:
  head/sys/x86/xen/xen_pci.c
Modified:
  head/sys/conf/files.amd64

Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Tue Dec  9 17:03:14 2014(r275648)
+++ head/sys/conf/files.amd64   Tue Dec  9 18:03:25 2014(r275649)
@@ -336,6 +336,8 @@ dev/viawd/viawd.c   optionalviawd
 dev/vmware/vmxnet3/if_vmx.coptionalvmx
 dev/wbwd/wbwd.coptionalwbwd
 dev/wpi/if_wpi.c   optionalwpi
+dev/xen/pci/xen_acpi_pci.c optionalxenhvm
+dev/xen/pci/xen_pci.c  optionalxenhvm
 dev/isci/isci.c
optional isci
 dev/isci/isci_controller.c optional isci
 dev/isci/isci_domain.c optional isci
@@ -572,4 +574,4 @@ x86/xen/xen_apic.c  optionalxenhvm
 x86/xen/xenpv.coptionalxenhvm
 x86/xen/xen_nexus.coptionalxenhvm
 x86/xen/xen_msi.c  optionalxenhvm
-x86/xen/xen_pci.c  optionalxenhvm
+x86/xen/xen_pci_bus.c  optionalxenhvm

Added: head/sys/dev/xen/pci/xen_acpi_pci.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/xen/pci/xen_acpi_pci.c Tue Dec  9 18:03:25 2014
(r275649)
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2014 Roger Pau Monné 
+ * 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 AND CONTRIBUTORS AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include "pcib_if.h"
+#include "pci_if.h"
+
+static int
+xen_acpi_pci_probe(device_t dev)
+{
+
+   if (!xen_pv_domain())
+   return (ENXIO);
+   if (acpi_get_handle(dev) == NULL)
+   return (ENXIO);
+
+   device_set_desc(dev, "Xen ACPI PCI bus");
+
+   return (BUS_PROBE_SPECIFIC);
+}
+
+static device_method_t xen_acpi_pci_methods[] = {
+   /* Device interface */
+   DEVMETHOD(device_probe, xen_acpi_pci_probe),
+
+   /* PCI interface overwrites */
+   DEVMETHOD(pci_enable_msi,   xen_pci_enabl

svn commit: r275650 - head/usr.sbin/mtree

2014-12-09 Thread Simon J. Gerraty
Author: sjg
Date: Tue Dec  9 19:50:50 2014
New Revision: 275650
URL: https://svnweb.freebsd.org/changeset/base/275650

Log:
  -u and -U are supposed to affect existing files too.
  
  Reviewed by:  marcel

Modified:
  head/usr.sbin/mtree/verify.c

Modified: head/usr.sbin/mtree/verify.c
==
--- head/usr.sbin/mtree/verify.cTue Dec  9 18:03:25 2014
(r275649)
+++ head/usr.sbin/mtree/verify.cTue Dec  9 19:50:50 2014
(r275650)
@@ -233,7 +233,7 @@ miss(NODE *p, char *tail)
miss(p->child, tp + 1);
*tp = '\0';
 
-   if (!create)
+   if (!create && !uflag)
continue;
if (chown(path, p->st_uid, p->st_gid) == -1) {
serr = errno;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r275651 - head/contrib/llvm/patches

2014-12-09 Thread Dimitry Andric
Author: dim
Date: Tue Dec  9 20:04:26 2014
New Revision: 275651
URL: https://svnweb.freebsd.org/changeset/base/275651

Log:
  Add llvm patch corresponding to r275633.

Added:
  head/contrib/llvm/patches/patch-r275633-llvm-r223171-fix-vectorizer.diff

Added: head/contrib/llvm/patches/patch-r275633-llvm-r223171-fix-vectorizer.diff
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/contrib/llvm/patches/patch-r275633-llvm-r223171-fix-vectorizer.diff
Tue Dec  9 20:04:26 2014(r275651)
@@ -0,0 +1,71 @@
+Pull in r223171 from upstream llvm trunk (by Michael Zolotukhin):
+
+  PR21302. Vectorize only bottom-tested loops.
+
+  rdar://problem/18886083
+
+This fixes a bug in the llvm vectorizer, which could sometimes cause
+vectorized loops to perform an additional iteration, leading to possible
+buffer overruns.  Symptoms of this, which are usually segfaults, were
+first noticed when building gcc ports, here:
+
+https://lists.freebsd.org/pipermail/freebsd-ports/2014-September/095466.html
+https://lists.freebsd.org/pipermail/freebsd-toolchain/2014-September/001211.html
+
+Introduced here: http://svnweb.freebsd.org/changeset/base/275633
+
+Index: lib/Transforms/Vectorize/LoopVectorize.cpp
+===
+--- lib/Transforms/Vectorize/LoopVectorize.cpp (revision 21)
 lib/Transforms/Vectorize/LoopVectorize.cpp (revision 22)
+@@ -2864,6 +2864,14 @@ bool LoopVectorizationLegality::canVectorize() {
+   if (!TheLoop->getExitingBlock())
+ return false;
+ 
++  // We only handle bottom-tested loops, i.e. loop in which the condition is
++  // checked at the end of each iteration. With that we can assume that all
++  // instructions in the loop are executed the same number of times.
++  if (TheLoop->getExitingBlock() != TheLoop->getLoopLatch()) {
++DEBUG(dbgs() << "LV: loop control flow is not understood by 
vectorizer\n");
++return false;
++  }
++
+   // We need to have a loop header.
+   DEBUG(dbgs() << "LV: Found a loop: " <<
+ TheLoop->getHeader()->getName() << '\n');
+Index: test/Transforms/LoopVectorize/loop-form.ll
+===
+--- test/Transforms/LoopVectorize/loop-form.ll (revision 0)
 test/Transforms/LoopVectorize/loop-form.ll (revision 22)
+@@ -0,0 +1,31 @@
++; RUN: opt -S -loop-vectorize < %s | FileCheck %s
++target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
++
++; Check that we vectorize only bottom-tested loops.
++; This is a reduced testcase from PR21302.
++;
++; rdar://problem/18886083
++
++%struct.X = type { i32, i16 }
++; CHECK-LABEL: @foo(
++; CHECK-NOT: vector.body
++
++define void @foo(i32 %n) {
++entry:
++  br label %for.cond
++
++for.cond:
++  %i = phi i32 [ 0, %entry ], [ %inc, %for.body ]
++  %cmp = icmp slt i32 %i, %n
++  br i1 %cmp, label %for.body, label %if.end
++
++for.body:
++  %iprom = sext i32 %i to i64
++  %b = getelementptr inbounds %struct.X* undef, i64 %iprom, i32 1
++  store i16 0, i16* %b, align 4
++  %inc = add nsw i32 %i, 1
++  br label %for.cond
++
++if.end:
++  ret void
++}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r275653 - head/usr.sbin/pw/tests

2014-12-09 Thread Brad Davis
Author: brd (doc committer)
Date: Tue Dec  9 20:36:07 2014
New Revision: 275653
URL: https://svnweb.freebsd.org/changeset/base/275653

Log:
  Add more tests for pw(8) useradd.
  
  PR:   195832
  Submitted by: Robert O'Neil 
  Approved by:  will

Added:
  head/usr.sbin/pw/tests/pw_add.sh   (contents, props changed)
Modified:
  head/usr.sbin/pw/tests/Makefile

Modified: head/usr.sbin/pw/tests/Makefile
==
--- head/usr.sbin/pw/tests/Makefile Tue Dec  9 20:05:05 2014
(r275652)
+++ head/usr.sbin/pw/tests/Makefile Tue Dec  9 20:36:07 2014
(r275653)
@@ -5,8 +5,9 @@ TESTSRC=${.CURDIR}/../../../contrib/net
 
 TESTSDIR=  ${TESTSBASE}/usr.sbin/pw
 
-ATF_TESTS_SH=  pw_delete pw_lock pw_modify pw_etcdir
+ATF_TESTS_SH=  pw_add pw_delete pw_etcdir pw_lock pw_modify
 
+TEST_METADATA.pw_add+= required_user="root"
 TEST_METADATA.pw_delete+=  required_user="root"
 TEST_METADATA.pw_modify+=  required_user="root"
 

Added: head/usr.sbin/pw/tests/pw_add.sh
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/pw/tests/pw_add.shTue Dec  9 20:36:07 2014
(r275653)
@@ -0,0 +1,40 @@
+# $FreeBSD$
+
+# Import helper functions
+. $(atf_get_srcdir)/helper_functions.shin
+
+# Test add user
+atf_test_case user_add
+user_add_body() {
+   populate_etc_skel
+
+   atf_check -s exit:0 ${PW} useradd test
+   atf_check -s exit:0 -o match:"^test:.*" \
+   grep "^test:.*" $HOME/master.passwd
+}
+
+
+atf_test_case user_add_comments
+user_add_comments_body() {
+   populate_etc_skel
+
+   atf_check -s exit:0 ${PW} useradd test -c "Test User,work,123,456"
+   atf_check -s exit:0 -o match:"^test:.*:Test User,work,123,456:" \
+   grep "^test:.*:Test User,work,123,456:" $HOME/master.passwd
+}
+
+atf_test_case user_add_comments_invalid
+user_add_comments_invalid_body() {
+   populate_etc_skel
+
+   atf_check -s exit:65 -e match:"invalid character" \
+   ${PW} useradd test -c "Test User,work,123:456,456"
+   atf_check -s exit:1 -o empty \
+   grep "^test:.*:Test User,work,123:456,456:" $HOME/master.passwd
+}
+
+atf_init_test_cases() {
+   atf_add_test_case user_add
+   atf_add_test_case user_add_comments
+   atf_add_test_case user_add_comments_invalid 
+}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r275656 - head/usr.sbin/pw/tests

2014-12-09 Thread Brad Davis
Author: brd (doc committer)
Date: Tue Dec  9 21:43:03 2014
New Revision: 275656
URL: https://svnweb.freebsd.org/changeset/base/275656

Log:
  Break out the tests into a file per command and clean up some long lines
  
  Approved by:  will

Added:
  head/usr.sbin/pw/tests/pw_groupdel.sh   (contents, props changed)
  head/usr.sbin/pw/tests/pw_groupmod.sh
 - copied unchanged from r275652, head/usr.sbin/pw/tests/pw_modify.sh
  head/usr.sbin/pw/tests/pw_useradd.sh
 - copied unchanged from r275655, head/usr.sbin/pw/tests/pw_add.sh
  head/usr.sbin/pw/tests/pw_userdel.sh
 - copied, changed from r275652, head/usr.sbin/pw/tests/pw_delete.sh
Deleted:
  head/usr.sbin/pw/tests/pw_add.sh
  head/usr.sbin/pw/tests/pw_delete.sh
  head/usr.sbin/pw/tests/pw_modify.sh
Modified:
  head/usr.sbin/pw/tests/Makefile

Modified: head/usr.sbin/pw/tests/Makefile
==
--- head/usr.sbin/pw/tests/Makefile Tue Dec  9 20:46:17 2014
(r275655)
+++ head/usr.sbin/pw/tests/Makefile Tue Dec  9 21:43:03 2014
(r275656)
@@ -5,11 +5,11 @@ TESTSRC=  ${.CURDIR}/../../../contrib/net
 
 TESTSDIR=  ${TESTSBASE}/usr.sbin/pw
 
-ATF_TESTS_SH=  pw_add pw_delete pw_etcdir pw_lock pw_modify
+ATF_TESTS_SH=  pw_etcdir pw_lock pw_groupmod pw_useradd pw_userdel
 
-TEST_METADATA.pw_add+= required_user="root"
-TEST_METADATA.pw_delete+=  required_user="root"
-TEST_METADATA.pw_modify+=  required_user="root"
+TEST_METADATA.pw_groupmod+=required_user="root"
+TEST_METADATA.pw_useradd+= required_user="root"
+TEST_METADATA.pw_userdel+= required_user="root"
 
 FILES= group helper_functions.shin master.passwd
 FILESDIR=   ${TESTSDIR}

Added: head/usr.sbin/pw/tests/pw_groupdel.sh
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/pw/tests/pw_groupdel.sh   Tue Dec  9 21:43:03 2014
(r275656)
@@ -0,0 +1,24 @@
+# $FreeBSD$
+
+# Import helper functions
+. $(atf_get_srcdir)/helper_functions.shin
+
+
+# Test to make sure we do not accidentially delete wheel when trying to delete
+# an unknown group
+atf_test_case group_do_not_delete_wheel_if_group_unknown
+group_do_not_delete_wheel_if_group_unknown_head() {
+atf_set "descr" "Make sure we do not consider gid 0 an unknown group"
+}
+group_do_not_delete_wheel_if_group_unknown_body() {
+populate_etc_skel
+atf_check -s exit:0 -o inline:"wheel:*:0:root\n" -x ${PW} groupshow 
wheel
+atf_check -e inline:"pw: -g expects a number\n" -s exit:64 -x \
+   ${PW} groupdel -g I_do_not_exist
+atf_check -s exit:0 -o inline:"wheel:*:0:root\n" -x ${PW} groupshow 
wheel
+}
+
+
+atf_init_test_cases() {
+atf_add_test_case group_do_not_delete_wheel_if_group_unknown
+}

Copied: head/usr.sbin/pw/tests/pw_groupmod.sh (from r275652, 
head/usr.sbin/pw/tests/pw_modify.sh)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/pw/tests/pw_groupmod.sh   Tue Dec  9 21:43:03 2014
(r275656, copy of r275652, head/usr.sbin/pw/tests/pw_modify.sh)
@@ -0,0 +1,80 @@
+# $FreeBSD$
+
+# Import helper functions
+. $(atf_get_srcdir)/helper_functions.shin
+
+
+# Test adding & removing a user from a group
+atf_test_case groupmod_user
+groupmod_user_body() {
+   populate_etc_skel
+   atf_check -s exit:0 ${PW} addgroup test
+   atf_check -s exit:0 ${PW} groupmod test -m root
+   atf_check -s exit:0 -o match:"^test:\*:1001:root$" \
+   grep "^test:\*:.*:root$" $HOME/group
+   atf_check -s exit:0 ${PW} groupmod test -d root
+   atf_check -s exit:0 -o match:"^test:\*:1001:$" \
+   grep "^test:\*:.*:$" $HOME/group
+}
+
+
+# Test adding and removing a user that does not exist
+atf_test_case groupmod_invalid_user
+groupmod_invalid_user_body() {
+   populate_etc_skel
+   atf_check -s exit:0 ${PW} addgroup test
+   atf_check -s exit:67 -e match:"does not exist" ${PW} groupmod test -m 
foo
+   atf_check -s exit:0  ${PW} groupmod test -d foo
+}
+
+atf_test_case groupmod_bug_193704
+groupmod_bug_193704_head() {
+   atf_set "descr" "Regression test for the #193704 bug"
+}
+groupmod_bug_193704_body() {
+   populate_etc_skel
+   atf_check -s exit:0 -x ${PW} groupadd test
+   atf_check -s exit:0 -x ${PW} groupmod test -l newgroupname
+   atf_check -s exit:65 -e match:"^pw: unknown group" -x ${PW} groupshow 
test
+}
+
+atf_test_case usermod_bug_185666
+usermod_bug_185666_head() {
+   atf_set "descr" "Regression test for the #185666 bug"
+}
+
+usermod_bug_185666_body() {
+   populate_etc_skel
+   atf_check -s exit:0 -x ${PW} useradd testuser
+   atf_check -s exit:0 -x ${PW} groupadd testgroup
+   atf_check -s exit:0 -x ${PW} groupadd tes

svn commit: r275657 - head/usr.sbin/pw/tests

2014-12-09 Thread Brad Davis
Author: brd (doc committer)
Date: Tue Dec  9 22:11:56 2014
New Revision: 275657
URL: https://svnweb.freebsd.org/changeset/base/275657

Log:
  Add some tests for user modification. [1]
  Fix a missing test in the Makefile from my previous commit.
  
  PR:   195834 [1]
  Submitted by: Robert O'Neil 
  Approved by:  will

Added:
  head/usr.sbin/pw/tests/pw_usermod.sh   (contents, props changed)
Modified:
  head/usr.sbin/pw/tests/Makefile

Modified: head/usr.sbin/pw/tests/Makefile
==
--- head/usr.sbin/pw/tests/Makefile Tue Dec  9 21:43:03 2014
(r275656)
+++ head/usr.sbin/pw/tests/Makefile Tue Dec  9 22:11:56 2014
(r275657)
@@ -5,11 +5,13 @@ TESTSRC=  ${.CURDIR}/../../../contrib/net
 
 TESTSDIR=  ${TESTSBASE}/usr.sbin/pw
 
-ATF_TESTS_SH=  pw_etcdir pw_lock pw_groupmod pw_useradd pw_userdel
+ATF_TESTS_SH=  pw_etcdir pw_lock pw_groupdel pw_groupmod pw_useradd pw_userdel 
pw_usermod
 
+TEST_METADATA.pw_groupdel+=required_user="root"
 TEST_METADATA.pw_groupmod+=required_user="root"
 TEST_METADATA.pw_useradd+= required_user="root"
 TEST_METADATA.pw_userdel+= required_user="root"
+TEST_METADATA.pw_usermod+= required_user="root"
 
 FILES= group helper_functions.shin master.passwd
 FILESDIR=   ${TESTSDIR}

Added: head/usr.sbin/pw/tests/pw_usermod.sh
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/pw/tests/pw_usermod.shTue Dec  9 22:11:56 2014
(r275657)
@@ -0,0 +1,56 @@
+# $FreeBSD$
+
+# Import helper functions
+. $(atf_get_srcdir)/helper_functions.shin
+
+# Test modifying a user
+atf_test_case user_mod
+user_mod_body() {
+   populate_etc_skel
+
+   atf_check -s exit:67 -e match:"no such user" ${PW} usermod test
+   atf_check -s exit:0 ${PW} useradd test
+   atf_check -s exit:0 ${PW} usermod test
+   atf_check -s exit:0 -o match:"^test:.*" \
+   grep "^test:.*" $HOME/master.passwd
+}
+
+# Test modifying a user with comments
+atf_test_case user_mod_comments
+user_mod_comments_body() {
+   populate_etc_skel
+
+   atf_check -s exit:0 ${PW} useradd test -c "Test User,home,123,456"
+   atf_check -s exit:0 ${PW} usermod test -c "Test User,work,123,456"
+   atf_check -s exit:0 -o match:"^test:.*:Test User,work,123,456:" \
+   grep "^test:.*:Test User,work,123,456:" $HOME/master.passwd
+}
+
+# Test modifying a user with invalid comments
+atf_test_case user_mod_comments_invalid
+user_mod_comments_invalid_body() {
+   populate_etc_skel
+
+   atf_check -s exit:0 ${PW} useradd test
+   atf_check -s exit:65 -e match:"invalid character" \
+   ${PW} usermod test -c "Test User,work,123:456,456"
+   atf_check -s exit:1 -o empty \
+   grep "^test:.*:Test User,work,123:456,456:" $HOME/master.passwd
+}
+
+# Test modifying a user name with -l
+atf_test_case user_mod_name
+user_mod_name_body() {
+   populate_etc_skel
+
+   atf_check -s exit:0 ${PW} useradd foo
+   atf_check -s exit:0 ${PW} usermod foo -l "bar"
+   atf_check -s exit:0 -o match:"^bar:.*" \
+   grep "^bar:.*" $HOME/master.passwd
+}
+atf_init_test_cases() {
+   atf_add_test_case user_mod
+   atf_add_test_case user_mod_comments
+   atf_add_test_case user_mod_comments_invalid 
+   atf_add_test_case user_mod_name
+}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r275657 - head/usr.sbin/pw/tests

2014-12-09 Thread NGie Cooper
Hi Brad!

On Tue, Dec 9, 2014 at 2:11 PM, Brad Davis  wrote:
> Author: brd (doc committer)
> Date: Tue Dec  9 22:11:56 2014
> New Revision: 275657
> URL: https://svnweb.freebsd.org/changeset/base/275657
>
> Log:
>   Add some tests for user modification. [1]
>   Fix a missing test in the Makefile from my previous commit.
>
>   PR:   195834 [1]
>   Submitted by: Robert O'Neil 
>   Approved by:  will
>
> Added:
>   head/usr.sbin/pw/tests/pw_usermod.sh   (contents, props changed)
> Modified:
>   head/usr.sbin/pw/tests/Makefile
>
> Modified: head/usr.sbin/pw/tests/Makefile
> ==
> --- head/usr.sbin/pw/tests/Makefile Tue Dec  9 21:43:03 2014
> (r275656)
> +++ head/usr.sbin/pw/tests/Makefile Tue Dec  9 22:11:56 2014
> (r275657)
> @@ -5,11 +5,13 @@ TESTSRC=  ${.CURDIR}/../../../contrib/net
>
>  TESTSDIR=  ${TESTSBASE}/usr.sbin/pw
>
> -ATF_TESTS_SH=  pw_etcdir pw_lock pw_groupmod pw_useradd pw_userdel
> +ATF_TESTS_SH=  pw_etcdir pw_lock pw_groupdel pw_groupmod pw_useradd 
> pw_userdel pw_usermod

Please put this one item per-line so it's easier to backport and
doesn't exceed 80 columns.

> +TEST_METADATA.pw_groupdel+=required_user="root"
>  TEST_METADATA.pw_groupmod+=required_user="root"
>  TEST_METADATA.pw_useradd+= required_user="root"
>  TEST_METADATA.pw_userdel+= required_user="root"
> +TEST_METADATA.pw_usermod+= required_user="root"

This should probably just be a for-loop, e.g.

.for tp in ${ATF_TESTS_SH}
TEST_METADATA.${tp}+= required_user="root"
.endif
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r275657 - head/usr.sbin/pw/tests

2014-12-09 Thread Brad Davis
On Tue, Dec 09, 2014 at 02:28:46PM -0800, NGie Cooper wrote:
> Hi Brad!
> 
> On Tue, Dec 9, 2014 at 2:11 PM, Brad Davis  wrote:
> > Author: brd (doc committer)
> > Date: Tue Dec  9 22:11:56 2014
> > New Revision: 275657
> > URL: https://svnweb.freebsd.org/changeset/base/275657
> >
> > Log:
> >   Add some tests for user modification. [1]
> >   Fix a missing test in the Makefile from my previous commit.
> >
> >   PR:   195834 [1]
> >   Submitted by: Robert O'Neil 
> >   Approved by:  will
> >
> > Added:
> >   head/usr.sbin/pw/tests/pw_usermod.sh   (contents, props changed)
> > Modified:
> >   head/usr.sbin/pw/tests/Makefile
> >
> > Modified: head/usr.sbin/pw/tests/Makefile
> > ==
> > --- head/usr.sbin/pw/tests/Makefile Tue Dec  9 21:43:03 2014
> > (r275656)
> > +++ head/usr.sbin/pw/tests/Makefile Tue Dec  9 22:11:56 2014
> > (r275657)
> > @@ -5,11 +5,13 @@ TESTSRC=  ${.CURDIR}/../../../contrib/net
> >
> >  TESTSDIR=  ${TESTSBASE}/usr.sbin/pw
> >
> > -ATF_TESTS_SH=  pw_etcdir pw_lock pw_groupmod pw_useradd pw_userdel
> > +ATF_TESTS_SH=  pw_etcdir pw_lock pw_groupdel pw_groupmod pw_useradd 
> > pw_userdel pw_usermod
> 
> Please put this one item per-line so it's easier to backport and
> doesn't exceed 80 columns.
> 
> > +TEST_METADATA.pw_groupdel+=required_user="root"
> >  TEST_METADATA.pw_groupmod+=required_user="root"
> >  TEST_METADATA.pw_useradd+= required_user="root"
> >  TEST_METADATA.pw_userdel+= required_user="root"
> > +TEST_METADATA.pw_usermod+= required_user="root"
> 
> This should probably just be a for-loop, e.g.
> 
> .for tp in ${ATF_TESTS_SH}
> TEST_METADATA.${tp}+= required_user="root"
> .endif
> 

Hi,

Thanks for the suggestion!

Comitted in r275658.


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


svn commit: r275658 - head/usr.sbin/pw/tests

2014-12-09 Thread Brad Davis
Author: brd (doc committer)
Date: Tue Dec  9 23:26:47 2014
New Revision: 275658
URL: https://svnweb.freebsd.org/changeset/base/275658

Log:
  Restructure to make it easier to extend in the future
  
  Reviewed by:  will
  Suggested by: ngie

Modified:
  head/usr.sbin/pw/tests/Makefile

Modified: head/usr.sbin/pw/tests/Makefile
==
--- head/usr.sbin/pw/tests/Makefile Tue Dec  9 22:11:56 2014
(r275657)
+++ head/usr.sbin/pw/tests/Makefile Tue Dec  9 23:26:47 2014
(r275658)
@@ -5,13 +5,17 @@ TESTSRC=  ${.CURDIR}/../../../contrib/net
 
 TESTSDIR=  ${TESTSBASE}/usr.sbin/pw
 
-ATF_TESTS_SH=  pw_etcdir pw_lock pw_groupdel pw_groupmod pw_useradd pw_userdel 
pw_usermod
-
-TEST_METADATA.pw_groupdel+=required_user="root"
-TEST_METADATA.pw_groupmod+=required_user="root"
-TEST_METADATA.pw_useradd+= required_user="root"
-TEST_METADATA.pw_userdel+= required_user="root"
-TEST_METADATA.pw_usermod+= required_user="root"
+ATF_TESTS_SH=  pw_etcdir \
+   pw_lock \
+   pw_groupdel \
+   pw_groupmod \
+   pw_useradd \
+   pw_userdel \
+   pw_usermod
+
+.for tp in ${ATF_TESTS_SH}
+TEST_METADATA.${tp}+=  required_user="root"
+.endfor
 
 FILES= group helper_functions.shin master.passwd
 FILESDIR=   ${TESTSDIR}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r275659 - head/bin/freebsd-version

2014-12-09 Thread Dag-Erling Smørgrav
Author: des
Date: Wed Dec 10 03:12:22 2014
New Revision: 275659
URL: https://svnweb.freebsd.org/changeset/base/275659

Log:
  Fix dependency on newvers.sh
  
  Noticed by:   marck
  MFC after:1 week

Modified:
  head/bin/freebsd-version/Makefile

Modified: head/bin/freebsd-version/Makefile
==
--- head/bin/freebsd-version/Makefile   Tue Dec  9 23:26:47 2014
(r275658)
+++ head/bin/freebsd-version/Makefile   Wed Dec 10 03:12:22 2014
(r275659)
@@ -5,8 +5,7 @@ MAN = freebsd-version.1
 CLEANFILES = freebsd-version.sh
 NEWVERS = ${.CURDIR}/../../sys/conf/newvers.sh
 
-freebsd-version.sh.in: ${NEWVERS}
-freebsd-version.sh: ${.CURDIR}/freebsd-version.sh.in
+freebsd-version.sh: ${.CURDIR}/freebsd-version.sh.in ${NEWVERS}
eval $$(egrep '^(TYPE|REVISION|BRANCH)=' ${NEWVERS}) ; \
if ! sed -e "\
s/@@TYPE@@/$${TYPE}/g; \
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r275660 - head/sys/arm/broadcom/bcm2835

2014-12-09 Thread Ian Lepore
Author: ian
Date: Wed Dec 10 04:54:43 2014
New Revision: 275660
URL: https://svnweb.freebsd.org/changeset/base/275660

Log:
  Fix the watchdog timeout calculation to prevent wrap.  The RPi hardware
  can't do a timeout bigger than 15 seconds.  The code wasn't checking for
  this and because bitmasking was involved the requested timeout was
  basically adjusted modulo-16.  That led to things like a 128 second
  timeout actually being a 9 second timeout, which accidentally worked fine
  until watchdogd was changed to only pet the dog once every 10 seconds.

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

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_wdog.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_wdog.cWed Dec 10 03:12:22 
2014(r275659)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_wdog.cWed Dec 10 04:54:43 
2014(r275660)
@@ -142,14 +142,13 @@ bcmwd_watchdog_fn(void *private, u_int c
 
if (cmd > 0) {
sec = ((uint64_t)1 << (cmd & WD_INTERVAL)) / 10;
-   ticks = (sec << 16) & BCM2835_WDOG_TIME_MASK;
-   if (ticks == 0) {
+   if (sec == 0 || sec > 15) {
/* 
 * Can't arm
 * disable watchdog as watchdog(9) requires
 */
device_printf(sc->dev,
-   "Can't arm, timeout is less than 1 second\n");
+   "Can't arm, timeout must be between 1-15 
seconds\n");
WRITE(sc, BCM2835_RSTC_REG, 
(BCM2835_PASWORD << BCM2835_PASSWORD_SHIFT) |
BCM2835_RSTC_RESET);
@@ -157,6 +156,7 @@ bcmwd_watchdog_fn(void *private, u_int c
return;
}
 
+   ticks = (sec << 16) & BCM2835_WDOG_TIME_MASK;
reg = (BCM2835_PASWORD << BCM2835_PASSWORD_SHIFT) | ticks;
WRITE(sc, BCM2835_WDOG_REG, reg);
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"