CVS commit: src/sys/dev/usb
Module Name:src Committed By: matt Date: Thu Jan 17 06:24:45 UTC 2013 Modified Files: src/sys/dev/usb: usb_mem.c Log Message: Make sure a USB small memory fragment is a multiple of the cache line size. (since CACHE_LINE_SIZE defaults to 64, for most instances this won't result in any code changing). To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/sys/dev/usb/usb_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/usb/usb_mem.c diff -u src/sys/dev/usb/usb_mem.c:1.55 src/sys/dev/usb/usb_mem.c:1.56 --- src/sys/dev/usb/usb_mem.c:1.55 Mon Jan 7 15:07:41 2013 +++ src/sys/dev/usb/usb_mem.c Thu Jan 17 06:24:44 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: usb_mem.c,v 1.55 2013/01/07 15:07:41 prlw1 Exp $ */ +/* $NetBSD: usb_mem.c,v 1.56 2013/01/17 06:24:44 matt Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: usb_mem.c,v 1.55 2013/01/07 15:07:41 prlw1 Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usb_mem.c,v 1.56 2013/01/17 06:24:44 matt Exp $"); #include #include @@ -70,7 +70,7 @@ extern int usbdebug; #define DPRINTFN(n,x) #endif -#define USB_MEM_SMALL 64 +#define USB_MEM_SMALL roundup(64, CACHE_LINE_SIZE) #define USB_MEM_CHUNKS 64 #define USB_MEM_BLOCK (USB_MEM_SMALL * USB_MEM_CHUNKS)
CVS commit: [matt-nb6-plus] src/sys/arch/arm/include
Module Name:src Committed By: matt Date: Thu Jan 17 01:33:34 UTC 2013 Modified Files: src/sys/arch/arm/include [matt-nb6-plus]: bus_funcs.h Log Message: Pullup from HEAD: Cortex needs ._dmamap_sync_post for BUS_DMASYNC_POSTREAD To generate a diff of this commit: cvs rdiff -u -r1.1.10.1 -r1.1.10.2 src/sys/arch/arm/include/bus_funcs.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/arch/arm/include/bus_funcs.h diff -u src/sys/arch/arm/include/bus_funcs.h:1.1.10.1 src/sys/arch/arm/include/bus_funcs.h:1.1.10.2 --- src/sys/arch/arm/include/bus_funcs.h:1.1.10.1 Wed Nov 28 22:40:28 2012 +++ src/sys/arch/arm/include/bus_funcs.h Thu Jan 17 01:33:34 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: bus_funcs.h,v 1.1.10.1 2012/11/28 22:40:28 matt Exp $ */ +/* $NetBSD: bus_funcs.h,v 1.1.10.2 2013/01/17 01:33:34 matt Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc. @@ -64,6 +64,10 @@ #ifndef _ARM32_BUS_FUNCS_H_ #define _ARM32_BUS_FUNCS_H_ +#ifdef _KERNEL_OPT +#include "opt_cputypes.h" +#endif + /* * Utility macros; INTERNAL USE ONLY. */ @@ -635,7 +639,7 @@ void _bus_dmamap_unload(bus_dma_tag_t, b void _bus_dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t, bus_size_t, int); -#ifdef _ARM32_NEED_BUS_DMA_BOUNCE +#if defined(_ARM32_NEED_BUS_DMA_BOUNCE) || defined(CPU_CORTEX) #define _BUS_DMAMAP_SYNC_FUNCS \ ._dmamap_sync_pre = _bus_dmamap_sync, \ ._dmamap_sync_post = _bus_dmamap_sync
CVS commit: src/sys/arch/arm/include
Module Name:src Committed By: matt Date: Thu Jan 17 01:32:02 UTC 2013 Modified Files: src/sys/arch/arm/include: bus_funcs.h Log Message: Cortex needs ._dmamap_sync_post for BUS_DMASYNC_POSTREAD To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/include/bus_funcs.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/arch/arm/include/bus_funcs.h diff -u src/sys/arch/arm/include/bus_funcs.h:1.4 src/sys/arch/arm/include/bus_funcs.h:1.5 --- src/sys/arch/arm/include/bus_funcs.h:1.4 Fri Oct 19 13:46:07 2012 +++ src/sys/arch/arm/include/bus_funcs.h Thu Jan 17 01:32:02 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: bus_funcs.h,v 1.4 2012/10/19 13:46:07 matt Exp $ */ +/* $NetBSD: bus_funcs.h,v 1.5 2013/01/17 01:32:02 matt Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc. @@ -64,6 +64,10 @@ #ifndef _ARM32_BUS_FUNCS_H_ #define _ARM32_BUS_FUNCS_H_ +#ifdef _KERNEL_OPT +#include "opt_cputypes.h" +#endif + /* * Utility macros; INTERNAL USE ONLY. */ @@ -635,7 +639,7 @@ void _bus_dmamap_unload(bus_dma_tag_t, b void _bus_dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t, bus_size_t, int); -#ifdef _ARM32_NEED_BUS_DMA_BOUNCE +#if defined(_ARM32_NEED_BUS_DMA_BOUNCE) || defined(CPU_CORTEX) #define _BUS_DMAMAP_SYNC_FUNCS \ ._dmamap_sync_pre = _bus_dmamap_sync, \ ._dmamap_sync_post = _bus_dmamap_sync
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: macallan Date: Thu Jan 17 01:10:53 UTC 2013 Modified Files: src/sys/arch/arm/omap: omapfb.c Log Message: don't draw blanks by hand, use the blitter instead To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/omap/omapfb.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/omap/omapfb.c diff -u src/sys/arch/arm/omap/omapfb.c:1.12 src/sys/arch/arm/omap/omapfb.c:1.13 --- src/sys/arch/arm/omap/omapfb.c:1.12 Wed Jan 16 20:34:10 2013 +++ src/sys/arch/arm/omap/omapfb.c Thu Jan 17 01:10:52 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: omapfb.c,v 1.12 2013/01/16 20:34:10 macallan Exp $ */ +/* $NetBSD: omapfb.c,v 1.13 2013/01/17 01:10:52 macallan Exp $ */ /* * Copyright (c) 2010 Michael Lorenz @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: omapfb.c,v 1.12 2013/01/16 20:34:10 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omapfb.c,v 1.13 2013/01/17 01:10:52 macallan Exp $"); #include #include @@ -801,6 +801,17 @@ omapfb_putchar(void *cookie, int row, in struct vcons_screen *scr = ri->ri_hw; struct omapfb_softc *sc = scr->scr_cookie; + if (c == 0x20) { + uint32_t fg, bg, ul; + rasops_unpack_attr(attr, &fg, &bg, &ul); + omapfb_rectfill(sc, + ri->ri_xorigin + ri->ri_font->fontwidth * col, + ri->ri_yorigin + ri->ri_font->fontheight * row, + ri->ri_font->fontwidth, + ri->ri_font->fontheight, + ri->ri_devcmap[bg]); + return; + } omapfb_wait_idle(sc); sc->sc_putchar(cookie, row, col, c, attr); }
CVS commit: src/distrib/utils/embedded
Module Name:src Committed By: christos Date: Wed Jan 16 23:27:34 UTC 2013 Modified Files: src/distrib/utils/embedded: mkimage src/distrib/utils/embedded/conf: beagleboard.conf rpi.conf Added Files: src/distrib/utils/embedded/conf: evbarm.conf Log Message: - Add support for xsets - Factor out common evbarm code To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/distrib/utils/embedded/mkimage cvs rdiff -u -r1.2 -r1.3 src/distrib/utils/embedded/conf/beagleboard.conf cvs rdiff -u -r0 -r1.1 src/distrib/utils/embedded/conf/evbarm.conf cvs rdiff -u -r1.8 -r1.9 src/distrib/utils/embedded/conf/rpi.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/mkimage diff -u src/distrib/utils/embedded/mkimage:1.12 src/distrib/utils/embedded/mkimage:1.13 --- src/distrib/utils/embedded/mkimage:1.12 Wed Jan 16 10:58:19 2013 +++ src/distrib/utils/embedded/mkimage Wed Jan 16 18:27:34 2013 @@ -1,7 +1,7 @@ #! /bin/sh -# $NetBSD: mkimage,v 1.12 2013/01/16 15:58:19 christos Exp $ - +# $NetBSD: mkimage,v 1.13 2013/01/16 23:27:34 christos Exp $ +# # Copyright (c) 2012 Alistair Crooks # All rights reserved. # @@ -72,7 +72,7 @@ usage() { cat << EOF 1>&2 Usage: $PROG [-S ] [-c ] [-h ] [-s ] EOF -exit 1 + exit 1 } # Return the filesystem size for an ls -l or tar -xvf list @@ -174,9 +174,10 @@ makeffssize() { } finish() { -cleanup -${sudo} umount ${mnt} -${sudo} vnconfig -u ${vnddev} + cleanup + ${sudo} umount ${mnt} + ${sudo} vnconfig -u ${vnddev} + rm -fr ${mnt} } @@ -188,6 +189,8 @@ mnt="${TMPDIR:-/tmp}/image.$$" src="/usr/src" obj="/usr/obj" +sets="base comp etc games man misc modules text" +xsets="xbase xcomp xetc xfont xserver" # Presumable block and fragment size. bsize=16384 @@ -225,7 +228,7 @@ do c) custom="$OPTARG";; h) ;; s) size="$OPTARG";; - x) set -x;; + x) sets="$sets $xsets";; *) usage;; esac done @@ -242,10 +245,12 @@ fi # calculate the set bytes setbytes=0 echo -n "${bar} computing set sizes (" +b= for s in ${sets}; do one="$(sizeone ${setsdir}/${s}.tgz)" - echo -n " $s=$(( ${one} / ${mtob} ))MB" + echo -n "$b$s=$(( ${one} / ${mtob} ))MB" setbytes=$(( ${setbytes} + ${one} )) + b=" " done echo "): $(( ${setbytes} / ${mtob} ))MB ${bar}" Index: src/distrib/utils/embedded/conf/beagleboard.conf diff -u src/distrib/utils/embedded/conf/beagleboard.conf:1.2 src/distrib/utils/embedded/conf/beagleboard.conf:1.3 --- src/distrib/utils/embedded/conf/beagleboard.conf:1.2 Mon Jan 14 21:51:10 2013 +++ src/distrib/utils/embedded/conf/beagleboard.conf Wed Jan 16 18:27:34 2013 @@ -1,120 +1,33 @@ -# $NetBSD: beagleboard.conf,v 1.2 2013/01/15 02:51:10 jmcneill Exp $ +# $NetBSD: beagleboard.conf,v 1.3 2013/01/16 23:27:34 christos Exp $ # BeagleBoard customization script used by mkimage # board=beagleboard kernelconf=BEAGLEBOARD +kerneldir=$src/sys/arch/evbarm/compile/obj/${kernelconf} + +. ${DIR}/conf/evbarm.conf + kernelimg=netbsd.ub loadaddr=8100 -image=$HOME/${board}.img -sets="base etc comp games man misc modules tests text" -setsdir=$obj/evbarm/media -kerneldir=$src/sys/arch/evbarm/compile/obj/${kernelconf} -specialdirs="/kern /proc" - -swap=512 -size=2048 -overhead=8 -boot=112 -init=8 -msdosid=12 -tmp=/tmp/${board}.disklabel.$$ make_filesystems() { - - local asize=$(( ${size} * 1024 )) - local swapsize=$(( ${swap} * 1024 )) - local bootsize=$(( ${boot} * 1024 )) - - local bootoffset=$((${init} * 1024 )) - local swapoffset=$(( ${bootoffset} + ${bootsize} )) - local aoffset=$(( ${swapoffset} + ${swapsize} )) - - local totalsize=$(( ${asize} + ${swapsize} + ${bootsize} + ${bootoffset} )) - local bps=512 - local spt=32 - local tpc=64 - local spc=2048 - local cylinders=$(( ${totalsize} / ${spc} )) - - cat > ${tmp} << EOF -type: SCSI -disk: STORAGE DEVICE -label: fictitious -flags: removable -bytes/sector: ${bps} -sectors/track: ${spt} -tracks/cylinder: ${tpc} -sectors/cylinder: ${spc} -cylinders: ${cylinders} -total sectors: ${totalsize} -rpm: 3600 -interleave: 1 -trackskew: 0 -cylinderskew: 0 -headswitch: 0 # microseconds -track-to-track seek: 0 # microseconds -drivedata: 0 - -8 partitions: -# size offsetfstype [fsize bsize cpg/sgs] - a: ${asize} ${aoffset}4.2BSD 2048 16384 0 # - b: ${swapsize} ${swapoffset} swap # - d: ${totalsize} 0 unused 0 0# - e: ${bootsize} ${bootoffset} MSDOS # -EOF - ${sudo} disklabel -R ${vnddev} ${tmp} - ${sudo} fdisk -f -u -0 -s ${msdosid}/${bootoffset}/${bootsize} -F ${image} - ${sudo} newfs /dev/r${vnddev}a - ${sudo} newfs_msdos /dev/r${vnddev}e - ${sudo} mount /dev/${vnddev}a ${mnt} - ${sudo} mkdir ${mnt}/boot - ${sudo} mount_msdos /dev/${vnddev}e ${mnt}/boot + make_filesystems_evbarm } make_fstab() { -${sudo} cat > ${mnt}/e
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: jmcneill Date: Wed Jan 16 23:27:06 UTC 2013 Modified Files: src/sys/arch/arm/omap: omap2_mputmr.c Log Message: calc_timer_factors: use supplied ints_per_sec, not hz, when calculating counter frequency. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/omap/omap2_mputmr.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/omap/omap2_mputmr.c diff -u src/sys/arch/arm/omap/omap2_mputmr.c:1.4 src/sys/arch/arm/omap/omap2_mputmr.c:1.5 --- src/sys/arch/arm/omap/omap2_mputmr.c:1.4 Fri Jul 1 20:30:21 2011 +++ src/sys/arch/arm/omap/omap2_mputmr.c Wed Jan 16 23:27:05 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: omap2_mputmr.c,v 1.4 2011/07/01 20:30:21 dyoung Exp $ */ +/* $NetBSD: omap2_mputmr.c,v 1.5 2013/01/16 23:27:05 jmcneill Exp $ */ /* * OMAP 2430 GP timers @@ -77,7 +77,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: omap2_mputmr.c,v 1.4 2011/07/01 20:30:21 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap2_mputmr.c,v 1.5 2013/01/16 23:27:05 jmcneill Exp $"); #include "opt_omap.h" #include "opt_cpuoptions.h" @@ -317,7 +317,7 @@ calc_timer_factors(int ints_per_sec, tim for (;;) { ptv_power = 1 << tf->ptv; count_freq = OMAP_MPU_TIMER_CLOCK_FREQ; - count_freq /= hz; + count_freq /= ints_per_sec; count_freq /= ptv_power; tf->reload = -count_freq; tf->counts_per_usec = count_freq / us_per_sec;
CVS commit: [matt-nb6-plus] src/sys/arch/arm/arm32
Module Name:src Committed By: matt Date: Wed Jan 16 22:44:18 UTC 2013 Modified Files: src/sys/arch/arm/arm32 [matt-nb6-plus]: bus_dma.c Log Message: Pullup from HEAD: On Cortex, speculative loads can cache lines to be populated after then they've been invalidated for a DMA read. So after the DMA read we have to reinvalidate them again. We have to both invalidates since the former prevents dirty lines overwriting just DMAed data. To generate a diff of this commit: cvs rdiff -u -r1.54.10.1 -r1.54.10.2 src/sys/arch/arm/arm32/bus_dma.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/arm32/bus_dma.c diff -u src/sys/arch/arm/arm32/bus_dma.c:1.54.10.1 src/sys/arch/arm/arm32/bus_dma.c:1.54.10.2 --- src/sys/arch/arm/arm32/bus_dma.c:1.54.10.1 Wed Nov 28 22:40:17 2012 +++ src/sys/arch/arm/arm32/bus_dma.c Wed Jan 16 22:44:18 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: bus_dma.c,v 1.54.10.1 2012/11/28 22:40:17 matt Exp $ */ +/* $NetBSD: bus_dma.c,v 1.54.10.2 2013/01/16 22:44:18 matt Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #define _ARM32_BUS_DMA_PRIVATE #include -__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.54.10.1 2012/11/28 22:40:17 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.54.10.2 2013/01/16 22:44:18 matt Exp $"); #include #include @@ -758,6 +758,20 @@ _bus_dmamap_sync_segment(vaddr_t va, pad cpu_dcache_wb_range(va, len); cpu_sdcache_wb_range(va, pa, len); break; + +#ifdef CPU_CORTEX + /* + * Cortex CPUs can do speculative loads so we need to clean the cache + * after a DMA read to deal with any speculatively loaded cache lines. + * Since these can't be dirty, we can just invalidate them and don't + * have to worry about having to write back their contents. + */ + case BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE: + case BUS_DMASYNC_POSTREAD: + cpu_dcache_inv_range(va, len); + cpu_sdcache_inv_range(va, pa, len); + break; +#endif } } @@ -786,7 +800,7 @@ _bus_dmamap_sync_linear(bus_dma_tag_t t, if ((ds->_ds_flags & _BUS_DMAMAP_COHERENT) == 0) _bus_dmamap_sync_segment(va + offset, pa, seglen, ops, - false); + false); offset += seglen; len -= seglen; @@ -935,7 +949,9 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm * we are doing a PREREAD|PREWRITE, we can collapse * the whole thing into a single Wb-Inv. * - * POSTREAD -- Nothing. + * POSTREAD -- Re-invalidate the D-cache in case speculative + * memory accesses caused cachelines to become valid with now + * invalid data. * * POSTWRITE -- Nothing. */ @@ -946,7 +962,12 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm #endif const int pre_ops = ops & (BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); - if (!bouncing && pre_ops == 0) { +#ifdef CPU_CORTEX + const int post_ops = ops & (BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE); +#else + const int post_ops = 0; +#endif + if (!bouncing && pre_ops == 0 && post_ops == BUS_DMASYNC_POSTWRITE) { return; }
CVS commit: src/sys/arch/arm/arm32
Module Name:src Committed By: matt Date: Wed Jan 16 22:32:46 UTC 2013 Modified Files: src/sys/arch/arm/arm32: bus_dma.c Log Message: On Cortex, speculative loads can cache lines to be populated after then they've been invalidated for a DMA read. So after the DMA read we have to reinvalidate them again. We have to both invalidates since the former prevents dirty lines overwriting just DMAed data. To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/sys/arch/arm/arm32/bus_dma.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/arm32/bus_dma.c diff -u src/sys/arch/arm/arm32/bus_dma.c:1.66 src/sys/arch/arm/arm32/bus_dma.c:1.67 --- src/sys/arch/arm/arm32/bus_dma.c:1.66 Tue Oct 23 12:23:20 2012 +++ src/sys/arch/arm/arm32/bus_dma.c Wed Jan 16 22:32:45 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: bus_dma.c,v 1.66 2012/10/23 12:23:20 skrll Exp $ */ +/* $NetBSD: bus_dma.c,v 1.67 2013/01/16 22:32:45 matt Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #define _ARM32_BUS_DMA_PRIVATE #include -__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.66 2012/10/23 12:23:20 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.67 2013/01/16 22:32:45 matt Exp $"); #include #include @@ -758,6 +758,20 @@ _bus_dmamap_sync_segment(vaddr_t va, pad cpu_dcache_wb_range(va, len); cpu_sdcache_wb_range(va, pa, len); break; + +#ifdef CPU_CORTEX + /* + * Cortex CPUs can do speculative loads so we need to clean the cache + * after a DMA read to deal with any speculatively loaded cache lines. + * Since these can't be dirty, we can just invalidate them and don't + * have to worry about having to write back their contents. + */ + case BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE: + case BUS_DMASYNC_POSTREAD: + cpu_dcache_inv_range(va, len); + cpu_sdcache_inv_range(va, pa, len); + break; +#endif } } @@ -786,7 +800,7 @@ _bus_dmamap_sync_linear(bus_dma_tag_t t, if ((ds->_ds_flags & _BUS_DMAMAP_COHERENT) == 0) _bus_dmamap_sync_segment(va + offset, pa, seglen, ops, - false); + false); offset += seglen; len -= seglen; @@ -935,7 +949,9 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm * we are doing a PREREAD|PREWRITE, we can collapse * the whole thing into a single Wb-Inv. * - * POSTREAD -- Nothing. + * POSTREAD -- Re-invalidate the D-cache in case speculative + * memory accesses caused cachelines to become valid with now + * invalid data. * * POSTWRITE -- Nothing. */ @@ -946,7 +962,12 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm #endif const int pre_ops = ops & (BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); - if (!bouncing && pre_ops == 0) { +#ifdef CPU_CORTEX + const int post_ops = ops & (BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE); +#else + const int post_ops = 0; +#endif + if (!bouncing && pre_ops == 0 && post_ops == BUS_DMASYNC_POSTWRITE) { return; }
CVS commit: src/common/lib/libc/arch/arm/gen
Module Name:src Committed By: matt Date: Wed Jan 16 21:48:56 UTC 2013 Modified Files: src/common/lib/libc/arch/arm/gen: byte_swap_4.S Log Message: Add some comments to illustrate what is actually happening. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/common/lib/libc/arch/arm/gen/byte_swap_4.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/arch/arm/gen/byte_swap_4.S diff -u src/common/lib/libc/arch/arm/gen/byte_swap_4.S:1.5 src/common/lib/libc/arch/arm/gen/byte_swap_4.S:1.6 --- src/common/lib/libc/arch/arm/gen/byte_swap_4.S:1.5 Tue Nov 27 23:57:07 2012 +++ src/common/lib/libc/arch/arm/gen/byte_swap_4.S Wed Jan 16 21:48:56 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: byte_swap_4.S,v 1.5 2012/11/27 23:57:07 matt Exp $ */ +/* $NetBSD: byte_swap_4.S,v 1.6 2013/01/16 21:48:56 matt Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -42,11 +42,11 @@ _ENTRY(_C_LABEL(htonl)) #endif _PROF_PROLOGUE #ifdef _ARM_ARCH_6 - rev r0, r0 + rev r0, r0 #else - eor r1, r0, r0, ror #16 - bic r1, r1, #0x00FF - mov r0, r0, ror #8 - eor r0, r0, r1, lsr #8 + eor r1, r0, r0, ror #16 /* 4.3.2.1 -> 42.31.42.31 */ + bic r1, r1, #0x00FF /* 42.31.42.31 -> 42.0.42.31 */ + mov r0, r0, ror #8 /* 4.3.2.1 -> 1.4.3.2 */ + eor r0, r0, r1, lsr #8 /* 1.4.3.2 ^ 0.42.0.42 -> 1.2.3.4 */ #endif RET
CVS commit: src/sys/fs/puffs
Module Name:src Committed By: pooka Date: Wed Jan 16 21:10:14 UTC 2013 Modified Files: src/sys/fs/puffs: puffs_vfsops.c Log Message: Do the protocol consistency check hack only when compiling ELF. To generate a diff of this commit: cvs rdiff -u -r1.106 -r1.107 src/sys/fs/puffs/puffs_vfsops.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/fs/puffs/puffs_vfsops.c diff -u src/sys/fs/puffs/puffs_vfsops.c:1.106 src/sys/fs/puffs/puffs_vfsops.c:1.107 --- src/sys/fs/puffs/puffs_vfsops.c:1.106 Thu Aug 9 07:46:18 2012 +++ src/sys/fs/puffs/puffs_vfsops.c Wed Jan 16 21:10:14 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: puffs_vfsops.c,v 1.106 2012/08/09 07:46:18 manu Exp $ */ +/* $NetBSD: puffs_vfsops.c,v 1.107 2013/01/16 21:10:14 pooka Exp $ */ /* * Copyright (c) 2005, 2006 Antti Kantee. All Rights Reserved. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: puffs_vfsops.c,v 1.106 2012/08/09 07:46:18 manu Exp $"); +__KERNEL_RCSID(0, "$NetBSD: puffs_vfsops.c,v 1.107 2013/01/16 21:10:14 pooka Exp $"); #include #include @@ -85,7 +85,7 @@ static struct putter_ops puffs_putter = * Try to ensure data structures used by the puffs protocol * do not unexpectedly change. */ -#ifdef __i386__ +#if defined(__i386__) && defined(__ELF__) CTASSERT(sizeof(struct puffs_kargs) == 3928); CTASSERT(sizeof(struct vattr) == 136); CTASSERT(sizeof(struct puffs_req) == 44);
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: macallan Date: Wed Jan 16 20:34:10 UTC 2013 Modified Files: src/sys/arch/arm/omap: omapfb.c Log Message: copy data in 32bit chunks whenever alignment permits -> very noticeable speedup To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/omap/omapfb.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/omap/omapfb.c diff -u src/sys/arch/arm/omap/omapfb.c:1.11 src/sys/arch/arm/omap/omapfb.c:1.12 --- src/sys/arch/arm/omap/omapfb.c:1.11 Wed Jan 16 00:09:27 2013 +++ src/sys/arch/arm/omap/omapfb.c Wed Jan 16 20:34:10 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: omapfb.c,v 1.11 2013/01/16 00:09:27 macallan Exp $ */ +/* $NetBSD: omapfb.c,v 1.12 2013/01/16 20:34:10 macallan Exp $ */ /* * Copyright (c) 2010 Michael Lorenz @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: omapfb.c,v 1.11 2013/01/16 00:09:27 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omapfb.c,v 1.12 2013/01/16 20:34:10 macallan Exp $"); #include #include @@ -642,14 +642,43 @@ static void omapfb_rectfill(struct omapfb_softc *sc, int x, int y, int wi, int he, uint32_t colour) { - int width_in_bytes = wi * (sc->sc_depth >> 3); + int bpp = sc->sc_depth >> 3; /* bytes per pixel */ + int width_in_bytes = wi * bpp; + uint32_t daddr; + daddr = sc->sc_fbhwaddr + sc->sc_stride * y + x * bpp; omapfb_wait_idle(sc); + /* + * stupid hardware + * in 32bit mode the DMA controller always writes 0 into the upper byte, so we + * can use this mode only if we actually want that + */ + if (((colour & 0xff00) == 0) && + (((daddr | width_in_bytes) & 3) == 0)) { + /* + * everything is properly aligned so we can copy stuff in + * 32bit chunks instead of pixel by pixel + */ + wi = wi >> 1; + + /* just in case */ + colour |= colour << 16; + + omapdma_write_ch_reg(0, OMAPDMAC_CSDPI, + CSDPI_SRC_BURST_64 | CSDPI_DST_BURST_64 | + CSDPI_DST_PACKED | CSDPI_WRITE_POSTED_EXCEPT_LAST | + CSDPI_DATA_TYPE_32); + } else { + omapdma_write_ch_reg(0, OMAPDMAC_CSDPI, + CSDPI_SRC_BURST_64 | CSDPI_DST_BURST_64 | + CSDPI_DST_PACKED | CSDPI_WRITE_POSTED_EXCEPT_LAST | + CSDPI_DATA_TYPE_16); + } + omapdma_write_ch_reg(0, OMAPDMAC_CEN, wi); omapdma_write_ch_reg(0, OMAPDMAC_CFN, he); - omapdma_write_ch_reg(0, OMAPDMAC_CDSA, - sc->sc_fbhwaddr + sc->sc_stride * y + x * (sc->sc_depth >> 3)); + omapdma_write_ch_reg(0, OMAPDMAC_CDSA, daddr); omapdma_write_ch_reg(0, OMAPDMAC_CCR, CCR_CONST_FILL_ENABLE | CCR_DST_AMODE_DOUBLE_INDEX | CCR_SRC_AMODE_CONST_ADDR); @@ -665,14 +694,19 @@ static void omapfb_bitblt(struct omapfb_softc *sc, int xs, int ys, int xd, int yd, int wi, int he, int rop) { - int width_in_bytes = wi * (sc->sc_depth >> 3); + int bpp = sc->sc_depth >> 3; /* bytes per pixel */ + int width_in_bytes = wi * bpp; + int hstep, vstep; uint32_t saddr, daddr; - omapfb_wait_idle(sc); - - saddr = sc->sc_fbhwaddr + sc->sc_stride * ys + xs * (sc->sc_depth >> 3); - daddr = sc->sc_fbhwaddr + sc->sc_stride * yd + xd * (sc->sc_depth >> 3); + /* + * TODO: + * - use 32bit transfers if we're properly aligned + */ + saddr = sc->sc_fbhwaddr + sc->sc_stride * ys + xs * bpp; + daddr = sc->sc_fbhwaddr + sc->sc_stride * yd + xd * bpp; + if (ys < yd) { /* need to go vertically backwards */ vstep = 1 - (sc->sc_stride + width_in_bytes); @@ -686,12 +720,30 @@ omapfb_bitblt(struct omapfb_softc *sc, i * and destination pixels are on the same line */ hstep = 1 - (sc->sc_depth >> 2); - vstep = sc->sc_stride + (sc->sc_depth >> 3) * (wi - 1) + 1; - saddr += (sc->sc_depth >> 3) * (wi - 1); - daddr += (sc->sc_depth >> 3) * (wi - 1); + vstep = sc->sc_stride + bpp * (wi - 1) + 1; + saddr += bpp * (wi - 1); + daddr += bpp * (wi - 1); } else hstep = 1; + omapfb_wait_idle(sc); + if (((saddr | daddr | width_in_bytes) & 3) == 0) { + /* + * everything is properly aligned so we can copy stuff in + * 32bit chunks instead of pixel by pixel + */ + wi = wi >> 1; + omapdma_write_ch_reg(0, OMAPDMAC_CSDPI, + CSDPI_SRC_BURST_64 | CSDPI_DST_BURST_64 | + CSDPI_DST_PACKED | CSDPI_WRITE_POSTED_EXCEPT_LAST | + CSDPI_DATA_TYPE_32); + } else { + omapdma_write_ch_reg(0, OMAPDMAC_CSDPI, + CSDPI_SRC_BURST_64 | CSDPI_DST_BURST_64 | + CSDPI_DST_PACKED | CSDPI_WRITE_POSTED_EXCEPT_LAST | + CSDPI_DATA_TYPE_16); + } + omapdma_write_ch_reg(0, OMAPDMAC_CEN, wi); omapdma_write_ch_reg(0, OMAPDMAC_CFN, he); omapdma_write_ch_reg(0, OMAPDMAC_CSSA, saddr);
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: macallan Date: Wed Jan 16 20:32:24 UTC 2013 Modified Files: src/sys/arch/arm/omap: omap3_sdmareg.h Log Message: fix some bit #define, now the name actually makes some sense To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/omap/omap3_sdmareg.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/arch/arm/omap/omap3_sdmareg.h diff -u src/sys/arch/arm/omap/omap3_sdmareg.h:1.2 src/sys/arch/arm/omap/omap3_sdmareg.h:1.3 --- src/sys/arch/arm/omap/omap3_sdmareg.h:1.2 Wed Jan 9 04:38:14 2013 +++ src/sys/arch/arm/omap/omap3_sdmareg.h Wed Jan 16 20:32:24 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: omap3_sdmareg.h,v 1.2 2013/01/09 04:38:14 macallan Exp $ */ +/* $NetBSD: omap3_sdmareg.h,v 1.3 2013/01/16 20:32:24 macallan Exp $ */ /* * Copyright (c) 2012 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: omap3_sdmareg.h,v 1.2 2013/01/09 04:38:14 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap3_sdmareg.h,v 1.3 2013/01/16 20:32:24 macallan Exp $"); #ifndef OMAPDMA_REG_H #define OMAPDMA_REG_H @@ -154,7 +154,7 @@ __KERNEL_RCSID(0, "$NetBSD: omap3_sdmare #define CSDPI_WRITE_MODE_MASK 0x00018000 #define CSDPI_WRITE_NONPOSTED 0x #define CSDPI_WRITE_POSTED 0x8000 - #define CSDPI_WRITE_EXCEPT_LAST 0x0001 + #define CSDPI_WRITE_POSTED_EXCEPT_LAST 0x0001 #define CSDPI_DST_BURST_MASK 0xc000 #define CSDPI_DST_BURST_SINGLE 0x #define CSDPI_DST_BURST_16 0x4000
CVS commit: src/sys/dev/usb
Module Name:src Committed By: christos Date: Wed Jan 16 17:18:55 UTC 2013 Modified Files: src/sys/dev/usb: if_axe.c Log Message: fix misplaced paren To generate a diff of this commit: cvs rdiff -u -r1.62 -r1.63 src/sys/dev/usb/if_axe.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_axe.c diff -u src/sys/dev/usb/if_axe.c:1.62 src/sys/dev/usb/if_axe.c:1.63 --- src/sys/dev/usb/if_axe.c:1.62 Fri Jan 4 20:30:15 2013 +++ src/sys/dev/usb/if_axe.c Wed Jan 16 12:18:55 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: if_axe.c,v 1.62 2013/01/05 01:30:15 christos Exp $ */ +/* $NetBSD: if_axe.c,v 1.63 2013/01/16 17:18:55 christos Exp $ */ /* $OpenBSD: if_axe.c,v 1.96 2010/01/09 05:33:08 jsg Exp $ */ /* @@ -89,7 +89,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.62 2013/01/05 01:30:15 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.63 2013/01/16 17:18:55 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -930,7 +930,7 @@ axe_rxeof(usbd_xfer_handle xfer, usbd_pr goto done; } - rxlen = le16toh(hdr.len & AXE_RH1M_RXLEN_MASK); + rxlen = le16toh(hdr.len) & AXE_RH1M_RXLEN_MASK; if (total_len < rxlen) { pktlen = total_len; total_len = 0;
CVS commit: src/distrib/sets
Module Name:src Committed By: christos Date: Wed Jan 16 16:01:09 UTC 2013 Modified Files: src/distrib/sets: maketars sets.subr src/distrib/sets/lists/comp: ad.arm ad.armeb ad.m68k ad.m68k.shl ad.mips ad.mips64eb ad.mips64el ad.powerpc md.acorn32 md.alpha md.amd64 md.amiga md.atari md.bebox md.evbarm md.hp300 md.hp700 md.hpcarm md.hpcmips md.hpcsh md.i386 md.macppc md.mipsco md.mmeye md.mvme68k md.ofppc md.prep md.rs6000 md.sgimips md.shark md.sparc md.sparc64 md.sun2 md.sun3 md.vax md.x68k md.zaurus mi shl.mi src/distrib/sets/lists/misc: mi src/distrib/sets/lists/tests: mi module.mi shl.mi src/distrib/sets/lists/xcomp: md.acorn32 md.alpha md.amd64 md.amiga md.cats md.dreamcast md.evbmips md.ews4800mips md.hp300 md.hpcarm md.hpcmips md.hpcsh md.i386 md.luna68k md.mac68k md.macppc md.netwinder md.newsmips md.ofppc md.pmax md.sgimips md.shark md.sparc md.sparc64 md.sun3 md.vax md.x68k md.zaurus mi shl.mi src/distrib/sets/lists/xserver: md.alpha md.amd64 md.bebox md.cats md.dreamcast md.evbarm md.evbmips md.ews4800mips md.hp300 md.hpcarm md.hpcmips md.hpcsh md.i386 md.luna68k md.macppc md.netwinder md.newsmips md.ofppc md.prep md.sgimips md.shark md.sparc md.sparc64 md.vax md.zaurus Added Files: src/distrib/sets/lists/debug: ad.arm ad.armeb ad.m68k ad.m68k.shl ad.mips ad.mips64eb ad.mips64el ad.powerpc md.acorn32 md.alpha md.amd64 md.amiga md.atari md.bebox md.cats md.dreamcast md.evbarm md.evbarm.armeb md.evbmips md.ews4800mips md.hp300 md.hp700 md.hpcarm md.hpcmips md.hpcsh md.i386 md.luna68k md.mac68k md.macppc md.mipsco md.mmeye md.mvme68k md.netwinder md.newsmips md.ofppc md.pmax md.prep md.rs6000 md.sgimips md.shark md.sparc md.sparc64 md.sun2 md.sun3 md.vax md.x68k md.zaurus mi module.mi shl.mi Log Message: Add a new "debug" set that gets built when ${MKDEBUG} is set. On evbarm: -rw-r--r-- 1 root src 35806068 Jan 16 10:47 base.tgz -rw-r--r-- 1 root src 57374069 Jan 16 10:48 comp.tgz -rw-r--r-- 1 root src 101286193 Jan 16 10:49 debug.tgz ... This allows always building the debugging code and libraries but not installing it (although now it is placed in the default sets if ${MKDEBUG} is set To generate a diff of this commit: cvs rdiff -u -r1.74 -r1.75 src/distrib/sets/maketars cvs rdiff -u -r1.140 -r1.141 src/distrib/sets/sets.subr cvs rdiff -u -r1.42 -r1.43 src/distrib/sets/lists/comp/ad.arm cvs rdiff -u -r1.9 -r1.10 src/distrib/sets/lists/comp/ad.armeb \ src/distrib/sets/lists/comp/md.hp700 cvs rdiff -u -r1.45 -r1.46 src/distrib/sets/lists/comp/ad.m68k cvs rdiff -u -r1.8 -r1.9 src/distrib/sets/lists/comp/ad.m68k.shl cvs rdiff -u -r1.39 -r1.40 src/distrib/sets/lists/comp/ad.mips cvs rdiff -u -r1.97 -r1.98 src/distrib/sets/lists/comp/ad.mips64eb cvs rdiff -u -r1.99 -r1.100 src/distrib/sets/lists/comp/ad.mips64el cvs rdiff -u -r1.59 -r1.60 src/distrib/sets/lists/comp/ad.powerpc \ src/distrib/sets/lists/comp/md.x68k cvs rdiff -u -r1.27 -r1.28 src/distrib/sets/lists/comp/md.acorn32 \ src/distrib/sets/lists/comp/md.prep cvs rdiff -u -r1.63 -r1.64 src/distrib/sets/lists/comp/md.alpha cvs rdiff -u -r1.187 -r1.188 src/distrib/sets/lists/comp/md.amd64 cvs rdiff -u -r1.58 -r1.59 src/distrib/sets/lists/comp/md.amiga \ src/distrib/sets/lists/comp/md.atari cvs rdiff -u -r1.35 -r1.36 src/distrib/sets/lists/comp/md.bebox cvs rdiff -u -r1.17 -r1.18 src/distrib/sets/lists/comp/md.evbarm cvs rdiff -u -r1.61 -r1.62 src/distrib/sets/lists/comp/md.hp300 \ src/distrib/sets/lists/comp/md.sun3 cvs rdiff -u -r1.18 -r1.19 src/distrib/sets/lists/comp/md.hpcarm \ src/distrib/sets/lists/comp/md.sgimips cvs rdiff -u -r1.30 -r1.31 src/distrib/sets/lists/comp/md.hpcmips \ src/distrib/sets/lists/comp/md.mmeye cvs rdiff -u -r1.26 -r1.27 src/distrib/sets/lists/comp/md.hpcsh cvs rdiff -u -r1.131 -r1.132 src/distrib/sets/lists/comp/md.i386 cvs rdiff -u -r1.36 -r1.37 src/distrib/sets/lists/comp/md.macppc \ src/distrib/sets/lists/comp/md.mvme68k cvs rdiff -u -r1.21 -r1.22 src/distrib/sets/lists/comp/md.mipsco \ src/distrib/sets/lists/comp/md.shark cvs rdiff -u -r1.13 -r1.14 src/distrib/sets/lists/comp/md.ofppc cvs rdiff -u -r1.5 -r1.6 src/distrib/sets/lists/comp/md.rs6000 cvs rdiff -u -r1.77 -r1.78 src/distrib/sets/lists/comp/md.sparc cvs rdiff -u -r1.164 -r1.165 src/distrib/sets/lists/comp/md.sparc64 cvs rdiff -u -r1.19 -r1.20 src/distrib/sets/lists/comp/md.sun2 cvs rdiff -u -r1.37 -r1.38 src/distrib/sets/lists/comp/md.vax cvs rdiff -u -r1.10 -r1.11 src/distrib/sets/lists/comp/md.zaurus cvs rdiff -u -r1.1796 -r1.1797 src/distrib/sets/lists/comp/mi cvs rdiff -u -r1.244 -r1.245 src/distrib/sets/lists/comp/shl.mi cvs rdiff -u -r0 -r1.1 src/distrib/sets/lists/debug/ad.arm \
CVS commit: src/distrib/utils/embedded
Module Name:src Committed By: christos Date: Wed Jan 16 15:58:19 UTC 2013 Modified Files: src/distrib/utils/embedded: mkimage Log Message: tidy up some more by factoring out the sizing code. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/distrib/utils/embedded/mkimage 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/mkimage diff -u src/distrib/utils/embedded/mkimage:1.11 src/distrib/utils/embedded/mkimage:1.12 --- src/distrib/utils/embedded/mkimage:1.11 Tue Jan 15 16:04:41 2013 +++ src/distrib/utils/embedded/mkimage Wed Jan 16 10:58:19 2013 @@ -1,6 +1,6 @@ #! /bin/sh -# $NetBSD: mkimage,v 1.11 2013/01/15 21:04:41 christos Exp $ +# $NetBSD: mkimage,v 1.12 2013/01/16 15:58:19 christos Exp $ # Copyright (c) 2012 Alistair Crooks # All rights reserved. @@ -68,6 +68,32 @@ next_avail () echo "${dev}${N}" } +usage() { + cat << EOF 1>&2 +Usage: $PROG [-S ] [-c ] [-h ] [-s ] +EOF +exit 1 +} + +# Return the filesystem size for an ls -l or tar -xvf list +# Directories and symlinks in tar are 0 size, we assume one block +# (which is too much), we round up by the fragment size the rest. +getfssize() { + local bsize="$1" + local fsize="$2" + + awk -v fsize=${fsize} -v bsize=${bsize} ' + NF >= 9 && $1 != "tar:" { + if ($5 == 0) + tot += bsize; + else + tot += ((int)(($5 + fsize - 1) / fsize)) * fsize; + } + END { + printf("%d\n", tot); + }' +} + # find the size of the gzipped files in a .tgz archive # Directories appear as 0, so count them as one block # and round up files to a fragment. @@ -78,19 +104,10 @@ sizeone() { echo 0 return; fi + case "$1" in *.tgz|*.tar.gz|*.tbz|*.tar.bz2|*.txz|*.tar.xz) -tar tvzf "$1" | - awk -v fsize=${fsize} -v bsize=${bsize} ' - { - if ($5 == 0) -tot += bsize; - else -tot += ((int)(($5 + fsize - 1) / fsize)) * fsize; - } - END { - printf("%d\n", tot); - }' +tar tvzf "$1" | getfssize ${bsize} ${fsize} ;; *) echo 0 @@ -98,12 +115,6 @@ sizeone() { esac } -usage() { - cat << EOF 1>&2 -Usage: $PROG [-S ] [-c ] [-h ] [-s ] -EOF -exit 1 -} # Return the usable filesystem size in bytes, given the total size in bytes, # and optionally block and fragment sizes @@ -181,6 +192,7 @@ obj="/usr/obj" # Presumable block and fragment size. bsize=16384 fsize=2048 +mtob=$(( 1024 * 1024 )) # First pass for options to get the host OPTS="S:c:h:s:x" @@ -232,24 +244,23 @@ setbytes=0 echo -n "${bar} computing set sizes (" for s in ${sets}; do one="$(sizeone ${setsdir}/${s}.tgz)" - echo -n " $s=$(( ${one} / 1024 / 1024 ))MB" + echo -n " $s=$(( ${one} / ${mtob} ))MB" setbytes=$(( ${setbytes} + ${one} )) done -echo "): $(( ${setbytes} / 1024 / 1024 ))MB ${bar}" +echo "): $(( ${setbytes} / ${mtob} ))MB ${bar}" # calculate size of custom files custbytes=0 if [ -d "${custom}" ]; then - custbytes=$(ls -lR "${custom}" | - awk 'NF == 9 { tot += $5 } END { print tot }') + custbytes=$(ls -lR "${custom}" | getfssize ${bsize} ${fsize}) fi -echo "${bar} computing custom sizes: $(( ${custbytes} / 1024 / 1024 ))MB ${bar}" +echo "${bar} computing custom sizes: $(( ${custbytes} / ${mtob} ))MB ${bar}" # how many bytes rawbytes="$(( ${setbytes} + ${custbytes} ))" -echo -n "${bar} computing ffs filesystem size for $(( ${rawbytes} / 1024 / 1024 ))MB: " +echo -n "${bar} computing ffs filesystem size for $(( ${rawbytes} / ${mtob} ))MB: " ffsbytes="$(makeffssize "${rawbytes}")" -ffsmb=$(( ${ffsbytes} / 1024 / 1024 )) +ffsmb=$(( ${ffsbytes} / ${mtob} )) echo " ${ffsmb}MB ${bar}" # total in MB
CVS commit: src/sys/arch/luna68k/stand/boot
Module Name:src Committed By: tsutsui Date: Wed Jan 16 15:46:20 UTC 2013 Modified Files: src/sys/arch/luna68k/stand/boot: conf.c devopen.c samachdep.h version Log Message: Add UFS2 support. Also bump version. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/luna68k/stand/boot/conf.c \ src/sys/arch/luna68k/stand/boot/devopen.c cvs rdiff -u -r1.5 -r1.6 src/sys/arch/luna68k/stand/boot/samachdep.h cvs rdiff -u -r1.3 -r1.4 src/sys/arch/luna68k/stand/boot/version 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/luna68k/stand/boot/conf.c diff -u src/sys/arch/luna68k/stand/boot/conf.c:1.2 src/sys/arch/luna68k/stand/boot/conf.c:1.3 --- src/sys/arch/luna68k/stand/boot/conf.c:1.2 Sun Jan 13 14:10:55 2013 +++ src/sys/arch/luna68k/stand/boot/conf.c Wed Jan 16 15:46:20 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: conf.c,v 1.2 2013/01/13 14:10:55 tsutsui Exp $ */ +/* $NetBSD: conf.c,v 1.3 2013/01/16 15:46:20 tsutsui Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -92,11 +92,16 @@ int n_netif_drivers = __arraycount(netif * Filesystem configuration */ #ifdef SUPPORT_DISK -struct fs_ops file_system_ufs[] = { FS_OPS(ufs) }; +struct fs_ops file_system_disk[] = { + FS_OPS(ffsv1), + FS_OPS(ffsv2) +}; +int nfsys_disk = __arraycount(file_system_disk); #endif #ifdef SUPPORT_ETHERNET struct fs_ops file_system_nfs[] = { FS_OPS(nfs) }; #endif -struct fs_ops file_system[1]; +#define MAX_NFSYS 5 +struct fs_ops file_system[MAX_NFSYS]; int nfsys = 1; /* we always know which one we want */ Index: src/sys/arch/luna68k/stand/boot/devopen.c diff -u src/sys/arch/luna68k/stand/boot/devopen.c:1.2 src/sys/arch/luna68k/stand/boot/devopen.c:1.3 --- src/sys/arch/luna68k/stand/boot/devopen.c:1.2 Sun Jan 13 14:10:55 2013 +++ src/sys/arch/luna68k/stand/boot/devopen.c Wed Jan 16 15:46:20 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: devopen.c,v 1.2 2013/01/13 14:10:55 tsutsui Exp $ */ +/* $NetBSD: devopen.c,v 1.3 2013/01/16 15:46:20 tsutsui Exp $ */ /* * Copyright (c) 1992 OMRON Corporation. @@ -82,6 +82,7 @@ devopen(struct open_file *f, const char int dev, unit, part; int error; struct devsw *dp; + int i; if (make_device(fname, &dev, &unit, &part, file) != 0) return ENXIO; @@ -100,11 +101,15 @@ devopen(struct open_file *f, const char return error; } - file_system[0] = file_system_ufs[0]; + for (i = 0; i < nfsys_disk; i++) + file_system[i] = file_system_disk[i]; + nfsys = nfsys_disk; + #ifdef SUPPORT_ETHERNET if (strcmp(dp->dv_name, "le") == 0) { /* XXX mixing local fs_ops on netboot could be troublesome */ file_system[0] = file_system_nfs[0]; + nfsys = 1; } #endif Index: src/sys/arch/luna68k/stand/boot/samachdep.h diff -u src/sys/arch/luna68k/stand/boot/samachdep.h:1.5 src/sys/arch/luna68k/stand/boot/samachdep.h:1.6 --- src/sys/arch/luna68k/stand/boot/samachdep.h:1.5 Wed Jan 16 15:15:01 2013 +++ src/sys/arch/luna68k/stand/boot/samachdep.h Wed Jan 16 15:46:20 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: samachdep.h,v 1.5 2013/01/16 15:15:01 tsutsui Exp $ */ +/* $NetBSD: samachdep.h,v 1.6 2013/01/16 15:46:20 tsutsui Exp $ */ /* * Copyright (c) 1982, 1990, 1993 @@ -222,7 +222,8 @@ do { \ } while (__N > 0); \ } while (/* CONSTCOND */ 0) -extern struct fs_ops file_system_ufs[]; +extern struct fs_ops file_system_disk[]; +extern int nfsys_disk; extern struct fs_ops file_system_nfs[]; extern const char bootprog_name[], bootprog_rev[], bootprog_kernrev[]; Index: src/sys/arch/luna68k/stand/boot/version diff -u src/sys/arch/luna68k/stand/boot/version:1.3 src/sys/arch/luna68k/stand/boot/version:1.4 --- src/sys/arch/luna68k/stand/boot/version:1.3 Mon Jan 14 01:37:57 2013 +++ src/sys/arch/luna68k/stand/boot/version Wed Jan 16 15:46:20 2013 @@ -1,4 +1,4 @@ -$NetBSD: version,v 1.3 2013/01/14 01:37:57 tsutsui Exp $ +$NetBSD: version,v 1.4 2013/01/16 15:46:20 tsutsui Exp $ NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this file is important - make sure the entries are appended on end, last item @@ -7,3 +7,4 @@ is taken as the current. 1.0: Initial revision, based on 4.4BSD-Lite2/luna68k and NetBSD/hp300 1.1: Add netboot support. 1.2: Add support for secondary SPC SCSI on LUNA-II. +1.3: Add UFS2 support.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: christos Date: Wed Jan 16 15:36:49 UTC 2013 Modified Files: src/sys/dev/usb: usbdi.c Log Message: don't wait for completion if we were interrupted. To generate a diff of this commit: cvs rdiff -u -r1.143 -r1.144 src/sys/dev/usb/usbdi.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/usbdi.c diff -u src/sys/dev/usb/usbdi.c:1.143 src/sys/dev/usb/usbdi.c:1.144 --- src/sys/dev/usb/usbdi.c:1.143 Tue Jan 15 18:57:13 2013 +++ src/sys/dev/usb/usbdi.c Wed Jan 16 10:36:49 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: usbdi.c,v 1.143 2013/01/15 23:57:13 christos Exp $ */ +/* $NetBSD: usbdi.c,v 1.144 2013/01/16 15:36:49 christos Exp $ */ /* * Copyright (c) 1998, 2012 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.143 2013/01/15 23:57:13 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.144 2013/01/16 15:36:49 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -323,17 +323,20 @@ usbd_transfer(usbd_xfer_handle xfer) if (pipe->device->bus->use_polling) panic("usbd_transfer: not done"); + err = 0; if ((flags & USBD_SYNCHRONOUS_SIG) != 0) { if (pipe->device->bus->lock) cv_wait_sig(&xfer->cv, pipe->device->bus->lock); else -tsleep(xfer, PZERO|PCATCH, "usbsyn", 0); +err = tsleep(xfer, PZERO|PCATCH, "usbsyn", 0); } else { if (pipe->device->bus->lock) cv_wait(&xfer->cv, pipe->device->bus->lock); else -tsleep(xfer, PRIBIO, "usbsyn", 0); +err = tsleep(xfer, PRIBIO, "usbsyn", 0); } + if (err) + break; } usbd_unlock_pipe(pipe); return (xfer->status);
CVS commit: src/usr.bin/mail
Module Name:src Committed By: christos Date: Wed Jan 16 15:21:42 UTC 2013 Modified Files: src/usr.bin/mail: head.c Log Message: From: Steffen "Daode" Nurpmeso: Amend the previous commit to support zone-style RFC 822 dates. RFC 5322 marks this zone-style as obsolete (obs-zone), but still supports it. But then, even if you don't wanna support military style single-letter zones, the UT zone exists and will not be supported by this commit. The changes here are not strictly correct (since not all possible single-letter zones are assigned, and only *UT* has two letters), but which will match all thre possible *obs-zone* forms. Compiled and tested on a single MBOX. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/usr.bin/mail/head.c 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/mail/head.c diff -u src/usr.bin/mail/head.c:1.23 src/usr.bin/mail/head.c:1.24 --- src/usr.bin/mail/head.c:1.23 Tue Jan 15 12:25:42 2013 +++ src/usr.bin/mail/head.c Wed Jan 16 10:21:42 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: head.c,v 1.23 2013/01/15 17:25:42 christos Exp $ */ +/* $NetBSD: head.c,v 1.24 2013/01/16 15:21:42 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)head.c 8.2 (Berkeley) 4/20/95"; #else -__RCSID("$NetBSD: head.c,v 1.23 2013/01/15 17:25:42 christos Exp $"); +__RCSID("$NetBSD: head.c,v 1.24 2013/01/16 15:21:42 christos Exp $"); #endif #endif /* not lint */ @@ -115,22 +115,52 @@ cmatch(const char *cp, const char *tp) * 'N' A new line * '+' A plus or minus sign */ -static const char *datetypes[] = { - "Aaa Aaa O0 00:00:00 ", /* BSD ctype */ - "Aaa Aaa O0 00:00 ", /* SysV ctype */ - "Aaa Aaa O0 00:00:00 AAA ", /* BSD tmztype */ - "Aaa Aaa O0 00:00 AAA ", /* SysV tmztype */ - "Aaa Aaa O0 00:00:00 +", /* RFC822 type */ - "Aaa Aaa O0 00:00:00 AAA", /* RFC822 alttype */ +static struct cmatch_data { + size_t tlen; + char const *tdata; +} const cmatch_data[] = { +#define TSZ(a) (sizeof(a) - 1), a + { TSZ("Aaa Aaa O0 00:00:00 ") }, /* BSD ctype */ + { TSZ("Aaa Aaa O0 00:00 ") }, /* SysV ctype */ + { TSZ("Aaa Aaa O0 00:00:00 AAA ") }, /* BSD tmztype */ + { TSZ("Aaa Aaa O0 00:00 AAA ") }, /* SysV tmztype */ + /* + * RFC 822-alike From_ lines do not conform to RFC 4155, but seem to + * be used in the wild by UW-imap (MBX format plus) + */ + { TSZ("Aaa Aaa O0 00:00:00 +") }, /* RFC822, UT offset */ + /* + * RFC 822 with zone spec: + *1. military, + *2. UT, + *3. north america time zone strings + * note that 1. is strictly speaking not correct as some letters are + * not used + */ + { TSZ("Aaa Aaa O0 00:00:00 A") }, + { TSZ("Aaa Aaa O0 00:00:00 AA") }, +{ TSZ("Aaa Aaa O0 00:00:00 AAA") }, + { 0, NULL }, }; static int isdate(const char date[]) { + static size_t cmatch_minlen = 0; + struct cmatch_data const *cmdp; + size_t dl = strlen(date); + + if (cmatch_minlen == 0) + for (cmdp = cmatch_data; cmdp->tdata != NULL; ++cmdp) + cmatch_minlen = MIN(cmatch_minlen, cmdp->tlen); - for (size_t i = 0; i < __arraycount(datetypes); i++) - if (cmatch(date, datetypes[i])) + if (dl < cmatch_minlen) + return 0; + + for (cmdp = cmatch_data; cmdp->tdata != NULL; ++cmdp) + if (dl == cmdp->tlen && cmatch(date, cmdp->tdata)) return 1; + return 0; }
CVS commit: src/sys/arch/luna68k/stand/boot
Module Name:src Committed By: tsutsui Date: Wed Jan 16 15:15:02 UTC 2013 Modified Files: src/sys/arch/luna68k/stand/boot: Makefile parse.c samachdep.h Added Files: src/sys/arch/luna68k/stand/boot: ls.c Log Message: Enable and add ls command for ufs. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/luna68k/stand/boot/Makefile cvs rdiff -u -r0 -r1.1 src/sys/arch/luna68k/stand/boot/ls.c cvs rdiff -u -r1.1 -r1.2 src/sys/arch/luna68k/stand/boot/parse.c cvs rdiff -u -r1.4 -r1.5 src/sys/arch/luna68k/stand/boot/samachdep.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/arch/luna68k/stand/boot/Makefile diff -u src/sys/arch/luna68k/stand/boot/Makefile:1.5 src/sys/arch/luna68k/stand/boot/Makefile:1.6 --- src/sys/arch/luna68k/stand/boot/Makefile:1.5 Sun Jan 13 14:10:55 2013 +++ src/sys/arch/luna68k/stand/boot/Makefile Wed Jan 16 15:15:01 2013 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.5 2013/01/13 14:10:55 tsutsui Exp $ +# $NetBSD: Makefile,v 1.6 2013/01/16 15:15:01 tsutsui Exp $ # @(#)Makefile 8.2 (Berkeley) 8/15/93 NOMAN= # defined @@ -18,6 +18,7 @@ CPPFLAGS+= -DSUPPORT_ETHERNET CPPFLAGS+= -DSUPPORT_DHCP -DSUPPORT_BOOTP #CPPFLAGS+= -DBOOTP_DEBUG -DNETIF_DEBUG -DETHER_DEBUG -DNFS_DEBUG #CPPFLAGS+= -DRPC_DEBUG -DRARP_DEBUG -DNET_DEBUG -DDEBUG -DPARANOID +CPPFLAGS+= -DLIBSA_ENABLE_LS_OP CPPFLAGS+= -DLIBSA_PRINTF_WIDTH_SUPPORT CFLAGS= -Os -msoft-float @@ -46,6 +47,7 @@ SRCS+= scsi.c sc.c sd.c SRCS+= disklabel.c #SRCS+= fsdump.c SRCS+= ufs_disksubr.c +SRCS+= ls.c # netboot support SRCS+= if_le.c lance.c getsecs.c @@ -69,7 +71,7 @@ Z_AS= library ### find out what to use for libsa SA_AS= library -SAMISCMAKEFLAGS+=SA_USE_LOADFILE=yes SA_USE_CREAD=yes +SAMISCMAKEFLAGS+=SA_USE_LOADFILE=yes SA_USE_CREAD=yes SA_ENABLE_LS_OP=yes .include "${S}/lib/libsa/Makefile.inc" LIBS= ${SALIB} ${ZLIB} ${KERNLIB} Index: src/sys/arch/luna68k/stand/boot/parse.c diff -u src/sys/arch/luna68k/stand/boot/parse.c:1.1 src/sys/arch/luna68k/stand/boot/parse.c:1.2 --- src/sys/arch/luna68k/stand/boot/parse.c:1.1 Sat Jan 5 17:44:24 2013 +++ src/sys/arch/luna68k/stand/boot/parse.c Wed Jan 16 15:15:01 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.1 2013/01/05 17:44:24 tsutsui Exp $ */ +/* $NetBSD: parse.c,v 1.2 2013/01/16 15:15:01 tsutsui Exp $ */ /* * Copyright (c) 1992 OMRON Corporation. @@ -112,6 +112,7 @@ struct command_entry entries[] = { { "fsrestore", fsrestore}, #endif { "howto", how_to_boot }, + { "ls", cmd_ls }, { "screen", screen }, #ifdef notyet { "tape", tape }, Index: src/sys/arch/luna68k/stand/boot/samachdep.h diff -u src/sys/arch/luna68k/stand/boot/samachdep.h:1.4 src/sys/arch/luna68k/stand/boot/samachdep.h:1.5 --- src/sys/arch/luna68k/stand/boot/samachdep.h:1.4 Mon Jan 14 01:37:57 2013 +++ src/sys/arch/luna68k/stand/boot/samachdep.h Wed Jan 16 15:15:01 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: samachdep.h,v 1.4 2013/01/14 01:37:57 tsutsui Exp $ */ +/* $NetBSD: samachdep.h,v 1.5 2013/01/16 15:15:01 tsutsui Exp $ */ /* * Copyright (c) 1982, 1990, 1993 @@ -144,6 +144,9 @@ int spl4(void); int spl5(void); int spl6(void); +/* ls.c */ +int cmd_ls(int, char **); + /* machdep.c */ void straytrap(int); int badaddr(volatile void *); Added files: Index: src/sys/arch/luna68k/stand/boot/ls.c diff -u /dev/null src/sys/arch/luna68k/stand/boot/ls.c:1.1 --- /dev/null Wed Jan 16 15:15:02 2013 +++ src/sys/arch/luna68k/stand/boot/ls.c Wed Jan 16 15:15:01 2013 @@ -0,0 +1,53 @@ +/* $NetBSD: ls.c,v 1.1 2013/01/16 15:15:01 tsutsui Exp $ */ + +/* + * Copyright (c) 2001 Minoura Makoto + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, E
CVS commit: src/usr.sbin/ldpd
Module Name:src Committed By: kefren Date: Wed Jan 16 08:28:46 UTC 2013 Modified Files: src/usr.sbin/ldpd: mpls_routes.h socketops.c Log Message: Make sure there is enough space for sockaddr subtypes Use u_char for IP_MULTICAST_LOOP as specified in in.h To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/ldpd/mpls_routes.h cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/ldpd/socketops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/ldpd/mpls_routes.h diff -u src/usr.sbin/ldpd/mpls_routes.h:1.1 src/usr.sbin/ldpd/mpls_routes.h:1.2 --- src/usr.sbin/ldpd/mpls_routes.h:1.1 Wed Dec 8 07:20:15 2010 +++ src/usr.sbin/ldpd/mpls_routes.h Wed Jan 16 08:28:44 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: mpls_routes.h,v 1.1 2010/12/08 07:20:15 kefren Exp $ */ +/* $NetBSD: mpls_routes.h,v 1.2 2013/01/16 08:28:44 kefren Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -49,6 +49,7 @@ union sockunion { struct sockaddr sa; struct sockaddr_in sin; + struct sockaddr_in6 sin6; struct sockaddr_mpls smpls; struct sockaddr_dl sdl; }; Index: src/usr.sbin/ldpd/socketops.c diff -u src/usr.sbin/ldpd/socketops.c:1.15 src/usr.sbin/ldpd/socketops.c:1.16 --- src/usr.sbin/ldpd/socketops.c:1.15 Tue Nov 13 06:58:58 2012 +++ src/usr.sbin/ldpd/socketops.c Wed Jan 16 08:28:45 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: socketops.c,v 1.15 2012/11/13 06:58:58 kefren Exp $ */ +/* $NetBSD: socketops.c,v 1.16 2013/01/16 08:28:45 kefren Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -147,8 +147,8 @@ create_hello_sockets() #endif /* We don't need to receive back our messages */ - if (setsockopt(s, IPPROTO_IP, IP_MULTICAST_LOOP, &(uint8_t){0}, - sizeof(uint8_t)) == -1) { + if (setsockopt(s, IPPROTO_IP, IP_MULTICAST_LOOP, &(u_char){0}, + sizeof(u_char)) == -1) { fatalp("INET setsockopt IP_MCAST_LOOP: %s\n", strerror(errno)); goto chs_error; } @@ -260,27 +260,25 @@ socket_reuse_port(int s) static int bind_socket(int s, uint8_t stype) { - struct sockaddr sa; + union sockunion su; assert (stype == 4 || stype == 6); if (stype == 4) { - struct sockaddr_in *sa_inet = (struct sockaddr_in *)(&sa); - sa_inet->sin_len = sizeof(*sa_inet); - sa_inet->sin_family = AF_INET; - sa_inet->sin_addr.s_addr = INADDR_ANY; - sa_inet->sin_port = htons(LDP_PORT); + su.sin.sin_len = sizeof(su.sin); + su.sin.sin_family = AF_INET; + su.sin.sin_addr.s_addr = INADDR_ANY; + su.sin.sin_port = htons(LDP_PORT); } #ifdef INET6 else if (stype == 6) { - struct sockaddr_in6 *sa_inet6 = (struct sockaddr_in6 *)(&sa); - sa_inet6->sin6_len = sizeof(*sa_inet6); - sa_inet6->sin6_family = AF_INET6; - sa_inet6->sin6_addr = in6addr_any; - sa_inet6->sin6_port = htons(LDP_PORT); + su.sin6.sin6_len = sizeof(su.sin6); + su.sin6.sin6_family = AF_INET6; + su.sin6.sin6_addr = in6addr_any; + su.sin6.sin6_port = htons(LDP_PORT); } #endif - if (bind(s, &sa, sa.sa_len)) { + if (bind(s, &su.sa, su.sa.sa_len)) { fatalp("bind_socket: %s\n", strerror(errno)); return -1; }