svn commit: r212355 - head/sys/dev/atkbdc

2010-09-09 Thread Ed Schouten
Author: ed
Date: Thu Sep  9 07:52:15 2010
New Revision: 212355
URL: http://svn.freebsd.org/changeset/base/212355

Log:
  Let psm(4) use si_drv1 to refer to its softc.

Modified:
  head/sys/dev/atkbdc/psm.c

Modified: head/sys/dev/atkbdc/psm.c
==
--- head/sys/dev/atkbdc/psm.c   Thu Sep  9 07:48:56 2010(r212354)
+++ head/sys/dev/atkbdc/psm.c   Thu Sep  9 07:52:15 2010(r212355)
@@ -143,11 +143,6 @@ __FBSDID("$FreeBSD$");
 #defineMOUSE_PS2PLUS_PACKET_TYPE(b)\
 (((b[0] & 0x30) >> 2) | ((b[1] & 0x30) >> 4))
 
-/* some macros */
-#definePSM_UNIT(dev)   (dev2unit(dev) >> 1)
-#definePSM_NBLOCKIO(dev)   (dev2unit(dev) & 1)
-#definePSM_MKMINOR(unit,block) (((unit) << 1) | ((block) ? 0:1))
-
 /* ring buffer */
 typedef struct ringbuf {
int count;  /* # of valid elements in the buffer */
@@ -305,8 +300,6 @@ struct psm_softc {  /* Driver status inf
struct sigio*async; /* Processes waiting for SIGIO */
 };
 static devclass_t psm_devclass;
-#definePSM_SOFTC(unit) \
-((struct psm_softc*)devclass_get_softc(psm_devclass, unit))
 
 /* driver state flags (state) */
 #definePSM_VALID   0x80
@@ -1457,10 +1450,10 @@ psmattach(device_t dev)
}
 
/* Done */
-   sc->dev = make_dev(&psm_cdevsw, PSM_MKMINOR(unit, FALSE), 0, 0, 0666,
-   "psm%d", unit);
-   sc->bdev = make_dev(&psm_cdevsw, PSM_MKMINOR(unit, TRUE), 0, 0, 0666,
-   "bpsm%d", unit);
+   sc->dev = make_dev(&psm_cdevsw, 0, 0, 0, 0666, "psm%d", unit);
+   sc->dev->si_drv1 = sc;
+   sc->bdev = make_dev(&psm_cdevsw, 0, 0, 0, 0666, "bpsm%d", unit);
+   sc->bdev->si_drv1 = sc;
 
if (!verbose)
printf("psm%d: model %s, device ID %d\n",
@@ -1504,14 +1497,13 @@ psmdetach(device_t dev)
 static int
 psmopen(struct cdev *dev, int flag, int fmt, struct thread *td)
 {
-   int unit = PSM_UNIT(dev);
struct psm_softc *sc;
int command_byte;
int err;
int s;
 
/* Get device data */
-   sc = PSM_SOFTC(unit);
+   sc = dev->si_drv1;
if ((sc == NULL) || (sc->state & PSM_VALID) == 0) {
/* the device is no longer valid/functioning */
return (ENXIO);
@@ -1521,7 +1513,7 @@ psmopen(struct cdev *dev, int flag, int 
if (sc->state & PSM_OPEN)
return (EBUSY);
 
-   device_busy(devclass_get_device(psm_devclass, unit));
+   device_busy(devclass_get_device(psm_devclass, sc->unit));
 
/* Initialize state */
sc->mode.level = sc->dflt_mode.level;
@@ -1565,7 +1557,8 @@ psmopen(struct cdev *dev, int flag, int 
kbdc_lock(sc->kbdc, FALSE);
splx(s);
log(LOG_ERR,
-   "psm%d: unable to set the command byte (psmopen).\n", unit);
+   "psm%d: unable to set the command byte (psmopen).\n",
+   sc->unit);
return (EIO);
}
/*
@@ -1590,8 +1583,7 @@ psmopen(struct cdev *dev, int flag, int 
 static int
 psmclose(struct cdev *dev, int flag, int fmt, struct thread *td)
 {
-   int unit = PSM_UNIT(dev);
-   struct psm_softc *sc = PSM_SOFTC(unit);
+   struct psm_softc *sc = dev->si_drv1;
int stat[3];
int command_byte;
int s;
@@ -1615,7 +1607,8 @@ psmclose(struct cdev *dev, int flag, int
KBD_DISABLE_KBD_PORT | KBD_DISABLE_KBD_INT |
KBD_ENABLE_AUX_PORT | KBD_DISABLE_AUX_INT)) {
log(LOG_ERR,
-   "psm%d: failed to disable the aux int (psmclose).\n", unit);
+   "psm%d: failed to disable the aux int (psmclose).\n",
+   sc->unit);
/* CONTROLLER ERROR;
 * NOTE: we shall force our way through. Because the only
 * ill effect we shall see is that we may not be able
@@ -1643,12 +1636,13 @@ psmclose(struct cdev *dev, int flag, int
 */
log(LOG_ERR,
"psm%d: failed to disable the device (psmclose).\n",
-   unit);
+   sc->unit);
}
 
if (get_mouse_status(sc->kbdc, stat, 0, 3) < 3)
log(LOG_DEBUG,
-   "psm%d: failed to get status (psmclose).\n", unit);
+   "psm%d: failed to get status (psmclose).\n",
+   sc->unit);
}
 
if (!set_controller_command_byte(sc->kbdc,
@@ -1661,7 +1655,7 @@ psmclose(struct cdev *dev, int flag, int
 */
log(LOG_ERR,
"psm%d: failed to disable the aux port (psmclose).\n",
-   unit);
+   sc->unit);
}
 
/* remove anything left in the output buff

svn commit: r212356 - head/sys/kern

2010-09-09 Thread Pawel Jakub Dawidek
Author: pjd
Date: Thu Sep  9 07:55:13 2010
New Revision: 212356
URL: http://svn.freebsd.org/changeset/base/212356

Log:
  Remove VI_MOUNT flag from vnode on VFS_MOUNT() failure.

Modified:
  head/sys/kern/vfs_mount.c

Modified: head/sys/kern/vfs_mount.c
==
--- head/sys/kern/vfs_mount.c   Thu Sep  9 07:52:15 2010(r212355)
+++ head/sys/kern/vfs_mount.c   Thu Sep  9 07:55:13 2010(r212356)
@@ -856,6 +856,9 @@ vfs_domount_first(
if (error != 0) {
vfs_unbusy(mp);
vfs_mount_destroy(mp);
+   VI_LOCK(vp);
+   vp->v_iflag &= ~VI_MOUNT;
+   VI_UNLOCK(vp);
vrele(vp);
return (error);
}
___
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: r212357 - in head/sys: cddl/contrib/opensolaris/uts/common/dtrace cddl/contrib/opensolaris/uts/common/sys kern

2010-09-09 Thread Rui Paulo
Author: rpaulo
Date: Thu Sep  9 09:58:05 2010
New Revision: 212357
URL: http://svn.freebsd.org/changeset/base/212357

Log:
  Fix two bugs in DTrace:
  * when the process exits, remove the associated USDT probes
  * when the process forks, duplicate the USDT probes.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
  head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
  head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h
  head/sys/kern/kern_fork.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.cThu Sep 
 9 07:55:13 2010(r212356)
+++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.cThu Sep 
 9 09:58:05 2010(r212357)
@@ -9218,7 +9218,6 @@ dtrace_difo_init(dtrace_difo_t *dp, dtra
dtrace_difo_hold(dp);
 }
 
-#if defined(sun)
 static dtrace_difo_t *
 dtrace_difo_duplicate(dtrace_difo_t *dp, dtrace_vstate_t *vstate)
 {
@@ -9262,7 +9261,6 @@ dtrace_difo_duplicate(dtrace_difo_t *dp,
dtrace_difo_init(new, vstate);
return (new);
 }
-#endif
 
 static void
 dtrace_difo_destroy(dtrace_difo_t *dp, dtrace_vstate_t *vstate)
@@ -14615,12 +14613,16 @@ dtrace_helpers_create(proc_t *p)
 }
 
 #if defined(sun)
-static void
-dtrace_helpers_destroy(void)
+static
+#endif
+void
+dtrace_helpers_destroy(proc_t *p)
 {
dtrace_helpers_t *help;
dtrace_vstate_t *vstate;
+#if defined(sun)
proc_t *p = curproc;
+#endif
int i;
 
mutex_enter(&dtrace_lock);
@@ -14707,7 +14709,10 @@ dtrace_helpers_destroy(void)
mutex_exit(&dtrace_lock);
 }
 
-static void
+#if defined(sun)
+static
+#endif
+void
 dtrace_helpers_duplicate(proc_t *from, proc_t *to)
 {
dtrace_helpers_t *help, *newhelp;
@@ -14788,7 +14793,6 @@ dtrace_helpers_duplicate(proc_t *from, p
if (hasprovs)
dtrace_helper_provider_register(to, newhelp, NULL);
 }
-#endif
 
 #if defined(sun)
 /*

Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c  Thu Sep 
 9 07:55:13 2010(r212356)
+++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c  Thu Sep 
 9 09:58:05 2010(r212357)
@@ -456,6 +456,16 @@ fasttrap_fork(proc_t *p, proc_t *cp)
 #if defined(sun)
ASSERT(p->p_dtrace_count > 0);
 #else
+   if (p->p_dtrace_helpers) {
+   /*
+* dtrace_helpers_duplicate() allocates memory.
+*/
+   PROC_UNLOCK(p);
+   PROC_UNLOCK(cp);
+   dtrace_helpers_duplicate(p, cp);
+   PROC_LOCK(cp);
+   PROC_LOCK(p);
+   }
/*
 * This check is purposely here instead of in kern_fork.c because,
 * for legal resons, we cannot include the dtrace_cddl.h header
@@ -539,6 +549,10 @@ fasttrap_exec_exit(proc_t *p)
 * static probes are handled by the meta-provider remove entry point.
 */
fasttrap_provider_retire(p->p_pid, FASTTRAP_PID_NAME, 0);
+#if !defined(sun)
+   if (p->p_dtrace_helpers)
+   dtrace_helpers_destroy(p);
+#endif
PROC_LOCK(p);
 }
 

Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h   Thu Sep  9 
07:55:13 2010(r212356)
+++ head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h   Thu Sep  9 
09:58:05 2010(r212357)
@@ -2289,6 +2289,11 @@ extern int dtrace_blksuword32(uintptr_t,
 extern void dtrace_getfsr(uint64_t *);
 #endif
 
+#if !defined(sun)
+extern void dtrace_helpers_duplicate(proc_t *, proc_t *);
+extern void dtrace_helpers_destroy(proc_t *);
+#endif
+
 #defineDTRACE_CPUFLAG_ISSET(flag) \
(cpu_core[curcpu].cpuc_dtrace_flags & (flag))
 

Modified: head/sys/kern/kern_fork.c
==
--- head/sys/kern/kern_fork.c   Thu Sep  9 07:55:13 2010(r212356)
+++ head/sys/kern/kern_fork.c   Thu Sep  9 09:58:05 2010(r212357)
@@ -671,15 +671,6 @@ again:
p2->p_pfsflags = p1->p_pfsflags;
}
 
-#ifdef KDTRACE_HOOKS
-   /*
-* Tell the DTrace fasttrap provider about the new process
-* if it has registered an interest.
-*/
-   if (dtrace_fasttrap_fork)
-   dtrace_fasttrap_fork(p1, p2);
-#endif
-
/*
 * This begins the section where we must prevent the parent
 * from being swapped.
@@ -744,6 +735,21 @@ again:
PROC_SLOCK(p2);
p2->p_state = PRS_NORMAL;
PROC_SUNLOCK(p2);
+#ifdef KDT

svn commit: r212358 - head/cddl/contrib/opensolaris/lib/libdtrace/common

2010-09-09 Thread Rui Paulo
Author: rpaulo
Date: Thu Sep  9 11:10:15 2010
New Revision: 212358
URL: http://svn.freebsd.org/changeset/base/212358

Log:
  Don't clobber an existing target object file when doing the DTrace
  linking process. This is needed because we change the source object
  files and the second this dtrace -G is run, no probes will be found.
  This hack allows us to build postgres with DTrace probes enabled. I'll
  try to find a way to fix this without needing this hack.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c
==
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.cThu Sep 
 9 09:58:05 2010(r212357)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.cThu Sep 
 9 11:10:15 2010(r212358)
@@ -1616,6 +1616,18 @@ dtrace_program_link(dtrace_hdl_t *dtp, d
int eprobes = 0, ret = 0;
 
 #if !defined(sun)
+   if (access(file, R_OK) == 0) {
+   fprintf(stderr, "dtrace: target object (%s) already exists. "
+   "Please remove the target\ndtrace: object and rebuild all "
+   "the source objects if you wish to run the DTrace\n"
+   "dtrace: linking process again\n", file);
+   /*
+* Several build infrastructures run DTrace twice (e.g.
+* postgres) and we don't want the build to fail. Return
+* 0 here since this isn't really a fatal error.
+*/
+   return (0);
+   }
/* XXX Should get a temp file name here. */
snprintf(tfile, sizeof(tfile), "%s.tmp", file);
 #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"


svn commit: r212359 - in head/sys/dev/ata: . chipsets

2010-09-09 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Thu Sep  9 13:17:30 2010
New Revision: 212359
URL: http://svn.freebsd.org/changeset/base/212359

Log:
  Fix a problem where device detection would work unreliably on Serverworks
  K2 SATA controllers. The chip's status register must be read first, and
  as a long, for other registers to be correctly updated after a command, and
  this includes the command sequence in device detection as well as the
  previously handled case after interrupts. While here, clean up some
  previous hacks related to this controller.
  
  Reported by:  many
  Reviewed by:  mav
  MFC after:3 weeks

Modified:
  head/sys/dev/ata/ata-all.h
  head/sys/dev/ata/ata-lowlevel.c
  head/sys/dev/ata/chipsets/ata-serverworks.c

