CVS commit: src/sys/dev/pci/ixgbe
Module Name:src Committed By: msaitoh Date: Mon Aug 3 05:43:01 UTC 2015 Modified Files: src/sys/dev/pci/ixgbe: ixgbe.c Log Message: Add missing evcnt_detach(&rxr->rx_copies) in ixgbe_detach(). To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/dev/pci/ixgbe/ixgbe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/ixgbe/ixgbe.c diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.30 src/sys/dev/pci/ixgbe/ixgbe.c:1.31 --- src/sys/dev/pci/ixgbe/ixgbe.c:1.30 Sat May 9 13:08:26 2015 +++ src/sys/dev/pci/ixgbe/ixgbe.c Mon Aug 3 05:43:01 2015 @@ -59,7 +59,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ /*$FreeBSD: head/sys/dev/ixgbe/ixgbe.c 250108 2013-04-30 16:18:29Z luigi $*/ -/*$NetBSD: ixgbe.c,v 1.30 2015/05/09 13:08:26 christos Exp $*/ +/*$NetBSD: ixgbe.c,v 1.31 2015/08/03 05:43:01 msaitoh Exp $*/ #include "opt_inet.h" #include "opt_inet6.h" @@ -807,6 +807,7 @@ ixgbe_detach(device_t dev, int flags) evcnt_detach(&rxr->rx_packets); evcnt_detach(&rxr->rx_bytes); + evcnt_detach(&rxr->rx_copies); evcnt_detach(&rxr->no_jmbuf); evcnt_detach(&rxr->rx_discarded); evcnt_detach(&rxr->rx_irq);
CVS commit: src/sys/dev/sdmmc
Module Name:src Committed By: mlelstv Date: Mon Aug 3 05:32:50 UTC 2015 Modified Files: src/sys/dev/sdmmc: ld_sdmmc.c sdmmc.c sdmmc_io.c sdmmc_mem.c Log Message: use mutex locking for MP safety. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/dev/sdmmc/ld_sdmmc.c cvs rdiff -u -r1.27 -r1.28 src/sys/dev/sdmmc/sdmmc.c cvs rdiff -u -r1.8 -r1.9 src/sys/dev/sdmmc/sdmmc_io.c cvs rdiff -u -r1.37 -r1.38 src/sys/dev/sdmmc/sdmmc_mem.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/sdmmc/ld_sdmmc.c diff -u src/sys/dev/sdmmc/ld_sdmmc.c:1.17 src/sys/dev/sdmmc/ld_sdmmc.c:1.18 --- src/sys/dev/sdmmc/ld_sdmmc.c:1.17 Mon Jul 27 07:53:46 2015 +++ src/sys/dev/sdmmc/ld_sdmmc.c Mon Aug 3 05:32:50 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: ld_sdmmc.c,v 1.17 2015/07/27 07:53:46 skrll Exp $ */ +/* $NetBSD: ld_sdmmc.c,v 1.18 2015/08/03 05:32:50 mlelstv Exp $ */ /* * Copyright (c) 2008 KIYOHARA Takashi @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ld_sdmmc.c,v 1.17 2015/07/27 07:53:46 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ld_sdmmc.c,v 1.18 2015/08/03 05:32:50 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_sdmmc.h" @@ -191,7 +191,7 @@ ld_sdmmc_dobio(void *arg) struct ld_sdmmc_task *task = (struct ld_sdmmc_task *)arg; struct ld_sdmmc_softc *sc = task->task_sc; struct buf *bp = task->task_bp; - int error, s; + int error; /* * I/O operation @@ -208,13 +208,10 @@ ld_sdmmc_dobio(void *arg) bp->b_rawblkno, sc->sc_sf->csd.capacity); bp->b_error = EINVAL; bp->b_resid = bp->b_bcount; - s = splbio(); lddone(&sc->sc_ld, bp); - splx(s); return; } - s = splbio(); if (bp->b_flags & B_READ) error = sdmmc_mem_read_block(sc->sc_sf, bp->b_rawblkno, bp->b_data, bp->b_bcount); @@ -231,7 +228,6 @@ ld_sdmmc_dobio(void *arg) } lddone(&sc->sc_ld, bp); - splx(s); } static int Index: src/sys/dev/sdmmc/sdmmc.c diff -u src/sys/dev/sdmmc/sdmmc.c:1.27 src/sys/dev/sdmmc/sdmmc.c:1.28 --- src/sys/dev/sdmmc/sdmmc.c:1.27 Tue Jul 28 06:19:47 2015 +++ src/sys/dev/sdmmc/sdmmc.c Mon Aug 3 05:32:50 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: sdmmc.c,v 1.27 2015/07/28 06:19:47 mlelstv Exp $ */ +/* $NetBSD: sdmmc.c,v 1.28 2015/08/03 05:32:50 mlelstv Exp $ */ /* $OpenBSD: sdmmc.c,v 1.18 2009/01/09 10:58:38 jsg Exp $ */ /* @@ -49,7 +49,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sdmmc.c,v 1.27 2015/07/28 06:19:47 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sdmmc.c,v 1.28 2015/08/03 05:32:50 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_sdmmc.h" @@ -148,7 +148,7 @@ sdmmc_attach(device_t parent, device_t s sdmmc_init_task(&sc->sc_discover_task, sdmmc_discover_task, sc); sdmmc_init_task(&sc->sc_intr_task, sdmmc_intr_task, sc); - mutex_init(&sc->sc_mtx, MUTEX_DEFAULT, IPL_SDMMC); + mutex_init(&sc->sc_mtx, MUTEX_DEFAULT, IPL_NONE); mutex_init(&sc->sc_tskq_mtx, MUTEX_DEFAULT, IPL_SDMMC); mutex_init(&sc->sc_discover_task_mtx, MUTEX_DEFAULT, IPL_SDMMC); mutex_init(&sc->sc_intr_task_mtx, MUTEX_DEFAULT, IPL_SDMMC); @@ -336,9 +336,8 @@ sdmmc_polling_card(void *arg) { struct sdmmc_softc *sc = (struct sdmmc_softc *)arg; int card_detect; - int s; - s = splsdmmc(); + mutex_enter(&sc->sc_mtx); card_detect = sdmmc_chip_card_detect(sc->sc_sct, sc->sc_sch); if (card_detect) { if (!ISSET(sc->sc_flags, SMF_CARD_PRESENT)) { @@ -349,7 +348,7 @@ sdmmc_polling_card(void *arg) sdmmc_needs_discover(sc->sc_dev); } } - splx(s); + mutex_exit(&sc->sc_mtx); callout_schedule(&sc->sc_card_detect_ch, hz); } Index: src/sys/dev/sdmmc/sdmmc_io.c diff -u src/sys/dev/sdmmc/sdmmc_io.c:1.8 src/sys/dev/sdmmc/sdmmc_io.c:1.9 --- src/sys/dev/sdmmc/sdmmc_io.c:1.8 Tue Jul 28 06:17:53 2015 +++ src/sys/dev/sdmmc/sdmmc_io.c Mon Aug 3 05:32:50 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: sdmmc_io.c,v 1.8 2015/07/28 06:17:53 mlelstv Exp $ */ +/* $NetBSD: sdmmc_io.c,v 1.9 2015/08/03 05:32:50 mlelstv Exp $ */ /* $OpenBSD: sdmmc_io.c,v 1.10 2007/09/17 01:33:33 krw Exp $ */ /* @@ -20,7 +20,7 @@ /* Routines for SD I/O cards. */ #include -__KERNEL_RCSID(0, "$NetBSD: sdmmc_io.c,v 1.8 2015/07/28 06:17:53 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sdmmc_io.c,v 1.9 2015/08/03 05:32:50 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_sdmmc.h" @@ -627,7 +627,6 @@ sdmmc_intr_establish(device_t dev, int ( { struct sdmmc_softc *sc = device_private(dev); struct sdmmc_intr_handler *ih; - int s; if (sc->sc_sct->card_enable_intr == NULL) return NULL; @@ -647,13 +646,13 @@ sdmmc_intr_establish(device_t dev, int ( ih->ih_fun = fun; ih->ih_arg = arg; - s = splhigh(); + mutex_enter(&sc->sc_mtx); if (TAILQ_EMPTY(&sc->sc_intrq)) { sdmmc_intr_enable(sc->sc_fn0); sdmmc_chip_card_enable_intr(sc->sc_sct, sc->sc_sch, 1); } TAILQ_INSERT_TAIL(&sc->sc_intrq, ih, entry); - splx(s); + mutex_exit(&sc->sc_mtx); return ih; } @@ -666,1
CVS commit: src/sys/dev/sdmmc
Module Name:src Committed By: mlelstv Date: Mon Aug 3 05:26:53 UTC 2015 Modified Files: src/sys/dev/sdmmc: sdmmc_mem.c Log Message: more debug output To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/sys/dev/sdmmc/sdmmc_mem.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/sdmmc/sdmmc_mem.c diff -u src/sys/dev/sdmmc/sdmmc_mem.c:1.36 src/sys/dev/sdmmc/sdmmc_mem.c:1.37 --- src/sys/dev/sdmmc/sdmmc_mem.c:1.36 Sun Aug 2 22:47:05 2015 +++ src/sys/dev/sdmmc/sdmmc_mem.c Mon Aug 3 05:26:53 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: sdmmc_mem.c,v 1.36 2015/08/02 22:47:05 jmcneill Exp $ */ +/* $NetBSD: sdmmc_mem.c,v 1.37 2015/08/03 05:26:53 mlelstv Exp $ */ /* $OpenBSD: sdmmc_mem.c,v 1.10 2009/01/09 10:55:22 jsg Exp $ */ /* @@ -45,7 +45,7 @@ /* Routines for SD/MMC memory cards. */ #include -__KERNEL_RCSID(0, "$NetBSD: sdmmc_mem.c,v 1.36 2015/08/02 22:47:05 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sdmmc_mem.c,v 1.37 2015/08/03 05:26:53 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_sdmmc.h" @@ -742,6 +742,7 @@ sdmmc_mem_sd_init(struct sdmmc_softc *sc host_ocr = sdmmc_chip_host_ocr(sc->sc_sct, sc->sc_sch); support_func = SFUNC_STATUS_GROUP(&status, 1); + DPRINTF(("%s: support_func %#x\n", SDMMCDEVNAME(sc), support_func)); best_func = 0; for (i = 0, g = 1; i < __arraycount(switch_group0_functions); i++, g <<= 1) {
CVS commit: src/sys/dev/sdmmc
Module Name:src Committed By: mlelstv Date: Mon Aug 3 05:24:37 UTC 2015 Modified Files: src/sys/dev/sdmmc: sdhc.c Log Message: better error message To generate a diff of this commit: cvs rdiff -u -r1.74 -r1.75 src/sys/dev/sdmmc/sdhc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/sdmmc/sdhc.c diff -u src/sys/dev/sdmmc/sdhc.c:1.74 src/sys/dev/sdmmc/sdhc.c:1.75 --- src/sys/dev/sdmmc/sdhc.c:1.74 Mon Aug 3 00:44:52 2015 +++ src/sys/dev/sdmmc/sdhc.c Mon Aug 3 05:24:37 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: sdhc.c,v 1.74 2015/08/03 00:44:52 jmcneill Exp $ */ +/* $NetBSD: sdhc.c,v 1.75 2015/08/03 05:24:37 mlelstv Exp $ */ /* $OpenBSD: sdhc.c,v 1.25 2009/01/13 19:44:20 grange Exp $ */ /* @@ -23,7 +23,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.74 2015/08/03 00:44:52 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.75 2015/08/03 05:24:37 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_sdmmc.h" @@ -1218,8 +1218,8 @@ sdhc_wait_state(struct sdhc_host *hp, ui return 0; sdmmc_delay(10); } - aprint_error_dev(hp->sc->sc_dev, "timeout waiting for %x (state=%x)\n", - value, state); + aprint_error_dev(hp->sc->sc_dev, "timeout waiting for mask %#x value %#x (state=%#x)\n", + mask, value, state); return ETIMEDOUT; }
CVS commit: src/sys/kern
Module Name:src Committed By: christos Date: Mon Aug 3 04:55:15 UTC 2015 Modified Files: src/sys/kern: kern_descrip.c Log Message: 1. mask fflags so we don't tack on whateve oflags were passed from userland 2. honor O_CLOEXEC, so the children of daemons that use cloning devices, don't end up with the parents descriptors fd_clone and in general the fd approach of 'allocate' > 'play with guts' > 'attach' should be converted to be more constructor like. XXX: pullup-{6,7} To generate a diff of this commit: cvs rdiff -u -r1.228 -r1.229 src/sys/kern/kern_descrip.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/kern_descrip.c diff -u src/sys/kern/kern_descrip.c:1.228 src/sys/kern/kern_descrip.c:1.229 --- src/sys/kern/kern_descrip.c:1.228 Sun Sep 21 13:17:15 2014 +++ src/sys/kern/kern_descrip.c Mon Aug 3 00:55:15 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_descrip.c,v 1.228 2014/09/21 17:17:15 christos Exp $ */ +/* $NetBSD: kern_descrip.c,v 1.229 2015/08/03 04:55:15 christos Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -70,7 +70,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.228 2014/09/21 17:17:15 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.229 2015/08/03 04:55:15 christos Exp $"); #include #include @@ -1861,8 +1861,14 @@ int fd_clone(file_t *fp, unsigned fd, int flag, const struct fileops *fops, void *data) { + fdfile_t *ff; + filedesc_t *fdp; - fp->f_flag = flag; + fp->f_flag |= flag & FMASK; + fdp = curproc->p_fd; + ff = fdp->fd_dt->dt_ff[fd]; + KASSERT(ff != NULL); + ff->ff_exclose = (flag & O_CLOEXEC) != 0; fp->f_type = DTYPE_MISC; fp->f_ops = fops; fp->f_data = data;
CVS commit: src/sbin/fsck_lfs
Module Name:src Committed By: dholland Date: Mon Aug 3 04:16:10 UTC 2015 Modified Files: src/sbin/fsck_lfs: pass5.c Log Message: Use intmax_t to print daddr_t; from sevan@. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sbin/fsck_lfs/pass5.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_lfs/pass5.c diff -u src/sbin/fsck_lfs/pass5.c:1.34 src/sbin/fsck_lfs/pass5.c:1.35 --- src/sbin/fsck_lfs/pass5.c:1.34 Sun Aug 2 18:14:16 2015 +++ src/sbin/fsck_lfs/pass5.c Mon Aug 3 04:16:10 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: pass5.c,v 1.34 2015/08/02 18:14:16 dholland Exp $ */ +/* $NetBSD: pass5.c,v 1.35 2015/08/03 04:16:10 dholland Exp $ */ /*- * Copyright (c) 2000, 2003 The NetBSD Foundation, Inc. @@ -152,8 +152,8 @@ pass5(void) } } if (avail != lfs_sb_getavail(fs)) { - pwarn("AVAIL GIVEN AS %jd, SHOULD BE %ld\n", - (intmax_t)lfs_sb_getavail(fs), avail); + pwarn("AVAIL GIVEN AS %jd, SHOULD BE %jd\n", + (intmax_t)lfs_sb_getavail(fs), (intmax_t)avail); if (preen || reply("FIX")) { lfs_sb_setavail(fs, avail); sbdirty();
CVS commit: src/sys/dev/sdmmc
Module Name:src Committed By: jmcneill Date: Mon Aug 3 00:44:52 UTC 2015 Modified Files: src/sys/dev/sdmmc: sdhc.c Log Message: don't select SDR12 mode if we are <= 400 kHz To generate a diff of this commit: cvs rdiff -u -r1.73 -r1.74 src/sys/dev/sdmmc/sdhc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/sdmmc/sdhc.c diff -u src/sys/dev/sdmmc/sdhc.c:1.73 src/sys/dev/sdmmc/sdhc.c:1.74 --- src/sys/dev/sdmmc/sdhc.c:1.73 Mon Aug 3 00:19:27 2015 +++ src/sys/dev/sdmmc/sdhc.c Mon Aug 3 00:44:52 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: sdhc.c,v 1.73 2015/08/03 00:19:27 jmcneill Exp $ */ +/* $NetBSD: sdhc.c,v 1.74 2015/08/03 00:44:52 jmcneill Exp $ */ /* $OpenBSD: sdhc.c,v 1.25 2009/01/13 19:44:20 grange Exp $ */ /* @@ -23,7 +23,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.73 2015/08/03 00:19:27 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.74 2015/08/03 00:44:52 jmcneill Exp $"); #ifdef _KERNEL_OPT #include "opt_sdmmc.h" @@ -1015,7 +1015,7 @@ sdhc_bus_clock(sdmmc_chipset_handle_t sc HSET2(hp, SDHC_HOST_CTL2, SDHC_UHS_MODE_SELECT_SDR50); } else if (freq > 25000) { HSET2(hp, SDHC_HOST_CTL2, SDHC_UHS_MODE_SELECT_SDR25); - } else { + } else if (freq > 400) { HSET2(hp, SDHC_HOST_CTL2, SDHC_UHS_MODE_SELECT_SDR12); } }
CVS commit: src/sys/dev/sdmmc
Module Name:src Committed By: jmcneill Date: Mon Aug 3 00:19:27 UTC 2015 Modified Files: src/sys/dev/sdmmc: sdhc.c Log Message: dont confuse signaling voltage and bus voltage To generate a diff of this commit: cvs rdiff -u -r1.72 -r1.73 src/sys/dev/sdmmc/sdhc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/sdmmc/sdhc.c diff -u src/sys/dev/sdmmc/sdhc.c:1.72 src/sys/dev/sdmmc/sdhc.c:1.73 --- src/sys/dev/sdmmc/sdhc.c:1.72 Sun Aug 2 22:01:28 2015 +++ src/sys/dev/sdmmc/sdhc.c Mon Aug 3 00:19:27 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: sdhc.c,v 1.72 2015/08/02 22:01:28 jmcneill Exp $ */ +/* $NetBSD: sdhc.c,v 1.73 2015/08/03 00:19:27 jmcneill Exp $ */ /* $OpenBSD: sdhc.c,v 1.25 2009/01/13 19:44:20 grange Exp $ */ /* @@ -23,7 +23,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.72 2015/08/02 22:01:28 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.73 2015/08/03 00:19:27 jmcneill Exp $"); #ifdef _KERNEL_OPT #include "opt_sdmmc.h" @@ -832,7 +832,7 @@ sdhc_bus_power(sdmmc_chipset_handle_t sc * Select the lowest voltage according to capabilities. */ ocr &= hp->ocr; - if (ISSET(ocr, MMC_OCR_1_7V_1_8V|MMC_OCR_1_8V_1_9V|MMC_OCR_S18A)) { + if (ISSET(ocr, MMC_OCR_1_7V_1_8V|MMC_OCR_1_8V_1_9V)) { vdd = SDHC_VOLTAGE_1_8V; } else if (ISSET(ocr, MMC_OCR_2_9V_3_0V|MMC_OCR_3_0V_3_1V)) { vdd = SDHC_VOLTAGE_3_0V;
CVS commit: src/sys/dev/sdmmc
Module Name:src Committed By: jmcneill Date: Sun Aug 2 22:47:05 UTC 2015 Modified Files: src/sys/dev/sdmmc: sdmmc_mem.c sdmmcreg.h Log Message: Add support for eMMC 5.0 HS200 timings. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sys/dev/sdmmc/sdmmc_mem.c cvs rdiff -u -r1.16 -r1.17 src/sys/dev/sdmmc/sdmmcreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/sdmmc/sdmmc_mem.c diff -u src/sys/dev/sdmmc/sdmmc_mem.c:1.35 src/sys/dev/sdmmc/sdmmc_mem.c:1.36 --- src/sys/dev/sdmmc/sdmmc_mem.c:1.35 Sun Aug 2 21:44:36 2015 +++ src/sys/dev/sdmmc/sdmmc_mem.c Sun Aug 2 22:47:05 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: sdmmc_mem.c,v 1.35 2015/08/02 21:44:36 jmcneill Exp $ */ +/* $NetBSD: sdmmc_mem.c,v 1.36 2015/08/02 22:47:05 jmcneill Exp $ */ /* $OpenBSD: sdmmc_mem.c,v 1.10 2009/01/09 10:55:22 jsg Exp $ */ /* @@ -45,7 +45,7 @@ /* Routines for SD/MMC memory cards. */ #include -__KERNEL_RCSID(0, "$NetBSD: sdmmc_mem.c,v 1.35 2015/08/02 21:44:36 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sdmmc_mem.c,v 1.36 2015/08/02 22:47:05 jmcneill Exp $"); #ifdef _KERNEL_OPT #include "opt_sdmmc.h" @@ -796,6 +796,7 @@ sdmmc_mem_mmc_init(struct sdmmc_softc *s int width, value, hs_timing, bus_clock, error; char ext_csd[512]; uint32_t sectors = 0; + int host_ocr; /* change bus clock */ bus_clock = min(sc->sc_busclk, sf->csd.tran_speed); @@ -805,6 +806,8 @@ sdmmc_mem_mmc_init(struct sdmmc_softc *s return error; } + host_ocr = sdmmc_chip_host_ocr(sc->sc_sct, sc->sc_sch); + if (sf->csd.mmcver >= MMC_CSD_MMCVER_4_0) { error = sdmmc_mem_send_cxd_data(sc, MMC_SEND_EXT_CSD, ext_csd, sizeof(ext_csd)); @@ -821,7 +824,11 @@ sdmmc_mem_mmc_init(struct sdmmc_softc *s return ENOTSUP; } - if (ext_csd[EXT_CSD_CARD_TYPE] & EXT_CSD_CARD_TYPE_F_52M) { + if (ISSET(host_ocr, MMC_OCR_1_7V_1_8V|MMC_OCR_1_8V_1_9V) && + ext_csd[EXT_CSD_CARD_TYPE] & EXT_CSD_CARD_TYPE_F_HS200_1_8V) { + sf->csd.tran_speed = 20; /* 200MHz SDR */ + hs_timing = 2; + } else if (ext_csd[EXT_CSD_CARD_TYPE] & EXT_CSD_CARD_TYPE_F_52M) { sf->csd.tran_speed = 52000; /* 52MHz */ hs_timing = 1; } else if (ext_csd[EXT_CSD_CARD_TYPE] & EXT_CSD_CARD_TYPE_F_26M) { Index: src/sys/dev/sdmmc/sdmmcreg.h diff -u src/sys/dev/sdmmc/sdmmcreg.h:1.16 src/sys/dev/sdmmc/sdmmcreg.h:1.17 --- src/sys/dev/sdmmc/sdmmcreg.h:1.16 Sun Aug 2 21:44:36 2015 +++ src/sys/dev/sdmmc/sdmmcreg.h Sun Aug 2 22:47:05 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: sdmmcreg.h,v 1.16 2015/08/02 21:44:36 jmcneill Exp $ */ +/* $NetBSD: sdmmcreg.h,v 1.17 2015/08/02 22:47:05 jmcneill Exp $ */ /* $OpenBSD: sdmmcreg.h,v 1.4 2009/01/09 10:55:22 jsg Exp $ */ /* @@ -135,12 +135,14 @@ #define EXT_CSD_STRUCTURE_VER_1_2 2 /* Version 4.1-4.2-4.3 */ /* EXT_CSD_CARD_TYPE */ -/* The only currently valid values for this field are 0x01, 0x03, 0x07, - * 0x0B and 0x0F. */ #define EXT_CSD_CARD_TYPE_F_26M (1 << 0) #define EXT_CSD_CARD_TYPE_F_52M (1 << 1) #define EXT_CSD_CARD_TYPE_F_52M_1_8V (1 << 2) #define EXT_CSD_CARD_TYPE_F_52M_1_2V (1 << 3) +#define EXT_CSD_CARD_TYPE_F_HS200_1_8V (1 << 4) +#define EXT_CSD_CARD_TYPE_F_HS200_1_2V (1 << 5) +#define EXT_CSD_CARD_TYPE_F_HS400_1_8V (1 << 6) +#define EXT_CSD_CARD_TYPE_F_HS400_1_2V (1 << 7) #define EXT_CSD_CARD_TYPE_26M 0x01 #define EXT_CSD_CARD_TYPE_52M 0x03 #define EXT_CSD_CARD_TYPE_52M_V18 0x07
CVS commit: src/sys/arch/arm/broadcom
Module Name:src Committed By: jmcneill Date: Sun Aug 2 22:09:43 UTC 2015 Modified Files: src/sys/arch/arm/broadcom: bcm2835_emmc.c Log Message: enable UHS support To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/arch/arm/broadcom/bcm2835_emmc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/broadcom/bcm2835_emmc.c diff -u src/sys/arch/arm/broadcom/bcm2835_emmc.c:1.24 src/sys/arch/arm/broadcom/bcm2835_emmc.c:1.25 --- src/sys/arch/arm/broadcom/bcm2835_emmc.c:1.24 Fri Jul 31 15:00:07 2015 +++ src/sys/arch/arm/broadcom/bcm2835_emmc.c Sun Aug 2 22:09:43 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: bcm2835_emmc.c,v 1.24 2015/07/31 15:00:07 jmcneill Exp $ */ +/* $NetBSD: bcm2835_emmc.c,v 1.25 2015/08/02 22:09:43 jmcneill Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: bcm2835_emmc.c,v 1.24 2015/07/31 15:00:07 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bcm2835_emmc.c,v 1.25 2015/08/02 22:09:43 jmcneill Exp $"); #include "bcmdmac.h" @@ -116,8 +116,10 @@ bcmemmc_attach(device_t parent, device_t sc->sc.sc_flags |= SDHC_FLAG_32BIT_ACCESS; sc->sc.sc_flags |= SDHC_FLAG_HOSTCAPS; sc->sc.sc_flags |= SDHC_FLAG_NO_HS_BIT; - sc->sc.sc_caps = SDHC_VOLTAGE_SUPP_3_3V | SDHC_HIGH_SPEED_SUPP | + sc->sc.sc_caps = SDHC_VOLTAGE_SUPP_3_3V | SDHC_VOLTAGE_SUPP_1_8V | + SDHC_HIGH_SPEED_SUPP | (SDHC_MAX_BLK_LEN_1024 << SDHC_MAX_BLK_LEN_SHIFT); + sc->sc.sc_caps2 = SDHC_SDR50_SUPP | SDHC_SDR104_SUPP | SDHC_DDR50_SUPP; sc->sc.sc_host = sc->sc_hosts; sc->sc.sc_clkbase = 5; /* Default to 50MHz */
CVS commit: src/sys/dev/sdmmc
Module Name:src Committed By: jmcneill Date: Sun Aug 2 22:01:28 UTC 2015 Modified Files: src/sys/dev/sdmmc: sdhc.c sdhcvar.h Log Message: let SDHC_FLAG_HOSTCAPS override SDHC_CAPABILITIES2 as well To generate a diff of this commit: cvs rdiff -u -r1.71 -r1.72 src/sys/dev/sdmmc/sdhc.c cvs rdiff -u -r1.21 -r1.22 src/sys/dev/sdmmc/sdhcvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/sdmmc/sdhc.c diff -u src/sys/dev/sdmmc/sdhc.c:1.71 src/sys/dev/sdmmc/sdhc.c:1.72 --- src/sys/dev/sdmmc/sdhc.c:1.71 Sun Aug 2 21:45:12 2015 +++ src/sys/dev/sdmmc/sdhc.c Sun Aug 2 22:01:28 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: sdhc.c,v 1.71 2015/08/02 21:45:12 jmcneill Exp $ */ +/* $NetBSD: sdhc.c,v 1.72 2015/08/02 22:01:28 jmcneill Exp $ */ /* $OpenBSD: sdhc.c,v 1.25 2009/01/13 19:44:20 grange Exp $ */ /* @@ -23,7 +23,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.71 2015/08/02 21:45:12 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.72 2015/08/02 22:01:28 jmcneill Exp $"); #ifdef _KERNEL_OPT #include "opt_sdmmc.h" @@ -315,13 +315,14 @@ sdhc_host_found(struct sdhc_softc *sc, b /* Determine host capabilities. */ if (ISSET(sc->sc_flags, SDHC_FLAG_HOSTCAPS)) { caps = sc->sc_caps; + caps2 = sc->sc_caps2; } else { caps = HREAD4(hp, SDHC_CAPABILITIES); - } - if (hp->specver >= SDHC_SPEC_VERS_300) { - caps2 = HREAD4(hp, SDHC_CAPABILITIES2); - } else { - caps2 = 0; + if (hp->specver >= SDHC_SPEC_VERS_300) { + caps2 = HREAD4(hp, SDHC_CAPABILITIES2); + } else { + caps2 = 0; + } } /* Index: src/sys/dev/sdmmc/sdhcvar.h diff -u src/sys/dev/sdmmc/sdhcvar.h:1.21 src/sys/dev/sdmmc/sdhcvar.h:1.22 --- src/sys/dev/sdmmc/sdhcvar.h:1.21 Fri Jul 31 15:00:08 2015 +++ src/sys/dev/sdmmc/sdhcvar.h Sun Aug 2 22:01:28 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: sdhcvar.h,v 1.21 2015/07/31 15:00:08 jmcneill Exp $ */ +/* $NetBSD: sdhcvar.h,v 1.22 2015/08/02 22:01:28 jmcneill Exp $ */ /* $OpenBSD: sdhcvar.h,v 1.3 2007/09/06 08:01:01 jsg Exp $ */ /* @@ -60,6 +60,7 @@ struct sdhc_softc { uint32_t sc_clkbase; int sc_clkmsk; /* Mask for SDCLK */ uint32_t sc_caps;/* attachment provided capabilities */ + uint32_t sc_caps2; int (*sc_vendor_rod)(struct sdhc_softc *, int); int (*sc_vendor_write_protect)(struct sdhc_softc *);
CVS commit: src/sys/arch/arm/nvidia
Module Name:src Committed By: jmcneill Date: Sun Aug 2 21:45:52 UTC 2015 Modified Files: src/sys/arch/arm/nvidia: tegra_sdhc.c Log Message: set ref clk to 204MHz so we can take advantage of UHS-I modes To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/nvidia/tegra_sdhc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/nvidia/tegra_sdhc.c diff -u src/sys/arch/arm/nvidia/tegra_sdhc.c:1.9 src/sys/arch/arm/nvidia/tegra_sdhc.c:1.10 --- src/sys/arch/arm/nvidia/tegra_sdhc.c:1.9 Wed Jul 29 12:11:32 2015 +++ src/sys/arch/arm/nvidia/tegra_sdhc.c Sun Aug 2 21:45:52 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: tegra_sdhc.c,v 1.9 2015/07/29 12:11:32 jmcneill Exp $ */ +/* $NetBSD: tegra_sdhc.c,v 1.10 2015/08/02 21:45:52 jmcneill Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill @@ -29,7 +29,7 @@ #include "locators.h" #include -__KERNEL_RCSID(0, "$NetBSD: tegra_sdhc.c,v 1.9 2015/07/29 12:11:32 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tegra_sdhc.c,v 1.10 2015/08/02 21:45:52 jmcneill Exp $"); #include #include @@ -124,7 +124,7 @@ tegra_sdhc_attach(device_t parent, devic if (sc->sc_pin_wp) sc->sc.sc_vendor_write_protect = tegra_sdhc_write_protect; - tegra_car_periph_sdmmc_set_rate(sc->sc_port, 5000); + tegra_car_periph_sdmmc_set_rate(sc->sc_port, 20400); sc->sc.sc_clkbase = tegra_car_periph_sdmmc_rate(sc->sc_port) / 1000; aprint_naive("\n");
CVS commit: src/sys/dev/sdmmc
Module Name:src Committed By: jmcneill Date: Sun Aug 2 21:45:12 UTC 2015 Modified Files: src/sys/dev/sdmmc: sdhc.c sdhcreg.h Log Message: add support for UHS-I modes on capable 3.0+ controllers To generate a diff of this commit: cvs rdiff -u -r1.70 -r1.71 src/sys/dev/sdmmc/sdhc.c cvs rdiff -u -r1.14 -r1.15 src/sys/dev/sdmmc/sdhcreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/sdmmc/sdhc.c diff -u src/sys/dev/sdmmc/sdhc.c:1.70 src/sys/dev/sdmmc/sdhc.c:1.71 --- src/sys/dev/sdmmc/sdhc.c:1.70 Sun Aug 2 11:28:01 2015 +++ src/sys/dev/sdmmc/sdhc.c Sun Aug 2 21:45:12 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: sdhc.c,v 1.70 2015/08/02 11:28:01 jmcneill Exp $ */ +/* $NetBSD: sdhc.c,v 1.71 2015/08/02 21:45:12 jmcneill Exp $ */ /* $OpenBSD: sdhc.c,v 1.25 2009/01/13 19:44:20 grange Exp $ */ /* @@ -23,7 +23,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.70 2015/08/02 11:28:01 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.71 2015/08/02 21:45:12 jmcneill Exp $"); #ifdef _KERNEL_OPT #include "opt_sdmmc.h" @@ -181,6 +181,7 @@ static void sdhc_card_enable_intr(sdmmc_ static void sdhc_card_intr_ack(sdmmc_chipset_handle_t); static void sdhc_exec_command(sdmmc_chipset_handle_t, struct sdmmc_command *); +static int sdhc_signal_voltage(sdmmc_chipset_handle_t, int); static int sdhc_start_command(struct sdhc_host *, struct sdmmc_command *); static int sdhc_wait_state(struct sdhc_host *, uint32_t, uint32_t); static int sdhc_soft_reset(struct sdhc_host *, int); @@ -218,7 +219,10 @@ static struct sdmmc_chip_functions sdhc_ /* card interrupt */ .card_enable_intr = sdhc_card_enable_intr, - .card_intr_ack = sdhc_card_intr_ack + .card_intr_ack = sdhc_card_intr_ack, + + /* UHS functions */ + .signal_voltage = sdhc_signal_voltage, }; static int @@ -249,7 +253,7 @@ sdhc_host_found(struct sdhc_softc *sc, b { struct sdmmcbus_attach_args saa; struct sdhc_host *hp; - uint32_t caps; + uint32_t caps, caps2; uint16_t sdhcver; int error; @@ -314,6 +318,11 @@ sdhc_host_found(struct sdhc_softc *sc, b } else { caps = HREAD4(hp, SDHC_CAPABILITIES); } + if (hp->specver >= SDHC_SPEC_VERS_300) { + caps2 = HREAD4(hp, SDHC_CAPABILITIES2); + } else { + caps2 = 0; + } /* * Use DMA if the host system and the controller support it. @@ -402,11 +411,21 @@ sdhc_host_found(struct sdhc_softc *sc, b aprint_normal(","); if (ISSET(caps, SDHC_HIGH_SPEED_SUPP)) { SET(hp->ocr, MMC_OCR_HCS); - aprint_normal(" High-Speed"); + aprint_normal(" HS"); + } + if (ISSET(caps2, SDHC_SDR50_SUPP)) { + SET(hp->ocr, MMC_OCR_S18A); + aprint_normal(" SDR50"); + } + if (ISSET(caps2, SDHC_SDR104_SUPP)) { + SET(hp->ocr, MMC_OCR_S18A); + aprint_normal(" SDR104"); + } + if (ISSET(caps2, SDHC_DDR50_SUPP)) { + SET(hp->ocr, MMC_OCR_S18A); + aprint_normal(" DDR50"); } - if (ISSET(caps, SDHC_VOLTAGE_SUPP_1_8V) && - (hp->specver < SDHC_SPEC_VERS_300 || - ISSET(caps, SDHC_EMBEDDED_SLOT))) { + if (ISSET(caps, SDHC_VOLTAGE_SUPP_1_8V)) { SET(hp->ocr, MMC_OCR_1_7V_1_8V | MMC_OCR_1_8V_1_9V); aprint_normal(" 1.8V"); } @@ -812,7 +831,7 @@ sdhc_bus_power(sdmmc_chipset_handle_t sc * Select the lowest voltage according to capabilities. */ ocr &= hp->ocr; - if (ISSET(ocr, MMC_OCR_1_7V_1_8V|MMC_OCR_1_8V_1_9V)) { + if (ISSET(ocr, MMC_OCR_1_7V_1_8V|MMC_OCR_1_8V_1_9V|MMC_OCR_S18A)) { vdd = SDHC_VOLTAGE_1_8V; } else if (ISSET(ocr, MMC_OCR_2_9V_3_0V|MMC_OCR_3_0V_3_1V)) { vdd = SDHC_VOLTAGE_3_0V; @@ -986,6 +1005,20 @@ sdhc_bus_clock(sdmmc_chipset_handle_t sc goto out; } + if (hp->specver >= SDHC_SPEC_VERS_300) { + /* XXX DDR */ + HCLR2(hp, SDHC_HOST_CTL2, SDHC_UHS_MODE_SELECT_MASK); + if (freq > 10) { + HSET2(hp, SDHC_HOST_CTL2, SDHC_UHS_MODE_SELECT_SDR104); + } else if (freq > 5) { + HSET2(hp, SDHC_HOST_CTL2, SDHC_UHS_MODE_SELECT_SDR50); + } else if (freq > 25000) { + HSET2(hp, SDHC_HOST_CTL2, SDHC_UHS_MODE_SELECT_SDR25); + } else { + HSET2(hp, SDHC_HOST_CTL2, SDHC_UHS_MODE_SELECT_SDR12); + } + } + /* * Set the minimum base clock frequency divisor. */ @@ -1155,6 +1188,25 @@ sdhc_card_intr_ack(sdmmc_chipset_handle_ } static int +sdhc_signal_voltage(sdmmc_chipset_handle_t sch, int signal_voltage) +{ + struct sdhc_host *hp = (struct sdhc_host *)sch; + + switch (signal_voltage) { + case SDMMC_SIGNAL_VOLTAGE_180: + HSET2(hp, SDHC_HOST_CTL2, SDHC_1_8V_SIGNAL_EN); + break; + case SDMMC_SIGNAL_VOLTAGE_330: + HCLR2(hp, SDHC_HOST_CTL2, SDHC_1_8V_SIGNAL_EN); + break; + default: + return EINVAL; + } + + return 0; +} + +static int sdhc_wait_state(struct sdhc_host *hp, uint32_t mask, uint32_t value) { uint32_t state; Index: src/sys/dev/sdmmc/sdhcreg.h diff -u src/sys/dev/sdmmc/sdhcreg.h:1.14 src/sys/dev/sdmmc/sdhcreg.h:1.15 --- src/sys/dev/sdmmc/sdhcreg.h:1.14 Wed Jul 29 12:11:14 2015 +++ src/sys/dev/sdmmc/sdhcreg.h Sun
CVS commit: src/sys/dev/sdmmc
Module Name:src Committed By: jmcneill Date: Sun Aug 2 21:44:36 UTC 2015 Modified Files: src/sys/dev/sdmmc: sdmmc_mem.c sdmmcchip.h sdmmcreg.h sdmmcvar.h Log Message: Add basic UHS-I support. SDR50 and SDR104 are supported, but not DDR50. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sys/dev/sdmmc/sdmmc_mem.c cvs rdiff -u -r1.4 -r1.5 src/sys/dev/sdmmc/sdmmcchip.h cvs rdiff -u -r1.15 -r1.16 src/sys/dev/sdmmc/sdmmcreg.h cvs rdiff -u -r1.16 -r1.17 src/sys/dev/sdmmc/sdmmcvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/sdmmc/sdmmc_mem.c diff -u src/sys/dev/sdmmc/sdmmc_mem.c:1.34 src/sys/dev/sdmmc/sdmmc_mem.c:1.35 --- src/sys/dev/sdmmc/sdmmc_mem.c:1.34 Fri Feb 27 16:08:17 2015 +++ src/sys/dev/sdmmc/sdmmc_mem.c Sun Aug 2 21:44:36 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: sdmmc_mem.c,v 1.34 2015/02/27 16:08:17 nonaka Exp $ */ +/* $NetBSD: sdmmc_mem.c,v 1.35 2015/08/02 21:44:36 jmcneill Exp $ */ /* $OpenBSD: sdmmc_mem.c,v 1.10 2009/01/09 10:55:22 jsg Exp $ */ /* @@ -45,7 +45,7 @@ /* Routines for SD/MMC memory cards. */ #include -__KERNEL_RCSID(0, "$NetBSD: sdmmc_mem.c,v 1.34 2015/02/27 16:08:17 nonaka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sdmmc_mem.c,v 1.35 2015/08/02 21:44:36 jmcneill Exp $"); #ifdef _KERNEL_OPT #include "opt_sdmmc.h" @@ -104,6 +104,7 @@ sdmmc_mem_enable(struct sdmmc_softc *sc) { uint32_t host_ocr; uint32_t card_ocr; + uint32_t new_ocr; uint32_t ocr = 0; int error; @@ -184,19 +185,78 @@ mmc_mode: error = sdmmc_mem_send_if_cond(sc, 0x1aa, &card_ocr); if (error == 0 && card_ocr == 0x1aa) SET(ocr, MMC_OCR_HCS); + + if (sdmmc_chip_host_ocr(sc->sc_sct, sc->sc_sch) & MMC_OCR_S18A) + SET(ocr, MMC_OCR_S18A); } host_ocr |= ocr; /* Send the new OCR value until all cards are ready. */ - error = sdmmc_mem_send_op_cond(sc, host_ocr, NULL); + error = sdmmc_mem_send_op_cond(sc, host_ocr, &new_ocr); if (error) { DPRINTF(("%s: couldn't send memory OCR\n", SDMMCDEVNAME(sc))); goto out; } + if (ISSET(new_ocr, MMC_OCR_S18A) && sc->sc_sct->signal_voltage) { + /* + * Card and host support low voltage mode, begin switch + * sequence. + */ + struct sdmmc_command cmd; + memset(&cmd, 0, sizeof(cmd)); + cmd.c_arg = 0; + cmd.c_flags = SCF_CMD_AC | SCF_RSP_R1; + cmd.c_opcode = SD_VOLTAGE_SWITCH; + error = sdmmc_mmc_command(sc, &cmd); + if (error) { + DPRINTF(("%s: voltage switch command failed\n", + SDMMCDEVNAME(sc))); + goto out; + } + + delay(1000); + + /* + * Stop the clock + */ + error = sdmmc_chip_bus_clock(sc->sc_sct, sc->sc_sch, + SDMMC_SDCLK_OFF); + if (error) + goto out; + + delay(1000); + + /* + * Card switch command was successful, update host controller + * signal voltage setting. + */ + error = sdmmc_chip_signal_voltage(sc->sc_sct, + sc->sc_sch, SDMMC_SIGNAL_VOLTAGE_180); + if (error) + goto out; + + delay(5000); + + /* + * Switch to SDR12 timing + */ + error = sdmmc_chip_bus_clock(sc->sc_sct, sc->sc_sch, 25000); + if (error) + goto out; + + delay(1000); + + SET(sc->sc_flags, SMF_UHS_MODE); + } + out: SDMMC_UNLOCK(sc); + if (error) + printf("%s: %s failed with error %d\n", SDMMCDEVNAME(sc), + __func__, error); + return error; } @@ -617,23 +677,26 @@ sdmmc_mem_sd_init(struct sdmmc_softc *sc static const struct { int v; int freq; + int uhs; } switch_group0_functions[] = { /* Default/SDR12 */ { MMC_OCR_1_7V_1_8V | MMC_OCR_1_8V_1_9V | - MMC_OCR_3_2V_3_3V | MMC_OCR_3_3V_3_4V, 25000 }, + MMC_OCR_3_2V_3_3V | MMC_OCR_3_3V_3_4V, 25000, 0 }, /* High-Speed/SDR25 */ { MMC_OCR_1_7V_1_8V | MMC_OCR_1_8V_1_9V | - MMC_OCR_3_2V_3_3V | MMC_OCR_3_3V_3_4V, 5 }, + MMC_OCR_3_2V_3_3V | MMC_OCR_3_3V_3_4V, 5, 0 }, /* SDR50 */ - { MMC_OCR_1_7V_1_8V | MMC_OCR_1_8V_1_9V, 10 }, + { MMC_OCR_1_7V_1_8V | MMC_OCR_1_8V_1_9V, 10, 1 }, /* SDR104 */ - { MMC_OCR_1_7V_1_8V | MMC_OCR_1_8V_1_9V, 208000 }, + { MMC_OCR_1_7V_1_8V | MMC_OCR_1_8V_1_9V, 208000, 1 }, +#if notyet /* DDR50 */ - { MMC_OCR_1_7V_1_8V | MMC_OCR_1_8V_1_9V, 5 }, + { MMC_OCR_1_7V_1_8V | MMC_OCR_1_8V_1_9V, 5, 1 }, +#endif }; int host_ocr, support_func, best_func, bus_clock, error, g, i; sdmmc_bitfield512_t status; /* Switch Function Status */ @@ -684,6 +747,9 @@ sdmmc_mem_sd_init(struct sdmmc_softc *sc i < __arraycount(switch_group0_functions); i++, g <<= 1) { if (!(switch_group0_functions[i].v & host_ocr)) continue; + if (switch_group0_functions[i].uhs && + !ISSET(sc->sc_flags, SMF_UHS_MODE)) +break; if (g & support_func) best_func = i; } Index: src/sys/dev/sdmmc/sdmmcchip.h diff -u src/sys/dev/sdmmc/sdmmcchip.h:1.4 src/sys/dev/sdmmc/sdmmcchip.h:1.5 --- src/sys/dev/sdmmc/sdmmcchip.h:1.4 Wed May 18 01:07:17 2011 +++ src/sys/dev/sdmmc/sdmmcchip.h Sun Aug 2 21:44:36 2015
CVS commit: src/sys/dev/hdmicec
Module Name:src Committed By: jmcneill Date: Sun Aug 2 21:22:34 UTC 2015 Added Files: src/sys/dev/hdmicec: Makefile Log Message: add makefile for installing hdmicecio.h To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/dev/hdmicec/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/sys/dev/hdmicec/Makefile diff -u /dev/null src/sys/dev/hdmicec/Makefile:1.1 --- /dev/null Sun Aug 2 21:22:34 2015 +++ src/sys/dev/hdmicec/Makefile Sun Aug 2 21:22:34 2015 @@ -0,0 +1,8 @@ +# $NetBSD: Makefile,v 1.1 2015/08/02 21:22:34 jmcneill Exp $ + +INCSDIR= /usr/include/dev/hdmicec + +# Only install includes which are used by userland +INCS= hdmicecio.h + +.include
CVS commit: src/sys/ufs/lfs
Module Name:src Committed By: dholland Date: Sun Aug 2 20:23:21 UTC 2015 Modified Files: src/sys/ufs/lfs: lfs_inode.c Log Message: whoops, fix 32-bit build To generate a diff of this commit: cvs rdiff -u -r1.142 -r1.143 src/sys/ufs/lfs/lfs_inode.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/lfs/lfs_inode.c diff -u src/sys/ufs/lfs/lfs_inode.c:1.142 src/sys/ufs/lfs/lfs_inode.c:1.143 --- src/sys/ufs/lfs/lfs_inode.c:1.142 Sun Aug 2 18:12:41 2015 +++ src/sys/ufs/lfs/lfs_inode.c Sun Aug 2 20:23:21 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_inode.c,v 1.142 2015/08/02 18:12:41 dholland Exp $ */ +/* $NetBSD: lfs_inode.c,v 1.143 2015/08/02 20:23:21 dholland Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc. @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: lfs_inode.c,v 1.142 2015/08/02 18:12:41 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lfs_inode.c,v 1.143 2015/08/02 20:23:21 dholland Exp $"); #if defined(_KERNEL_OPT) #include "opt_quota.h" @@ -207,7 +207,7 @@ lfs_truncate(struct vnode *ovp, off_t le struct lfs *fs; struct buf *bp; int offset, size, level; - long count, rcount; + daddr_t count, rcount; daddr_t blocksreleased = 0, real_released = 0; int i, nblocks; int aflags, error, allerror = 0;
CVS commit: src/sys/ufs/lfs
Module Name:src Committed By: dholland Date: Sun Aug 2 18:18:46 UTC 2015 Modified Files: src/sys/ufs/lfs: lfs.h lfs_accessors.h lfs_balloc.c lfs_segment.c lfs_vfsops.c ulfs_bmap.c Log Message: Pass the fs object to LFS_MAX_DADDR so it can check lfs_is64. Remove some hackish intentional 64->32 truncations next to the checks using LFS_MAX_DADDR, and tackle the problem they handled in bmap instead. The problem: the magic block pointer value UNWRITTEN has magic value -2, and if it's not handled specifically, uint32 -> uint64 promotion turns it into 4294967294, which then causes consternation and monkeyhouse downstream. What's here is still kind of a hack, but it's a step forward. To generate a diff of this commit: cvs rdiff -u -r1.171 -r1.172 src/sys/ufs/lfs/lfs.h cvs rdiff -u -r1.7 -r1.8 src/sys/ufs/lfs/lfs_accessors.h cvs rdiff -u -r1.85 -r1.86 src/sys/ufs/lfs/lfs_balloc.c cvs rdiff -u -r1.250 -r1.251 src/sys/ufs/lfs/lfs_segment.c cvs rdiff -u -r1.333 -r1.334 src/sys/ufs/lfs/lfs_vfsops.c cvs rdiff -u -r1.5 -r1.6 src/sys/ufs/lfs/ulfs_bmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/lfs/lfs.h diff -u src/sys/ufs/lfs/lfs.h:1.171 src/sys/ufs/lfs/lfs.h:1.172 --- src/sys/ufs/lfs/lfs.h:1.171 Sun Aug 2 18:18:10 2015 +++ src/sys/ufs/lfs/lfs.h Sun Aug 2 18:18:46 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: lfs.h,v 1.171 2015/08/02 18:18:10 dholland Exp $ */ +/* $NetBSD: lfs.h,v 1.172 2015/08/02 18:18:46 dholland Exp $ */ /* from NetBSD: dinode.h,v 1.22 2013/01/22 09:39:18 dholland Exp */ /* from NetBSD: dir.h,v 1.21 2009/07/22 04:49:19 dholland Exp */ @@ -194,8 +194,6 @@ #define LFS_V1_SUMMARY_SIZE 512 /* V1 fixed summary size */ #define LFS_DFL_SUMMARY_SIZE 512 /* Default summary size */ -#define LFS_MAX_DADDR 0x7fff /* Highest addressable fsb */ - #define LFS_MAXNAMLEN 255 /* maximum name length in a dir */ #define ULFS_NXADDR 2 Index: src/sys/ufs/lfs/lfs_accessors.h diff -u src/sys/ufs/lfs/lfs_accessors.h:1.7 src/sys/ufs/lfs/lfs_accessors.h:1.8 --- src/sys/ufs/lfs/lfs_accessors.h:1.7 Sun Aug 2 18:18:10 2015 +++ src/sys/ufs/lfs/lfs_accessors.h Sun Aug 2 18:18:46 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_accessors.h,v 1.7 2015/08/02 18:18:10 dholland Exp $ */ +/* $NetBSD: lfs_accessors.h,v 1.8 2015/08/02 18:18:46 dholland Exp $ */ /* from NetBSD: lfs.h,v 1.165 2015/07/24 06:59:32 dholland Exp */ /* from NetBSD: dinode.h,v 1.22 2013/01/22 09:39:18 dholland Exp */ @@ -563,6 +563,10 @@ lfs_sb_setfsmnt(STRUCT_LFS *fs, const ch } } +/* Highest addressable fsb */ +#define LFS_MAX_DADDR(fs) \ + ((fs)->lfs_is64 ? 0x7fff : 0x7fff) + /* LFS_NINDIR is the number of indirects in a file system block. */ #define LFS_NINDIR(fs) (lfs_sb_getnindir(fs)) Index: src/sys/ufs/lfs/lfs_balloc.c diff -u src/sys/ufs/lfs/lfs_balloc.c:1.85 src/sys/ufs/lfs/lfs_balloc.c:1.86 --- src/sys/ufs/lfs/lfs_balloc.c:1.85 Sun Aug 2 18:08:13 2015 +++ src/sys/ufs/lfs/lfs_balloc.c Sun Aug 2 18:18:46 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_balloc.c,v 1.85 2015/08/02 18:08:13 dholland Exp $ */ +/* $NetBSD: lfs_balloc.c,v 1.86 2015/08/02 18:18:46 dholland Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc. @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: lfs_balloc.c,v 1.85 2015/08/02 18:08:13 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lfs_balloc.c,v 1.86 2015/08/02 18:18:46 dholland Exp $"); #if defined(_KERNEL_OPT) #include "opt_quota.h" @@ -219,8 +219,7 @@ lfs_balloc(struct vnode *vp, off_t start if (error) return (error); - daddr = (daddr_t)((int32_t)daddr); /* XXX ondisk32 */ - KASSERT(daddr <= LFS_MAX_DADDR); + KASSERT(daddr <= LFS_MAX_DADDR(fs)); /* * Do byte accounting all at once, so we can gracefully fail *before* Index: src/sys/ufs/lfs/lfs_segment.c diff -u src/sys/ufs/lfs/lfs_segment.c:1.250 src/sys/ufs/lfs/lfs_segment.c:1.251 --- src/sys/ufs/lfs/lfs_segment.c:1.250 Sun Aug 2 18:18:10 2015 +++ src/sys/ufs/lfs/lfs_segment.c Sun Aug 2 18:18:46 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_segment.c,v 1.250 2015/08/02 18:18:10 dholland Exp $ */ +/* $NetBSD: lfs_segment.c,v 1.251 2015/08/02 18:18:46 dholland Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc. @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.250 2015/08/02 18:18:10 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.251 2015/08/02 18:18:46 dholland Exp $"); #define _VFS_VNODE_PRIVATE /* XXX: check for VI_MARKER, this has to go */ @@ -1473,8 +1473,7 @@ lfs_update_single(struct lfs *fs, struct if (error) panic("lfs_updatemeta: ulfs_bmaparray returned %d", error); - daddr = (daddr_t)((int32_t)daddr); /* XXX ondisk32 */ - KASSERT(daddr <= LFS_MAX_DADDR); + KASSERT(daddr <= LFS_MAX_DADDR(fs)); if (daddr > 0) daddr = LFS_DBTOF
CVS commit: src
Module Name:src Committed By: dholland Date: Sun Aug 2 18:18:10 UTC 2015 Modified Files: src/libexec/lfs_cleanerd: cleaner.h lfs_cleanerd.c src/sbin/dump_lfs: lfs_inode.c src/sbin/fsck_lfs: lfs.c segwrite.c src/sbin/newfs_lfs: extern.h make_lfs.c src/sbin/resize_lfs: resize_lfs.c src/sbin/scan_ffs: scan_ffs.c src/sys/lib/libsa: lfsv1.c lfsv2.c ufs.c src/sys/ufs/lfs: lfs.h lfs_accessors.h lfs_cksum.c lfs_debug.c lfs_extern.h lfs_segment.c lfs_vfsops.c src/usr.sbin/dumplfs: dumplfs.c Log Message: Add a (draft) 64-bit superblock. Make things build again. Add pieces of support for using both superblock types where convenient, and specifically to the superblock accessors, but don't actually enable it anywhere. First substantive step on PR 5. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/libexec/lfs_cleanerd/cleaner.h cvs rdiff -u -r1.43 -r1.44 src/libexec/lfs_cleanerd/lfs_cleanerd.c cvs rdiff -u -r1.22 -r1.23 src/sbin/dump_lfs/lfs_inode.c cvs rdiff -u -r1.51 -r1.52 src/sbin/fsck_lfs/lfs.c cvs rdiff -u -r1.35 -r1.36 src/sbin/fsck_lfs/segwrite.c cvs rdiff -u -r1.12 -r1.13 src/sbin/newfs_lfs/extern.h cvs rdiff -u -r1.39 -r1.40 src/sbin/newfs_lfs/make_lfs.c cvs rdiff -u -r1.13 -r1.14 src/sbin/resize_lfs/resize_lfs.c cvs rdiff -u -r1.30 -r1.31 src/sbin/scan_ffs/scan_ffs.c cvs rdiff -u -r1.11 -r1.12 src/sys/lib/libsa/lfsv1.c \ src/sys/lib/libsa/lfsv2.c cvs rdiff -u -r1.69 -r1.70 src/sys/lib/libsa/ufs.c cvs rdiff -u -r1.170 -r1.171 src/sys/ufs/lfs/lfs.h cvs rdiff -u -r1.6 -r1.7 src/sys/ufs/lfs/lfs_accessors.h cvs rdiff -u -r1.29 -r1.30 src/sys/ufs/lfs/lfs_cksum.c cvs rdiff -u -r1.49 -r1.50 src/sys/ufs/lfs/lfs_debug.c cvs rdiff -u -r1.106 -r1.107 src/sys/ufs/lfs/lfs_extern.h cvs rdiff -u -r1.249 -r1.250 src/sys/ufs/lfs/lfs_segment.c cvs rdiff -u -r1.332 -r1.333 src/sys/ufs/lfs/lfs_vfsops.c cvs rdiff -u -r1.48 -r1.49 src/usr.sbin/dumplfs/dumplfs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/libexec/lfs_cleanerd/cleaner.h diff -u src/libexec/lfs_cleanerd/cleaner.h:1.10 src/libexec/lfs_cleanerd/cleaner.h:1.11 --- src/libexec/lfs_cleanerd/cleaner.h:1.10 Sun Aug 2 18:10:07 2015 +++ src/libexec/lfs_cleanerd/cleaner.h Sun Aug 2 18:18:09 2015 @@ -16,7 +16,11 @@ struct clfs_seguse { * The cleaner's view of the superblock data structure. */ struct clfs { - struct dlfs lfs_dlfs; + union { + struct dlfs u_32; + struct dlfs64 u_64; + } lfs_dlfs_u; + unsigned lfs_is64 : 1; /* Ifile */ int clfs_ifilefd; /* Ifile file descriptor */ Index: src/libexec/lfs_cleanerd/lfs_cleanerd.c diff -u src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.43 src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.44 --- src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.43 Sun Aug 2 18:14:16 2015 +++ src/libexec/lfs_cleanerd/lfs_cleanerd.c Sun Aug 2 18:18:09 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_cleanerd.c,v 1.43 2015/08/02 18:14:16 dholland Exp $ */ +/* $NetBSD: lfs_cleanerd.c,v 1.44 2015/08/02 18:18:09 dholland Exp $ */ /*- * Copyright (c) 2005 The NetBSD Foundation, Inc. @@ -94,6 +94,11 @@ extern u_int32_t lfs_sb_cksum(struct dlf extern u_int32_t lfs_cksum_part(void *, size_t, u_int32_t); extern int ulfs_getlbns(struct lfs *, struct uvnode *, daddr_t, struct indir *, int *); +/* Ugh */ +#define FSMNT_SIZE MAX(sizeof(((struct dlfs *)0)->dlfs_fsmnt), \ + sizeof(((struct dlfs64 *)0)->dlfs_fsmnt)) + + /* Compat */ void pwarn(const char *unused, ...) { /* Does nothing */ }; @@ -133,9 +138,9 @@ handle_error(struct clfs **cfsp, int n) int reinit_fs(struct clfs *fs) { - char fsname[sizeof(fs->lfs_dlfs.dlfs_fsmnt)]; + char fsname[FSMNT_SIZE]; - memcpy(fsname, fs->lfs_dlfs.dlfs_fsmnt, sizeof(fsname)); + memcpy(fsname, lfs_sb_getfsmnt(fs), sizeof(fsname)); fsname[sizeof(fsname) - 1] = '\0'; kops.ko_close(fs->clfs_ifilefd); @@ -202,7 +207,7 @@ init_unmounted_fs(struct clfs *fs, char int init_fs(struct clfs *fs, char *fsname) { - char mnttmp[sizeof(fs->lfs_dlfs.dlfs_fsmnt)]; + char mnttmp[FSMNT_SIZE]; struct statvfs sf; int rootfd; int i; @@ -254,9 +259,17 @@ init_fs(struct clfs *fs, char *fsname) return -1; } - memcpy(&(fs->lfs_dlfs), sbuf, sizeof(struct dlfs)); + __CTASSERT(sizeof(struct dlfs) == sizeof(struct dlfs64)); + memcpy(&fs->lfs_dlfs_u, sbuf, sizeof(struct dlfs)); free(sbuf); + /* If it is not LFS, complain and exit! */ + if (fs->lfs_dlfs_u.u_32.dlfs_magic != LFS_MAGIC) { + syslog(LOG_ERR, "%s: not LFS", fsname); + return -1; + } + fs->lfs_is64 = 0; /* XXX notyet */ + /* If this is not a version 2 filesystem, complain and exit */ if (lfs_sb_getversion(fs) != 2) { syslog(LOG_ERR, "%s: not a version 2 LFS", fsname); @@ -266,7 +279,7 @@ init_fs(struct clfs *fs, char *fsname) /* Assume fsname is the mounted name */ strncpy(mnttmp, fsname, sizeof(mnttmp)); mnttmp[sizeof(mnttmp)
CVS commit: src
Module Name:src Committed By: dholland Date: Sun Aug 2 18:14:16 UTC 2015 Modified Files: src/libexec/lfs_cleanerd: lfs_cleanerd.c src/sbin/dump_lfs: lfs_inode.c src/sbin/fsck_lfs: lfs.c pass5.c segwrite.c setup.c src/sbin/newfs_lfs: make_lfs.c src/sbin/scan_ffs: scan_ffs.c src/sys/ufs/lfs: lfs_accessors.h lfs_alloc.c lfs_debug.c lfs_itimes.c lfs_rfw.c lfs_segment.c lfs_syscalls.c lfs_vfsops.c src/usr.sbin/dumplfs: dumplfs.c Log Message: Use accessor functions for the version field of the lfs superblock. I thought at first maybe the cases that test the version should be rolled into the accessors, but on the whole I think the conclusion on that is no. To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/libexec/lfs_cleanerd/lfs_cleanerd.c cvs rdiff -u -r1.21 -r1.22 src/sbin/dump_lfs/lfs_inode.c cvs rdiff -u -r1.50 -r1.51 src/sbin/fsck_lfs/lfs.c cvs rdiff -u -r1.33 -r1.34 src/sbin/fsck_lfs/pass5.c cvs rdiff -u -r1.34 -r1.35 src/sbin/fsck_lfs/segwrite.c cvs rdiff -u -r1.51 -r1.52 src/sbin/fsck_lfs/setup.c cvs rdiff -u -r1.38 -r1.39 src/sbin/newfs_lfs/make_lfs.c cvs rdiff -u -r1.29 -r1.30 src/sbin/scan_ffs/scan_ffs.c cvs rdiff -u -r1.5 -r1.6 src/sys/ufs/lfs/lfs_accessors.h cvs rdiff -u -r1.124 -r1.125 src/sys/ufs/lfs/lfs_alloc.c cvs rdiff -u -r1.48 -r1.49 src/sys/ufs/lfs/lfs_debug.c cvs rdiff -u -r1.16 -r1.17 src/sys/ufs/lfs/lfs_itimes.c cvs rdiff -u -r1.24 -r1.25 src/sys/ufs/lfs/lfs_rfw.c cvs rdiff -u -r1.248 -r1.249 src/sys/ufs/lfs/lfs_segment.c cvs rdiff -u -r1.163 -r1.164 src/sys/ufs/lfs/lfs_syscalls.c cvs rdiff -u -r1.331 -r1.332 src/sys/ufs/lfs/lfs_vfsops.c cvs rdiff -u -r1.47 -r1.48 src/usr.sbin/dumplfs/dumplfs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/libexec/lfs_cleanerd/lfs_cleanerd.c diff -u src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.42 src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.43 --- src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.42 Sun Aug 2 18:10:07 2015 +++ src/libexec/lfs_cleanerd/lfs_cleanerd.c Sun Aug 2 18:14:16 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_cleanerd.c,v 1.42 2015/08/02 18:10:07 dholland Exp $ */ +/* $NetBSD: lfs_cleanerd.c,v 1.43 2015/08/02 18:14:16 dholland Exp $ */ /*- * Copyright (c) 2005 The NetBSD Foundation, Inc. @@ -258,7 +258,7 @@ init_fs(struct clfs *fs, char *fsname) free(sbuf); /* If this is not a version 2 filesystem, complain and exit */ - if (fs->lfs_version != 2) { + if (lfs_sb_getversion(fs) != 2) { syslog(LOG_ERR, "%s: not a version 2 LFS", fsname); return -1; } Index: src/sbin/dump_lfs/lfs_inode.c diff -u src/sbin/dump_lfs/lfs_inode.c:1.21 src/sbin/dump_lfs/lfs_inode.c:1.22 --- src/sbin/dump_lfs/lfs_inode.c:1.21 Fri Jul 24 06:59:31 2015 +++ src/sbin/dump_lfs/lfs_inode.c Sun Aug 2 18:14:16 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_inode.c,v 1.21 2015/07/24 06:59:31 dholland Exp $ */ +/* $NetBSD: lfs_inode.c,v 1.22 2015/08/02 18:14:16 dholland Exp $ */ /*- * Copyright (c) 1980, 1991, 1993, 1994 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/1/95"; #else -__RCSID("$NetBSD: lfs_inode.c,v 1.21 2015/07/24 06:59:31 dholland Exp $"); +__RCSID("$NetBSD: lfs_inode.c,v 1.22 2015/08/02 18:14:16 dholland Exp $"); #endif #endif /* not lint */ @@ -115,7 +115,7 @@ fs_read_sblock(char *superblock) msg("Warning: secondary superblock at 0x%" PRIx64 " bad magic\n", LFS_FSBTODB(sblock, (off_t)lfs_sb_getsboff(sblock, 1))); } else { - if (sblock->lfs_version > 1) { + if (lfs_sb_getversion(sblock) > 1) { if (lfs_sb_getserial(&u.lfss) < lfs_sb_getserial(sblock)) { memcpy(sblock, u.tbuf, sizeof(u.tbuf)); sboff = lfs_fsbtob(sblock, (off_t)lfs_sb_getsboff(sblock, 1)); @@ -147,14 +147,14 @@ fs_parametrize(void) spcl.c_flags = iswap32(iswap32(spcl.c_flags) | DR_NEWINODEFMT); ufsi.ufs_dsize = LFS_FSBTODB(sblock, lfs_sb_getsize(sblock)); - if (sblock->lfs_version == 1) + if (lfs_sb_getversion(sblock) == 1) ufsi.ufs_dsize = lfs_sb_getsize(sblock) >> lfs_sb_getblktodb(sblock); ufsi.ufs_bsize = lfs_sb_getbsize(sblock); ufsi.ufs_bshift = lfs_sb_getbshift(sblock); ufsi.ufs_fsize = lfs_sb_getfsize(sblock); ufsi.ufs_frag = lfs_sb_getfrag(sblock); ufsi.ufs_fsatoda = lfs_sb_getfsbtodb(sblock); - if (sblock->lfs_version == 1) + if (lfs_sb_getversion(sblock) == 1) ufsi.ufs_fsatoda = 0; ufsi.ufs_nindir = lfs_sb_getnindir(sblock); ufsi.ufs_inopb = lfs_sb_getinopb(sblock); Index: src/sbin/fsck_lfs/lfs.c diff -u src/sbin/fsck_lfs/lfs.c:1.50 src/sbin/fsck_lfs/lfs.c:1.51 --- src/sbin/fsck_lfs/lfs.c:1.50 Sun Aug 2 18:10:08 2015 +++ src/sbin/fsck_lfs/lfs.c Sun Aug 2 18:14:16 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: lfs.c,v 1.50 2015/08/02 18:10:08 dholland Exp $ */ +/* $NetBSD: lfs.c,v 1.51 2015/08/02 18:14:16 dholland Exp $ */ /*- * Copyright (c) 2003 The
CVS commit: src/sys/ufs/lfs
Module Name:src Committed By: dholland Date: Sun Aug 2 18:12:59 UTC 2015 Modified Files: src/sys/ufs/lfs: lfs.h lfs_vnops.c Log Message: lfs_cleanint[] in the in-memory superblock needs to have 64-bit entries. To generate a diff of this commit: cvs rdiff -u -r1.169 -r1.170 src/sys/ufs/lfs/lfs.h cvs rdiff -u -r1.279 -r1.280 src/sys/ufs/lfs/lfs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/lfs/lfs.h diff -u src/sys/ufs/lfs/lfs.h:1.169 src/sys/ufs/lfs/lfs.h:1.170 --- src/sys/ufs/lfs/lfs.h:1.169 Sun Aug 2 18:10:08 2015 +++ src/sys/ufs/lfs/lfs.h Sun Aug 2 18:12:59 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: lfs.h,v 1.169 2015/08/02 18:10:08 dholland Exp $ */ +/* $NetBSD: lfs.h,v 1.170 2015/08/02 18:12:59 dholland Exp $ */ /* from NetBSD: dinode.h,v 1.22 2013/01/22 09:39:18 dholland Exp */ /* from NetBSD: dir.h,v 1.21 2009/07/22 04:49:19 dholland Exp */ @@ -721,7 +721,7 @@ struct lfs { struct pool lfs_segpool; /* Pool for struct segment */ #endif /* _KERNEL */ #define LFS_MAX_CLEANIND 64 - int32_t lfs_cleanint[LFS_MAX_CLEANIND]; /* Active cleaning intervals */ + daddr_t lfs_cleanint[LFS_MAX_CLEANIND]; /* Active cleaning intervals */ int lfs_cleanind; /* Index into intervals */ int lfs_sleepers; /* # procs sleeping this fs */ int lfs_pages; /* dirty pages blaming this fs */ Index: src/sys/ufs/lfs/lfs_vnops.c diff -u src/sys/ufs/lfs/lfs_vnops.c:1.279 src/sys/ufs/lfs/lfs_vnops.c:1.280 --- src/sys/ufs/lfs/lfs_vnops.c:1.279 Sun Aug 2 18:12:41 2015 +++ src/sys/ufs/lfs/lfs_vnops.c Sun Aug 2 18:12:59 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_vnops.c,v 1.279 2015/08/02 18:12:41 dholland Exp $ */ +/* $NetBSD: lfs_vnops.c,v 1.280 2015/08/02 18:12:59 dholland Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc. @@ -125,7 +125,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.279 2015/08/02 18:12:41 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.280 2015/08/02 18:12:59 dholland Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -1466,7 +1466,7 @@ lfs_strategy(void *v) tbn >= fs->lfs_cleanint[i]) { DLOG((DLOG_CLEAN, "lfs_strategy: ino %d lbn %" PRId64 - " ind %d sn %d fsb %" PRIx32 + " ind %d sn %d fsb %" PRIx64 " given sn %d fsb %" PRIx64 "\n", ip->i_number, bp->b_lblkno, i, lfs_dtosn(fs, fs->lfs_cleanint[i]),
CVS commit: src/sys/ufs/lfs
Module Name:src Committed By: dholland Date: Sun Aug 2 18:12:41 UTC 2015 Modified Files: src/sys/ufs/lfs: lfs_inode.c lfs_inode.h lfs_segment.c lfs_vnops.c Log Message: Make i_eff_nblks in the in-memory inode 64 bits wide. To generate a diff of this commit: cvs rdiff -u -r1.141 -r1.142 src/sys/ufs/lfs/lfs_inode.c cvs rdiff -u -r1.7 -r1.8 src/sys/ufs/lfs/lfs_inode.h cvs rdiff -u -r1.247 -r1.248 src/sys/ufs/lfs/lfs_segment.c cvs rdiff -u -r1.278 -r1.279 src/sys/ufs/lfs/lfs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/lfs/lfs_inode.c diff -u src/sys/ufs/lfs/lfs_inode.c:1.141 src/sys/ufs/lfs/lfs_inode.c:1.142 --- src/sys/ufs/lfs/lfs_inode.c:1.141 Sun Aug 2 18:08:13 2015 +++ src/sys/ufs/lfs/lfs_inode.c Sun Aug 2 18:12:41 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_inode.c,v 1.141 2015/08/02 18:08:13 dholland Exp $ */ +/* $NetBSD: lfs_inode.c,v 1.142 2015/08/02 18:12:41 dholland Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc. @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: lfs_inode.c,v 1.141 2015/08/02 18:08:13 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lfs_inode.c,v 1.142 2015/08/02 18:12:41 dholland Exp $"); #if defined(_KERNEL_OPT) #include "opt_quota.h" @@ -575,8 +575,8 @@ done: #ifdef DIAGNOSTIC if (oip->i_size == 0 && (oip->i_ffs1_blocks != 0 || oip->i_lfs_effnblks != 0)) { - printf("lfs_truncate: truncate to 0 but %d blks/%d effblks\n", - oip->i_ffs1_blocks, oip->i_lfs_effnblks); + printf("lfs_truncate: truncate to 0 but %d blks/%jd effblks\n", + oip->i_ffs1_blocks, (intmax_t)oip->i_lfs_effnblks); panic("lfs_truncate: persistent blocks"); } #endif Index: src/sys/ufs/lfs/lfs_inode.h diff -u src/sys/ufs/lfs/lfs_inode.h:1.7 src/sys/ufs/lfs/lfs_inode.h:1.8 --- src/sys/ufs/lfs/lfs_inode.h:1.7 Mon May 26 19:12:43 2014 +++ src/sys/ufs/lfs/lfs_inode.h Sun Aug 2 18:12:41 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_inode.h,v 1.7 2014/05/26 19:12:43 ryoon Exp $ */ +/* $NetBSD: lfs_inode.h,v 1.8 2015/08/02 18:12:41 dholland Exp $ */ /* from NetBSD: ulfs_inode.h,v 1.5 2013/06/06 00:51:50 dholland Exp */ /* from NetBSD: inode.h,v 1.64 2012/11/19 00:36:21 jakllsch Exp */ @@ -221,7 +221,7 @@ struct inode { */ struct lfs_inode_ext { off_t lfs_osize; /* size of file on disk */ - u_int32_t lfs_effnblocks; /* number of blocks when i/o completes */ + u_int64_t lfs_effnblocks; /* number of blocks when i/o completes */ size_t lfs_fragsize[ULFS_NDADDR]; /* size of on-disk direct blocks */ TAILQ_ENTRY(inode) lfs_dchain; /* Dirop chain. */ TAILQ_ENTRY(inode) lfs_pchain; /* Paging chain. */ Index: src/sys/ufs/lfs/lfs_segment.c diff -u src/sys/ufs/lfs/lfs_segment.c:1.247 src/sys/ufs/lfs/lfs_segment.c:1.248 --- src/sys/ufs/lfs/lfs_segment.c:1.247 Sun Aug 2 18:10:55 2015 +++ src/sys/ufs/lfs/lfs_segment.c Sun Aug 2 18:12:41 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_segment.c,v 1.247 2015/08/02 18:10:55 dholland Exp $ */ +/* $NetBSD: lfs_segment.c,v 1.248 2015/08/02 18:12:41 dholland Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc. @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.247 2015/08/02 18:10:55 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.248 2015/08/02 18:12:41 dholland Exp $"); #define _VFS_VNODE_PRIVATE /* XXX: check for VI_MARKER, this has to go */ @@ -1215,8 +1215,8 @@ lfs_writeinode(struct lfs *fs, struct se PRId64 "\n", (int)ip->i_number, ip->i_size, cdp->di_size)); } if (ip->i_lfs_effnblks != ip->i_ffs1_blocks) { - DLOG((DLOG_SEG, "lfs_writeinode: cleansing ino %d eff %d != nblk %d)" - " at %jx\n", ip->i_number, ip->i_lfs_effnblks, + DLOG((DLOG_SEG, "lfs_writeinode: cleansing ino %d eff %jd != nblk %d)" + " at %jx\n", ip->i_number, (intmax_t)ip->i_lfs_effnblks, ip->i_ffs1_blocks, (uintmax_t)lfs_sb_getoffset(fs))); for (daddrp = cdp->di_db; daddrp < cdp->di_ib + ULFS_NIADDR; daddrp++) { @@ -1259,8 +1259,8 @@ lfs_writeinode(struct lfs *fs, struct se LFS_CLR_UINO(ip, IN_MODIFIED); else { DLOG((DLOG_VNODE, "lfs_writeinode: ino %d: real " - "blks=%d, eff=%d\n", ip->i_number, - ip->i_ffs1_blocks, ip->i_lfs_effnblks)); + "blks=%d, eff=%jd\n", ip->i_number, + ip->i_ffs1_blocks, (intmax_t)ip->i_lfs_effnblks)); } } @@ -2108,9 +2108,9 @@ lfs_writeseg(struct lfs *fs, struct segm if (bp->b_lblkno < 0 && bp->b_vp != devvp && bp->b_vp && VTOI(bp->b_vp)->i_ffs1_blocks != VTOI(bp->b_vp)->i_lfs_effnblks) { - DLOG((DLOG_VNODE, "lfs_writeseg: cleansing ino %d (%d != %d)\n", + DLOG((DLOG_VNODE, "lfs_writeseg: cleansing ino %d (%jd != %d)\n", VTOI(bp->b_vp)->i_number, - VTOI(bp->b_vp)->i_lfs_effnblks, + (intmax_t)VTOI(bp->b_vp)->i_lfs_effnblks,
CVS commit: src
Module Name:src Committed By: dholland Date: Sun Aug 2 18:11:57 UTC 2015 Modified Files: src/sbin/mount_lfs: mount_lfs.c mount_lfs.h src/usr.sbin/puffs/rump_lfs: rump_lfs.c Log Message: Use the lfs header file and lfs's mount args struct, not ufsmount.h and the ffs mount args struct, for mounting lfs. (they are the same, so this doesn't matter yet, but still...) To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sbin/mount_lfs/mount_lfs.c cvs rdiff -u -r1.2 -r1.3 src/sbin/mount_lfs/mount_lfs.h cvs rdiff -u -r1.17 -r1.18 src/usr.sbin/puffs/rump_lfs/rump_lfs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/mount_lfs/mount_lfs.c diff -u src/sbin/mount_lfs/mount_lfs.c:1.37 src/sbin/mount_lfs/mount_lfs.c:1.38 --- src/sbin/mount_lfs/mount_lfs.c:1.37 Sat Oct 19 23:14:27 2013 +++ src/sbin/mount_lfs/mount_lfs.c Sun Aug 2 18:11:57 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: mount_lfs.c,v 1.37 2013/10/19 23:14:27 christos Exp $ */ +/* $NetBSD: mount_lfs.c,v 1.38 2015/08/02 18:11:57 dholland Exp $ */ /*- * Copyright (c) 1993, 1994 @@ -39,14 +39,14 @@ __COPYRIGHT("@(#) Copyright (c) 1993, 19 #if 0 static char sccsid[] = "@(#)mount_lfs.c 8.4 (Berkeley) 4/26/95"; #else -__RCSID("$NetBSD: mount_lfs.c,v 1.37 2013/10/19 23:14:27 christos Exp $"); +__RCSID("$NetBSD: mount_lfs.c,v 1.38 2015/08/02 18:11:57 dholland Exp $"); #endif #endif /* not lint */ #include #include -#include +#include #include #include @@ -94,7 +94,7 @@ main(int argc, char **argv) void mount_lfs_parseargs(int argc, char *argv[], - struct ufs_args *args, int *mntflags, + struct ulfs_args *args, int *mntflags, char *canon_dev, char *canon_dir) { int ch; @@ -149,7 +149,7 @@ mount_lfs_parseargs(int argc, char *argv int mount_lfs(int argc, char *argv[]) { - struct ufs_args args; + struct ulfs_args args; int mntflags; int mntsize, oldflags, i; char fs_name[MAXPATHLEN], canon_dev[MAXPATHLEN]; Index: src/sbin/mount_lfs/mount_lfs.h diff -u src/sbin/mount_lfs/mount_lfs.h:1.2 src/sbin/mount_lfs/mount_lfs.h:1.3 --- src/sbin/mount_lfs/mount_lfs.h:1.2 Thu Aug 6 00:58:32 2009 +++ src/sbin/mount_lfs/mount_lfs.h Sun Aug 2 18:11:57 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: mount_lfs.h,v 1.2 2009/08/06 00:58:32 pooka Exp $ */ +/* $NetBSD: mount_lfs.h,v 1.3 2015/08/02 18:11:57 dholland Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation. All Rights Reserved. @@ -28,10 +28,10 @@ #ifndef _SBIN_MOUNT_LFS_MOUNT_LFS_H_ #define _SBIN_MOUNT_LFS_MOUNT_LFS_H_ -#include +#include int mount_lfs(int, char **); -void mount_lfs_parseargs(int, char **, struct ufs_args *, int *, +void mount_lfs_parseargs(int, char **, struct ulfs_args *, int *, char *, char *); int lfs_cleaner_main(int, char **); Index: src/usr.sbin/puffs/rump_lfs/rump_lfs.c diff -u src/usr.sbin/puffs/rump_lfs/rump_lfs.c:1.17 src/usr.sbin/puffs/rump_lfs/rump_lfs.c:1.18 --- src/usr.sbin/puffs/rump_lfs/rump_lfs.c:1.17 Thu Jan 10 08:35:26 2013 +++ src/usr.sbin/puffs/rump_lfs/rump_lfs.c Sun Aug 2 18:11:57 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rump_lfs.c,v 1.17 2013/01/10 08:35:26 riastradh Exp $ */ +/* $NetBSD: rump_lfs.c,v 1.18 2015/08/02 18:11:57 dholland Exp $ */ /* * Copyright (c) 2008 Antti Kantee. All Rights Reserved. @@ -60,7 +60,7 @@ cleaner(void *arg) int main(int argc, char *argv[]) { - struct ufs_args args; + struct ulfs_args args; char canon_dev[UKFS_DEVICE_MAXPATHLEN], canon_dir[MAXPATHLEN]; char rawdev[MAXPATHLEN]; struct p2k_mount *p2m;
CVS commit: src/sbin/resize_lfs
Module Name:src Committed By: dholland Date: Sun Aug 2 18:12:18 UTC 2015 Modified Files: src/sbin/resize_lfs: resize_lfs.c Log Message: Don't include ufs headers. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sbin/resize_lfs/resize_lfs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/resize_lfs/resize_lfs.c diff -u src/sbin/resize_lfs/resize_lfs.c:1.12 src/sbin/resize_lfs/resize_lfs.c:1.13 --- src/sbin/resize_lfs/resize_lfs.c:1.12 Tue Jul 28 05:09:34 2015 +++ src/sbin/resize_lfs/resize_lfs.c Sun Aug 2 18:12:18 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: resize_lfs.c,v 1.12 2015/07/28 05:09:34 dholland Exp $ */ +/* $NetBSD: resize_lfs.c,v 1.13 2015/08/02 18:12:18 dholland Exp $ */ /*- * Copyright (c) 2005 The NetBSD Foundation, Inc. * All rights reserved. @@ -38,7 +38,6 @@ #include #include -#include #include #include
CVS commit: src/sbin/newfs_lfs
Module Name:src Committed By: dholland Date: Sun Aug 2 18:11:36 UTC 2015 Modified Files: src/sbin/newfs_lfs: make_lfs.c Log Message: Typo in comment. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sbin/newfs_lfs/make_lfs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/newfs_lfs/make_lfs.c diff -u src/sbin/newfs_lfs/make_lfs.c:1.37 src/sbin/newfs_lfs/make_lfs.c:1.38 --- src/sbin/newfs_lfs/make_lfs.c:1.37 Sun Aug 2 18:11:12 2015 +++ src/sbin/newfs_lfs/make_lfs.c Sun Aug 2 18:11:36 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: make_lfs.c,v 1.37 2015/08/02 18:11:12 dholland Exp $ */ +/* $NetBSD: make_lfs.c,v 1.38 2015/08/02 18:11:36 dholland Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -62,7 +62,7 @@ #if 0 static char sccsid[] = "@(#)lfs.c 8.5 (Berkeley) 5/24/95"; #else -__RCSID("$NetBSD: make_lfs.c,v 1.37 2015/08/02 18:11:12 dholland Exp $"); +__RCSID("$NetBSD: make_lfs.c,v 1.38 2015/08/02 18:11:36 dholland Exp $"); #endif #endif /* not lint */ @@ -274,7 +274,7 @@ make_dinode(ino_t ino, struct ulfs1_dino /* * Construct a set of directory entries in "bufp". We assume that all the - * entries in protodir fir in the first DIRBLKSIZ. + * entries in protodir fit in the first DIRBLKSIZ. */ static void make_dir(void *bufp, struct lfs_direct *protodir, int entries)
CVS commit: src/sys/ufs/lfs
Module Name:src Committed By: dholland Date: Sun Aug 2 18:10:55 UTC 2015 Modified Files: src/sys/ufs/lfs: lfs_segment.c Log Message: Fix catastrophic bug in lfs_rewind() that changed segment numbers (lfs_curseg/lfs_nextseg in the superblock) using the wrong units. These fields are for whatever reason the start addresses of segments (measured in frags) rather than the segment numbers 0..n. This only apparently affects dumping from a mounted fs; however, it trashes the fs. I would really, really like to have a static analysis tool that can keep track of the units things are measured in, since fs code is full of conversion macros and the macros are named inscrutable things like "sntod" whose letters don't necessarily even correspond to the units they convert. It is surprising that more of these are not wrong. To generate a diff of this commit: cvs rdiff -u -r1.246 -r1.247 src/sys/ufs/lfs/lfs_segment.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/lfs/lfs_segment.c diff -u src/sys/ufs/lfs/lfs_segment.c:1.246 src/sys/ufs/lfs/lfs_segment.c:1.247 --- src/sys/ufs/lfs/lfs_segment.c:1.246 Sun Aug 2 18:10:08 2015 +++ src/sys/ufs/lfs/lfs_segment.c Sun Aug 2 18:10:55 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_segment.c,v 1.246 2015/08/02 18:10:08 dholland Exp $ */ +/* $NetBSD: lfs_segment.c,v 1.247 2015/08/02 18:10:55 dholland Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc. @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.246 2015/08/02 18:10:08 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.247 2015/08/02 18:10:55 dholland Exp $"); #define _VFS_VNODE_PRIVATE /* XXX: check for VI_MARKER, this has to go */ @@ -1699,7 +1699,7 @@ lfs_updatemeta(struct segment *sp) } /* - * Move lfs_offset to a segment earlier than sn. + * Move lfs_offset to a segment earlier than newsn. */ int lfs_rewind(struct lfs *fs, int newsn) @@ -1730,7 +1730,7 @@ lfs_rewind(struct lfs *fs, int newsn) panic("lfs_rewind: no clean segments"); if (newsn >= 0 && sn >= newsn) return ENOENT; - lfs_sb_setnextseg(fs, sn); + lfs_sb_setnextseg(fs, lfs_sntod(fs, sn)); lfs_newseg(fs); lfs_sb_setoffset(fs, lfs_sb_getcurseg(fs));
CVS commit: src/sbin/newfs_lfs
Module Name:src Committed By: dholland Date: Sun Aug 2 18:11:12 UTC 2015 Modified Files: src/sbin/newfs_lfs: make_lfs.c Log Message: Use c99 initializers. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/sbin/newfs_lfs/make_lfs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/newfs_lfs/make_lfs.c diff -u src/sbin/newfs_lfs/make_lfs.c:1.36 src/sbin/newfs_lfs/make_lfs.c:1.37 --- src/sbin/newfs_lfs/make_lfs.c:1.36 Sun Aug 2 18:10:08 2015 +++ src/sbin/newfs_lfs/make_lfs.c Sun Aug 2 18:11:12 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: make_lfs.c,v 1.36 2015/08/02 18:10:08 dholland Exp $ */ +/* $NetBSD: make_lfs.c,v 1.37 2015/08/02 18:11:12 dholland Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -62,7 +62,7 @@ #if 0 static char sccsid[] = "@(#)lfs.c 8.5 (Berkeley) 5/24/95"; #else -__RCSID("$NetBSD: make_lfs.c,v 1.36 2015/08/02 18:10:08 dholland Exp $"); +__RCSID("$NetBSD: make_lfs.c,v 1.37 2015/08/02 18:11:12 dholland Exp $"); #endif #endif /* not lint */ @@ -110,70 +110,70 @@ ulfs_daddr_t ifibc; /* How many indirect #endif static struct lfs lfs_default = { - .lfs_dlfs = { /* lfs_dlfs */ - /* dlfs_magic */ LFS_MAGIC, - /* dlfs_version */ LFS_VERSION, - /* dlfs_size */ 0, - /* dlfs_ssize */ DFL_LFSSEG, - /* dlfs_dsize */ 0, - /* dlfs_bsize */ DFL_LFSBLOCK, - /* dlfs_fsize */ DFL_LFSFRAG, - /* dlfs_frag */ DFL_LFSBLOCK/DFL_LFSFRAG, - /* dlfs_freehd */ HIGHEST_USED_INO + 1, - /* dlfs_bfree */ 0, - /* dlfs_nfiles */ 0, - /* dlfs_avail */ 0, - /* dlfs_uinodes */ 0, - /* dlfs_idaddr */ 0, - /* dlfs_ifile */ LFS_IFILE_INUM, - /* dlfs_lastseg */ 0, - /* dlfs_nextseg */ 0, - /* dlfs_curseg */ 0, - /* dlfs_offset */ 0, - /* dlfs_lastpseg */ 0, - /* dlfs_inopf */ 0, - /* dlfs_minfree */ MINFREE, - /* dlfs_maxfilesize */ 0, - /* dlfs_fsbpseg */ 0, - /* dlfs_inopb */ DFL_LFSBLOCK/sizeof(struct ulfs1_dinode), - /* dlfs_ifpb */ DFL_LFSBLOCK/sizeof(IFILE), - /* dlfs_sepb */ DFL_LFSBLOCK/sizeof(SEGUSE), + .lfs_dlfs = { + .dlfs_magic = LFS_MAGIC, + .dlfs_version = LFS_VERSION, + .dlfs_size = 0, + .dlfs_ssize = DFL_LFSSEG, + .dlfs_dsize = 0, + .dlfs_bsize = DFL_LFSBLOCK, + .dlfs_fsize = DFL_LFSFRAG, + .dlfs_frag = DFL_LFSBLOCK/DFL_LFSFRAG, + .dlfs_freehd = HIGHEST_USED_INO + 1, + .dlfs_bfree = 0, + .dlfs_nfiles = 0, + .dlfs_avail = 0, + .dlfs_uinodes = 0, + .dlfs_idaddr = 0, + .dlfs_ifile = LFS_IFILE_INUM, + .dlfs_lastseg = 0, + .dlfs_nextseg = 0, + .dlfs_curseg = 0, + .dlfs_offset = 0, + .dlfs_lastpseg = 0, + .dlfs_inopf = 0, + .dlfs_minfree = MINFREE, + .dlfs_maxfilesize = 0, + .dlfs_fsbpseg = 0, + .dlfs_inopb = DFL_LFSBLOCK/sizeof(struct ulfs1_dinode), + .dlfs_ifpb = DFL_LFSBLOCK/sizeof(IFILE), + .dlfs_sepb = DFL_LFSBLOCK/sizeof(SEGUSE), /* XXX ondisk32 */ - /* dlfs_nindir */ DFL_LFSBLOCK/sizeof(int32_t), - /* dlfs_nseg */ 0, - /* dlfs_nspf */ 0, - /* dlfs_cleansz */ 0, - /* dlfs_segtabsz */ 0, - /* dlfs_segmask */ DFL_LFSSEG_MASK, - /* dlfs_segshift */ DFL_LFSSEG_SHIFT, - /* dlfs_bshift */ DFL_LFSBLOCK_SHIFT, - /* dlfs_ffshift */ DFL_LFS_FFSHIFT, - /* dlfs_fbshift */ DFL_LFS_FBSHIFT, - /* dlfs_bmask */ DFL_LFSBLOCK_MASK, - /* dlfs_ffmask */ DFL_LFS_FFMASK, - /* dlfs_fbmask */ DFL_LFS_FBMASK, - /* dlfs_blktodb */ 0, - /* dlfs_sushift */ 0, - /* dlfs_maxsymlinklen */ ULFS1_MAXSYMLINKLEN, - /* dlfs_sboffs */ { 0 }, - /* dlfs_nclean */ 0, - /* dlfs_fsmnt */{ 0 }, - /* dlfs_pflags */ LFS_PF_CLEAN, - /* dlfs_dmeta */ 0, - /* dlfs_minfreeseg */ 0, - /* dlfs_sumsize */ 0, - /* dlfs_serial */ 0, - /* dlfs_ibsize */ DFL_LFSFRAG, - /* dlfs_start */ 0, - /* dlfs_tstamp */ 0, - /* dlfs_inodefmt */ LFS_44INODEFMT, - /* dlfs_interleave */ 0, - /* dlfs_ident */0, - /* dlfs_fsbtodb */ 0, - /* dlfs_resvseg */ 0, + .dlfs_nindir = DFL_LFSBLOCK/sizeof(int32_t), + .dlfs_nseg = 0, + .dlfs_nspf = 0, + .dlfs_cleansz = 0, + .dlfs_segtabsz = 0, + .dlfs_segmask = DFL_LFSSEG_MASK, + .dlfs_segshift = DFL_LFSSEG_SHIFT, + .dlfs_bshift = DFL_LFSBLOCK_SHIFT, + .dlfs_ffshift = DFL_LFS_FFSHIFT, + .dlfs_fbshift = DFL_LFS_FBSHIFT, + .dlfs_bmask = DFL_LFSBLOCK_MASK, + .dlfs_ffmask = DFL_LFS_FFMASK, + .dlfs_fbmask = DFL_LFS_FBMASK, + .dlfs_blktodb = 0, + .dlfs_sushift = 0, + .dlfs_maxsymlinklen = ULFS1_MAXSYMLINKLEN, + .dlfs_sboffs = { 0 }, + .dlfs_nclean = 0, + .dlfs_fsmnt = { 0 }, + .dlfs_pflags = LFS_PF_CLEAN, + .dlfs_dmeta = 0, + .dlfs_minfreeseg = 0, + .dlfs_sumsize = 0, + .dlfs_serial = 0, + .dlfs_ibsize = DFL_LFSFRAG, + .dlfs_s0addr = 0, + .dlfs_tstamp = 0, + .dlfs_inodefmt = LFS_44INODEFMT, + .dlfs_interleave = 0, + .dlfs_ident = 0, + .dlfs_fsbtodb = 0, + .dlfs_resvseg = 0, - /* dlfs_pad */ { 0 }, - /* dlfs_cksum */ 0 + .dlfs_pad = { 0 }, + .dlfs_ck
CVS commit: src
Module Name:src Committed By: dholland Date: Sun Aug 2 18:10:08 UTC 2015 Modified Files: src/libexec/lfs_cleanerd: cleaner.h lfs_cleanerd.c src/sbin/fsck_lfs: lfs.c setup.c src/sbin/newfs_lfs: make_lfs.c src/sys/ufs/lfs: lfs.h lfs_accessors.h lfs_debug.c lfs_extern.h lfs_pages.c lfs_segment.c lfs_vfsops.c src/usr.sbin/dumplfs: dumplfs.c Log Message: Second batch of 64 -> 32 truncations in lfs, along with more minor tidyups and corrections in passing. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/libexec/lfs_cleanerd/cleaner.h cvs rdiff -u -r1.41 -r1.42 src/libexec/lfs_cleanerd/lfs_cleanerd.c cvs rdiff -u -r1.49 -r1.50 src/sbin/fsck_lfs/lfs.c cvs rdiff -u -r1.50 -r1.51 src/sbin/fsck_lfs/setup.c cvs rdiff -u -r1.35 -r1.36 src/sbin/newfs_lfs/make_lfs.c cvs rdiff -u -r1.168 -r1.169 src/sys/ufs/lfs/lfs.h cvs rdiff -u -r1.4 -r1.5 src/sys/ufs/lfs/lfs_accessors.h cvs rdiff -u -r1.47 -r1.48 src/sys/ufs/lfs/lfs_debug.c cvs rdiff -u -r1.105 -r1.106 src/sys/ufs/lfs/lfs_extern.h cvs rdiff -u -r1.5 -r1.6 src/sys/ufs/lfs/lfs_pages.c cvs rdiff -u -r1.245 -r1.246 src/sys/ufs/lfs/lfs_segment.c cvs rdiff -u -r1.330 -r1.331 src/sys/ufs/lfs/lfs_vfsops.c cvs rdiff -u -r1.46 -r1.47 src/usr.sbin/dumplfs/dumplfs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/libexec/lfs_cleanerd/cleaner.h diff -u src/libexec/lfs_cleanerd/cleaner.h:1.9 src/libexec/lfs_cleanerd/cleaner.h:1.10 --- src/libexec/lfs_cleanerd/cleaner.h:1.9 Tue Jul 28 05:14:23 2015 +++ src/libexec/lfs_cleanerd/cleaner.h Sun Aug 2 18:10:07 2015 @@ -63,7 +63,6 @@ int invalidate_segment(struct clfs *, in void lfs_ientry(IFILE **, struct clfs *, ino_t, struct ubuf **); int load_segment(struct clfs *, int, BLOCK_INFO **, int *); int needs_cleaning(struct clfs *, CLEANERINFO *); -int32_t parse_pseg(struct clfs *, daddr_t, BLOCK_INFO **, int *); int reinit_fs(struct clfs *); void reload_ifile(struct clfs *); void toss_old_blocks(struct clfs *, BLOCK_INFO **, int *, int *); Index: src/libexec/lfs_cleanerd/lfs_cleanerd.c diff -u src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.41 src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.42 --- src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.41 Tue Jul 28 05:14:23 2015 +++ src/libexec/lfs_cleanerd/lfs_cleanerd.c Sun Aug 2 18:10:07 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_cleanerd.c,v 1.41 2015/07/28 05:14:23 dholland Exp $ */ +/* $NetBSD: lfs_cleanerd.c,v 1.42 2015/08/02 18:10:07 dholland Exp $ */ /*- * Copyright (c) 2005 The NetBSD Foundation, Inc. @@ -380,13 +380,14 @@ check_test_pattern(BLOCK_INFO *bip) * Parse the partial segment at daddr, adding its information to * bip. Return the address of the next partial segment to read. */ -int32_t +static daddr_t parse_pseg(struct clfs *fs, daddr_t daddr, BLOCK_INFO **bipp, int *bic) { SEGSUM *ssp; IFILE *ifp; BLOCK_INFO *bip, *nbip; - int32_t *iaddrp, idaddr, odaddr; + int32_t *iaddrp; + daddr_t idaddr, odaddr; FINFO *fip; struct ubuf *ifbp; struct ulfs1_dinode *dip; @@ -405,6 +406,7 @@ parse_pseg(struct clfs *fs, daddr_t dadd */ cp = fd_ptrget(fs->clfs_devvp, daddr); ssp = (SEGSUM *)cp; + /* XXX ondisk32 */ iaddrp = ((int32_t *)(cp + lfs_sb_getibsize(fs))) - 1; fip = (FINFO *)(cp + sizeof(SEGSUM)); @@ -412,16 +414,16 @@ parse_pseg(struct clfs *fs, daddr_t dadd * Check segment header magic and checksum */ if (ssp->ss_magic != SS_MAGIC) { - syslog(LOG_WARNING, "%s: sumsum magic number bad at 0x%x:" + syslog(LOG_WARNING, "%s: sumsum magic number bad at 0x%jx:" " read 0x%x, expected 0x%x", lfs_sb_getfsmnt(fs), - (int32_t)daddr, ssp->ss_magic, SS_MAGIC); + (intmax_t)daddr, ssp->ss_magic, SS_MAGIC); return 0x0; } ck = cksum(&ssp->ss_datasum, lfs_sb_getsumsize(fs) - sizeof(ssp->ss_sumsum)); if (ck != ssp->ss_sumsum) { - syslog(LOG_WARNING, "%s: sumsum checksum mismatch at 0x%x:" + syslog(LOG_WARNING, "%s: sumsum checksum mismatch at 0x%jx:" " read 0x%x, computed 0x%x", lfs_sb_getfsmnt(fs), - (int32_t)daddr, ssp->ss_sumsum, ck); + (intmax_t)daddr, ssp->ss_sumsum, ck); return 0x0; } @@ -443,8 +445,8 @@ parse_pseg(struct clfs *fs, daddr_t dadd * If we don't have either one, it's an error. */ if (fic >= ssp->ss_nfinfo && *iaddrp != daddr) { - syslog(LOG_WARNING, "%s: bad pseg at %x (seg %d)", - lfs_sb_getfsmnt(fs), odaddr, lfs_dtosn(fs, odaddr)); + syslog(LOG_WARNING, "%s: bad pseg at %jx (seg %d)", + lfs_sb_getfsmnt(fs), (intmax_t)odaddr, lfs_dtosn(fs, odaddr)); *bipp = bip; return 0x0; } @@ -517,8 +519,8 @@ parse_pseg(struct clfs *fs, daddr_t dadd struct ubuf *nbp; SEGSUM *nssp; - syslog(LOG_WARNING, "fixing short FINFO at %x (seg %d)", - odaddr, lfs_dtosn(fs, odaddr)); + syslog(LOG_WARNING, "fixing short FINFO at %jx (seg %d)", + (intmax
CVS commit: src
Module Name:src Committed By: dholland Date: Sun Aug 2 18:08:13 UTC 2015 Modified Files: src/sbin/fsck_lfs: lfs.c pass5.c pass6.c src/sbin/newfs_lfs: make_lfs.c src/sbin/scan_ffs: scan_ffs.c src/sys/ufs/lfs: lfs.h lfs_accessors.h lfs_balloc.c lfs_bio.c lfs_debug.c lfs_inode.c lfs_vfsops.c src/usr.sbin/dumplfs: dumplfs.c Log Message: Fix assorted 64 -> 32 truncations in lfs. Also, some minor tidyups and corrections in passing. To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/sbin/fsck_lfs/lfs.c cvs rdiff -u -r1.32 -r1.33 src/sbin/fsck_lfs/pass5.c cvs rdiff -u -r1.37 -r1.38 src/sbin/fsck_lfs/pass6.c cvs rdiff -u -r1.34 -r1.35 src/sbin/newfs_lfs/make_lfs.c cvs rdiff -u -r1.28 -r1.29 src/sbin/scan_ffs/scan_ffs.c cvs rdiff -u -r1.167 -r1.168 src/sys/ufs/lfs/lfs.h cvs rdiff -u -r1.3 -r1.4 src/sys/ufs/lfs/lfs_accessors.h cvs rdiff -u -r1.84 -r1.85 src/sys/ufs/lfs/lfs_balloc.c cvs rdiff -u -r1.132 -r1.133 src/sys/ufs/lfs/lfs_bio.c cvs rdiff -u -r1.46 -r1.47 src/sys/ufs/lfs/lfs_debug.c cvs rdiff -u -r1.140 -r1.141 src/sys/ufs/lfs/lfs_inode.c cvs rdiff -u -r1.329 -r1.330 src/sys/ufs/lfs/lfs_vfsops.c cvs rdiff -u -r1.45 -r1.46 src/usr.sbin/dumplfs/dumplfs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_lfs/lfs.c diff -u src/sbin/fsck_lfs/lfs.c:1.48 src/sbin/fsck_lfs/lfs.c:1.49 --- src/sbin/fsck_lfs/lfs.c:1.48 Tue Jul 28 05:09:34 2015 +++ src/sbin/fsck_lfs/lfs.c Sun Aug 2 18:08:12 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: lfs.c,v 1.48 2015/07/28 05:09:34 dholland Exp $ */ +/* $NetBSD: lfs.c,v 1.49 2015/08/02 18:08:12 dholland Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. * All rights reserved. @@ -72,8 +72,8 @@ #define vnode uvnode #include -#include #include +#include #undef vnode #include Index: src/sbin/fsck_lfs/pass5.c diff -u src/sbin/fsck_lfs/pass5.c:1.32 src/sbin/fsck_lfs/pass5.c:1.33 --- src/sbin/fsck_lfs/pass5.c:1.32 Tue Jul 28 05:09:34 2015 +++ src/sbin/fsck_lfs/pass5.c Sun Aug 2 18:08:12 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: pass5.c,v 1.32 2015/07/28 05:09:34 dholland Exp $ */ +/* $NetBSD: pass5.c,v 1.33 2015/08/02 18:08:12 dholland Exp $ */ /*- * Copyright (c) 2000, 2003 The NetBSD Foundation, Inc. @@ -60,9 +60,9 @@ pass5(void) SEGUSE *su; struct ubuf *bp; int i; - unsigned long bb; /* total number of used blocks (lower bound) */ - unsigned long ubb; /* upper bound number of used blocks */ - unsigned long avail; /* blocks available for writing */ + daddr_t bb; /* total number of used blocks (lower bound) */ + daddr_t ubb; /* upper bound number of used blocks */ + daddr_t avail; /* blocks available for writing */ unsigned long dmeta; /* blocks in segsums and inodes */ int nclean; /* clean segments */ size_t labelskew; @@ -152,8 +152,8 @@ pass5(void) } } if (avail != lfs_sb_getavail(fs)) { - pwarn("AVAIL GIVEN AS %d, SHOULD BE %ld\n", - lfs_sb_getavail(fs), avail); + pwarn("AVAIL GIVEN AS %jd, SHOULD BE %ld\n", + (intmax_t)lfs_sb_getavail(fs), avail); if (preen || reply("FIX")) { lfs_sb_setavail(fs, avail); sbdirty(); @@ -174,10 +174,10 @@ pass5(void) labelskew = lfs_btofsb(fs, LFS_LABELPAD); if (lfs_sb_getbfree(fs) > lfs_sb_getdsize(fs) - bb - labelskew || lfs_sb_getbfree(fs) < lfs_sb_getdsize(fs) - ubb - labelskew) { - pwarn("BFREE GIVEN AS %jd, SHOULD BE BETWEEN %ld AND %ld\n", + pwarn("BFREE GIVEN AS %jd, SHOULD BE BETWEEN %jd AND %jd\n", (intmax_t)lfs_sb_getbfree(fs), - lfs_sb_getdsize(fs) - ubb - labelskew, - lfs_sb_getdsize(fs) - bb - labelskew); + (intmax_t)(lfs_sb_getdsize(fs) - ubb - labelskew), + (intmax_t)(lfs_sb_getdsize(fs) - bb - labelskew)); if (preen || reply("FIX")) { lfs_sb_setbfree(fs, ((lfs_sb_getdsize(fs) - labelskew - ubb) + Index: src/sbin/fsck_lfs/pass6.c diff -u src/sbin/fsck_lfs/pass6.c:1.37 src/sbin/fsck_lfs/pass6.c:1.38 --- src/sbin/fsck_lfs/pass6.c:1.37 Tue Jul 28 05:09:34 2015 +++ src/sbin/fsck_lfs/pass6.c Sun Aug 2 18:08:12 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: pass6.c,v 1.37 2015/07/28 05:09:34 dholland Exp $ */ +/* $NetBSD: pass6.c,v 1.38 2015/08/02 18:08:12 dholland Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -78,7 +78,7 @@ static int nnewblocks; * Account for this change in the segment table. */ static void -rfw_update_single(struct uvnode *vp, daddr_t lbn, ulfs_daddr_t ndaddr, int size) +rfw_update_single(struct uvnode *vp, daddr_t lbn, ulfs_daddr_t ndaddr, size_t size) { SEGUSE *sup; struct ubuf *bp; Index: src/sbin/newfs_lfs/make_lfs.c diff -u src/sbin/newfs_lfs/make_lfs.c:1.34 src/sbin/newfs_lfs/make_lfs.c:1.35 --- src/sbin/newfs_lfs/make_lfs.c:1.34 Tue Jul 28 05:09:34 2015 +++ src/sbin/newfs_lfs/make_lfs.c Sun Aug 2 18:08:12 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: make_lfs.c,v 1.34 2015/07/28 05:09:34 dholland Ex
CVS commit: src/sys/ufs/lfs
Module Name:src Committed By: dholland Date: Sun Aug 2 17:57:27 UTC 2015 Modified Files: src/sys/ufs/lfs: lfs_accessors.h Log Message: Allow superblock accessors that widen 32-bit disk fields to 64-bit memory values. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/ufs/lfs/lfs_accessors.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/lfs/lfs_accessors.h diff -u src/sys/ufs/lfs/lfs_accessors.h:1.2 src/sys/ufs/lfs/lfs_accessors.h:1.3 --- src/sys/ufs/lfs/lfs_accessors.h:1.2 Tue Jul 28 05:14:23 2015 +++ src/sys/ufs/lfs/lfs_accessors.h Sun Aug 2 17:57:27 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_accessors.h,v 1.2 2015/07/28 05:14:23 dholland Exp $ */ +/* $NetBSD: lfs_accessors.h,v 1.3 2015/08/02 17:57:27 dholland Exp $ */ /* from NetBSD: lfs.h,v 1.165 2015/07/24 06:59:32 dholland Exp */ /* from NetBSD: dinode.h,v 1.22 2013/01/22 09:39:18 dholland Exp */ @@ -388,7 +388,7 @@ #define STRUCT_LFS struct lfs #endif -#define LFS_DEF_SB_ACCESSOR(type, field) \ +#define LFS_DEF_SB_ACCESSOR_FULL(type, type32, field) \ static __unused inline type\ lfs_sb_get##field(STRUCT_LFS *fs) \ { \ @@ -402,19 +402,21 @@ static __unused inline void\ lfs_sb_add##field(STRUCT_LFS *fs, type val) \ { \ - type *p = &fs->lfs_dlfs.dlfs_##field; \ + type32 *p = &fs->lfs_dlfs.dlfs_##field; \ *p += val; \ } \ static __unused inline void\ lfs_sb_sub##field(STRUCT_LFS *fs, type val) \ { \ - type *p = &fs->lfs_dlfs.dlfs_##field; \ + type32 *p = &fs->lfs_dlfs.dlfs_##field; \ *p -= val; \ } +#define LFS_DEF_SB_ACCESSOR(t, f) LFS_DEF_SB_ACCESSOR_FULL(t, t, f) + #define lfs_magic lfs_dlfs.dlfs_magic #define lfs_version lfs_dlfs.dlfs_version -LFS_DEF_SB_ACCESSOR(u_int32_t, size); +LFS_DEF_SB_ACCESSOR_FULL(u_int64_t, u_int32_t, size); LFS_DEF_SB_ACCESSOR(u_int32_t, ssize); LFS_DEF_SB_ACCESSOR(u_int32_t, dsize); LFS_DEF_SB_ACCESSOR(u_int32_t, bsize);
CVS commit: src/sbin/fsck_lfs
Module Name:src Committed By: dholland Date: Sun Aug 2 17:56:24 UTC 2015 Modified Files: src/sbin/fsck_lfs: setup.c Log Message: Fix bug: for format version 1, the superblock "size" field is measured in blocks instead of frags, so use lfs_blkstofrags to correct it. This code was instead multiplying by the block size divided by DEV_BSIZE to get the number of disk blocks rather than the number of frags. (I gather that originally these were the same, but they're not necessarily any more.) To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/sbin/fsck_lfs/setup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_lfs/setup.c diff -u src/sbin/fsck_lfs/setup.c:1.49 src/sbin/fsck_lfs/setup.c:1.50 --- src/sbin/fsck_lfs/setup.c:1.49 Tue Jul 28 05:09:34 2015 +++ src/sbin/fsck_lfs/setup.c Sun Aug 2 17:56:24 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: setup.c,v 1.49 2015/07/28 05:09:34 dholland Exp $ */ +/* $NetBSD: setup.c,v 1.50 2015/08/02 17:56:24 dholland Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -334,7 +334,7 @@ setup(const char *dev) pwarn("lfs_inopb = %lu\n", (unsigned long) lfs_sb_getinopb(fs)); } if (fs->lfs_version == 1) - maxfsblock = lfs_sb_getsize(fs) * (lfs_sb_getbsize(fs) / dev_bsize); + maxfsblock = lfs_blkstofrags(fs, lfs_sb_getsize(fs)); else maxfsblock = lfs_sb_getsize(fs); maxfilesize = calcmaxfilesize(lfs_sb_getbshift(fs));
CVS commit: src/sys/arch/arm/broadcom
Module Name:src Committed By: jmcneill Date: Sun Aug 2 16:46:12 UTC 2015 Modified Files: src/sys/arch/arm/broadcom: bcm2835_dmac.c Log Message: When halting a channel, abort the current DMA CB and reset the channel before stopping DMA. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/broadcom/bcm2835_dmac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/broadcom/bcm2835_dmac.c diff -u src/sys/arch/arm/broadcom/bcm2835_dmac.c:1.11 src/sys/arch/arm/broadcom/bcm2835_dmac.c:1.12 --- src/sys/arch/arm/broadcom/bcm2835_dmac.c:1.11 Wed Jul 29 14:22:49 2015 +++ src/sys/arch/arm/broadcom/bcm2835_dmac.c Sun Aug 2 16:46:12 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: bcm2835_dmac.c,v 1.11 2015/07/29 14:22:49 skrll Exp $ */ +/* $NetBSD: bcm2835_dmac.c,v 1.12 2015/08/02 16:46:12 jmcneill Exp $ */ /*- * Copyright (c) 2014 Jared D. McNeill @@ -29,7 +29,7 @@ #include "opt_ddb.h" #include -__KERNEL_RCSID(0, "$NetBSD: bcm2835_dmac.c,v 1.11 2015/07/29 14:22:49 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bcm2835_dmac.c,v 1.12 2015/08/02 16:46:12 jmcneill Exp $"); #include #include @@ -275,6 +275,9 @@ bcm_dmac_transfer(struct bcm_dmac_channe void bcm_dmac_halt(struct bcm_dmac_channel *ch) { + struct bcm_dmac_softc *sc = ch->ch_sc; + + DMAC_WRITE(sc, DMAC_CS(ch->ch_index), DMAC_CS_RESET|DMAC_CS_ABORT); bcm_dmac_set_conblk_addr(ch, 0); }
CVS commit: [netbsd-6-0] src/doc
Module Name:src Committed By: martin Date: Sun Aug 2 12:55:46 UTC 2015 Modified Files: src/doc [netbsd-6-0]: CHANGES-6.0.7 Log Message: Ticket #1318 To generate a diff of this commit: cvs rdiff -u -r1.1.2.46 -r1.1.2.47 src/doc/CHANGES-6.0.7 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-6.0.7 diff -u src/doc/CHANGES-6.0.7:1.1.2.46 src/doc/CHANGES-6.0.7:1.1.2.47 --- src/doc/CHANGES-6.0.7:1.1.2.46 Fri Jul 24 07:38:24 2015 +++ src/doc/CHANGES-6.0.7 Sun Aug 2 12:55:46 2015 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-6.0.7,v 1.1.2.46 2015/07/24 07:38:24 martin Exp $ +# $NetBSD: CHANGES-6.0.7,v 1.1.2.47 2015/08/02 12:55:46 martin Exp $ A complete list of changes from the NetBSD 6.0.6 release to the NetBSD 6.0.7 release: @@ -6264,3 +6264,8 @@ sys/netinet/tcp_output.c 1.184 Make sure that snd_win doesn't go negative. [matt, ticket #1315] +sys/compat/netbsd32/netbsd32_ioctl.c 1.82 + + Fix inverted logic when checking the size of data to copyin(). + [maxv, ticket #1318] +
CVS commit: [netbsd-6-0] src/sys/compat/netbsd32
Module Name:src Committed By: martin Date: Sun Aug 2 12:54:34 UTC 2015 Modified Files: src/sys/compat/netbsd32 [netbsd-6-0]: netbsd32_ioctl.c Log Message: Pull up following revision(s) (requested by maxv in ticket #1318): sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.82 Wrong logic. Here, userland can control the size and the data copied, which basically means it can overflow kernel memory. ok martin@ christos@ To generate a diff of this commit: cvs rdiff -u -r1.64 -r1.64.12.1 src/sys/compat/netbsd32/netbsd32_ioctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/netbsd32/netbsd32_ioctl.c diff -u src/sys/compat/netbsd32/netbsd32_ioctl.c:1.64 src/sys/compat/netbsd32/netbsd32_ioctl.c:1.64.12.1 --- src/sys/compat/netbsd32/netbsd32_ioctl.c:1.64 Thu Oct 6 03:19:32 2011 +++ src/sys/compat/netbsd32/netbsd32_ioctl.c Sun Aug 2 12:54:34 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_ioctl.c,v 1.64 2011/10/06 03:19:32 macallan Exp $ */ +/* $NetBSD: netbsd32_ioctl.c,v 1.64.12.1 2015/08/02 12:54:34 martin Exp $ */ /* * Copyright (c) 1998, 2001 Matthew R. Green @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.64 2011/10/06 03:19:32 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.64.12.1 2015/08/02 12:54:34 martin Exp $"); #include #include @@ -192,7 +192,7 @@ netbsd32_to_if_addrprefreq(const struct strlcpy(ifap->ifap_name, ifap32->ifap_name, sizeof(ifap->ifap_name)); ifap->ifap_preference = ifap32->ifap_preference; memcpy(&ifap->ifap_addr, &ifap32->ifap_addr, - max(ifap32->ifap_addr.ss_len, _SS_MAXSIZE)); + min(ifap32->ifap_addr.ss_len, _SS_MAXSIZE)); } static inline void @@ -425,7 +425,7 @@ netbsd32_from_if_addrprefreq(const struc strlcpy(ifap32->ifap_name, ifap->ifap_name, sizeof(ifap32->ifap_name)); ifap32->ifap_preference = ifap->ifap_preference; memcpy(&ifap32->ifap_addr, &ifap->ifap_addr, - max(ifap->ifap_addr.ss_len, _SS_MAXSIZE)); + min(ifap->ifap_addr.ss_len, _SS_MAXSIZE)); } static inline void
CVS commit: [netbsd-6-1] src/sys/compat/netbsd32
Module Name:src Committed By: martin Date: Sun Aug 2 12:53:00 UTC 2015 Modified Files: src/sys/compat/netbsd32 [netbsd-6-1]: netbsd32_ioctl.c Log Message: Pull up following revision(s) (requested by maxv in ticket #1318): sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.82 Wrong logic. Here, userland can control the size and the data copied, which basically means it can overflow kernel memory. ok martin@ christos@ To generate a diff of this commit: cvs rdiff -u -r1.64 -r1.64.14.1 src/sys/compat/netbsd32/netbsd32_ioctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/netbsd32/netbsd32_ioctl.c diff -u src/sys/compat/netbsd32/netbsd32_ioctl.c:1.64 src/sys/compat/netbsd32/netbsd32_ioctl.c:1.64.14.1 --- src/sys/compat/netbsd32/netbsd32_ioctl.c:1.64 Thu Oct 6 03:19:32 2011 +++ src/sys/compat/netbsd32/netbsd32_ioctl.c Sun Aug 2 12:52:59 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_ioctl.c,v 1.64 2011/10/06 03:19:32 macallan Exp $ */ +/* $NetBSD: netbsd32_ioctl.c,v 1.64.14.1 2015/08/02 12:52:59 martin Exp $ */ /* * Copyright (c) 1998, 2001 Matthew R. Green @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.64 2011/10/06 03:19:32 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.64.14.1 2015/08/02 12:52:59 martin Exp $"); #include #include @@ -192,7 +192,7 @@ netbsd32_to_if_addrprefreq(const struct strlcpy(ifap->ifap_name, ifap32->ifap_name, sizeof(ifap->ifap_name)); ifap->ifap_preference = ifap32->ifap_preference; memcpy(&ifap->ifap_addr, &ifap32->ifap_addr, - max(ifap32->ifap_addr.ss_len, _SS_MAXSIZE)); + min(ifap32->ifap_addr.ss_len, _SS_MAXSIZE)); } static inline void @@ -425,7 +425,7 @@ netbsd32_from_if_addrprefreq(const struc strlcpy(ifap32->ifap_name, ifap->ifap_name, sizeof(ifap32->ifap_name)); ifap32->ifap_preference = ifap->ifap_preference; memcpy(&ifap32->ifap_addr, &ifap->ifap_addr, - max(ifap->ifap_addr.ss_len, _SS_MAXSIZE)); + min(ifap->ifap_addr.ss_len, _SS_MAXSIZE)); } static inline void
CVS commit: [netbsd-6-1] src/doc
Module Name:src Committed By: martin Date: Sun Aug 2 12:53:39 UTC 2015 Modified Files: src/doc [netbsd-6-1]: CHANGES-6.1.6 Log Message: Ticket #1318 To generate a diff of this commit: cvs rdiff -u -r1.1.2.45 -r1.1.2.46 src/doc/CHANGES-6.1.6 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-6.1.6 diff -u src/doc/CHANGES-6.1.6:1.1.2.45 src/doc/CHANGES-6.1.6:1.1.2.46 --- src/doc/CHANGES-6.1.6:1.1.2.45 Fri Jul 24 07:36:51 2015 +++ src/doc/CHANGES-6.1.6 Sun Aug 2 12:53:39 2015 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-6.1.6,v 1.1.2.45 2015/07/24 07:36:51 martin Exp $ +# $NetBSD: CHANGES-6.1.6,v 1.1.2.46 2015/08/02 12:53:39 martin Exp $ A complete list of changes from the NetBSD 6.1.5 release to the NetBSD 6.1.6 release: @@ -5985,3 +5985,9 @@ sys/netinet/tcp_output.c 1.184 [matt, ticket #1315] +sys/compat/netbsd32/netbsd32_ioctl.c 1.82 + + Fix inverted logic when checking the size of data to copyin(). + [maxv, ticket #1318] + +
CVS commit: [netbsd-6] src/doc
Module Name:src Committed By: martin Date: Sun Aug 2 12:51:34 UTC 2015 Modified Files: src/doc [netbsd-6]: CHANGES-6.2 Log Message: Ticket #1318 To generate a diff of this commit: cvs rdiff -u -r1.1.2.223 -r1.1.2.224 src/doc/CHANGES-6.2 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-6.2 diff -u src/doc/CHANGES-6.2:1.1.2.223 src/doc/CHANGES-6.2:1.1.2.224 --- src/doc/CHANGES-6.2:1.1.2.223 Fri Jul 24 07:40:57 2015 +++ src/doc/CHANGES-6.2 Sun Aug 2 12:51:34 2015 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-6.2,v 1.1.2.223 2015/07/24 07:40:57 martin Exp $ +# $NetBSD: CHANGES-6.2,v 1.1.2.224 2015/08/02 12:51:34 martin Exp $ A complete list of changes from the 6.1 release until the 6.2 release: @@ -11798,3 +11798,8 @@ sys/netinet/tcp_output.c 1.184 Make sure that snd_win doesn't go negative. [matt, ticket #1315] +sys/compat/netbsd32/netbsd32_ioctl.c 1.82 + + Fix inverted logic when checking the size of data to copyin(). + [maxv, ticket #1318] +
CVS commit: [netbsd-6] src/sys/compat/netbsd32
Module Name:src Committed By: martin Date: Sun Aug 2 12:50:48 UTC 2015 Modified Files: src/sys/compat/netbsd32 [netbsd-6]: netbsd32_ioctl.c Log Message: Pull up following revision(s) (requested by maxv in ticket #1318): sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.82 Wrong logic. Here, userland can control the size and the data copied, which basically means it can overflow kernel memory. ok martin@ christos@ To generate a diff of this commit: cvs rdiff -u -r1.64.8.1 -r1.64.8.2 src/sys/compat/netbsd32/netbsd32_ioctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/netbsd32/netbsd32_ioctl.c diff -u src/sys/compat/netbsd32/netbsd32_ioctl.c:1.64.8.1 src/sys/compat/netbsd32/netbsd32_ioctl.c:1.64.8.2 --- src/sys/compat/netbsd32/netbsd32_ioctl.c:1.64.8.1 Tue Mar 18 07:18:22 2014 +++ src/sys/compat/netbsd32/netbsd32_ioctl.c Sun Aug 2 12:50:48 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_ioctl.c,v 1.64.8.1 2014/03/18 07:18:22 msaitoh Exp $ */ +/* $NetBSD: netbsd32_ioctl.c,v 1.64.8.2 2015/08/02 12:50:48 martin Exp $ */ /* * Copyright (c) 1998, 2001 Matthew R. Green @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.64.8.1 2014/03/18 07:18:22 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.64.8.2 2015/08/02 12:50:48 martin Exp $"); #include #include @@ -193,7 +193,7 @@ netbsd32_to_if_addrprefreq(const struct strlcpy(ifap->ifap_name, ifap32->ifap_name, sizeof(ifap->ifap_name)); ifap->ifap_preference = ifap32->ifap_preference; memcpy(&ifap->ifap_addr, &ifap32->ifap_addr, - max(ifap32->ifap_addr.ss_len, _SS_MAXSIZE)); + min(ifap32->ifap_addr.ss_len, _SS_MAXSIZE)); } static inline void @@ -443,7 +443,7 @@ netbsd32_from_if_addrprefreq(const struc strlcpy(ifap32->ifap_name, ifap->ifap_name, sizeof(ifap32->ifap_name)); ifap32->ifap_preference = ifap->ifap_preference; memcpy(&ifap32->ifap_addr, &ifap->ifap_addr, - max(ifap->ifap_addr.ss_len, _SS_MAXSIZE)); + min(ifap->ifap_addr.ss_len, _SS_MAXSIZE)); } static inline void
CVS commit: src/usr.bin/patch
Module Name:src Committed By: wiz Date: Sun Aug 2 12:19:13 UTC 2015 Modified Files: src/usr.bin/patch: patch.1 Log Message: Fix two typos. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/usr.bin/patch/patch.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/patch/patch.1 diff -u src/usr.bin/patch/patch.1:1.18 src/usr.bin/patch/patch.1:1.19 --- src/usr.bin/patch/patch.1:1.18 Sun Aug 2 03:19:02 2015 +++ src/usr.bin/patch/patch.1 Sun Aug 2 12:19:12 2015 @@ -1,6 +1,6 @@ .\" $OpenBSD: patch.1,v 1.22 2008/06/06 20:44:00 jmc Exp $ .\" $DragonFly: src/usr.bin/patch/patch.1,v 1.10 2008/08/18 19:15:55 joerg Exp $ -.\" $NetBSD: patch.1,v 1.18 2015/08/02 03:19:02 christos Exp $ +.\" $NetBSD: patch.1,v 1.19 2015/08/02 12:19:12 wiz Exp $ .\" Copyright 1986, Larry Wall .\" .\" Redistribution and use in source and binary forms, with or without @@ -21,7 +21,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd Auguest 2, 2015 +.Dd August 2, 2015 .Dt PATCH 1 .Os .Sh NAME @@ -445,7 +445,7 @@ the shortest basename, and the shortest .It If no file exists, .Nm -checks for the existence of the files in an RCS directory sing the criteria +checks for the existence of the files in an RCS directory using the criteria specified above. If found, .Nm
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Sun Aug 2 11:55:29 UTC 2015 Modified Files: src/sys/dev/usb: if_smsc.c Log Message: count collisions, count and debug print more errors. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/dev/usb/if_smsc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/usb/if_smsc.c diff -u src/sys/dev/usb/if_smsc.c:1.23 src/sys/dev/usb/if_smsc.c:1.24 --- src/sys/dev/usb/if_smsc.c:1.23 Mon Apr 13 16:33:25 2015 +++ src/sys/dev/usb/if_smsc.c Sun Aug 2 11:55:28 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: if_smsc.c,v 1.23 2015/04/13 16:33:25 riastradh Exp $ */ +/* $NetBSD: if_smsc.c,v 1.24 2015/08/02 11:55:28 mlelstv Exp $ */ /* $OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $ */ /* $FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */ @@ -1294,7 +1294,12 @@ smsc_rxeof(usbd_xfer_handle xfer, usbd_p buf += sizeof(rxhdr); total_len -= sizeof(rxhdr); - if (rxhdr & SMSC_RX_STAT_ERROR) { + if (rxhdr & SMSC_RX_STAT_COLLISION) + ifp->if_collisions++; + + if (rxhdr & (SMSC_RX_STAT_ERROR + | SMSC_RX_STAT_LENGTH_ERROR + | SMSC_RX_STAT_MII_ERROR)) { smsc_dbg_printf(sc, "rx error (hdr 0x%08x)\n", rxhdr); ifp->if_ierrors++; goto done;
CVS commit: src/sys/dev
Module Name:src Committed By: mlelstv Date: Sun Aug 2 11:40:41 UTC 2015 Modified Files: src/sys/dev: vnd.c Log Message: use dk_openlock when accessing openmask. To generate a diff of this commit: cvs rdiff -u -r1.246 -r1.247 src/sys/dev/vnd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/vnd.c diff -u src/sys/dev/vnd.c:1.246 src/sys/dev/vnd.c:1.247 --- src/sys/dev/vnd.c:1.246 Tue Jul 28 13:12:47 2015 +++ src/sys/dev/vnd.c Sun Aug 2 11:40:41 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: vnd.c,v 1.246 2015/07/28 13:12:47 prlw1 Exp $ */ +/* $NetBSD: vnd.c,v 1.247 2015/08/02 11:40:41 mlelstv Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.246 2015/07/28 13:12:47 prlw1 Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.247 2015/08/02 11:40:41 mlelstv Exp $"); #if defined(_KERNEL_OPT) #include "opt_vnd.h" @@ -343,6 +343,8 @@ vndopen(dev_t dev, int flags, int mode, if ((error = vndlock(sc)) != 0) return error; + mutex_enter(&sc->sc_dkdev.dk_openlock); + if ((sc->sc_flags & VNF_CLEARING) != 0) { error = ENXIO; goto done; @@ -403,6 +405,7 @@ vndopen(dev_t dev, int flags, int mode, sc->sc_dkdev.dk_copenmask | sc->sc_dkdev.dk_bopenmask; done: + mutex_exit(&sc->sc_dkdev.dk_openlock); vndunlock(sc); return error; } @@ -425,6 +428,8 @@ vndclose(dev_t dev, int flags, int mode, if ((error = vndlock(sc)) != 0) return error; + mutex_enter(&sc->sc_dkdev.dk_openlock); + part = DISKPART(dev); /* ...that much closer to allowing unconfiguration... */ @@ -446,6 +451,8 @@ vndclose(dev_t dev, int flags, int mode, sc->sc_flags &= ~VNF_VLABEL; } + mutex_exit(&sc->sc_dkdev.dk_openlock); + vndunlock(sc); if ((sc->sc_flags & VNF_INITED) == 0) {
CVS commit: [netbsd-7] src/doc
Module Name:src Committed By: martin Date: Sun Aug 2 11:30:45 UTC 2015 Modified Files: src/doc [netbsd-7]: CHANGES-7.0 Log Message: Ticket #930 To generate a diff of this commit: cvs rdiff -u -r1.1.2.352 -r1.1.2.353 src/doc/CHANGES-7.0 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-7.0 diff -u src/doc/CHANGES-7.0:1.1.2.352 src/doc/CHANGES-7.0:1.1.2.353 --- src/doc/CHANGES-7.0:1.1.2.352 Fri Jul 31 17:55:21 2015 +++ src/doc/CHANGES-7.0 Sun Aug 2 11:30:45 2015 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-7.0,v 1.1.2.352 2015/07/31 17:55:21 snj Exp $ +# $NetBSD: CHANGES-7.0,v 1.1.2.353 2015/08/02 11:30:45 martin Exp $ A complete list of changes from the initial NetBSD 7.0 branch on 11 Aug 2014 until the 7.0 release: @@ -33692,3 +33692,8 @@ sys/dev/ccd.c 1.163 Initialize sc_unit. [christos, ticket #924] +sys/compat/netbsd32/netbsd32_ioctl.c 1.82 + + Fix inverted logic when checking the size of data to copyin(). + [maxv, ticket #930] +
CVS commit: [netbsd-7] src/sys/compat/netbsd32
Module Name:src Committed By: martin Date: Sun Aug 2 11:29:10 UTC 2015 Modified Files: src/sys/compat/netbsd32 [netbsd-7]: netbsd32_ioctl.c Log Message: Pull up following revision(s) (requested by maxv in ticket #930): sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.82 Wrong logic. Here, userland can control the size and the data copied, which basically means it can overflow kernel memory. ok martin@ christos@ To generate a diff of this commit: cvs rdiff -u -r1.69 -r1.69.4.1 src/sys/compat/netbsd32/netbsd32_ioctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/netbsd32/netbsd32_ioctl.c diff -u src/sys/compat/netbsd32/netbsd32_ioctl.c:1.69 src/sys/compat/netbsd32/netbsd32_ioctl.c:1.69.4.1 --- src/sys/compat/netbsd32/netbsd32_ioctl.c:1.69 Fri Jan 24 12:16:10 2014 +++ src/sys/compat/netbsd32/netbsd32_ioctl.c Sun Aug 2 11:29:10 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_ioctl.c,v 1.69 2014/01/24 12:16:10 bouyer Exp $ */ +/* $NetBSD: netbsd32_ioctl.c,v 1.69.4.1 2015/08/02 11:29:10 martin Exp $ */ /* * Copyright (c) 1998, 2001 Matthew R. Green @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.69 2014/01/24 12:16:10 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.69.4.1 2015/08/02 11:29:10 martin Exp $"); #include #include @@ -137,7 +137,7 @@ netbsd32_to_if_addrprefreq(const struct strlcpy(ifap->ifap_name, ifap32->ifap_name, sizeof(ifap->ifap_name)); ifap->ifap_preference = ifap32->ifap_preference; memcpy(&ifap->ifap_addr, &ifap32->ifap_addr, - max(ifap32->ifap_addr.ss_len, _SS_MAXSIZE)); + min(ifap32->ifap_addr.ss_len, _SS_MAXSIZE)); } static inline void @@ -454,7 +454,7 @@ netbsd32_from_if_addrprefreq(const struc strlcpy(ifap32->ifap_name, ifap->ifap_name, sizeof(ifap32->ifap_name)); ifap32->ifap_preference = ifap->ifap_preference; memcpy(&ifap32->ifap_addr, &ifap->ifap_addr, - max(ifap->ifap_addr.ss_len, _SS_MAXSIZE)); + min(ifap->ifap_addr.ss_len, _SS_MAXSIZE)); } static inline void
CVS commit: src/sys/dev/sdmmc
Module Name:src Committed By: jmcneill Date: Sun Aug 2 11:28:01 UTC 2015 Modified Files: src/sys/dev/sdmmc: sdhc.c Log Message: bus_dma_segment_t ds_addr is bus_addr_t not paddr_t (another case of it) To generate a diff of this commit: cvs rdiff -u -r1.69 -r1.70 src/sys/dev/sdmmc/sdhc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/sdmmc/sdhc.c diff -u src/sys/dev/sdmmc/sdhc.c:1.69 src/sys/dev/sdmmc/sdhc.c:1.70 --- src/sys/dev/sdmmc/sdhc.c:1.69 Sun Aug 2 11:26:21 2015 +++ src/sys/dev/sdmmc/sdhc.c Sun Aug 2 11:28:01 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: sdhc.c,v 1.69 2015/08/02 11:26:21 jmcneill Exp $ */ +/* $NetBSD: sdhc.c,v 1.70 2015/08/02 11:28:01 jmcneill Exp $ */ /* $OpenBSD: sdhc.c,v 1.25 2009/01/13 19:44:20 grange Exp $ */ /* @@ -23,7 +23,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.69 2015/08/02 11:26:21 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.70 2015/08/02 11:28:01 jmcneill Exp $"); #ifdef _KERNEL_OPT #include "opt_sdmmc.h" @@ -1405,7 +1405,7 @@ sdhc_start_command(struct sdhc_host *hp, HCLR1(hp, SDHC_HOST_CTL, SDHC_DMA_SELECT); HSET1(hp, SDHC_HOST_CTL, SDHC_DMA_SELECT_ADMA2); - const paddr_t desc_addr = hp->adma_map->dm_segs[0].ds_addr; + const bus_addr_t desc_addr = hp->adma_map->dm_segs[0].ds_addr; HWRITE4(hp, SDHC_ADMA_SYSTEM_ADDR, desc_addr & 0x); if (ISSET(hp->flags, SHF_USE_ADMA2_64)) {
CVS commit: src/sys/dev/sdmmc
Module Name:src Committed By: jmcneill Date: Sun Aug 2 11:26:21 UTC 2015 Modified Files: src/sys/dev/sdmmc: sdhc.c Log Message: bus_dma_segment_t ds_addr is bus_addr_t not paddr_t To generate a diff of this commit: cvs rdiff -u -r1.68 -r1.69 src/sys/dev/sdmmc/sdhc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/sdmmc/sdhc.c diff -u src/sys/dev/sdmmc/sdhc.c:1.68 src/sys/dev/sdmmc/sdhc.c:1.69 --- src/sys/dev/sdmmc/sdhc.c:1.68 Sun Aug 2 07:14:10 2015 +++ src/sys/dev/sdmmc/sdhc.c Sun Aug 2 11:26:21 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: sdhc.c,v 1.68 2015/08/02 07:14:10 mlelstv Exp $ */ +/* $NetBSD: sdhc.c,v 1.69 2015/08/02 11:26:21 jmcneill Exp $ */ /* $OpenBSD: sdhc.c,v 1.25 2009/01/13 19:44:20 grange Exp $ */ /* @@ -23,7 +23,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.68 2015/08/02 07:14:10 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.69 2015/08/02 11:26:21 jmcneill Exp $"); #ifdef _KERNEL_OPT #include "opt_sdmmc.h" @@ -1367,7 +1367,7 @@ sdhc_start_command(struct sdhc_host *hp, /* Set DMA start address. */ if (ISSET(hp->flags, SHF_USE_ADMA2_MASK) && cmd->c_datalen > 0) { for (int seg = 0; seg < cmd->c_dmamap->dm_nsegs; seg++) { - paddr_t paddr = + bus_addr_t paddr = cmd->c_dmamap->dm_segs[seg].ds_addr; uint16_t len = cmd->c_dmamap->dm_segs[seg].ds_len == 65536 ?
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: jmcneill Date: Sun Aug 2 11:11:32 UTC 2015 Modified Files: src/distrib/utils/embedded/conf: armv7.conf Log Message: install jetsontk1 boot script as boot.scr To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/distrib/utils/embedded/conf/armv7.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/conf/armv7.conf diff -u src/distrib/utils/embedded/conf/armv7.conf:1.6 src/distrib/utils/embedded/conf/armv7.conf:1.7 --- src/distrib/utils/embedded/conf/armv7.conf:1.6 Wed Jul 15 11:29:16 2015 +++ src/distrib/utils/embedded/conf/armv7.conf Sun Aug 2 11:11:32 2015 @@ -1,4 +1,4 @@ -# $NetBSD: armv7.conf,v 1.6 2015/07/15 11:29:16 martin Exp $ +# $NetBSD: armv7.conf,v 1.7 2015/08/02 11:11:32 jmcneill Exp $ # ARMv7 customization script used by mkimage # board=armv7 @@ -97,7 +97,7 @@ setenv bootargs root=ld1a fatload mmc 1:1 0x9000 ${jetsontk1_kernelimg} bootm 0x9000 EOF - "${MKUBOOTIMAGE}" -A arm -C none -O netbsd -T script -a 0 -n "NetBSD/tegra boot" "${mnt}/boot/boot-JETSONTK1.txt" "${mnt}/boot/boot-JETSONTK1.scr" + "${MKUBOOTIMAGE}" -A arm -C none -O netbsd -T script -a 0 -n "NetBSD/tegra boot" "${mnt}/boot/boot-JETSONTK1.txt" "${mnt}/boot/boot.scr" } populate() {
CVS commit: src
Module Name:src Committed By: jmcneill Date: Sun Aug 2 11:09:05 UTC 2015 Modified Files: src/distrib/sets/lists/base: mi src/distrib/sets/lists/comp: mi src/sys/dev: Makefile Log Message: Install hdmicecio.h To generate a diff of this commit: cvs rdiff -u -r1.1105 -r1.1106 src/distrib/sets/lists/base/mi cvs rdiff -u -r1.1975 -r1.1976 src/distrib/sets/lists/comp/mi cvs rdiff -u -r1.36 -r1.37 src/sys/dev/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/base/mi diff -u src/distrib/sets/lists/base/mi:1.1105 src/distrib/sets/lists/base/mi:1.1106 --- src/distrib/sets/lists/base/mi:1.1105 Wed Jul 29 06:07:35 2015 +++ src/distrib/sets/lists/base/mi Sun Aug 2 11:09:05 2015 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1105 2015/07/29 06:07:35 ozaki-r Exp $ +# $NetBSD: mi,v 1.1106 2015/08/02 11:09:05 jmcneill Exp $ # # Note: Don't delete entries from here - mark them as "obsolete" instead, # unless otherwise stated below. @@ -1023,6 +1023,7 @@ ./usr/include/dev/eisabase-obsolete obsolete ./usr/include/dev/filemon base-c-usr ./usr/include/dev/hdaudio base-c-usr +./usr/include/dev/hdmicec base-c-usr ./usr/include/dev/hpcbase-c-usr ./usr/include/dev/i2cbase-c-usr ./usr/include/dev/i2obase-c-usr Index: src/distrib/sets/lists/comp/mi diff -u src/distrib/sets/lists/comp/mi:1.1975 src/distrib/sets/lists/comp/mi:1.1976 --- src/distrib/sets/lists/comp/mi:1.1975 Fri Jul 31 12:51:32 2015 +++ src/distrib/sets/lists/comp/mi Sun Aug 2 11:09:05 2015 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1975 2015/07/31 12:51:32 kamil Exp $ +# $NetBSD: mi,v 1.1976 2015/08/02 11:09:05 jmcneill Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -400,6 +400,7 @@ ./usr/include/dev/fssvar.h comp-c-include ./usr/include/dev/hdaudio/hdaudioio.h comp-c-include ./usr/include/dev/hdaudio/hdaudioreg.h comp-c-include +./usr/include/dev/hdmicec/hdmicecio.h comp-c-include ./usr/include/dev/hpc/hpcfbio.h comp-c-include ./usr/include/dev/i2c/i2c_bus.h comp-obsolete obsolete ./usr/include/dev/i2c/i2c_eeprom.h comp-obsolete obsolete Index: src/sys/dev/Makefile diff -u src/sys/dev/Makefile:1.36 src/sys/dev/Makefile:1.37 --- src/sys/dev/Makefile:1.36 Sat Mar 28 14:09:58 2015 +++ src/sys/dev/Makefile Sun Aug 2 11:09:05 2015 @@ -1,6 +1,6 @@ -# $NetBSD: Makefile,v 1.36 2015/03/28 14:09:58 jmcneill Exp $ +# $NetBSD: Makefile,v 1.37 2015/08/02 11:09:05 jmcneill Exp $ -SUBDIR= apm ata bluetooth dec dm dmover dtv filemon hdaudio hpc \ +SUBDIR= apm ata bluetooth dec dm dmover dtv filemon hdaudio hdmicec hpc \ i2c i2o ic ieee1394 ir isa \ microcode ofw pci pckbport pcmcia pud putter raidframe sbus scsipi \ sun tc usb vme wscons
CVS commit: src/sys/compat/netbsd32
Module Name:src Committed By: maxv Date: Sun Aug 2 07:37:57 UTC 2015 Modified Files: src/sys/compat/netbsd32: netbsd32_ioctl.c Log Message: Wrong logic. Here, userland can control the size and the data copied, which basically means it can overflow kernel memory. ok martin@ christos@ To generate a diff of this commit: cvs rdiff -u -r1.81 -r1.82 src/sys/compat/netbsd32/netbsd32_ioctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/netbsd32/netbsd32_ioctl.c diff -u src/sys/compat/netbsd32/netbsd32_ioctl.c:1.81 src/sys/compat/netbsd32/netbsd32_ioctl.c:1.82 --- src/sys/compat/netbsd32/netbsd32_ioctl.c:1.81 Mon Jun 1 16:07:27 2015 +++ src/sys/compat/netbsd32/netbsd32_ioctl.c Sun Aug 2 07:37:57 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_ioctl.c,v 1.81 2015/06/01 16:07:27 roy Exp $ */ +/* $NetBSD: netbsd32_ioctl.c,v 1.82 2015/08/02 07:37:57 maxv Exp $ */ /* * Copyright (c) 1998, 2001 Matthew R. Green @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.81 2015/06/01 16:07:27 roy Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.82 2015/08/02 07:37:57 maxv Exp $"); #include #include @@ -144,7 +144,7 @@ netbsd32_to_if_addrprefreq(const struct strlcpy(ifap->ifap_name, ifap32->ifap_name, sizeof(ifap->ifap_name)); ifap->ifap_preference = ifap32->ifap_preference; memcpy(&ifap->ifap_addr, &ifap32->ifap_addr, - max(ifap32->ifap_addr.ss_len, _SS_MAXSIZE)); + min(ifap32->ifap_addr.ss_len, _SS_MAXSIZE)); } static inline void @@ -547,7 +547,7 @@ netbsd32_from_if_addrprefreq(const struc strlcpy(ifap32->ifap_name, ifap->ifap_name, sizeof(ifap32->ifap_name)); ifap32->ifap_preference = ifap->ifap_preference; memcpy(&ifap32->ifap_addr, &ifap->ifap_addr, - max(ifap->ifap_addr.ss_len, _SS_MAXSIZE)); + min(ifap->ifap_addr.ss_len, _SS_MAXSIZE)); } static inline void
CVS commit: src/sys/dev
Module Name:src Committed By: mlelstv Date: Sun Aug 2 07:25:40 UTC 2015 Modified Files: src/sys/dev: dksubr.c Log Message: fix diskerr message, it needs the driver name, not the device unit name. To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 src/sys/dev/dksubr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/dksubr.c diff -u src/sys/dev/dksubr.c:1.67 src/sys/dev/dksubr.c:1.68 --- src/sys/dev/dksubr.c:1.67 Wed Jul 22 10:32:16 2015 +++ src/sys/dev/dksubr.c Sun Aug 2 07:25:40 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: dksubr.c,v 1.67 2015/07/22 10:32:16 skrll Exp $ */ +/* $NetBSD: dksubr.c,v 1.68 2015/08/02 07:25:40 mlelstv Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2008 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.67 2015/07/22 10:32:16 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.68 2015/08/02 07:25:40 mlelstv Exp $"); #include #include @@ -289,7 +289,9 @@ dk_done(struct dk_softc *dksc, struct bu struct disk *dk = &dksc->sc_dkdev; if (bp->b_error != 0) { - diskerr(bp, dksc->sc_xname, "error", LOG_PRINTF, 0, + struct cfdriver *cd = device_cfdriver(dksc->sc_dev); + + diskerr(bp, cd->cd_name, "error", LOG_PRINTF, 0, dk->dk_label); printf("\n"); }
CVS commit: src/sys/dev/sdmmc
Module Name:src Committed By: mlelstv Date: Sun Aug 2 07:14:10 UTC 2015 Modified Files: src/sys/dev/sdmmc: sdhc.c Log Message: Be more verbose about error conditions. To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 src/sys/dev/sdmmc/sdhc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/sdmmc/sdhc.c diff -u src/sys/dev/sdmmc/sdhc.c:1.67 src/sys/dev/sdmmc/sdhc.c:1.68 --- src/sys/dev/sdmmc/sdhc.c:1.67 Sun Aug 2 07:07:02 2015 +++ src/sys/dev/sdmmc/sdhc.c Sun Aug 2 07:14:10 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: sdhc.c,v 1.67 2015/08/02 07:07:02 mlelstv Exp $ */ +/* $NetBSD: sdhc.c,v 1.68 2015/08/02 07:14:10 mlelstv Exp $ */ /* $OpenBSD: sdhc.c,v 1.25 2009/01/13 19:44:20 grange Exp $ */ /* @@ -23,7 +23,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.67 2015/08/02 07:07:02 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.68 2015/08/02 07:14:10 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_sdmmc.h" @@ -991,6 +991,8 @@ sdhc_bus_clock(sdmmc_chipset_handle_t sc */ if (!sdhc_clock_divisor(hp, freq, &div)) { /* Invalid base clock frequency or `freq' value. */ + aprint_error_dev(hp->sc->sc_dev, + "Invalid bus clock %d kHz\n", freq); error = EINVAL; goto out; } @@ -1163,8 +1165,8 @@ sdhc_wait_state(struct sdhc_host *hp, ui return 0; sdmmc_delay(10); } - DPRINTF(0,("%s: timeout waiting for %x (state=%x)\n", HDEVNAME(hp), - value, state)); + aprint_error_dev(hp->sc->sc_dev, "timeout waiting for %x (state=%x)\n", + value, state); return ETIMEDOUT; } @@ -1344,8 +1346,10 @@ sdhc_start_command(struct sdhc_host *hp, /* Wait until command and data inhibit bits are clear. (1.5) */ error = sdhc_wait_state(hp, SDHC_CMD_INHIBIT_MASK, 0); - if (error) + if (error) { + aprint_error_dev(sc->sc_dev, "command or data phase inhibited\n"); return error; + } DPRINTF(1,("%s: writing cmd: blksize=%d blkcnt=%d mode=%04x cmd=%04x\n", HDEVNAME(hp), blksize, blkcount, mode, command));
CVS commit: src/sys/dev/sdmmc
Module Name:src Committed By: mlelstv Date: Sun Aug 2 07:07:02 UTC 2015 Modified Files: src/sys/dev/sdmmc: sdhc.c Log Message: correct (the commented out) calculation of bus frequency. To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/sys/dev/sdmmc/sdhc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/sdmmc/sdhc.c diff -u src/sys/dev/sdmmc/sdhc.c:1.66 src/sys/dev/sdmmc/sdhc.c:1.67 --- src/sys/dev/sdmmc/sdhc.c:1.66 Sun Aug 2 00:24:24 2015 +++ src/sys/dev/sdmmc/sdhc.c Sun Aug 2 07:07:02 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: sdhc.c,v 1.66 2015/08/02 00:24:24 jmcneill Exp $ */ +/* $NetBSD: sdhc.c,v 1.67 2015/08/02 07:07:02 mlelstv Exp $ */ /* $OpenBSD: sdhc.c,v 1.25 2009/01/13 19:44:20 grange Exp $ */ /* @@ -23,7 +23,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.66 2015/08/02 00:24:24 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.67 2015/08/02 07:07:02 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_sdmmc.h" @@ -922,7 +922,7 @@ sdhc_clock_divisor(struct sdhc_host *hp, << SDHC_SDCLK_XDIV_SHIFT) | (((div >> 0) & SDHC_SDCLK_DIV_MASK) << SDHC_SDCLK_DIV_SHIFT); - //freq = hp->clkbase / div; + //freq = hp->clkbase / (div ? div * 2 : 1); return true; } else { for (div = 1; div <= 256; div *= 2) {