Modified: head/sys/dev/ata/ata-all.h
==
--- head/sys/dev/ata/ata-all.h  Thu Sep  9 11:10:15 2010(r212358)
+++ head/sys/dev/ata/ata-all.h  Thu Sep  9 13:17:30 2010(r212359)
@@ -566,6 +566,7 @@ struct ata_channel {
 #define ATA_SATA   0x80
 #define ATA_DMA_BEFORE_CMD 0x100
 #define ATA_KNOWN_PRESENCE 0x200
+#define ATA_STATUS_IS_LONG 0x400
 
 intpm_level;   /* power management 
level */
 int devices;/* what is present */

Modified: head/sys/dev/ata/ata-lowlevel.c
==
--- head/sys/dev/ata/ata-lowlevel.c Thu Sep  9 11:10:15 2010
(r212358)
+++ head/sys/dev/ata/ata-lowlevel.c Thu Sep  9 13:17:30 2010
(r212359)
@@ -516,10 +516,13 @@ ata_generic_reset(device_t dev)
if ((mask & 0x01) && (stat0 & ATA_S_BUSY)) {
ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_DEV(ATA_MASTER));
DELAY(10);
+   if (ch->flags & ATA_STATUS_IS_LONG)
+   stat0 = ATA_IDX_INL(ch, ATA_STATUS) & 0xff;
+   else
+   stat0 = ATA_IDX_INB(ch, ATA_STATUS);
err = ATA_IDX_INB(ch, ATA_ERROR);
lsb = ATA_IDX_INB(ch, ATA_CYL_LSB);
msb = ATA_IDX_INB(ch, ATA_CYL_MSB);
-   stat0 = ATA_IDX_INB(ch, ATA_STATUS);
if (bootverbose)
device_printf(dev,
  "stat0=0x%02x err=0x%02x lsb=0x%02x msb=0x%02x\n",
@@ -546,10 +549,13 @@ ata_generic_reset(device_t dev)
!((mask & 0x01) && (stat0 & ATA_S_BUSY))) {
ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_DEV(ATA_SLAVE));
DELAY(10);
+   if (ch->flags & ATA_STATUS_IS_LONG)
+   stat1 = ATA_IDX_INL(ch, ATA_STATUS) & 0xff;
+   else
+   stat1 = ATA_IDX_INB(ch, ATA_STATUS);
err = ATA_IDX_INB(ch, ATA_ERROR);
lsb = ATA_IDX_INB(ch, ATA_CYL_LSB);
msb = ATA_IDX_INB(ch, ATA_CYL_MSB);
-   stat1 = ATA_IDX_INB(ch, ATA_STATUS);
if (bootverbose)
device_printf(dev,
  "stat1=0x%02x err=0x%02x lsb=0x%02x msb=0x%02x\n",

Modified: head/sys/dev/ata/chipsets/ata-serverworks.c
==
--- head/sys/dev/ata/chipsets/ata-serverworks.c Thu Sep  9 11:10:15 2010
(r212358)
+++ head/sys/dev/ata/chipsets/ata-serverworks.c Thu Sep  9 13:17:30 2010
(r212359)
@@ -58,9 +58,8 @@ static int ata_serverworks_ch_detach(dev
 static void ata_serverworks_tf_read(struct ata_request *request);
 static void ata_serverworks_tf_write(struct ata_request *request);
 static int ata_serverworks_setmode(device_t dev, int target, int mode);
-#ifdef __powerpc__
+static void ata_serverworks_sata_reset(device_t dev);
 static int ata_serverworks_status(device_t dev);
-#endif
 
 /* misc defines */
 #define SWKS_330
@@ -101,7 +100,6 @@ ata_serverworks_probe(device_t dev)
 return (BUS_PROBE_DEFAULT);
 }
 
-#ifdef __powerpc__
 static int
 ata_serverworks_status(device_t dev)
 {
@@ -123,7 +121,6 @@ ata_serverworks_status(device_t dev)
 
 return ata_pci_status(dev);
 }
-#endif
 
 static int
 ata_serverworks_chipinit(device_t dev)
@@ -145,6 +142,7 @@ ata_serverworks_chipinit(device_t dev)
ctlr->ch_detach = ata_serverworks_ch_detach;
ctlr->setmode = ata_sata_setmode;
ctlr->getrev = ata_sata_getrev;
+   ctlr->reset = ata_serverworks_sata_reset;
return 0;
 }
 else if (ctlr->chip->cfg1 == SWKS_33) {
@@ -210,30 +208,20 @@ ata_serverworks_ch_attach(device_t dev)
 ch->r_io[ATA_SERROR].offset = ch_offset + 0x44;
 ch->r_io[ATA_SCONTROL].offset = ch_offset + 0x48;
 
-ch->flags |= ATA_NO_SLAVE;
-ch->flags |= ATA_SATA;
+ch->flags |= ATA_NO_SLAVE | ATA_SATA | ATA_KNOWN_PRESENCE;
 ata_pci_hw(dev);
 ch->hw.tf_read = ata_serverworks_tf_read;
 ch->hw.tf_write = ata_serverworks_tf_write;
-#ifdef __powerpc__
-ch->hw.status = ata_serverwork

svn commit: r212360 - head/sys/vm

2010-09-09 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Thu Sep  9 13:32:58 2010
New Revision: 212360
URL: http://svn.freebsd.org/changeset/base/212360

Log:
  On architectures with non-tree-based page tables like PowerPC, every page
  in a range must be checked when calling pmap_remove(). Calling
  pmap_remove() from vm_pageout_map_deactivate_pages() with the entire range
  of the map could result in attempting to demap an extraordinary number
  of pages (> 10^15), so iterate through each map entry and unmap each of
  them individually.
  
  MFC after:6 weeks

Modified:
  head/sys/vm/vm_pageout.c

Modified: head/sys/vm/vm_pageout.c
==
--- head/sys/vm/vm_pageout.cThu Sep  9 13:17:30 2010(r212359)
+++ head/sys/vm/vm_pageout.cThu Sep  9 13:32:58 2010(r212360)
@@ -701,8 +701,11 @@ vm_pageout_map_deactivate_pages(map, des
 * table pages.
 */
if (desired == 0 && nothingwired) {
-   pmap_remove(vm_map_pmap(map), vm_map_min(map),
-   vm_map_max(map));
+   tmpe = map->header.next;
+   while (tmpe != &map->header) {
+   pmap_remove(vm_map_pmap(map), tmpe->start, tmpe->end);
+   tmpe = tmpe->next;
+   }
}
vm_map_unlock(map);
 }
___
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: r212362 - head/sys/fs/nfsclient

2010-09-09 Thread Rick Macklem
Author: rmacklem
Date: Thu Sep  9 15:45:11 2010
New Revision: 212362
URL: http://svn.freebsd.org/changeset/base/212362

Log:
  Fix the experimental NFS client so that it doesn't panic when
  NFSv2,3 byte range locking is attempted. A fix that allows the
  nlm_advlock() to work with both clients is in progress, but
  may take a while. As such, I am doing this commit so that
  the kernel doesn't panic in the meantime.
  
  Submitted by: jh
  MFC after:2 weeks

Modified:
  head/sys/fs/nfsclient/nfs_clvnops.c

Modified: head/sys/fs/nfsclient/nfs_clvnops.c
==
--- head/sys/fs/nfsclient/nfs_clvnops.c Thu Sep  9 13:38:36 2010
(r212361)
+++ head/sys/fs/nfsclient/nfs_clvnops.c Thu Sep  9 15:45:11 2010
(r212362)
@@ -2939,8 +2939,10 @@ nfs_advlock(struct vop_advlock_args *ap)
} else {
if (ncl_advlock_p)
error = ncl_advlock_p(ap);
-   else
+   else {
+   VOP_UNLOCK(vp, 0);
error = ENOLCK;
+   }
}
}
return (error);
___
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: r212363 - head/sys/powerpc/aim

2010-09-09 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Thu Sep  9 16:06:55 2010
New Revision: 212363
URL: http://svn.freebsd.org/changeset/base/212363

Log:
  Reorder statistics tracking and table lock acquisitions already in place
  to avoid race conditions updating the PVO statistics.

Modified:
  head/sys/powerpc/aim/mmu_oea64.c

Modified: head/sys/powerpc/aim/mmu_oea64.c
==
--- head/sys/powerpc/aim/mmu_oea64.cThu Sep  9 15:45:11 2010
(r212362)
+++ head/sys/powerpc/aim/mmu_oea64.cThu Sep  9 16:06:55 2010
(r212363)
@@ -2424,7 +2424,6 @@ moea64_pvo_enter(pmap_t pm, uma_zone_t z
 * the bootstrap pool.
 */
 
-   moea64_pvo_enter_calls++;
first = 0;
bootstrap = (flags & PVO_BOOTSTRAP);
 
@@ -2444,6 +2443,8 @@ moea64_pvo_enter(pmap_t pm, uma_zone_t z
 */
LOCK_TABLE();
 
+   moea64_pvo_enter_calls++;
+
LIST_FOREACH(pvo, &moea64_pvo_table[ptegidx], pvo_olink) {
if (pvo->pvo_pmap == pm && PVO_VADDR(pvo) == va) {
if ((pvo->pvo_pte.lpte.pte_lo & LPTE_RPGN) == pa &&
@@ -2608,14 +2609,15 @@ moea64_pvo_remove(struct pvo_entry *pvo)
 * if we aren't going to reuse it.
 */
LIST_REMOVE(pvo, pvo_olink);
+
+   moea64_pvo_entries--;
+   moea64_pvo_remove_calls++;
+
UNLOCK_TABLE();
 
if (!(pvo->pvo_vaddr & PVO_BOOTSTRAP))
uma_zfree((pvo->pvo_vaddr & PVO_MANAGED) ? moea64_mpvo_zone :
moea64_upvo_zone, pvo);
-
-   moea64_pvo_entries--;
-   moea64_pvo_remove_calls++;
 }
 
 static struct pvo_entry *
___
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: r212360 - head/sys/vm

2010-09-09 Thread Alan Cox

Nathan Whitehorn wrote:

Author: nwhitehorn
Date: Thu Sep  9 13:32:58 2010
New Revision: 212360
URL: http://svn.freebsd.org/changeset/base/212360

Log:
  On architectures with non-tree-based page tables like PowerPC, every page
  in a range must be checked when calling pmap_remove(). Calling
  pmap_remove() from vm_pageout_map_deactivate_pages() with the entire range
  of the map could result in attempting to demap an extraordinary number
  of pages (> 10^15), so iterate through each map entry and unmap each of
  them individually.
  
  


This is a machine-dependent issue, and so I will argue that it is the 
pmap's and not the machine-independent layer's responsibility to deal 
with this.  Our sparc64 port faces the same problem with the TSB, and it 
deals with it internally.  Moreover, the solution isn't that 
complicated.  Is there any reason why the sparc64 solution can't be 
applied to powerpc?


Regards,
Alan

___
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: r212364 - head/share/man/man9

2010-09-09 Thread Matthew D Fleming
Author: mdf
Date: Thu Sep  9 16:27:02 2010
New Revision: 212364
URL: http://svn.freebsd.org/changeset/base/212364

Log:
  Fix small errors in the sbuf(9) man page.

Modified:
  head/share/man/man9/sbuf.9

Modified: head/share/man/man9/sbuf.9
==
--- head/share/man/man9/sbuf.9  Thu Sep  9 16:06:55 2010(r212363)
+++ head/share/man/man9/sbuf.9  Thu Sep  9 16:27:02 2010(r212364)
@@ -98,7 +98,7 @@
 The
 .Nm
 family of functions allows one to safely allocate, construct and
-release bounded null-terminated strings in kernel space.
+release bounded NUL-terminated strings in kernel space.
 Instead of arrays of characters, these functions operate on structures
 called
 .Fa sbufs ,
@@ -289,7 +289,7 @@ overflowed.
 .Pp
 The
 .Fn sbuf_finish
-function null-terminates the
+function NUL-terminates the
 .Fa sbuf
 and marks it as finished, which means that it may no longer be
 modified using
@@ -298,7 +298,10 @@ modified using
 .Fn sbuf_cpy ,
 .Fn sbuf_printf
 or
-.Fn sbuf_putc .
+.Fn sbuf_putc ,
+until
+.Fn sbuf_clear
+is used to reset the sbuf.
 .Pp
 The
 .Fn sbuf_data
@@ -309,7 +312,9 @@ functions return the actual string and i
 only works on a finished
 .Fa sbuf .
 .Fn sbuf_done
-returns non-zero if the sbuf is finished.
+returns non-zero if the
+.Fa sbuf
+is finished.
 .Sh NOTES
 If an operation caused an
 .Fa sbuf
___
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: r212365 - head/sys/kern

2010-09-09 Thread Matthew D Fleming
Author: mdf
Date: Thu Sep  9 16:51:52 2010
New Revision: 212365
URL: http://svn.freebsd.org/changeset/base/212365

Log:
  Refactor sbuf code so that most uses of sbuf_extend() are in a new
  sbuf_put_byte().  This makes it easier to add drain functionality when a
  buffer would overflow as there are fewer code points.
  
  Reviewed by:  phk

Modified:
  head/sys/kern/subr_sbuf.c

Modified: head/sys/kern/subr_sbuf.c
==
--- head/sys/kern/subr_sbuf.c   Thu Sep  9 16:27:02 2010(r212364)
+++ head/sys/kern/subr_sbuf.c   Thu Sep  9 16:51:52 2010(r212365)
@@ -272,27 +272,59 @@ sbuf_setpos(struct sbuf *s, int pos)
 }
 
 /*
+ * Append a byte to an sbuf.  This is the core function for appending
+ * to an sbuf and is the main place that deals with extending the
+ * buffer and marking overflow.
+ */
+static void
+sbuf_put_byte(int c, struct sbuf *s)
+{
+
+   assert_sbuf_integrity(s);
+   assert_sbuf_state(s, 0);
+
+   if (SBUF_HASOVERFLOWED(s))
+   return;
+   if (SBUF_FREESPACE(s) <= 0) {
+   if (sbuf_extend(s, 1) < 0) {
+   SBUF_SETFLAG(s, SBUF_OVERFLOWED);
+   return;
+   }
+   }
+   s->s_buf[s->s_len++] = c;
+}
+
+/*
+ * Append a non-NUL character to an sbuf.  This prototype signature is
+ * suitable for use with kvprintf(9).
+ */
+static void
+sbuf_putc_func(int c, void *arg)
+{
+
+   if (c != '\0')
+   sbuf_put_byte(c, arg);
+}
+
+/*
  * Append a byte string to an sbuf.
  */
 int
 sbuf_bcat(struct sbuf *s, const void *buf, size_t len)
 {
const char *str = buf;
+   const char *end = str + len;
 
assert_sbuf_integrity(s);
assert_sbuf_state(s, 0);
 
if (SBUF_HASOVERFLOWED(s))
return (-1);
-   for (; len; len--) {
-   if (!SBUF_HASROOM(s) && sbuf_extend(s, len) < 0)
-   break;
-   s->s_buf[s->s_len++] = *str++;
-   }
-   if (len > 0) {
-   SBUF_SETFLAG(s, SBUF_OVERFLOWED);
-   return (-1);
-   }
+   for (; str < end; str++) {
+   sbuf_put_byte(*str, s);
+   if (SBUF_HASOVERFLOWED(s))
+   return (-1);
+   }
return (0);
 }
 
@@ -352,13 +384,9 @@ sbuf_cat(struct sbuf *s, const char *str
return (-1);
 
while (*str != '\0') {
-   if (!SBUF_HASROOM(s) && sbuf_extend(s, strlen(str)) < 0)
-   break;
-   s->s_buf[s->s_len++] = *str++;
-   }
-   if (*str != '\0') {
-   SBUF_SETFLAG(s, SBUF_OVERFLOWED);
-   return (-1);
+   sbuf_put_byte(*str, s);
+   if (SBUF_HASOVERFLOWED(s))
+   return (-1);
}
return (0);
 }
@@ -417,6 +445,23 @@ sbuf_cpy(struct sbuf *s, const char *str
 /*
  * Format the given argument list and append the resulting string to an sbuf.
  */
+#ifdef _KERNEL
+int
+sbuf_vprintf(struct sbuf *s, const char *fmt, va_list ap)
+{
+
+   assert_sbuf_integrity(s);
+   assert_sbuf_state(s, 0);
+
+   KASSERT(fmt != NULL,
+   ("%s called with a NULL format string", __func__));
+
+   (void)kvprintf(fmt, sbuf_putc_func, s, 10, ap);
+   if (SBUF_HASOVERFLOWED(s))
+   return (-1);
+   return (0);
+}
+#else /* !_KERNEL */
 int
 sbuf_vprintf(struct sbuf *s, const char *fmt, va_list ap)
 {
@@ -432,6 +477,12 @@ sbuf_vprintf(struct sbuf *s, const char 
if (SBUF_HASOVERFLOWED(s))
return (-1);
 
+   /*
+* For the moment, there is no way to get vsnprintf(3) to hand
+* back a character at a time, to push everything into
+* sbuf_putc_func() as was done for the kernel.
+*/
+
do {
va_copy(ap_copy, ap);
len = vsnprintf(&s->s_buf[s->s_len], SBUF_FREESPACE(s) + 1,
@@ -462,6 +513,7 @@ sbuf_vprintf(struct sbuf *s, const char 
return (-1);
return (0);
 }
+#endif /* _KERNEL */
 
 /*
  * Format the given arguments and append the resulting string to an sbuf.
@@ -485,17 +537,9 @@ int
 sbuf_putc(struct sbuf *s, int c)
 {
 
-   assert_sbuf_integrity(s);
-   assert_sbuf_state(s, 0);
-
+   sbuf_putc_func(c, s);
if (SBUF_HASOVERFLOWED(s))
return (-1);
-   if (!SBUF_HASROOM(s) && sbuf_extend(s, 1) < 0) {
-   SBUF_SETFLAG(s, SBUF_OVERFLOWED);
-   return (-1);
-   }
-   if (c != '\0')
-   s->s_buf[s->s_len++] = c;
return (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"


Re: svn commit: r212360 - head/sys/vm

2010-09-09 Thread Nathan Whitehorn
On 09/09/10 11:01, Alan Cox wrote:
> Nathan Whitehorn wrote:
>> Author: nwhitehorn
>> Date: Thu Sep  9 13:32:58 2010
>> New Revision: 212360
>> URL: http://svn.freebsd.org/changeset/base/212360
>>
>> Log:
>>   On architectures with non-tree-based page tables like PowerPC,
>> every page
>>   in a range must be checked when calling pmap_remove(). Calling
>>   pmap_remove() from vm_pageout_map_deactivate_pages() with the
>> entire range
>>   of the map could result in attempting to demap an extraordinary number
>>   of pages (> 10^15), so iterate through each map entry and unmap
>> each of
>>   them individually.
>> 
>
> This is a machine-dependent issue, and so I will argue that it is the
> pmap's and not the machine-independent layer's responsibility to deal
> with this.  Our sparc64 port faces the same problem with the TSB, and
> it deals with it internally.  Moreover, the solution isn't that
> complicated.  Is there any reason why the sparc64 solution can't be
> applied to powerpc?
>
> Regards,
> Alan
>
It's really a pain. You have to either search the entire hashed page
table after transforming the ranges from effective addresses into
virtual addresses (and into a discontiguous set of ranges), which
involves sorting through several hundred thousand or more entries, or
every pmap needs to maintain a list of pages that belong to it at all
times, which starts to duplicate the functionality of vm_map, as far as
I understand it. The second approach seems to be the one followed by
sparc64 (though I'm not very familiar with sparc64's pmap).

This particular code seems to be the only place in the kernel that does
giant deallocations or protection changes, and I didn't see a reason why
this code would be any less efficient on architectures with tree-based
tables than the previous one, so it seemed to minimize the number of
required hacks just to change it here. If it actually is worse on x86,
I'm happy to revert the change and try to hack around this in pmap.
-Nathan
___
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: r212366 - head/sys/mips/rmi

2010-09-09 Thread Jayachandran C.
Author: jchandra
Date: Thu Sep  9 17:45:48 2010
New Revision: 212366
URL: http://svn.freebsd.org/changeset/base/212366

Log:
  Clean up and update sys/mips/rmi/rmi_mips_exts.h
  
  - Provide 64 bit implementations for some macros. On n64 and n32,
don't split 64 bit values.
  - No need for 32 bit ops for control registers.
  - Fix few bugs (write control reg, write_c0_register64).
  - Re-write EIRR/EIMR/CPUID operations using read_c0_registerXX, no
need of inline assembly.
  - rename control reg access functions to avoid phnx, update callers.
  - stlye/whitespace fixes.

Modified:
  head/sys/mips/rmi/rmi_mips_exts.h
  head/sys/mips/rmi/xlr_machdep.c
  head/sys/mips/rmi/xlr_pci.c

Modified: head/sys/mips/rmi/rmi_mips_exts.h
==
--- head/sys/mips/rmi/rmi_mips_exts.h   Thu Sep  9 16:51:52 2010
(r212365)
+++ head/sys/mips/rmi/rmi_mips_exts.h   Thu Sep  9 17:45:48 2010
(r212366)
@@ -30,234 +30,286 @@
  * $FreeBSD$
  */
 #ifndef __MIPS_EXTS_H__
-#define __MIPS_EXTS_H__
+#define__MIPS_EXTS_H__
 
-#define CPU_BLOCKID_IFU  0
-#define CPU_BLOCKID_ICU  1
-#define CPU_BLOCKID_IEU  2
-#define CPU_BLOCKID_LSU  3
-#define CPU_BLOCKID_MMU  4
-#define CPU_BLOCKID_PRF  5
-
-#define LSU_CERRLOG_REGID9
-
-static __inline__ unsigned int read_32bit_phnx_ctrl_reg(int block, int reg)
+#defineCPU_BLOCKID_IFU 0
+#defineCPU_BLOCKID_ICU 1
+#defineCPU_BLOCKID_IEU 2
+#defineCPU_BLOCKID_LSU 3
+#defineCPU_BLOCKID_MMU 4
+#defineCPU_BLOCKID_PRF 5
+
+#defineLSU_CERRLOG_REGID9
+
+#if defined(__mips_n64) || defined(__mips_n32)
+static __inline uint64_t
+read_xlr_ctrl_register(int block, int reg)
 { 
-   unsigned int __res;
+   uint64_t res;
+
+   __asm__ __volatile__(
+   ".set   push\n\t"
+   ".set   noreorder\n\t"
+   "move   $9, %1\n\t"
+   ".word  0x71280018\n\t"  /* mfcr $8, $9 */
+   "move   %0, $8\n\t"
+   ".set   pop\n"
+   : "=r" (res) : "r"((block << 8) | reg)
+   : "$8", "$9"
+   );
+   return (res);
+}
 
-   __asm__ __volatile__(   
-   ".set\tpush\n\t"
-   ".set\tnoreorder\n\t" 
-   "move $9, %1\n" 
-   /* "mfcr\t$8, $9\n\t"  */
-   ".word 0x71280018\n"
-   "move %0, $8\n"
-   ".set\tpop"   
-   : "=r" (__res) : "r"((block<<8)|reg)
-   : "$8", "$9"
-   );
-   return __res;
-}
-
-static __inline__ void write_32bit_phnx_ctrl_reg(int block, int reg, unsigned 
int value)
-{
-   __asm__ __volatile__(
-   ".set\tpush\n\t"
-   ".set\tnoreorder\n\t"
-   "move $8, %0\n"
-   "move $9, %1\n"
-   /* "mtcr\t$8, $9\n\t"  */
-   ".word 0x71280019\n"
-   ".set\tpop"
-   :
-   : "r" (value), "r"((block<<8)|reg)
-   : "$8", "$9"
-   );
+static __inline void
+write_xlr_ctrl_register(int block, int reg, uint64_t value)
+{
+   __asm__ __volatile__(
+   ".set   push\n\t"
+   ".set   noreorder\n\t"
+   "move   $8, %0\n"
+   "move   $9, %1\n"
+   ".word  0x71280019\n"/* mtcr $8, $9  */
+   ".set   pop\n"
+   :
+   : "r" (value), "r" ((block << 8) | reg)
+   : "$8", "$9"
+   );
 }
 
-static __inline__ unsigned long long read_64bit_phnx_ctrl_reg(int block, int 
reg)
+#else /* !(defined(__mips_n64) || defined(__mips_n32)) */
+
+static __inline uint64_t
+read_xlr_ctrl_register(int block, int reg)
 {  
-   unsigned int high, low; 
-   
-   __asm__ __volatile__(   
-   ".set\tmips64\n\t"  
-   "move$9, %2\n"
-   /* "mfcr$8, $9\n" */
-   ".word   0x71280018\n"
-   "dsrl32  %0, $8, 0\n\t" 
-   "dsll32  $8, $8, 0\n\t" 
-   "dsrl32  %1, $8, 0\n\t" 
-   ".set mips0"
-   : "=r" (high), "=r"(low)
-   : "r"((block<<8)|reg)
-   : "$8", "$9"
-   );  
-   
-   return ( (((unsigned long long)high)<<32) | low);
+   uint32_t high, low;
+
+   __asm__ __volatile__(
+   ".set   push\n\t"
+   ".set   n

svn commit: r212367 - in head: share/man/man9 sys/kern sys/sys

2010-09-09 Thread Matthew D Fleming
Author: mdf
Date: Thu Sep  9 17:49:18 2010
New Revision: 212367
URL: http://svn.freebsd.org/changeset/base/212367

Log:
  Add drain functionality to sbufs.  The drain is a function that is
  called when the sbuf internal buffer is filled.  For kernel sbufs with a
  drain, the internal buffer will never be expanded.  For userland sbufs
  with a drain, the internal buffer may still be expanded by
  sbuf_[v]printf(3).
  
  Sbufs now have three basic uses:
  1) static string manipulation.  Overflow is marked.
  2) dynamic string manipulation.  Overflow triggers string growth.
  3) drained string manipulation.  Overflow triggers draining.
  
  In all cases the manipulation is 'safe' in that overflow is detected and
  managed.
  
  Reviewed by:  phk (the previous version)

Modified:
  head/share/man/man9/Makefile
  head/share/man/man9/sbuf.9
  head/sys/kern/subr_sbuf.c
  head/sys/sys/sbuf.h

Modified: head/share/man/man9/Makefile
==
--- head/share/man/man9/MakefileThu Sep  9 17:45:48 2010
(r212366)
+++ head/share/man/man9/MakefileThu Sep  9 17:49:18 2010
(r212367)
@@ -1031,6 +1031,7 @@ MLINKS+=sbuf.9 sbuf_bcat.9 \
sbuf.9 sbuf_overflowed.9 \
sbuf.9 sbuf_printf.9 \
sbuf.9 sbuf_putc.9 \
+   sbuf.9 sbuf_set_drain.9 \
sbuf.9 sbuf_setpos.9 \
sbuf.9 sbuf_trim.9 \
sbuf.9 sbuf_vprintf.9

Modified: head/share/man/man9/sbuf.9
==
--- head/share/man/man9/sbuf.9  Thu Sep  9 17:45:48 2010(r212366)
+++ head/share/man/man9/sbuf.9  Thu Sep  9 17:49:18 2010(r212367)
@@ -43,6 +43,7 @@
 .Nm sbuf_printf ,
 .Nm sbuf_vprintf ,
 .Nm sbuf_putc ,
+.Nm sbuf_set_drain ,
 .Nm sbuf_trim ,
 .Nm sbuf_overflowed ,
 .Nm sbuf_finish ,
@@ -54,6 +55,8 @@
 .Sh SYNOPSIS
 .In sys/types.h
 .In sys/sbuf.h
+.Ft typedef\ int ( sbuf_drain_func ) ( void\ *arg, const\ char\ *data, int\ 
len ) ;
+.Pp
 .Ft struct sbuf *
 .Fn sbuf_new "struct sbuf *s" "char *buf" "int length" "int flags"
 .Ft struct sbuf *
@@ -80,11 +83,13 @@
 .Fn sbuf_vprintf "struct sbuf *s" "const char *fmt" "va_list ap"
 .Ft int
 .Fn sbuf_putc "struct sbuf *s" "int c"
+.Ft void
+.Fn sbuf_set_drain "struct sbuf *s" "sbuf_drain_func *func" "void *arg"
 .Ft int
 .Fn sbuf_trim "struct sbuf *s"
 .Ft int
 .Fn sbuf_overflowed "struct sbuf *s"
-.Ft void
+.Ft int
 .Fn sbuf_finish "struct sbuf *s"
 .Ft char *
 .Fn sbuf_data "struct sbuf *s"
@@ -224,6 +229,51 @@ to the
 at the current position.
 .Pp
 The
+.Fn sbuf_set_drain
+function sets a drain function
+.Fa func
+for the
+.Fa sbuf ,
+and records a pointer
+.Fa arg
+to be passed to the drain on callback.
+The drain function cannot be changed while
+.Fa sbuf_len
+is non-zero.
+.Pp
+The registered drain function
+.Vt sbuf_drain_func
+will be called with the argument
+.Fa arg
+provided to
+.Fn sbuf_set_drain ,
+a pointer
+.Fa data
+to a byte string that is the contents of the sbuf, and the length
+.Fa len
+of the data.
+If the drain function exists, it will be called when the sbuf internal
+buffer is full, or on behalf of
+.Fn sbuf_finish .
+The drain function may drain some or all of the data, but must drain
+at least 1 byte.
+The return value from the drain function, if positive, indicates how
+many bytes were drained.
+If negative, the return value indicates the negative error code which
+will be returned from this or a later call to
+.Fn sbuf_finish .
+The returned drained length cannot be zero.
+To do unbuffered draining, initialize the sbuf with a two-byte buffer.
+The drain will be called for every byte added to the sbuf.
+The
+.Fn sbuf_bcopyin ,
+.Fn sbuf_copyin ,
+.Fn sbuf_trim ,
+and
+.Fn sbuf_data
+functions cannot be used on an sbuf with a drain.
+.Pp
+The
 .Fn sbuf_copyin
 function copies a NUL-terminated string from the specified userland
 address into the
@@ -289,10 +339,17 @@ overflowed.
 .Pp
 The
 .Fn sbuf_finish
-function NUL-terminates the
+function will call the attached drain function if one exists until all
+the data in the
 .Fa sbuf
-and marks it as finished, which means that it may no longer be
-modified using
+is flushed.
+If there is no attached drain,
+.Fn sbuf_finish
+NUL-terminates the
+.Fa sbuf .
+In either case it marks the
+.Fa sbuf
+as finished, which means that it may no longer be modified using
 .Fn sbuf_setpos ,
 .Fn sbuf_cat ,
 .Fn sbuf_cpy ,
@@ -305,12 +362,21 @@ is used to reset the sbuf.
 .Pp
 The
 .Fn sbuf_data
-and
-.Fn sbuf_len
-functions return the actual string and its length, respectively;
+function returns the actual string;
 .Fn sbuf_data
 only works on a finished
 .Fa sbuf .
+The
+.Fn sbuf_len function returns the length of the string.
+For an
+.Fa sbuf
+with an attached drain,
+.Fn sbuf_len
+returns the length of the un-drained data.
+.Fn sbuf_done
+returns non-zero if the
+.Fa sbuf
+is finished.
 .Fn sbuf_done
 returns non-zero if the
 .Fa sbuf
@@ -329,6 +

svn commit: r212368 - head/sys/dev/pci

2010-09-09 Thread John Baldwin
Author: jhb
Date: Thu Sep  9 18:19:15 2010
New Revision: 212368
URL: http://svn.freebsd.org/changeset/base/212368

Log:
  - Rename the constant for the Master Data Parity Error flag in the
PCI status register to map its current name.
  - Use PCIM_* rather than PCIR_* for constants for fields in various AER
registers.  I got about half of them right in the previous commit.
  
  MFC after:1 week

Modified:
  head/sys/dev/pci/pcireg.h

Modified: head/sys/dev/pci/pcireg.h
==
--- head/sys/dev/pci/pcireg.h   Thu Sep  9 17:49:18 2010(r212367)
+++ head/sys/dev/pci/pcireg.h   Thu Sep  9 18:19:15 2010(r212368)
@@ -67,7 +67,7 @@
 #definePCIM_STATUS_CAPPRESENT  0x0010
 #definePCIM_STATUS_66CAPABLE   0x0020
 #definePCIM_STATUS_BACKTOBACK  0x0080
-#definePCIM_STATUS_PERRREPORT  0x0100
+#definePCIM_STATUS_MDPERR  0x0100
 #definePCIM_STATUS_SEL_FAST0x
 #definePCIM_STATUS_SEL_MEDIMUM 0x0200
 #definePCIM_STATUS_SEL_SLOW0x0400
@@ -689,18 +689,18 @@
 
 /* Advanced Error Reporting */
 #definePCIR_AER_UC_STATUS  0x04
-#definePCIR_AER_UC_TRAINING_ERROR  0x0001
-#definePCIR_AER_UC_DL_PROTOCOL_ERROR   0x0010
-#definePCIR_AER_UC_POISONED_TLP0x1000
-#definePCIR_AER_UC_FC_PROTOCOL_ERROR   0x2000
-#definePCIR_AER_UC_COMPLETION_TIMEOUT  0x4000
-#definePCIR_AER_UC_COMPLETER_ABORT 0x8000
-#definePCIR_AER_UC_UNEXPECTED_COMPLETION 0x0001
-#definePCIR_AER_UC_RECEIVER_OVERFLOW   0x0002
-#definePCIR_AER_UC_MALFORMED_TLP   0x0004
-#definePCIR_AER_UC_ECRC_ERROR  0x0008
-#definePCIR_AER_UC_UNSUPPORTED_REQUEST 0x0010
-#definePCIR_AER_UC_ACS_VIOLATION   0x0020
+#definePCIM_AER_UC_TRAINING_ERROR  0x0001
+#definePCIM_AER_UC_DL_PROTOCOL_ERROR   0x0010
+#definePCIM_AER_UC_POISONED_TLP0x1000
+#definePCIM_AER_UC_FC_PROTOCOL_ERROR   0x2000
+#definePCIM_AER_UC_COMPLETION_TIMEOUT  0x4000
+#definePCIM_AER_UC_COMPLETER_ABORT 0x8000
+#definePCIM_AER_UC_UNEXPECTED_COMPLETION 0x0001
+#definePCIM_AER_UC_RECEIVER_OVERFLOW   0x0002
+#definePCIM_AER_UC_MALFORMED_TLP   0x0004
+#definePCIM_AER_UC_ECRC_ERROR  0x0008
+#definePCIM_AER_UC_UNSUPPORTED_REQUEST 0x0010
+#definePCIM_AER_UC_ACS_VIOLATION   0x0020
 #definePCIR_AER_UC_MASK0x08/* Shares bits with UC_STATUS */
 #definePCIR_AER_UC_SEVERITY0x0c/* Shares bits with UC_STATUS */
 #definePCIR_AER_COR_STATUS 0x10
@@ -718,18 +718,18 @@
 #definePCIM_AER_ECRC_CHECK_ENABLE  0x0100
 #definePCIR_AER_HEADER_LOG 0x1c
 #definePCIR_AER_ROOTERR_CMD0x2c/* Only for root complex ports 
*/
-#definePCIR_AER_ROOTERR_COR_ENABLE 0x0001
-#definePCIR_AER_ROOTERR_NF_ENABLE  0x0002
-#definePCIR_AER_ROOTERR_F_ENABLE   0x0004
+#definePCIM_AER_ROOTERR_COR_ENABLE 0x0001
+#definePCIM_AER_ROOTERR_NF_ENABLE  0x0002
+#definePCIM_AER_ROOTERR_F_ENABLE   0x0004
 #definePCIR_AER_ROOTERR_STATUS 0x30/* Only for root complex ports 
*/
-#definePCIR_AER_ROOTERR_COR_ERR0x0001
-#definePCIR_AER_ROOTERR_MULTI_COR_ERR  0x0002
-#definePCIR_AER_ROOTERR_UC_ERR 0x0004
-#definePCIR_AER_ROOTERR_MULTI_UC_ERR   0x0008
-#definePCIR_AER_ROOTERR_FIRST_UC_FATAL 0x0010
-#definePCIR_AER_ROOTERR_NF_ERR 0x0020
-#definePCIR_AER_ROOTERR_F_ERR  0x0040
-#definePCIR_AER_ROOTERR_INT_MESSAGE0xf800
+#definePCIM_AER_ROOTERR_COR_ERR0x0001
+#definePCIM_AER_ROOTERR_MULTI_COR_ERR  0x0002
+#definePCIM_AER_ROOTERR_UC_ERR 0x0004
+#definePCIM_AER_ROOTERR_MULTI_UC_ERR   0x0008
+#definePCIM_AER_ROOTERR_FIRST_UC_FATAL 0x0010
+#definePCIM_AER_ROOTERR_NF_ERR 0x0020
+#definePCIM_AER_ROOTERR_F_ERR  0x0040
+#definePCIM_AER_ROOTERR_INT_MESSAGE0xf800
 #definePCIR_AER_COR_SOURCE_ID  0x34/* Only for root complex ports 
*/
 #definePCIR_AER_ERR_SOURCE_ID  0x36/* Only for root complex ports 
*/
 
___
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: r212369 - head/usr.sbin/pciconf

2010-09-09 Thread John Baldwin
Author: jhb
Date: Thu Sep  9 18:29:48 2010
New Revision: 212369
URL: http://svn.freebsd.org/changeset/base/212369

Log:
  - Use 'sta' to hold the PCIR_STATUS register value instead of 'cmd' when
walking the capability list.
  - Use constants for PCI header types instead of magic numbers.
  
  MFC after:1 week

Modified:
  head/usr.sbin/pciconf/cap.c

Modified: head/usr.sbin/pciconf/cap.c
==
--- head/usr.sbin/pciconf/cap.c Thu Sep  9 18:19:15 2010(r212368)
+++ head/usr.sbin/pciconf/cap.c Thu Sep  9 18:29:48 2010(r212369)
@@ -460,20 +460,20 @@ cap_pciaf(int fd, struct pci_conf *p, ui
 void
 list_caps(int fd, struct pci_conf *p)
 {
-   uint16_t cmd;
+   uint16_t sta;
uint8_t ptr, cap;
 
/* Are capabilities present for this device? */
-   cmd = read_config(fd, &p->pc_sel, PCIR_STATUS, 2);
-   if (!(cmd & PCIM_STATUS_CAPPRESENT))
+   sta = read_config(fd, &p->pc_sel, PCIR_STATUS, 2);
+   if (!(sta & PCIM_STATUS_CAPPRESENT))
return;
 
switch (p->pc_hdr & PCIM_HDRTYPE) {
-   case 0:
-   case 1:
+   case PCIM_HDRTYPE_NORMAL:
+   case PCIM_HDRTYPE_BRIDGE:
ptr = PCIR_CAP_PTR;
break;
-   case 2:
+   case PCIM_HDRTYPE_CARDBUS:
ptr = PCIR_CAP_PTR_2;
break;
default:
___
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: r212370 - in head/sys: dev/cxgb kern sys vm

2010-09-09 Thread Matthew D Fleming
Author: mdf
Date: Thu Sep  9 18:33:46 2010
New Revision: 212370
URL: http://svn.freebsd.org/changeset/base/212370

Log:
  Add a drain function for struct sysctl_req, and use it for a variety of
  handlers, some of which had to do awkward things to get a large enough
  FIXEDLEN buffer.
  
  Note that some sysctl handlers were explicitly outputting a trailing NUL
  byte.  This behaviour was preserved, though it should not be necessary.
  
  Reviewed by:  phk

Modified:
  head/sys/dev/cxgb/cxgb_sge.c
  head/sys/kern/kern_malloc.c
  head/sys/kern/kern_sysctl.c
  head/sys/kern/subr_lock.c
  head/sys/kern/subr_sbuf.c
  head/sys/kern/subr_sleepqueue.c
  head/sys/kern/subr_witness.c
  head/sys/sys/sysctl.h
  head/sys/vm/uma_core.c
  head/sys/vm/vm_phys.c
  head/sys/vm/vm_reserv.c

Modified: head/sys/dev/cxgb/cxgb_sge.c
==
--- head/sys/dev/cxgb/cxgb_sge.cThu Sep  9 18:29:48 2010
(r212369)
+++ head/sys/dev/cxgb/cxgb_sge.cThu Sep  9 18:33:46 2010
(r212370)
@@ -3227,7 +3227,6 @@ t3_dump_rspq(SYSCTL_HANDLER_ARGS)
struct sge_rspq *rspq;
struct sge_qset *qs;
int i, err, dump_end, idx;
-   static int multiplier = 1;
struct sbuf *sb;
struct rsp_desc *rspd;
uint32_t data[4];
@@ -3252,8 +3251,8 @@ t3_dump_rspq(SYSCTL_HANDLER_ARGS)
err = t3_sge_read_rspq(qs->port->adapter, rspq->cntxt_id, data);
if (err)
return (err);
-retry_sbufops:
-   sb = sbuf_new(NULL, NULL, QDUMP_SBUF_SIZE*multiplier, SBUF_FIXEDLEN);
+
+   sb = sbuf_new_for_sysctl(NULL, NULL, QDUMP_SBUF_SIZE, req);
 
sbuf_printf(sb, " \n index=%u size=%u MSI-X/RspQ=%u intr enable=%u intr 
armed=%u\n",
(data[0] & 0x), data[0] >> 16, ((data[2] >> 20) & 0x3f),
@@ -3276,13 +3275,11 @@ retry_sbufops:
rspd->rss_hdr.rss_hash_val, be32toh(rspd->flags),
be32toh(rspd->len_cq), rspd->intr_gen);
}
-   if (sbuf_overflowed(sb)) {
-   sbuf_delete(sb);
-   multiplier++;
-   goto retry_sbufops;
-   }
-   sbuf_finish(sb);
-   err = SYSCTL_OUT(req, sbuf_data(sb), sbuf_len(sb) + 1);
+
+   err = sbuf_finish(sb);
+   /* Output a trailing NUL. */
+   if (err == 0)
+   err = SYSCTL_OUT(req, "", 1);
sbuf_delete(sb);
return (err);
 }  
@@ -3293,7 +3290,6 @@ t3_dump_txq_eth(SYSCTL_HANDLER_ARGS)
struct sge_txq *txq;
struct sge_qset *qs;
int i, j, err, dump_end;
-   static int multiplier = 1;
struct sbuf *sb;
struct tx_desc *txd;
uint32_t *WR, wr_hi, wr_lo, gen;
@@ -3321,9 +3317,7 @@ t3_dump_txq_eth(SYSCTL_HANDLER_ARGS)
if (err)
return (err);

-   
-retry_sbufops:
-   sb = sbuf_new(NULL, NULL, QDUMP_SBUF_SIZE*multiplier, SBUF_FIXEDLEN);
+   sb = sbuf_new_for_sysctl(NULL, NULL, QDUMP_SBUF_SIZE, req);
 
sbuf_printf(sb, " \n credits=%u GTS=%u index=%u size=%u rspq#=%u 
cmdq#=%u\n",
(data[0] & 0x7fff), ((data[0] >> 15) & 1), (data[0] >> 16), 
@@ -3350,13 +3344,10 @@ retry_sbufops:
WR[j], WR[j + 1], WR[j + 2], WR[j + 3]);
 
}
-   if (sbuf_overflowed(sb)) {
-   sbuf_delete(sb);
-   multiplier++;
-   goto retry_sbufops;
-   }
-   sbuf_finish(sb);
-   err = SYSCTL_OUT(req, sbuf_data(sb), sbuf_len(sb) + 1);
+   err = sbuf_finish(sb);
+   /* Output a trailing NUL. */
+   if (err == 0)
+   err = SYSCTL_OUT(req, "", 1);
sbuf_delete(sb);
return (err);
 }
@@ -3367,7 +3358,6 @@ t3_dump_txq_ctrl(SYSCTL_HANDLER_ARGS)
struct sge_txq *txq;
struct sge_qset *qs;
int i, j, err, dump_end;
-   static int multiplier = 1;
struct sbuf *sb;
struct tx_desc *txd;
uint32_t *WR, wr_hi, wr_lo, gen;
@@ -3391,8 +3381,7 @@ t3_dump_txq_ctrl(SYSCTL_HANDLER_ARGS)
return (EINVAL);
}
 
-retry_sbufops:
-   sb = sbuf_new(NULL, NULL, QDUMP_SBUF_SIZE*multiplier, SBUF_FIXEDLEN);
+   sb = sbuf_new_for_sysctl(NULL, NULL, QDUMP_SBUF_SIZE, req);
sbuf_printf(sb, " qid=%d start=%d -> end=%d\n", qs->idx,
txq->txq_dump_start,
(txq->txq_dump_start + txq->txq_dump_count) & 255);
@@ -3412,13 +3401,10 @@ retry_sbufops:
WR[j], WR[j + 1], WR[j + 2], WR[j + 3]);
 
}
-   if (sbuf_overflowed(sb)) {
-   sbuf_delete(sb);
-   multiplier++;
-   goto retry_sbufops;
-   }
-   sbuf_finish(sb);
-   err = SYSCTL_OUT(req, sbuf_data(sb), sbuf_len(sb) + 1);
+   err = sbuf_finish(sb);
+   /* Output a trailing NUL. */
+   if (err == 0)
+   err = SYSCTL_OUT(req, "", 1);
sbuf_delete(sb);
return (err);
 }

Modified: head/sys/kern/ker

svn commit: r212371 - head/sys/dev/led

2010-09-09 Thread Matthew D Fleming
Author: mdf
Date: Thu Sep  9 18:35:08 2010
New Revision: 212371
URL: http://svn.freebsd.org/changeset/base/212371

Log:
  Fix an incorrect use of sbuf_overflowed() after a call to sbuf_finish().

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

Modified: head/sys/dev/led/led.c
==
--- head/sys/dev/led/led.c  Thu Sep  9 18:33:46 2010(r212370)
+++ head/sys/dev/led/led.c  Thu Sep  9 18:35:08 2010(r212371)
@@ -220,15 +220,11 @@ led_write(struct cdev *dev, struct uio *
free(s2, M_DEVBUF);
return (EINVAL);
}
-   sbuf_finish(sb);
+   error = sbuf_finish(sb);
free(s2, M_DEVBUF);
-   if (sbuf_overflowed(sb)) {
+   if (error != 0 || sbuf_len(sb) == 0) {
sbuf_delete(sb);
-   return (ENOMEM);
-   }
-   if (sbuf_len(sb) == 0) {
-   sbuf_delete(sb);
-   return (0);
+   return (error);
}
 
return (led_state(dev, sb, 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: r212372 - head/usr.sbin/pciconf

2010-09-09 Thread John Baldwin
Author: jhb
Date: Thu Sep  9 18:51:20 2010
New Revision: 212372
URL: http://svn.freebsd.org/changeset/base/212372

Log:
  Document the format of extended capabilities in the '-c' output.

Modified:
  head/usr.sbin/pciconf/pciconf.8

Modified: head/usr.sbin/pciconf/pciconf.8
==
--- head/usr.sbin/pciconf/pciconf.8 Thu Sep  9 18:35:08 2010
(r212371)
+++ head/usr.sbin/pciconf/pciconf.8 Thu Sep  9 18:51:20 2010
(r212372)
@@ -142,7 +142,7 @@ If the
 option is supplied,
 .Nm
 will list any capabilities supported by each device.
-Each capability will be enumerated via a line in the following format:
+Each capability is enumerated via a line in the following format:
 .Bd -literal
 cap 10[40] = PCI-Express 1 root port
 .Ed
@@ -154,6 +154,18 @@ The second value in the square brackets 
 in config space in hexadecimal.
 The format of the text after the equals sign is capability-specific.
 .Pp
+Each extended capability is enumerated via a line in a similar format:
+.Bd -literal
+ecap 0002[100] = VC 1 max VC0
+.Ed
+.Pp
+The first value after the
+.Dq Li ecap
+prefix is the extended capability ID in hexadecimal.
+The second value in the square brackets is the offset of the extended
+capability in config space in hexadecimal.
+The format of the text after the equals sign is capability-specific.
+.Pp
 If the
 .Fl v
 option is supplied,
___
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: r212373 - head/lib/libelf

2010-09-09 Thread Kai Wang
Author: kaiw
Date: Thu Sep  9 18:51:50 2010
New Revision: 212373
URL: http://svn.freebsd.org/changeset/base/212373

Log:
  libelf is overly strict about the type and alignment of Elf_Data
  objects inside one ELF section, which prevents the creation of a ELF
  section with mixed data types. For example, gcc LTO use libelf to
  create a .gnu_lto_XXX section that contains integers and a string
  table, which doesn't work with our libelf implementation.
  
  The changes made in this commit include:
  * Allow Elf_Data type to be different than section type.
  * Relax Elf_Data alignment check.
  * Align each Elf_Data by their own alignment instead of section alignment.
  
  MFC after:   1 month

Modified:
  head/lib/libelf/elf_update.c

Modified: head/lib/libelf/elf_update.c
==
--- head/lib/libelf/elf_update.cThu Sep  9 18:51:20 2010
(r212372)
+++ head/lib/libelf/elf_update.cThu Sep  9 18:51:50 2010
(r212373)
@@ -141,7 +141,7 @@ _libelf_compute_section_extents(Elf *e, 
 
/* Compute the section alignment. */
STAILQ_FOREACH(d, &s->s_data, d_next)  {
-   if (d->d_type != elftype) {
+   if (d->d_type > ELF_T_LAST) {
LIBELF_SET_ERROR(DATA, 0);
return (0);
}
@@ -149,11 +149,7 @@ _libelf_compute_section_extents(Elf *e, 
LIBELF_SET_ERROR(VERSION, 0);
return (0);
}
-   if ((d_align = d->d_align) % sh_align) {
-   LIBELF_SET_ERROR(LAYOUT, 0);
-   return (0);
-   }
-   if (d_align == 0 || (d_align & (d_align - 1))) {
+   if ((d_align = d->d_align) == 0 || (d_align & (d_align - 1))) {
LIBELF_SET_ERROR(DATA, 0);
return (0);
}
@@ -168,7 +164,7 @@ _libelf_compute_section_extents(Elf *e, 
if ((uint64_t) d->d_off + d->d_size > scn_size)
scn_size = d->d_off + d->d_size;
} else {
-   scn_size = roundup2(scn_size, scn_alignment);
+   scn_size = roundup2(scn_size, d->d_align);
d->d_off = scn_size;
scn_size += d->d_size;
}
@@ -560,8 +556,6 @@ _libelf_write_scn(Elf *e, char *nf, Elf_
elftype = _libelf_xlate_shtype(sh_type);
assert(elftype >= ELF_T_FIRST && elftype <= ELF_T_LAST);
 
-   msz = _libelf_msize(elftype, ec, e->e_version);
-
sh_off = s->s_offset;
assert(sh_off % _libelf_falign(elftype, ec) == 0);
 
@@ -608,6 +602,8 @@ _libelf_write_scn(Elf *e, char *nf, Elf_
 
STAILQ_FOREACH(d, &s->s_data, d_next) {
 
+   msz = _libelf_msize(d->d_type, ec, e->e_version);
+
if ((uint64_t) rc < sh_off + d->d_off)
(void) memset(nf + rc,
LIBELF_PRIVATE(fillchar), sh_off + d->d_off - rc);
@@ -615,13 +611,12 @@ _libelf_write_scn(Elf *e, char *nf, Elf_
rc = sh_off + d->d_off;
 
assert(d->d_buf != NULL);
-   assert(d->d_type == (Elf_Type) elftype);
assert(d->d_version == e->e_version);
assert(d->d_size % msz == 0);
 
nobjects = d->d_size / msz;
 
-   fsz = _libelf_fsize(elftype, ec, e->e_version, nobjects);
+   fsz = _libelf_fsize(d->d_type, ec, e->e_version, nobjects);
 
dst.d_buf= nf + rc;
dst.d_size   = fsz;
___
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: r212373 - head/lib/libelf

2010-09-09 Thread Steve Kargl
On Thu, Sep 09, 2010 at 06:51:50PM +, Kai Wang wrote:
> Author: kaiw
> Date: Thu Sep  9 18:51:50 2010
> New Revision: 212373
> URL: http://svn.freebsd.org/changeset/base/212373
> 
> Log:
>   libelf is overly strict about the type and alignment of Elf_Data
>   objects inside one ELF section, which prevents the creation of a ELF
>   section with mixed data types. For example, gcc LTO use libelf to
>   create a .gnu_lto_XXX section that contains integers and a string
>   table, which doesn't work with our libelf implementation.
>   
>   The changes made in this commit include:
>   * Allow Elf_Data type to be different than section type.
>   * Relax Elf_Data alignment check.
>   * Align each Elf_Data by their own alignment instead of section alignment.
>   

Thanks you!

-- 
Steve
___
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: r212374 - head/usr.bin/printf

2010-09-09 Thread David E. O'Brien
Author: obrien
Date: Thu Sep  9 19:27:40 2010
New Revision: 212374
URL: http://svn.freebsd.org/changeset/base/212374

Log:
  Note bug in trying to printf(1) things like: '-%s\n' "foo"

Modified:
  head/usr.bin/printf/printf.1

Modified: head/usr.bin/printf/printf.1
==
--- head/usr.bin/printf/printf.1Thu Sep  9 18:51:50 2010
(r212373)
+++ head/usr.bin/printf/printf.1Thu Sep  9 19:27:40 2010
(r212374)
@@ -355,3 +355,10 @@ Multibyte characters are not recognized 
 a problem if
 .Ql %
 can appear inside a multibyte character).
+.Pp
+Trying to print a dash ("-") as the first character causes
+.Nm
+to interpet the dash as a program argument.
+.Nm --
+must be used before 
+.Ar format .
___
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: r212374 - head/usr.bin/printf

2010-09-09 Thread Juli Mallett
On Thu, Sep 9, 2010 at 12:27, David E. O'Brien  wrote:
> Author: obrien
> Date: Thu Sep  9 19:27:40 2010
> New Revision: 212374
> URL: http://svn.freebsd.org/changeset/base/212374
>
> Log:
>  Note bug in trying to printf(1) things like: '-%s\n' "foo"

Should we also add something like this note to every manual page for a
program that operates on files as command line arguments after options
w.r.t. operating on files whose names begin with '-'?  It seems like
if it's appropriate in individual manpages at all it's appropriate in
all of them — it's one of the most frequently-asked questions by new
Unix users that I've encountered.  On the other hand, perhaps intro(1)
or similar is more appropriate.

Juli.
___
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: r212374 - head/usr.bin/printf

2010-09-09 Thread Jilles Tjoelker
On Thu, Sep 09, 2010 at 07:27:40PM +, David E. O'Brien wrote:
> Author: obrien
> Date: Thu Sep  9 19:27:40 2010
> New Revision: 212374
> URL: http://svn.freebsd.org/changeset/base/212374

> Log:
>   Note bug in trying to printf(1) things like: '-%s\n' "foo"

> Modified:
>   head/usr.bin/printf/printf.1

> Modified: head/usr.bin/printf/printf.1
> ==
> --- head/usr.bin/printf/printf.1  Thu Sep  9 18:51:50 2010
> (r212373)
> +++ head/usr.bin/printf/printf.1  Thu Sep  9 19:27:40 2010
> (r212374)
> @@ -355,3 +355,10 @@ Multibyte characters are not recognized 
>  a problem if
>  .Ql %
>  can appear inside a multibyte character).
> +.Pp
> +Trying to print a dash ("-") as the first character causes
> +.Nm
> +to interpet the dash as a program argument.
> +.Nm --
> +must be used before 
> +.Ar format .

I do not consider this a bug. POSIX requires printf to recognize -- and
pretty much all current implementations conform to this. Causing an
error for unrecognized options allows us to add options later on,
without fear of breaking scripts that use format strings starting with a
dash without -- protection.

Needing -- is not particularly onerous here as format strings are
usually constants.

A caveat could be added, but it is really echo(1) that is inconsistent
by not treating -- specially. The printf utility is consistent with most
other utilities in requiring --.

FWIW, the omission of hexadecimal character constants does not belong in
the BUGS section either. They are deliberately not provided, therefore
their omission is not a bug. (One reason is that there is no way to
force termination of such a sequence, unlike C where you can do things
like "\x1b" "c".)

-- 
Jilles Tjoelker
___
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: r212376 - head/lib/libc/posix1e

2010-09-09 Thread Edward Tomasz Napierala
Author: trasz
Date: Thu Sep  9 20:07:40 2010
New Revision: 212376
URL: http://svn.freebsd.org/changeset/base/212376

Log:
  Add minor optimization.  It's less strict than its kernel counterpart
  due to upcoming ACL changes required by the new ZFS.

Modified:
  head/lib/libc/posix1e/acl_strip.c

Modified: head/lib/libc/posix1e/acl_strip.c
==
--- head/lib/libc/posix1e/acl_strip.c   Thu Sep  9 19:51:46 2010
(r212375)
+++ head/lib/libc/posix1e/acl_strip.c   Thu Sep  9 20:07:40 2010
(r212376)
@@ -176,6 +176,15 @@ acl_is_trivial_np(const acl_t aclp, int 
 
case ACL_BRAND_NFS4:
/*
+* If the ACL has more than canonical six entries,
+* it's non trivial by definition.
+*/
+   if (aclp->ats_acl.acl_cnt > 6) {
+   *trivialp = 1;
+   return (0);
+   }
+   
+   /*
 * Calculate trivial ACL - using acl_strip_np - and compare
 * with the original.
 */
___
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: r212368 - head/sys/dev/pci

2010-09-09 Thread mdf
On Thu, Sep 9, 2010 at 11:19 AM, John Baldwin  wrote:
> Author: jhb
> Date: Thu Sep  9 18:19:15 2010
> New Revision: 212368
> URL: http://svn.freebsd.org/changeset/base/212368
>
> Log:
>  - Rename the constant for the Master Data Parity Error flag in the
>    PCI status register to map its current name.
>  - Use PCIM_* rather than PCIR_* for constants for fields in various AER
>    registers.  I got about half of them right in the previous commit.
>
>  MFC after:    1 week
>
> Modified:
>  head/sys/dev/pci/pcireg.h

This seems to break building CURRENT with this error:

/data/sb/bsd.git/sys/dev/msk/if_msk.c: In function 'mskc_reset':
/data/sb/bsd.git/sys/dev/msk/if_msk.c:1337: error:
'PCIM_STATUS_PERRREPORT' undeclared (first use in this function)
/data/sb/bsd.git/sys/dev/msk/if_msk.c:1337: error: (Each undeclared
identifier is reported only once
/data/sb/bsd.git/sys/dev/msk/if_msk.c:1337: error: for each function
it appears in.)
/data/sb/bsd.git/sys/dev/msk/if_msk.c: In function 'msk_intr_hwerr':
/data/sb/bsd.git/sys/dev/msk/if_msk.c:3408: error:
'PCIM_STATUS_PERRREPORT' undeclared (first use in this function)

Thanks,
matthew
>
> Modified: head/sys/dev/pci/pcireg.h
> ==
> --- head/sys/dev/pci/pcireg.h   Thu Sep  9 17:49:18 2010        (r212367)
> +++ head/sys/dev/pci/pcireg.h   Thu Sep  9 18:19:15 2010        (r212368)
> @@ -67,7 +67,7 @@
>  #define        PCIM_STATUS_CAPPRESENT  0x0010
>  #define        PCIM_STATUS_66CAPABLE   0x0020
>  #define        PCIM_STATUS_BACKTOBACK  0x0080
> -#define        PCIM_STATUS_PERRREPORT  0x0100
> +#define        PCIM_STATUS_MDPERR      0x0100
>  #define        PCIM_STATUS_SEL_FAST    0x
>  #define        PCIM_STATUS_SEL_MEDIMUM 0x0200
>  #define        PCIM_STATUS_SEL_SLOW    0x0400
> @@ -689,18 +689,18 @@
>
>  /* Advanced Error Reporting */
>  #define        PCIR_AER_UC_STATUS      0x04
> -#define        PCIR_AER_UC_TRAINING_ERROR      0x0001
> -#define        PCIR_AER_UC_DL_PROTOCOL_ERROR   0x0010
> -#define        PCIR_AER_UC_POISONED_TLP        0x1000
> -#define        PCIR_AER_UC_FC_PROTOCOL_ERROR   0x2000
> -#define        PCIR_AER_UC_COMPLETION_TIMEOUT  0x4000
> -#define        PCIR_AER_UC_COMPLETER_ABORT     0x8000
> -#define        PCIR_AER_UC_UNEXPECTED_COMPLETION 0x0001
> -#define        PCIR_AER_UC_RECEIVER_OVERFLOW   0x0002
> -#define        PCIR_AER_UC_MALFORMED_TLP       0x0004
> -#define        PCIR_AER_UC_ECRC_ERROR          0x0008
> -#define        PCIR_AER_UC_UNSUPPORTED_REQUEST 0x0010
> -#define        PCIR_AER_UC_ACS_VIOLATION       0x0020
> +#define        PCIM_AER_UC_TRAINING_ERROR      0x0001
> +#define        PCIM_AER_UC_DL_PROTOCOL_ERROR   0x0010
> +#define        PCIM_AER_UC_POISONED_TLP        0x1000
> +#define        PCIM_AER_UC_FC_PROTOCOL_ERROR   0x2000
> +#define        PCIM_AER_UC_COMPLETION_TIMEOUT  0x4000
> +#define        PCIM_AER_UC_COMPLETER_ABORT     0x8000
> +#define        PCIM_AER_UC_UNEXPECTED_COMPLETION 0x0001
> +#define        PCIM_AER_UC_RECEIVER_OVERFLOW   0x0002
> +#define        PCIM_AER_UC_MALFORMED_TLP       0x0004
> +#define        PCIM_AER_UC_ECRC_ERROR          0x0008
> +#define        PCIM_AER_UC_UNSUPPORTED_REQUEST 0x0010
> +#define        PCIM_AER_UC_ACS_VIOLATION       0x0020
>  #define        PCIR_AER_UC_MASK        0x08    /* Shares bits with UC_STATUS 
> */
>  #define        PCIR_AER_UC_SEVERITY    0x0c    /* Shares bits with UC_STATUS 
> */
>  #define        PCIR_AER_COR_STATUS     0x10
> @@ -718,18 +718,18 @@
>  #define        PCIM_AER_ECRC_CHECK_ENABLE      0x0100
>  #define        PCIR_AER_HEADER_LOG     0x1c
>  #define        PCIR_AER_ROOTERR_CMD    0x2c    /* Only for root complex 
> ports */
> -#define        PCIR_AER_ROOTERR_COR_ENABLE     0x0001
> -#define        PCIR_AER_ROOTERR_NF_ENABLE      0x0002
> -#define        PCIR_AER_ROOTERR_F_ENABLE       0x0004
> +#define        PCIM_AER_ROOTERR_COR_ENABLE     0x0001
> +#define        PCIM_AER_ROOTERR_NF_ENABLE      0x0002
> +#define        PCIM_AER_ROOTERR_F_ENABLE       0x0004
>  #define        PCIR_AER_ROOTERR_STATUS 0x30    /* Only for root complex 
> ports */
> -#define        PCIR_AER_ROOTERR_COR_ERR        0x0001
> -#define        PCIR_AER_ROOTERR_MULTI_COR_ERR  0x0002
> -#define        PCIR_AER_ROOTERR_UC_ERR         0x0004
> -#define        PCIR_AER_ROOTERR_MULTI_UC_ERR   0x0008
> -#define        PCIR_AER_ROOTERR_FIRST_UC_FATAL 0x0010
> -#define        PCIR_AER_ROOTERR_NF_ERR         0x0020
> -#define        PCIR_AER_ROOTERR_F_ERR          0x0040
> -#define        PCIR_AER_ROOTERR_INT_MESSAGE    0xf800
> +#define        PCIM_AER_ROOTERR_COR_ERR        0x0001
> +#define        PCIM_AER_ROOTERR_MULTI_COR_ERR  0x0002
> +#define        PCIM_AER_ROOTERR_UC_ERR         0x0004
> +#define        PCIM_AER_ROOT

svn commit: r212378 - in head/sys: dev/msk sparc64/pci

2010-09-09 Thread John Baldwin
Author: jhb
Date: Thu Sep  9 20:26:30 2010
New Revision: 212378
URL: http://svn.freebsd.org/changeset/base/212378

Log:
  Catch up to rename of the constant for the Master Data Parity Error bit in
  the PCI status register.
  
  Pointed out by:   mdf
  Pointy hat to:jhb

Modified:
  head/sys/dev/msk/if_msk.c
  head/sys/sparc64/pci/schizo.c

Modified: head/sys/dev/msk/if_msk.c
==
--- head/sys/dev/msk/if_msk.c   Thu Sep  9 20:11:41 2010(r212377)
+++ head/sys/dev/msk/if_msk.c   Thu Sep  9 20:26:30 2010(r212378)
@@ -1334,7 +1334,7 @@ mskc_reset(struct msk_softc *sc)
 
pci_write_config(sc->msk_dev, PCIR_STATUS, status |
PCIM_STATUS_PERR | PCIM_STATUS_SERR | PCIM_STATUS_RMABORT |
-   PCIM_STATUS_RTABORT | PCIM_STATUS_PERRREPORT, 2);
+   PCIM_STATUS_RTABORT | PCIM_STATUS_MDPERR, 2);
CSR_WRITE_2(sc, B0_CTST, CS_MRST_CLR);
 
switch (sc->msk_bustype) {
@@ -3405,7 +3405,7 @@ msk_intr_hwerr(struct msk_softc *sc)
CSR_WRITE_1(sc, B2_TST_CTRL1, TST_CFG_WRITE_ON);
pci_write_config(sc->msk_dev, PCIR_STATUS, v16 |
PCIM_STATUS_PERR | PCIM_STATUS_SERR | PCIM_STATUS_RMABORT |
-   PCIM_STATUS_RTABORT | PCIM_STATUS_PERRREPORT, 2);
+   PCIM_STATUS_RTABORT | PCIM_STATUS_MDPERR, 2);
CSR_WRITE_1(sc, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
}
 

Modified: head/sys/sparc64/pci/schizo.c
==
--- head/sys/sparc64/pci/schizo.c   Thu Sep  9 20:11:41 2010
(r212377)
+++ head/sys/sparc64/pci/schizo.c   Thu Sep  9 20:26:30 2010
(r212378)
@@ -849,7 +849,7 @@ schizo_pci_bus(void *arg)
fatal = 1;
if ((status & (PCIM_STATUS_PERR | PCIM_STATUS_SERR |
PCIM_STATUS_RMABORT | PCIM_STATUS_RTABORT |
-   PCIM_STATUS_PERRREPORT)) != 0 ||
+   PCIM_STATUS_MDPERR)) != 0 ||
(csr & (SCZ_PCI_CTRL_BUS_UNUS | TOM_PCI_CTRL_DTO_ERR |
STX_PCI_CTRL_TTO_ERR | STX_PCI_CTRL_RTRY_ERR |
SCZ_PCI_CTRL_SBH_ERR | STX_PCI_CTRL_SERR)) != 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: r212379 - head/lib/libc/posix1e

2010-09-09 Thread Edward Tomasz Napierala
Author: trasz
Date: Thu Sep  9 20:37:19 2010
New Revision: 212379
URL: http://svn.freebsd.org/changeset/base/212379

Log:
  Arrgh, tested wrong source tree _again_.  Fix previous commit.  Also,
  this and previous one are MFC candidate.
  
  MFC after:1 month

Modified:
  head/lib/libc/posix1e/acl_strip.c

Modified: head/lib/libc/posix1e/acl_strip.c
==
--- head/lib/libc/posix1e/acl_strip.c   Thu Sep  9 20:26:30 2010
(r212378)
+++ head/lib/libc/posix1e/acl_strip.c   Thu Sep  9 20:37:19 2010
(r212379)
@@ -180,7 +180,7 @@ acl_is_trivial_np(const acl_t aclp, int 
 * it's non trivial by definition.
 */
if (aclp->ats_acl.acl_cnt > 6) {
-   *trivialp = 1;
+   *trivialp = 0;
return (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: r212380 - head/sys/netinet

2010-09-09 Thread Michael Tuexen
Author: tuexen
Date: Thu Sep  9 20:51:23 2010
New Revision: 212380
URL: http://svn.freebsd.org/changeset/base/212380

Log:
  * Remove code which has no effect.
  * Clean up the handling in sctp_lower_sosend().
  
  MFC after: 3 weeks.

Modified:
  head/sys/netinet/sctp_output.c

Modified: head/sys/netinet/sctp_output.c
==
--- head/sys/netinet/sctp_output.c  Thu Sep  9 20:37:19 2010
(r212379)
+++ head/sys/netinet/sctp_output.c  Thu Sep  9 20:51:23 2010
(r212380)
@@ -12124,7 +12124,6 @@ sctp_sosend(struct socket *so,
 struct thread *p
 )
 {
-   struct sctp_inpcb *inp;
int error, use_rcvinfo = 0;
struct sctp_sndrcvinfo srcv;
struct sockaddr *addr_to_use;
@@ -12134,7 +12133,6 @@ sctp_sosend(struct socket *so,
 
 #endif
 
-   inp = (struct sctp_inpcb *)so->so_pcb;
if (control) {
/* process cmsg snd/rcv info (maybe a assoc-id) */
if (sctp_find_cmsg(SCTP_SNDRCV, (void *)&srcv, control,
@@ -12182,7 +12180,7 @@ sctp_lower_sosend(struct socket *so,
struct mbuf *top = NULL;
int queue_only = 0, queue_only_for_init = 0;
int free_cnt_applied = 0;
-   int un_sent = 0;
+   int un_sent;
int now_filled = 0;
unsigned int inqueue_bytes = 0;
struct sctp_block_entry be;
@@ -12525,9 +12523,10 @@ sctp_lower_sosend(struct socket *so,
 * change it BEFORE we append the message.
 */
}
-   }
+   } else
+   asoc = &stcb->asoc;
if (srcv == NULL)
-   srcv = (struct sctp_sndrcvinfo *)&stcb->asoc.def_send;
+   srcv = (struct sctp_sndrcvinfo *)&asoc->def_send;
if (srcv->sinfo_flags & SCTP_ADDR_OVER) {
if (addr)
net = sctp_findnet(stcb, addr);
@@ -12542,14 +12541,10 @@ sctp_lower_sosend(struct socket *so,
} else {
net = stcb->asoc.primary_destination;
}
-
-   if ((SCTP_SO_IS_NBIO(so)
-   || (flags & MSG_NBIO)
-   )) {
-   non_blocking = 1;
-   }
-   asoc = &stcb->asoc;
atomic_add_int(&stcb->total_sends, 1);
+   /* Keep the stcb from being freed under our feet */
+   atomic_add_int(&asoc->refcnt, 1);
+   free_cnt_applied = 1;
 
if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_NO_FRAGMENT)) {
if (sndlen > asoc->smallest_mtu) {
@@ -12558,6 +12553,11 @@ sctp_lower_sosend(struct socket *so,
goto out_unlocked;
}
}
+   if ((SCTP_SO_IS_NBIO(so)
+   || (flags & MSG_NBIO)
+   )) {
+   non_blocking = 1;
+   }
/* would we block? */
if (non_blocking) {
if (hold_tcblock == 0) {
@@ -12581,17 +12581,6 @@ sctp_lower_sosend(struct socket *so,
atomic_add_int(&stcb->asoc.sb_send_resv, sndlen);
}
local_soresv = sndlen;
-   /* Keep the stcb from being freed under our feet */
-   if (free_cnt_applied) {
-#ifdef INVARIANTS
-   panic("refcnt already incremented");
-#else
-   printf("refcnt:1 already incremented?\n");
-#endif
-   } else {
-   atomic_add_int(&stcb->asoc.refcnt, 1);
-   free_cnt_applied = 1;
-   }
if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, 
ECONNRESET);
error = ECONNRESET;
@@ -12634,26 +12623,6 @@ sctp_lower_sosend(struct socket *so,
if (p) {
p->td_ru.ru_msgsnd++;
}
-   if ((net->flight_size > net->cwnd) &&
-   (asoc->sctp_cmt_on_off == 0)) {
-   /*-
-* CMT: Added check for CMT above. net above is the primary
-* dest. If CMT is ON, sender should always attempt to send
-* with the output routine sctp_fill_outqueue() that loops
-* through all destination addresses. Therefore, if CMT is
-* ON, queue_only is NOT set to 1 here, so that
-* sctp_chunk_output() can be called below.
-*/
-   queue_only = 1;
-   } else if (asoc->ifp_had_enobuf) {
-   SCTP_STAT_INCR(sctps_ifnomemqueued);
-   if (net->flight_size > (net->mtu * 2))
-   queue_only = 1;
-   asoc->ifp_had_enobuf = 0;
-   } else {
-   un_sent = ((stcb->asoc.total_output_queue_size - 
stcb->asoc.total_flight) +
-   (stcb->asoc.stream_queue_cnt * sizeof(struct 
sctp_data_chunk)));
-   }
/* Are we aborting? */
if (srcv->sinfo_flags & SCTP_ABORT) {
struct mbuf *mm;
@@ -12857,7 +12826,6 @@ sctp_lower_sosend(struct socket *so,
}
inqueue_bytes = 

svn commit: r212381 - head/sys/sys

2010-09-09 Thread Matthew D Fleming
Author: mdf
Date: Thu Sep  9 21:01:41 2010
New Revision: 212381
URL: http://svn.freebsd.org/changeset/base/212381

Log:
  Bump __FreeBSD_version for sbuf ABI change.

Modified:
  head/sys/sys/param.h

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hThu Sep  9 20:51:23 2010(r212380)
+++ head/sys/sys/param.hThu Sep  9 21:01:41 2010(r212381)
@@ -58,7 +58,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 900019   /* Master, propagated to newvers */
+#define __FreeBSD_version 900020   /* Master, propagated to newvers */
 
 #ifndef LOCORE
 #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: r212382 - head/sys/boot/zfs

2010-09-09 Thread Pawel Jakub Dawidek
Author: pjd
Date: Thu Sep  9 21:15:16 2010
New Revision: 212382
URL: http://svn.freebsd.org/changeset/base/212382

Log:
  Remove duplicated code.
  
  MFC after:2 weeks

Modified:
  head/sys/boot/zfs/zfsimpl.c

Modified: head/sys/boot/zfs/zfsimpl.c
==
--- head/sys/boot/zfs/zfsimpl.c Thu Sep  9 21:01:41 2010(r212381)
+++ head/sys/boot/zfs/zfsimpl.c Thu Sep  9 21:15:16 2010(r212382)
@@ -488,7 +488,16 @@ vdev_init_from_nvlist(const unsigned cha
vdev->v_name = strdup(type);
}
}
+   } else {
+   is_new = 0;
+   }
 
+   if (is_new || is_newer) {
+   /*
+* This is either new vdev or we've already seen this vdev,
+* but from an older vdev label, so let's refresh its state
+* from the newer label.
+*/
if (is_offline)
vdev->v_state = VDEV_STATE_OFFLINE;
else if (is_removed)
@@ -499,26 +508,6 @@ vdev_init_from_nvlist(const unsigned cha
vdev->v_state = VDEV_STATE_DEGRADED;
else
vdev->v_state = VDEV_STATE_HEALTHY;
-   } else {
-   is_new = 0;
-
-   if (is_newer) {
-   /*
-* We've already seen this vdev, but from an older
-* vdev label, so let's refresh its state from the
-* newer label.
-*/
-   if (is_offline)
-   vdev->v_state = VDEV_STATE_OFFLINE;
-   else if (is_removed)
-   vdev->v_state = VDEV_STATE_REMOVED;
-   else if (is_faulted)
-   vdev->v_state = VDEV_STATE_FAULTED;
-   else if (is_degraded)
-   vdev->v_state = VDEV_STATE_DEGRADED;
-   else
-   vdev->v_state = VDEV_STATE_HEALTHY;
-   }
}
 
rc = nvlist_find(nvlist, ZPOOL_CONFIG_CHILDREN,
___
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: r212383 - head/sys/boot/zfs

2010-09-09 Thread Pawel Jakub Dawidek
Author: pjd
Date: Thu Sep  9 21:18:00 2010
New Revision: 212383
URL: http://svn.freebsd.org/changeset/base/212383

Log:
  Allow to boot from a pool within which replacing is in progress.
  Before the change it wasn't possible and the following error was printed:
  
ZFS: can only boot from disk, mirror or raidz vdevs
  
  Now if the original vdev (the one we are replacing) is still present we will
  read from it, but if it is not present we won't read from the new vdev, as it
  might not have enough valid data yet.
  
  MFC after:2 weeks

Modified:
  head/sys/boot/zfs/zfsimpl.c

Modified: head/sys/boot/zfs/zfsimpl.c
==
--- head/sys/boot/zfs/zfsimpl.c Thu Sep  9 21:15:16 2010(r212382)
+++ head/sys/boot/zfs/zfsimpl.c Thu Sep  9 21:18:00 2010(r212383)
@@ -376,6 +376,27 @@ vdev_mirror_read(vdev_t *vdev, const blk
return (rc);
 }
 
+static int
+vdev_replacing_read(vdev_t *vdev, const blkptr_t *bp, void *buf,
+off_t offset, size_t bytes)
+{
+   vdev_t *kid;
+
+   /*
+* Here we should have two kids:
+* First one which is the one we are replacing and we can trust
+* only this one to have valid data, but it might not be present.
+* Second one is that one we are replacing with. It is most likely
+* healthy, but we can't trust it has needed data, so we won't use it.
+*/
+   kid = STAILQ_FIRST(&vdev->v_children);
+   if (kid == NULL)
+   return (EIO);
+   if (kid->v_state != VDEV_STATE_HEALTHY)
+   return (EIO);
+   return (kid->v_read(kid, bp, buf, offset, bytes));
+}
+
 static vdev_t *
 vdev_find(uint64_t guid)
 {
@@ -416,7 +437,7 @@ vdev_init_from_nvlist(const unsigned cha
vdev_t *vdev, *kid;
const unsigned char *kids;
int nkids, i, is_new;
-   uint64_t is_offline, is_faulted, is_degraded, is_removed;
+   uint64_t is_offline, is_faulted, is_degraded, is_removed, isnt_present;
 
if (nvlist_find(nvlist, ZPOOL_CONFIG_GUID,
DATA_TYPE_UINT64, 0, &guid)
@@ -428,14 +449,17 @@ vdev_init_from_nvlist(const unsigned cha
return (ENOENT);
}
 
+
+
if (strcmp(type, VDEV_TYPE_MIRROR)
&& strcmp(type, VDEV_TYPE_DISK)
-   && strcmp(type, VDEV_TYPE_RAIDZ)) {
+   && strcmp(type, VDEV_TYPE_RAIDZ)
+   && strcmp(type, VDEV_TYPE_REPLACING)) {
printf("ZFS: can only boot from disk, mirror or raidz vdevs\n");
return (EIO);
}
 
-   is_offline = is_removed = is_faulted = is_degraded = 0;
+   is_offline = is_removed = is_faulted = is_degraded = isnt_present = 0;
 
nvlist_find(nvlist, ZPOOL_CONFIG_OFFLINE, DATA_TYPE_UINT64, 0,
&is_offline);
@@ -445,6 +469,8 @@ vdev_init_from_nvlist(const unsigned cha
&is_faulted);
nvlist_find(nvlist, ZPOOL_CONFIG_DEGRADED, DATA_TYPE_UINT64, 0,
&is_degraded);
+   nvlist_find(nvlist, ZPOOL_CONFIG_NOT_PRESENT, DATA_TYPE_UINT64, 0,
+   &isnt_present);
 
vdev = vdev_find(guid);
if (!vdev) {
@@ -454,6 +480,8 @@ vdev_init_from_nvlist(const unsigned cha
vdev = vdev_create(guid, vdev_mirror_read);
else if (!strcmp(type, VDEV_TYPE_RAIDZ))
vdev = vdev_create(guid, vdev_raidz_read);
+   else if (!strcmp(type, VDEV_TYPE_REPLACING))
+   vdev = vdev_create(guid, vdev_replacing_read);
else
vdev = vdev_create(guid, vdev_disk_read);
 
@@ -506,6 +534,8 @@ vdev_init_from_nvlist(const unsigned cha
vdev->v_state = VDEV_STATE_FAULTED;
else if (is_degraded)
vdev->v_state = VDEV_STATE_DEGRADED;
+   else if (isnt_present)
+   vdev->v_state = VDEV_STATE_CANT_OPEN;
else
vdev->v_state = VDEV_STATE_HEALTHY;
}
___
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: r212384 - head/sys/boot/zfs

2010-09-09 Thread Pawel Jakub Dawidek
Author: pjd
Date: Thu Sep  9 21:19:09 2010
New Revision: 212384
URL: http://svn.freebsd.org/changeset/base/212384

Log:
  Ignore log vdevs.
  
  MFC after:2 weeks

Modified:
  head/sys/boot/zfs/zfsimpl.c

Modified: head/sys/boot/zfs/zfsimpl.c
==
--- head/sys/boot/zfs/zfsimpl.c Thu Sep  9 21:18:00 2010(r212383)
+++ head/sys/boot/zfs/zfsimpl.c Thu Sep  9 21:19:09 2010(r212384)
@@ -773,6 +773,7 @@ vdev_probe(vdev_phys_read_t *read, void 
uint64_t val;
uint64_t guid;
uint64_t pool_txg, pool_guid;
+   uint64_t is_log;
const char *pool_name;
const unsigned char *vdevs;
int i, rc, is_newer;
@@ -849,6 +850,12 @@ vdev_probe(vdev_phys_read_t *read, void 
return (EIO);
}
 
+   is_log = 0;
+   (void) nvlist_find(nvlist, ZPOOL_CONFIG_IS_LOG, DATA_TYPE_UINT64, 0,
+   &is_log);
+   if (is_log)
+   return (EIO);
+
/*
 * Create the pool if this is the first time we've seen it.
 */
___
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: r212385 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2010-09-09 Thread Pawel Jakub Dawidek
Author: pjd
Date: Thu Sep  9 21:20:18 2010
New Revision: 212385
URL: http://svn.freebsd.org/changeset/base/212385

Log:
  On FreeBSD we can log from pool that have multiple top-level vdevs or log
  vdevs, so don't deny adding new vdevs if bootfs property is set.
  
  MFC after:2 weeks

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Thu Sep 
 9 21:19:09 2010(r212384)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Thu Sep 
 9 21:20:18 2010(r212385)
@@ -1217,8 +1217,12 @@ zfs_ioc_vdev_add(zfs_cmd_t *zc)
 {
spa_t *spa;
int error;
+#ifdef sun
nvlist_t *config, **l2cache, **spares;
uint_t nl2cache = 0, nspares = 0;
+#else
+   nvlist_t *config;
+#endif
 
error = spa_open(zc->zc_name, &spa, FTAG);
if (error != 0)
@@ -1226,6 +1230,7 @@ zfs_ioc_vdev_add(zfs_cmd_t *zc)
 
error = get_nvlist(zc->zc_nvlist_conf, zc->zc_nvlist_conf_size,
&config);
+#ifdef sun
(void) nvlist_lookup_nvlist_array(config, ZPOOL_CONFIG_L2CACHE,
&l2cache, &nl2cache);
 
@@ -1246,6 +1251,7 @@ zfs_ioc_vdev_add(zfs_cmd_t *zc)
spa_close(spa, FTAG);
return (EDOM);
}
+#endif
 
if (error == 0) {
error = spa_vdev_add(spa, config);
___
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: r212387 - head/sys/boot/zfs

2010-09-09 Thread Pawel Jakub Dawidek
Author: pjd
Date: Thu Sep  9 21:32:09 2010
New Revision: 212387
URL: http://svn.freebsd.org/changeset/base/212387

Log:
  Remove empty lines committed by accident.
  
  MFC after:2 weeks

Modified:
  head/sys/boot/zfs/zfsimpl.c

Modified: head/sys/boot/zfs/zfsimpl.c
==
--- head/sys/boot/zfs/zfsimpl.c Thu Sep  9 21:26:55 2010(r212386)
+++ head/sys/boot/zfs/zfsimpl.c Thu Sep  9 21:32:09 2010(r212387)
@@ -449,8 +449,6 @@ vdev_init_from_nvlist(const unsigned cha
return (ENOENT);
}
 
-
-
if (strcmp(type, VDEV_TYPE_MIRROR)
&& strcmp(type, VDEV_TYPE_DISK)
&& strcmp(type, VDEV_TYPE_RAIDZ)
___
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: r212388 - head/share/man/man4

2010-09-09 Thread Christian Brueffer
Author: brueffer
Date: Thu Sep  9 21:37:05 2010
New Revision: 212388
URL: http://svn.freebsd.org/changeset/base/212388

Log:
  Some more grammar, wording and mdoc fixes.

Modified:
  head/share/man/man4/aesni.4

Modified: head/share/man/man4/aesni.4
==
--- head/share/man/man4/aesni.4 Thu Sep  9 21:32:09 2010(r212387)
+++ head/share/man/man4/aesni.4 Thu Sep  9 21:37:05 2010(r212388)
@@ -50,20 +50,24 @@ Starting with some models of Core i5/i7,
 a new set of instructions called AESNI.
 The set of six instructions accelerates the calculation of the key
 schedule for key lengths of 128, 192, and 256 of the Advanced
-Encryption Standard (AES) symmetric cipher, and provides hardware
+Encryption Standard (AES) symmetric cipher, and provides a hardware
 implementation of the regular and the last encryption and decryption
 rounds.
 .Pp
 The processor capability is reported as AESNI in the Features2 line at boot.
-Driver does not attach on the system that lacks the required CPU capability.
+The
+.Nm
+driver does not attach on systems that lack the required CPU capability.
 .Pp
 The
 .Nm
 driver registers itself to accelerate AES operations for
 .Xr crypto 4 .
-Besides speed, the advantage of using the driver is that the AESNI operation
+Besides speed, the advantage of using the
+.Nm
+driver is that the AESNI operation
 is data-independent, thus eliminating some attack vectors based on
-measuring cache use and timings typically present in the table-driven
+measuring cache use and timings typically present in table-driven
 implementations.
 .Sh SEE ALSO
 .Xr crypt 3 ,
___
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: r212389 - head/share/man/man4

2010-09-09 Thread Christian Brueffer
Author: brueffer
Date: Thu Sep  9 21:39:06 2010
New Revision: 212389
URL: http://svn.freebsd.org/changeset/base/212389

Log:
  Xref aesni(4).

Modified:
  head/share/man/man4/crypto.4

Modified: head/share/man/man4/crypto.4
==
--- head/share/man/man4/crypto.4Thu Sep  9 21:37:05 2010
(r212388)
+++ head/share/man/man4/crypto.4Thu Sep  9 21:39:06 2010
(r212389)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 3, 2009
+.Dd September 7, 2010
 .Dt CRYPTO 4
 .Os
 .Sh NAME
@@ -106,6 +106,7 @@ asymmetric cryptographic features are po
 crypto access device
 .El
 .Sh SEE ALSO
+.Xr aesni 4 ,
 .Xr glxsb 4 ,
 .Xr hifn 4 ,
 .Xr ipsec 4 ,
___
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: r212390 - head/bin/expr

2010-09-09 Thread Jilles Tjoelker
Author: jilles
Date: Thu Sep  9 21:59:53 2010
New Revision: 212390
URL: http://svn.freebsd.org/changeset/base/212390

Log:
  expr(1): Add sh(1) versions of examples, remove an incorrect example.
  
  The three examples are better done using sh(1) itself these days.
  
  The example
expr -- "$a" : ".*"
  is incorrect in the general case, as "$a" may be an operator.
  
  MFC after:2 weeks

Modified:
  head/bin/expr/expr.1

Modified: head/bin/expr/expr.1
==
--- head/bin/expr/expr.1Thu Sep  9 21:39:06 2010(r212389)
+++ head/bin/expr/expr.1Thu Sep  9 21:59:53 2010(r212390)
@@ -30,7 +30,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 12, 2004
+.Dd September 9, 2010
 .Dt EXPR 1
 .Os
 .Sh NAME
@@ -217,6 +217,9 @@ command, one might rearrange the express
 More generally, parenthesize possibly-negative values:
 .Dl "a=$(expr \e( $a \e) + 1)"
 .It
+With shell arithmetic, no escaping is required:
+.Dl "a=$((a + 1))"
+.It
 This example prints the filename portion of a pathname stored
 in variable
 .Va a .
@@ -229,6 +232,12 @@ The
 .Li //
 characters resolve this ambiguity.
 .Dl "expr \*q//$a\*q \&: '.*/\e(.*\e)'"
+.It
+With modern
+.Xr sh 1
+syntax,
+.Dl "\*q${a##*/}\*q"
+expands to the same value.
 .El
 .Pp
 The following examples output the number of characters in variable
@@ -237,19 +246,21 @@ Again, if
 .Va a
 might begin with a hyphen, it is necessary to prevent it from being
 interpreted as an option to
-.Nm .
+.Nm ,
+and
+.Va a
+might be interpreted as an operator.
 .Bl -bullet
 .It
-If the
-.Nm
-command conforms to
-.St -p1003.1-2001 ,
-this is simple:
-.Dl "expr -- \*q$a\*q \&: \*q.*\*q"
-.It
-For portability to older systems, however, a more complicated command
+To deal with all of this, a complicated command
 is required:
 .Dl "expr \e( \*qX$a\*q \&: \*q.*\*q \e) - 1"
+.It
+With modern
+.Xr sh 1
+syntax, this can be done much more easily:
+.Dl "${#a}"
+expands to the required number.
 .El
 .Sh SEE ALSO
 .Xr sh 1 ,
___
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: r212403 - head/sys/contrib/pf/net

2010-09-09 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Sep 10 00:00:06 2010
New Revision: 212403
URL: http://svn.freebsd.org/changeset/base/212403

Log:
  When using pf routing options, properly handle IP fragmentation
  for interfaces with TSO enabled, otherwise one would see an extra
  ICMP unreach, frag needed pre matching packet on lo0.
  This syncs pf code to ip_output.c r162084.
  
  PR:   kern/144311
  Submitted by: yongari via mlaier
  Reviewed by:  eri
  Tested by:kib
  MFC after:8 days

Modified:
  head/sys/contrib/pf/net/pf.c

Modified: head/sys/contrib/pf/net/pf.c
==
--- head/sys/contrib/pf/net/pf.cThu Sep  9 23:45:59 2010
(r212402)
+++ head/sys/contrib/pf/net/pf.cFri Sep 10 00:00:06 2010
(r212403)
@@ -6375,6 +6375,7 @@ pf_route(struct mbuf **m, struct pf_rule
m0->m_pkthdr.csum_flags &= ifp->if_hwassist;
 
if (ntohs(ip->ip_len) <= ifp->if_mtu ||
+   (m0->m_pkthdr.csum_flags & ifp->if_hwassist & CSUM_TSO) != 0 ||
(ifp->if_hwassist & CSUM_FRAGMENT &&
((ip->ip_off & htons(IP_DF)) == 0))) {
/*
@@ -6449,7 +6450,7 @@ pf_route(struct mbuf **m, struct pf_rule
 * Too large for interface; fragment if possible.
 * Must be able to put at least 8 bytes per fragment.
 */
-   if (ip->ip_off & htons(IP_DF)) {
+   if (ip->ip_off & htons(IP_DF) || (m0->m_pkthdr.csum_flags & CSUM_TSO)) {
KMOD_IPSTAT_INC(ips_cantfrag);
if (r->rt != PF_DUPTO) {
 #ifdef __FreeBSD__
___
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: r212405 - in head/lib: libc/stdlib libc/sys libthr/thread

2010-09-09 Thread David Xu
Author: davidxu
Date: Fri Sep 10 01:47:37 2010
New Revision: 212405
URL: http://svn.freebsd.org/changeset/base/212405

Log:
  Because POSIX does not allow EINTR to be returned from sigwait(),
  add a wrapper for it in libc and rework the code in libthr, the
  system call still can return EINTR, we keep this feature.
  
  Discussed on: thread
  Reviewed by:  jilles

Added:
  head/lib/libc/sys/sigwait.c   (contents, props changed)
Modified:
  head/lib/libc/stdlib/Makefile.inc
  head/lib/libc/sys/Makefile.inc
  head/lib/libc/sys/Symbol.map
  head/lib/libthr/thread/thr_sig.c

Modified: head/lib/libc/stdlib/Makefile.inc
==
--- head/lib/libc/stdlib/Makefile.inc   Fri Sep 10 00:23:44 2010
(r212404)
+++ head/lib/libc/stdlib/Makefile.inc   Fri Sep 10 01:47:37 2010
(r212405)
@@ -9,7 +9,7 @@ MISRCS+=_Exit.c a64l.c abort.c abs.c ate
getsubopt.c hcreate.c heapsort.c imaxabs.c imaxdiv.c \
insque.c l64a.c labs.c ldiv.c llabs.c lldiv.c lsearch.c malloc.c \
merge.c ptsname.c qsort.c qsort_r.c radixsort.c rand.c random.c \
-   reallocf.c realpath.c remque.c strfmon.c strtoimax.c \
+   reallocf.c realpath.c remque.c sigwait.c strfmon.c strtoimax.c \
strtol.c strtoll.c strtoq.c strtoul.c strtonum.c strtoull.c \
 strtoumax.c strtouq.c system.c tdelete.c tfind.c tsearch.c twalk.c
 

Modified: head/lib/libc/sys/Makefile.inc
==
--- head/lib/libc/sys/Makefile.inc  Fri Sep 10 00:23:44 2010
(r212404)
+++ head/lib/libc/sys/Makefile.inc  Fri Sep 10 01:47:37 2010
(r212405)
@@ -21,6 +21,9 @@ SRCS+=stack_protector.c stack_protector
 SRCS+= fcntl.c ftruncate.c lseek.c mmap.c pread.c pwrite.c truncate.c
 PSEUDO+= _fcntl.o
 .endif
+SRCS+= sigwait.c
+NOASM+= sigwait.o
+PSEUDO+= _sigwait.o
 
 # Add machine dependent asm sources:
 SRCS+=${MDASM}

Modified: head/lib/libc/sys/Symbol.map
==
--- head/lib/libc/sys/Symbol.mapFri Sep 10 00:23:44 2010
(r212404)
+++ head/lib/libc/sys/Symbol.mapFri Sep 10 01:47:37 2010
(r212405)
@@ -919,6 +919,7 @@ FBSDprivate_1.0 {
_sigtimedwait;
__sys_sigtimedwait;
_sigwait;
+   __sigwait;
__sys_sigwait;
_sigwaitinfo;
__sys_sigwaitinfo;

Added: head/lib/libc/sys/sigwait.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libc/sys/sigwait.c Fri Sep 10 01:47:37 2010(r212405)
@@ -0,0 +1,46 @@
+/*-
+ * Copyright (c) 2010 davi...@freebsd.org
+ *
+ * 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 
+
+int __sys_sigwait(const sigset_t * restrict, int * restrict);
+
+__weak_reference(__sigwait, sigwait);
+
+int
+__sigwait(const sigset_t * restrict set, int * restrict sig)
+{
+   int ret;
+
+   /* POSIX does not allow EINTR to be returned */
+   do  {
+   ret = __sys_sigwait(set, sig);
+   } while (ret == EINTR);
+   return (ret);
+}

Modified: head/lib/libthr/thread/thr_sig.c
==
--- head/lib/libthr/thread/thr_sig.cFri Sep 10 00:23:44 2010
(r212404)
+++ head/lib/libthr/thread/thr_sig.cFri Sep 10 01:47:37 2010
(r212405)
@@ -67,7 +67,7 @@ int   _sigtimedwait(const sigset_t *set, s
const struct timespec * timeout);
 int__sigwaitinfo(const sigset_t *set, siginfo_t *info);
 int_

Re: svn commit: r212373 - head/lib/libelf

2010-09-09 Thread Steve Kargl
On Thu, Sep 09, 2010 at 06:51:50PM +, Kai Wang wrote:
> Author: kaiw
> Date: Thu Sep  9 18:51:50 2010
> New Revision: 212373
> URL: http://svn.freebsd.org/changeset/base/212373
> 
> Log:
>   libelf is overly strict about the type and alignment of Elf_Data
>   objects inside one ELF section, which prevents the creation of a ELF
>   section with mixed data types. For example, gcc LTO use libelf to
>   create a .gnu_lto_XXX section that contains integers and a string
>   table, which doesn't work with our libelf implementation.
>   
>   The changes made in this commit include:
>   * Allow Elf_Data type to be different than section type.
>   * Relax Elf_Data alignment check.
>   * Align each Elf_Data by their own alignment instead of section alignment.
>   
>   MFC after:   1 month
> 
> Modified:
>   head/lib/libelf/elf_update.c
> 

libelf still doesn't work with GCC.  All testsuite failures
are of the form

collect2: lto-wrapper returned 1 exit status
compiler exited with status 1
output is:
lto1: error: could not open ELF file: Request error: invalid ELF_C_* argument
lto-wrapper: /usr/home/sgk/gcc/obj4x/gcc/testsuite/gfortran/../../gfortran 
returned 1 exit status
collect2: lto-wrapper returned 1 exit status

-- 
Steve
___
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: r212368 - head/sys/dev/pci

2010-09-09 Thread John Baldwin
On Thursday, September 09, 2010 4:10:55 pm m...@freebsd.org wrote:
> On Thu, Sep 9, 2010 at 11:19 AM, John Baldwin  wrote:
> > Author: jhb
> > Date: Thu Sep  9 18:19:15 2010
> > New Revision: 212368
> > URL: http://svn.freebsd.org/changeset/base/212368
> >
> > Log:
> >  - Rename the constant for the Master Data Parity Error flag in the
> >PCI status register to map its current name.
> >  - Use PCIM_* rather than PCIR_* for constants for fields in various AER
> >registers.  I got about half of them right in the previous commit.
> >
> >  MFC after:1 week
> >
> > Modified:
> >  head/sys/dev/pci/pcireg.h
> 
> This seems to break building CURRENT with this error:
> 
> /data/sb/bsd.git/sys/dev/msk/if_msk.c: In function 'mskc_reset':
> /data/sb/bsd.git/sys/dev/msk/if_msk.c:1337: error:
> 'PCIM_STATUS_PERRREPORT' undeclared (first use in this function)
> /data/sb/bsd.git/sys/dev/msk/if_msk.c:1337: error: (Each undeclared
> identifier is reported only once
> /data/sb/bsd.git/sys/dev/msk/if_msk.c:1337: error: for each function
> it appears in.)
> /data/sb/bsd.git/sys/dev/msk/if_msk.c: In function 'msk_intr_hwerr':
> /data/sb/bsd.git/sys/dev/msk/if_msk.c:3408: error:
> 'PCIM_STATUS_PERRREPORT' undeclared (first use in this function)

My bad, I will fix.  Surprised a driver is even messing with this bit as only
the PCI bus driver should really be doing so (if it grows error handling 
ability).

-- 
John Baldwin
___
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: r212384 - head/sys/boot/zfs

2010-09-09 Thread Giorgos Keramidas
On Thu, 9 Sep 2010 21:19:10 + (UTC), Pawel Jakub Dawidek  
wrote:
> Author: pjd
> Date: Thu Sep  9 21:19:09 2010
> New Revision: 212384
> URL: http://svn.freebsd.org/changeset/base/212384
>
> Log:
>   Ignore log vdevs.
>
>   MFC after:  2 weeks

> --- head/sys/boot/zfs/zfsimpl.c   Thu Sep  9 21:18:00 2010
> (r212383)
> +++ head/sys/boot/zfs/zfsimpl.c   Thu Sep  9 21:19:09 2010
> (r212384)
> @@ -849,6 +850,12 @@ vdev_probe(vdev_phys_read_t *read, void
>   return (EIO);
>   }
>
> + is_log = 0;
> + (void) nvlist_find(nvlist, ZPOOL_CONFIG_IS_LOG, DATA_TYPE_UINT64, 0,
> + &is_log);
> + if (is_log)
> + return (EIO);
> +

ZPOOL_CONFIG_IS_LOG is not visible in zfsimpl.c and it breaks the build
here with:

  /usr/src/sys/boot/zfs/zfsimpl.c: In function 'vdev_probe':
  /usr/src/sys/boot/zfs/zfsimpl.c:853: error: 'ZPOOL_CONFIG_IS_LOG' undeclared 
(first use in this function)
  /usr/src/sys/boot/zfs/zfsimpl.c:853: error: (Each undeclared identifier is 
reported only once
  /usr/src/sys/boot/zfs/zfsimpl.c:853: error: for each function it appears in.)

It looks like we have to resync the ZFS_CONFIG_XXX defines from zfs.h to
zfsimpl.h to make this buildable again:

%%%
diff -r 561815530ad6 sys/cddl/boot/zfs/zfsimpl.h
--- a/sys/cddl/boot/zfs/zfsimpl.h   Fri May 07 22:51:07 2010 +0300
+++ b/sys/cddl/boot/zfs/zfsimpl.h   Fri Sep 10 06:13:11 2010 +0300
@@ -546,17 +546,23 @@
 #defineZPOOL_CONFIG_NPARITY"nparity"
 #defineZPOOL_CONFIG_HOSTID "hostid"
 #defineZPOOL_CONFIG_HOSTNAME   "hostname"
-#defineZPOOL_CONFIG_TIMESTAMP  "timestamp" /* not stored on 
disk */
-
+#defineZPOOL_CONFIG_UNSPARE"unspare"
+#defineZPOOL_CONFIG_PHYS_PATH  "phys_path"
+#defineZPOOL_CONFIG_IS_LOG "is_log"
+#defineZPOOL_CONFIG_L2CACHE"l2cache"
+#defineZPOOL_CONFIG_SUSPENDED  "suspended" /* not stored 
on disk */
+#defineZPOOL_CONFIG_TIMESTAMP  "timestamp" /* not stored 
on disk */
+#defineZPOOL_CONFIG_BOOTFS "bootfs"/* not stored 
on disk */
 /*
  * The persistent vdev state is stored as separate values rather than a single
  * 'vdev_state' entry.  This is because a device can be in multiple states, 
such
  * as offline and degraded.
  */
-#defineZPOOL_CONFIG_OFFLINE"offline"
-#defineZPOOL_CONFIG_FAULTED"faulted"
-#defineZPOOL_CONFIG_DEGRADED   "degraded"
-#defineZPOOL_CONFIG_REMOVED"removed"
+#defineZPOOL_CONFIG_OFFLINE"offline"
+#defineZPOOL_CONFIG_FAULTED"faulted"
+#defineZPOOL_CONFIG_DEGRADED   "degraded"
+#defineZPOOL_CONFIG_REMOVED"removed"
+#defineZPOOL_CONFIG_FRU"fru"
 
 #defineVDEV_TYPE_ROOT  "root"
 #defineVDEV_TYPE_MIRROR"mirror"
%%%
___
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: r212407 - head/sys/cddl/boot/zfs

2010-09-09 Thread Pawel Jakub Dawidek
Author: pjd
Date: Fri Sep 10 04:44:13 2010
New Revision: 212407
URL: http://svn.freebsd.org/changeset/base/212407

Log:
  Forgot to commit this file. Add ZPOOL_CONFIG_IS_LOG.
  
  Reported by:  keramida
  MFC after:2 weeks

Modified:
  head/sys/cddl/boot/zfs/zfsimpl.h

Modified: head/sys/cddl/boot/zfs/zfsimpl.h
==
--- head/sys/cddl/boot/zfs/zfsimpl.hFri Sep 10 03:52:05 2010
(r212406)
+++ head/sys/cddl/boot/zfs/zfsimpl.hFri Sep 10 04:44:13 2010
(r212407)
@@ -546,6 +546,7 @@ typedef enum {
 #defineZPOOL_CONFIG_NPARITY"nparity"
 #defineZPOOL_CONFIG_HOSTID "hostid"
 #defineZPOOL_CONFIG_HOSTNAME   "hostname"
+#defineZPOOL_CONFIG_IS_LOG "is_log"
 #defineZPOOL_CONFIG_TIMESTAMP  "timestamp" /* not stored on 
disk */
 
 /*
___
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: r212384 - head/sys/boot/zfs

2010-09-09 Thread Pawel Jakub Dawidek
On Fri, Sep 10, 2010 at 06:13:21AM +0300, Giorgos Keramidas wrote:
> ZPOOL_CONFIG_IS_LOG is not visible in zfsimpl.c and it breaks the build
> here with:
> 
>   /usr/src/sys/boot/zfs/zfsimpl.c: In function 'vdev_probe':
>   /usr/src/sys/boot/zfs/zfsimpl.c:853: error: 'ZPOOL_CONFIG_IS_LOG' 
> undeclared (first use in this function)
>   /usr/src/sys/boot/zfs/zfsimpl.c:853: error: (Each undeclared identifier is 
> reported only once
>   /usr/src/sys/boot/zfs/zfsimpl.c:853: error: for each function it appears 
> in.)

Yes, I forgot to include one file in 'svn commit'. Thanks!

-- 
Pawel Jakub Dawidek   http://www.wheelsystems.com
p...@freebsd.org   http://www.FreeBSD.org
FreeBSD committer Am I Evil? Yes, I Am!


pgpSEgidSbQdQ.pgp
Description: PGP signature


Re: svn commit: r212384 - head/sys/boot/zfs

2010-09-09 Thread Giorgos Keramidas
On Fri, 10 Sep 2010 06:44:52 +0200, Pawel Jakub Dawidek  
wrote:
> On Fri, Sep 10, 2010 at 06:13:21AM +0300, Giorgos Keramidas wrote:
>> ZPOOL_CONFIG_IS_LOG is not visible in zfsimpl.c and it breaks the build
>> here with:
>>
>>   /usr/src/sys/boot/zfs/zfsimpl.c: In function 'vdev_probe':
>>   /usr/src/sys/boot/zfs/zfsimpl.c:853: error: 'ZPOOL_CONFIG_IS_LOG' 
>> undeclared (first use in this function)
>>   /usr/src/sys/boot/zfs/zfsimpl.c:853: error: (Each undeclared identifier is 
>> reported only once
>>   /usr/src/sys/boot/zfs/zfsimpl.c:853: error: for each function it appears 
>> in.)
>
> Yes, I forgot to include one file in 'svn commit'. Thanks!

No problem.  Problem resolved locally & in svn too :-)

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

2010-09-09 Thread David E. O'Brien
Author: obrien
Date: Fri Sep 10 06:26:28 2010
New Revision: 212408
URL: http://svn.freebsd.org/changeset/base/212408

Log:
  Protect BSDI $Id from accidental manipulation.

Modified:
  head/sys/sys/lock.h

Modified: head/sys/sys/lock.h
==
--- head/sys/sys/lock.h Fri Sep 10 04:44:13 2010(r212407)
+++ head/sys/sys/lock.h Fri Sep 10 06:26:28 2010(r212408)
@@ -25,7 +25,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * from BSDI $Id: mutex.h,v 2.7.2.35 2000/04/27 03:10:26 cp Exp $
+ * from BSDI Id: mutex.h,v 2.7.2.35 2000/04/27 03:10:26 cp
  * $FreeBSD$
  */
 
___
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"