From owner-svn-src-user@FreeBSD.ORG Sun Jun 17 03:59:19 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4800C1065670; Sun, 17 Jun 2012 03:59:19 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2E0FD8FC15; Sun, 17 Jun 2012 03:59:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5H3xJmu083339; Sun, 17 Jun 2012 03:59:19 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5H3xIvA083309; Sun, 17 Jun 2012 03:59:18 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201206170359.q5H3xIvA083309@svn.freebsd.org> From: Alan Cox Date: Sun, 17 Jun 2012 03:59:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237181 - in user/alc/pvh_global_lock: . cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common contrib/gcc/config/arm etc gnu/lib/libgomp gnu/lib/libstdc++ inclu... X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jun 2012 03:59:19 -0000 Author: alc Date: Sun Jun 17 03:59:17 2012 New Revision: 237181 URL: http://svn.freebsd.org/changeset/base/237181 Log: MFC r237179 Added: user/alc/pvh_global_lock/sys/arm/include/atags.h - copied unchanged from r237179, head/sys/arm/include/atags.h user/alc/pvh_global_lock/tools/regression/usr.bin/make/variables/modifier_t/ - copied from r237179, head/tools/regression/usr.bin/make/variables/modifier_t/ Deleted: user/alc/pvh_global_lock/etc/auth.conf user/alc/pvh_global_lock/lib/libutil/auth.3 user/alc/pvh_global_lock/lib/libutil/auth.conf.5 user/alc/pvh_global_lock/sys/arm/at91/files.at91sam9 Modified: user/alc/pvh_global_lock/Makefile.inc1 user/alc/pvh_global_lock/ObsoleteFiles.inc user/alc/pvh_global_lock/cddl/contrib/opensolaris/cmd/zpool/zpool.8 user/alc/pvh_global_lock/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c user/alc/pvh_global_lock/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c user/alc/pvh_global_lock/contrib/gcc/config/arm/freebsd.h user/alc/pvh_global_lock/etc/Makefile user/alc/pvh_global_lock/gnu/lib/libgomp/config.h user/alc/pvh_global_lock/gnu/lib/libstdc++/config.h user/alc/pvh_global_lock/include/paths.h user/alc/pvh_global_lock/lib/libc/arm/Symbol.map user/alc/pvh_global_lock/lib/libc/gen/fstab.c user/alc/pvh_global_lock/lib/libc/gen/getnetgrent.c user/alc/pvh_global_lock/lib/libc/gen/signal.3 user/alc/pvh_global_lock/lib/libc/stdlib/getopt_long.c user/alc/pvh_global_lock/lib/libcrypt/Makefile user/alc/pvh_global_lock/lib/libcrypt/crypt.3 user/alc/pvh_global_lock/lib/libcrypt/crypt.c user/alc/pvh_global_lock/lib/libkiconv/Makefile user/alc/pvh_global_lock/lib/libusb/Makefile user/alc/pvh_global_lock/lib/libusb/libusb10.c user/alc/pvh_global_lock/lib/libusb/libusb10_io.c user/alc/pvh_global_lock/lib/libutil/Makefile user/alc/pvh_global_lock/lib/libutil/auth.c user/alc/pvh_global_lock/lib/libutil/property.3 user/alc/pvh_global_lock/libexec/rtld-elf/map_object.c user/alc/pvh_global_lock/release/picobsd/tinyware/passwd/passwd.c user/alc/pvh_global_lock/sbin/fsck_ffs/suj.c user/alc/pvh_global_lock/share/examples/csh/dot.cshrc user/alc/pvh_global_lock/share/examples/etc/README.examples user/alc/pvh_global_lock/share/examples/mdoc/example.4 user/alc/pvh_global_lock/share/man/man4/hptrr.4 user/alc/pvh_global_lock/share/man/man4/ip.4 user/alc/pvh_global_lock/share/misc/committers-src.dot user/alc/pvh_global_lock/share/mk/bsd.own.mk user/alc/pvh_global_lock/sys/amd64/acpica/acpi_wakecode.S user/alc/pvh_global_lock/sys/amd64/amd64/cpu_switch.S user/alc/pvh_global_lock/sys/amd64/amd64/mp_machdep.c user/alc/pvh_global_lock/sys/amd64/amd64/trap.c user/alc/pvh_global_lock/sys/amd64/conf/GENERIC user/alc/pvh_global_lock/sys/amd64/include/pcb.h user/alc/pvh_global_lock/sys/amd64/include/pmap.h user/alc/pvh_global_lock/sys/amd64/include/smp.h user/alc/pvh_global_lock/sys/arm/arm/bcopyinout_xscale.S user/alc/pvh_global_lock/sys/arm/arm/bootconfig.c user/alc/pvh_global_lock/sys/arm/arm/busdma_machdep.c user/alc/pvh_global_lock/sys/arm/arm/cpufunc.c user/alc/pvh_global_lock/sys/arm/arm/cpufunc_asm.S user/alc/pvh_global_lock/sys/arm/arm/cpufunc_asm_arm10.S user/alc/pvh_global_lock/sys/arm/arm/cpufunc_asm_arm11.S user/alc/pvh_global_lock/sys/arm/arm/cpufunc_asm_arm7tdmi.S user/alc/pvh_global_lock/sys/arm/arm/cpufunc_asm_arm8.S user/alc/pvh_global_lock/sys/arm/arm/cpufunc_asm_arm9.S user/alc/pvh_global_lock/sys/arm/arm/cpufunc_asm_armv4.S user/alc/pvh_global_lock/sys/arm/arm/cpufunc_asm_armv5.S user/alc/pvh_global_lock/sys/arm/arm/cpufunc_asm_sa1.S user/alc/pvh_global_lock/sys/arm/arm/cpufunc_asm_xscale.S user/alc/pvh_global_lock/sys/arm/arm/cpufunc_asm_xscale_c3.S user/alc/pvh_global_lock/sys/arm/arm/db_disasm.c user/alc/pvh_global_lock/sys/arm/arm/db_interface.c user/alc/pvh_global_lock/sys/arm/arm/db_trace.c user/alc/pvh_global_lock/sys/arm/arm/disassem.c user/alc/pvh_global_lock/sys/arm/arm/dump_machdep.c user/alc/pvh_global_lock/sys/arm/arm/elf_trampoline.c user/alc/pvh_global_lock/sys/arm/arm/exception.S user/alc/pvh_global_lock/sys/arm/arm/gdb_machdep.c user/alc/pvh_global_lock/sys/arm/arm/in_cksum.c user/alc/pvh_global_lock/sys/arm/arm/intr.c user/alc/pvh_global_lock/sys/arm/arm/irq_dispatch.S user/alc/pvh_global_lock/sys/arm/arm/machdep.c user/alc/pvh_global_lock/sys/arm/arm/mem.c user/alc/pvh_global_lock/sys/arm/arm/nexus.c user/alc/pvh_global_lock/sys/arm/arm/pmap.c user/alc/pvh_global_lock/sys/arm/arm/support.S user/alc/pvh_global_lock/sys/arm/arm/swtch.S user/alc/pvh_global_lock/sys/arm/arm/sys_machdep.c user/alc/pvh_global_lock/sys/arm/arm/trap.c user/alc/pvh_global_lock/sys/arm/arm/undefined.c user/alc/pvh_global_lock/sys/arm/arm/vectors.S user/alc/pvh_global_lock/sys/arm/arm/vm_machdep.c user/alc/pvh_global_lock/sys/arm/at91/at91.c user/alc/pvh_global_lock/sys/arm/at91/at91_machdep.c user/alc/pvh_global_lock/sys/arm/at91/at91_mci.c user/alc/pvh_global_lock/sys/arm/at91/at91_pio.c user/alc/pvh_global_lock/sys/arm/at91/at91_pio_rm9200.h user/alc/pvh_global_lock/sys/arm/at91/at91_pit.c user/alc/pvh_global_lock/sys/arm/at91/at91_pitreg.h user/alc/pvh_global_lock/sys/arm/at91/at91_pmcvar.h user/alc/pvh_global_lock/sys/arm/at91/at91_reset.S user/alc/pvh_global_lock/sys/arm/at91/at91_rst.c user/alc/pvh_global_lock/sys/arm/at91/at91_ssc.c user/alc/pvh_global_lock/sys/arm/at91/at91_st.c user/alc/pvh_global_lock/sys/arm/at91/at91_wdtreg.h user/alc/pvh_global_lock/sys/arm/at91/at91rm9200.c user/alc/pvh_global_lock/sys/arm/at91/at91rm92reg.h user/alc/pvh_global_lock/sys/arm/at91/at91sam9260reg.h user/alc/pvh_global_lock/sys/arm/at91/at91sam9g20.c user/alc/pvh_global_lock/sys/arm/at91/at91sam9g20reg.h user/alc/pvh_global_lock/sys/arm/at91/at91var.h user/alc/pvh_global_lock/sys/arm/at91/board_qila9g20.c user/alc/pvh_global_lock/sys/arm/at91/board_sam9g20ek.c user/alc/pvh_global_lock/sys/arm/at91/files.at91 user/alc/pvh_global_lock/sys/arm/at91/if_macb.c user/alc/pvh_global_lock/sys/arm/at91/std.at91 user/alc/pvh_global_lock/sys/arm/at91/std.at91sam9 user/alc/pvh_global_lock/sys/arm/at91/uart_cpu_at91rm9200usart.c user/alc/pvh_global_lock/sys/arm/conf/AVILA user/alc/pvh_global_lock/sys/arm/conf/BWCT user/alc/pvh_global_lock/sys/arm/conf/CAMBRIA user/alc/pvh_global_lock/sys/arm/conf/CNS11XXNAS user/alc/pvh_global_lock/sys/arm/conf/CRB user/alc/pvh_global_lock/sys/arm/conf/EP80219 user/alc/pvh_global_lock/sys/arm/conf/GUMSTIX user/alc/pvh_global_lock/sys/arm/conf/GUMSTIX-QEMU user/alc/pvh_global_lock/sys/arm/conf/HL200 user/alc/pvh_global_lock/sys/arm/conf/HL201 user/alc/pvh_global_lock/sys/arm/conf/IQ31244 user/alc/pvh_global_lock/sys/arm/conf/KB920X user/alc/pvh_global_lock/sys/arm/conf/LN2410SBC user/alc/pvh_global_lock/sys/arm/conf/NSLU user/alc/pvh_global_lock/sys/arm/conf/QILA9G20 user/alc/pvh_global_lock/sys/arm/conf/QILA9G20.hints user/alc/pvh_global_lock/sys/arm/conf/SAM9G20EK user/alc/pvh_global_lock/sys/arm/conf/SAM9G20EK.hints user/alc/pvh_global_lock/sys/arm/conf/SIMICS user/alc/pvh_global_lock/sys/arm/econa/econa_machdep.c user/alc/pvh_global_lock/sys/arm/include/armreg.h user/alc/pvh_global_lock/sys/arm/include/asmacros.h user/alc/pvh_global_lock/sys/arm/include/atomic.h user/alc/pvh_global_lock/sys/arm/include/blockio.h user/alc/pvh_global_lock/sys/arm/include/cpufunc.h user/alc/pvh_global_lock/sys/arm/include/elf.h user/alc/pvh_global_lock/sys/arm/include/endian.h user/alc/pvh_global_lock/sys/arm/include/fdt.h user/alc/pvh_global_lock/sys/arm/include/fp.h user/alc/pvh_global_lock/sys/arm/include/frame.h user/alc/pvh_global_lock/sys/arm/include/ieee.h user/alc/pvh_global_lock/sys/arm/include/in_cksum.h user/alc/pvh_global_lock/sys/arm/include/intr.h user/alc/pvh_global_lock/sys/arm/include/katelib.h user/alc/pvh_global_lock/sys/arm/include/machdep.h user/alc/pvh_global_lock/sys/arm/include/param.h user/alc/pvh_global_lock/sys/arm/include/pmap.h user/alc/pvh_global_lock/sys/arm/include/pmc_mdep.h user/alc/pvh_global_lock/sys/arm/include/profile.h user/alc/pvh_global_lock/sys/arm/include/pte.h user/alc/pvh_global_lock/sys/arm/include/resource.h user/alc/pvh_global_lock/sys/arm/include/stack.h user/alc/pvh_global_lock/sys/arm/include/vmparam.h user/alc/pvh_global_lock/sys/arm/mv/mv_machdep.c user/alc/pvh_global_lock/sys/arm/mv/mvwin.h user/alc/pvh_global_lock/sys/arm/mv/std.mv user/alc/pvh_global_lock/sys/arm/s3c2xx0/s3c2410reg.h user/alc/pvh_global_lock/sys/arm/s3c2xx0/s3c2440reg.h user/alc/pvh_global_lock/sys/arm/s3c2xx0/s3c24x0.c user/alc/pvh_global_lock/sys/arm/s3c2xx0/s3c24x0_machdep.c user/alc/pvh_global_lock/sys/arm/s3c2xx0/s3c24x0reg.h user/alc/pvh_global_lock/sys/arm/sa11x0/assabet_machdep.c user/alc/pvh_global_lock/sys/arm/sa11x0/sa11x0.c user/alc/pvh_global_lock/sys/arm/sa11x0/sa11x0_gpioreg.h user/alc/pvh_global_lock/sys/arm/sa11x0/sa11x0_io_asm.S user/alc/pvh_global_lock/sys/arm/sa11x0/sa11x0_irq.S user/alc/pvh_global_lock/sys/arm/sa11x0/sa11x0_ost.c user/alc/pvh_global_lock/sys/arm/sa11x0/sa11x0_ostreg.h user/alc/pvh_global_lock/sys/arm/sa11x0/sa11x0_var.h user/alc/pvh_global_lock/sys/arm/sa11x0/uart_dev_sa1110.c user/alc/pvh_global_lock/sys/arm/xscale/i80321/ep80219_machdep.c user/alc/pvh_global_lock/sys/arm/xscale/i80321/i80321.c user/alc/pvh_global_lock/sys/arm/xscale/i80321/i80321_aau.c user/alc/pvh_global_lock/sys/arm/xscale/i80321/i80321_dma.c user/alc/pvh_global_lock/sys/arm/xscale/i80321/i80321_intr.h user/alc/pvh_global_lock/sys/arm/xscale/i80321/i80321_pci.c user/alc/pvh_global_lock/sys/arm/xscale/i80321/i80321_space.c user/alc/pvh_global_lock/sys/arm/xscale/i80321/i80321_timer.c user/alc/pvh_global_lock/sys/arm/xscale/i80321/i80321reg.h user/alc/pvh_global_lock/sys/arm/xscale/i80321/iq31244_7seg.c user/alc/pvh_global_lock/sys/arm/xscale/i80321/iq31244_machdep.c user/alc/pvh_global_lock/sys/arm/xscale/i80321/iq80321.c user/alc/pvh_global_lock/sys/arm/xscale/i80321/obio.c user/alc/pvh_global_lock/sys/arm/xscale/i8134x/crb_machdep.c user/alc/pvh_global_lock/sys/arm/xscale/i8134x/i81342.c user/alc/pvh_global_lock/sys/arm/xscale/i8134x/i81342_mcu.c user/alc/pvh_global_lock/sys/arm/xscale/i8134x/i81342_pci.c user/alc/pvh_global_lock/sys/arm/xscale/i8134x/i81342_space.c user/alc/pvh_global_lock/sys/arm/xscale/i8134x/i81342reg.h user/alc/pvh_global_lock/sys/arm/xscale/i8134x/iq81342_7seg.c user/alc/pvh_global_lock/sys/arm/xscale/i8134x/obio.c user/alc/pvh_global_lock/sys/arm/xscale/i8134x/uart_cpu_i81342.c user/alc/pvh_global_lock/sys/arm/xscale/ixp425/avila_ata.c user/alc/pvh_global_lock/sys/arm/xscale/ixp425/avila_gpio.c user/alc/pvh_global_lock/sys/arm/xscale/ixp425/avila_machdep.c user/alc/pvh_global_lock/sys/arm/xscale/ixp425/cambria_exp_space.c user/alc/pvh_global_lock/sys/arm/xscale/ixp425/if_npe.c user/alc/pvh_global_lock/sys/arm/xscale/ixp425/if_npereg.h user/alc/pvh_global_lock/sys/arm/xscale/ixp425/ixp425.c user/alc/pvh_global_lock/sys/arm/xscale/ixp425/ixp425_iic.c user/alc/pvh_global_lock/sys/arm/xscale/ixp425/ixp425_npe.c user/alc/pvh_global_lock/sys/arm/xscale/ixp425/ixp425_npereg.h user/alc/pvh_global_lock/sys/arm/xscale/ixp425/ixp425_pci.c user/alc/pvh_global_lock/sys/arm/xscale/ixp425/ixp425_pci_space.c user/alc/pvh_global_lock/sys/arm/xscale/ixp425/ixp425_qmgr.c user/alc/pvh_global_lock/sys/arm/xscale/ixp425/ixp425_qmgr.h user/alc/pvh_global_lock/sys/arm/xscale/ixp425/ixp425reg.h user/alc/pvh_global_lock/sys/arm/xscale/pxa/if_smc_smi.c user/alc/pvh_global_lock/sys/arm/xscale/pxa/pxa_machdep.c user/alc/pvh_global_lock/sys/arm/xscale/pxa/pxareg.h user/alc/pvh_global_lock/sys/boot/zfs/zfsimpl.c user/alc/pvh_global_lock/sys/conf/kern.post.mk user/alc/pvh_global_lock/sys/conf/options.arm user/alc/pvh_global_lock/sys/dev/ata/chipsets/ata-ite.c user/alc/pvh_global_lock/sys/dev/ath/ath_hal/ah_desc.h user/alc/pvh_global_lock/sys/dev/ath/if_ath.c user/alc/pvh_global_lock/sys/dev/ath/if_ath_misc.h user/alc/pvh_global_lock/sys/dev/ath/if_ath_sysctl.c user/alc/pvh_global_lock/sys/dev/ath/if_ath_tx.c user/alc/pvh_global_lock/sys/dev/ath/if_ath_tx_ht.c user/alc/pvh_global_lock/sys/dev/ath/if_athvar.h user/alc/pvh_global_lock/sys/dev/drm2/i915/i915_gem.c user/alc/pvh_global_lock/sys/dev/hptrr/hptrr_osm_bsd.c user/alc/pvh_global_lock/sys/dev/hwpmc/hwpmc_arm.c user/alc/pvh_global_lock/sys/dev/isp/isp_pci.c user/alc/pvh_global_lock/sys/dev/mvs/mvs.c user/alc/pvh_global_lock/sys/dev/mvs/mvs.h user/alc/pvh_global_lock/sys/dev/mvs/mvs_soc.c user/alc/pvh_global_lock/sys/dev/pci/pci_pci.c user/alc/pvh_global_lock/sys/dev/sym/sym_conf.h user/alc/pvh_global_lock/sys/dev/sym/sym_hipd.c user/alc/pvh_global_lock/sys/dev/usb/quirk/usb_quirk.c user/alc/pvh_global_lock/sys/dev/usb/serial/uftdi.c user/alc/pvh_global_lock/sys/dev/usb/serial/uftdi_reg.h user/alc/pvh_global_lock/sys/dev/usb/usbdevs user/alc/pvh_global_lock/sys/geom/part/g_part_gpt.c user/alc/pvh_global_lock/sys/i386/acpica/acpi_wakecode.S user/alc/pvh_global_lock/sys/i386/conf/GENERIC user/alc/pvh_global_lock/sys/i386/i386/mp_machdep.c user/alc/pvh_global_lock/sys/i386/i386/swtch.s user/alc/pvh_global_lock/sys/i386/include/pcb.h user/alc/pvh_global_lock/sys/i386/include/pmap.h user/alc/pvh_global_lock/sys/i386/include/smp.h user/alc/pvh_global_lock/sys/ia64/include/pmap.h user/alc/pvh_global_lock/sys/kern/kern_descrip.c user/alc/pvh_global_lock/sys/kern/kern_event.c user/alc/pvh_global_lock/sys/kern/uipc_usrreq.c user/alc/pvh_global_lock/sys/kern/vfs_syscalls.c user/alc/pvh_global_lock/sys/mips/include/pmap.h user/alc/pvh_global_lock/sys/mips/rmi/rootfs_list.txt user/alc/pvh_global_lock/sys/net/if.h user/alc/pvh_global_lock/sys/net/if_gif.c user/alc/pvh_global_lock/sys/netgraph/netflow/netflow_v9.c user/alc/pvh_global_lock/sys/netgraph/netflow/ng_netflow.c user/alc/pvh_global_lock/sys/netinet/in.h user/alc/pvh_global_lock/sys/netinet/in_pcb.c user/alc/pvh_global_lock/sys/netinet/in_pcb.h user/alc/pvh_global_lock/sys/netinet/ip_input.c user/alc/pvh_global_lock/sys/netinet/ip_output.c user/alc/pvh_global_lock/sys/netinet/libalias/libalias.3 user/alc/pvh_global_lock/sys/netinet/sctp_indata.c user/alc/pvh_global_lock/sys/netinet/sctp_indata.h user/alc/pvh_global_lock/sys/netinet/sctp_input.c user/alc/pvh_global_lock/sys/netinet/sctp_input.h user/alc/pvh_global_lock/sys/netinet/sctp_output.c user/alc/pvh_global_lock/sys/netinet/sctp_output.h user/alc/pvh_global_lock/sys/netinet/sctputil.c user/alc/pvh_global_lock/sys/netinet/sctputil.h user/alc/pvh_global_lock/sys/netinet/udp_usrreq.c user/alc/pvh_global_lock/sys/netinet6/ip6_input.c user/alc/pvh_global_lock/sys/netinet6/sctp6_usrreq.c user/alc/pvh_global_lock/sys/netsmb/smb_dev.c user/alc/pvh_global_lock/sys/powerpc/include/pmap.h user/alc/pvh_global_lock/sys/sparc64/include/pmap.h user/alc/pvh_global_lock/sys/sys/cdefs.h user/alc/pvh_global_lock/sys/sys/filedesc.h user/alc/pvh_global_lock/sys/sys/kernel.h user/alc/pvh_global_lock/sys/ufs/ffs/ffs_softdep.c user/alc/pvh_global_lock/sys/vm/pmap.h user/alc/pvh_global_lock/sys/vm/swap_pager.c user/alc/pvh_global_lock/sys/vm/vm_page.c user/alc/pvh_global_lock/sys/vm/vm_page.h user/alc/pvh_global_lock/sys/vm/vm_pageout.c user/alc/pvh_global_lock/sys/vm/vnode_pager.c user/alc/pvh_global_lock/sys/x86/acpica/acpi_wakeup.c user/alc/pvh_global_lock/tools/tools/ath/athdebug/athdebug.c user/alc/pvh_global_lock/tools/tools/net80211/wlanstats/main.c user/alc/pvh_global_lock/usr.bin/find/find.1 user/alc/pvh_global_lock/usr.sbin/apmd/apmd.8 Directory Properties: user/alc/pvh_global_lock/ (props changed) user/alc/pvh_global_lock/cddl/contrib/opensolaris/ (props changed) user/alc/pvh_global_lock/contrib/gcc/ (props changed) user/alc/pvh_global_lock/gnu/lib/ (props changed) user/alc/pvh_global_lock/lib/libc/ (props changed) user/alc/pvh_global_lock/lib/libutil/ (props changed) user/alc/pvh_global_lock/sbin/ (props changed) user/alc/pvh_global_lock/share/man/man4/ (props changed) user/alc/pvh_global_lock/sys/ (props changed) user/alc/pvh_global_lock/sys/boot/ (props changed) user/alc/pvh_global_lock/sys/conf/ (props changed) Modified: user/alc/pvh_global_lock/Makefile.inc1 ============================================================================== --- user/alc/pvh_global_lock/Makefile.inc1 Sun Jun 17 03:54:10 2012 (r237180) +++ user/alc/pvh_global_lock/Makefile.inc1 Sun Jun 17 03:59:17 2012 (r237181) @@ -15,6 +15,7 @@ # -DNO_WWWUPDATE do not update www in ${MAKE} update # -DNO_CTF do not run the DTrace CTF conversion tools on built objects # LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list +# LOCAL_LIB_DIRS="list of dirs" to add additional dirs to libraries target # LOCAL_TOOL_DIRS="list of dirs" to add additional dirs to the build-tools # list # TARGET="machine" to crossbuild world for a different machine type @@ -88,7 +89,7 @@ SUBDIR+=etc # These are last, since it is nice to at least get the base system # rebuilt before you do them. -.for _DIR in ${LOCAL_DIRS} +.for _DIR in ${LOCAL_LIB_DIRS} ${LOCAL_DIRS} .if exists(${.CURDIR}/${_DIR}/Makefile) SUBDIR+= ${_DIR} .endif @@ -1273,6 +1274,11 @@ _ofed_lib= contrib/ofed/usr.lib/ .endif _generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib} +.for _DIR in ${LOCAL_LIB_DIRS} +.if exists(${.CURDIR}/${_DIR}/Makefile) +_generic_libs+= ${_DIR} +.endif +.endfor lib/libopie__L lib/libtacplus__L: lib/libmd__L Modified: user/alc/pvh_global_lock/ObsoleteFiles.inc ============================================================================== --- user/alc/pvh_global_lock/ObsoleteFiles.inc Sun Jun 17 03:54:10 2012 (r237180) +++ user/alc/pvh_global_lock/ObsoleteFiles.inc Sun Jun 17 03:59:17 2012 (r237181) @@ -38,8 +38,13 @@ # xargs -n1 | sort | uniq -d; # done +# 20120613: auth.conf removed +OLD_FILES+=etc/auth.conf +OLD_FILES+=usr/share/examples/etc/auth.conf +OLD_FILES+=usr/share/man/man3/auth.3.gz +OLD_FILES+=usr/share/man/man5/auth.conf.5.gz # 20120530: kde pam lives now in ports -OLD_FILES+=/etc/pam.d/kde +OLD_FILES+=etc/pam.d/kde # 20120505: new clang import installed a redundant internal header OLD_FILES+=usr/include/clang/3.1/stdalign.h # 20120428: MD2 removed from libmd Modified: user/alc/pvh_global_lock/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- user/alc/pvh_global_lock/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Sun Jun 17 03:54:10 2012 (r237180) +++ user/alc/pvh_global_lock/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Sun Jun 17 03:59:17 2012 (r237181) @@ -1348,6 +1348,8 @@ reports are printed. .It Fl H Scripted mode. Do not display headers, and separate fields by a single tab instead of arbitrary space. +.It Fl v +Show more detailed information. .It Fl o Ar property Ns Op , Ns Ar ... Comma-separated list of properties to display. See the .Qq Sx Properties Modified: user/alc/pvh_global_lock/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- user/alc/pvh_global_lock/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Sun Jun 17 03:54:10 2012 (r237180) +++ user/alc/pvh_global_lock/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Sun Jun 17 03:59:17 2012 (r237181) @@ -235,7 +235,7 @@ get_usage(zpool_help_t idx) { case HELP_LABELCLEAR: return (gettext("\tlabelclear [-f] \n")); case HELP_LIST: - return (gettext("\tlist [-H] [-o property[,...]] " + return (gettext("\tlist [-Hv] [-o property[,...]] " "[-T d|u] [pool] ... [interval [count]]\n")); case HELP_OFFLINE: return (gettext("\toffline [-t] ...\n")); Modified: user/alc/pvh_global_lock/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- user/alc/pvh_global_lock/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Sun Jun 17 03:54:10 2012 (r237180) +++ user/alc/pvh_global_lock/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Sun Jun 17 03:59:17 2012 (r237181) @@ -1485,11 +1485,13 @@ zfs_prop_set(zfs_handle_t *zhp, const ch /* * If the dataset's canmount property is being set to noauto, + * or being set to on and the dataset is already mounted, * then we want to prevent unmounting & remounting it. */ do_prefix = !((prop == ZFS_PROP_CANMOUNT) && (zprop_string_to_index(prop, propval, &idx, - ZFS_TYPE_DATASET) == 0) && (idx == ZFS_CANMOUNT_NOAUTO)); + ZFS_TYPE_DATASET) == 0) && (idx == ZFS_CANMOUNT_NOAUTO || + (idx == ZFS_CANMOUNT_ON && zfs_is_mounted(zhp, NULL)))); if (do_prefix && (ret = changelist_prefix(cl)) != 0) goto error; Modified: user/alc/pvh_global_lock/contrib/gcc/config/arm/freebsd.h ============================================================================== --- user/alc/pvh_global_lock/contrib/gcc/config/arm/freebsd.h Sun Jun 17 03:54:10 2012 (r237180) +++ user/alc/pvh_global_lock/contrib/gcc/config/arm/freebsd.h Sun Jun 17 03:59:17 2012 (r237181) @@ -50,6 +50,7 @@ %{rdynamic:-export-dynamic} \ %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \ %{static:-Bstatic}} \ + %{!static:--hash-style=both} \ %{symbolic:-Bsymbolic} \ -X %{mbig-endian:-EB} %{mlittle-endian:-EL}" Modified: user/alc/pvh_global_lock/etc/Makefile ============================================================================== --- user/alc/pvh_global_lock/etc/Makefile Sun Jun 17 03:54:10 2012 (r237180) +++ user/alc/pvh_global_lock/etc/Makefile Sun Jun 17 03:59:17 2012 (r237181) @@ -7,8 +7,7 @@ SUBDIR= sendmail .endif -BIN1= auth.conf \ - crontab \ +BIN1= crontab \ devd.conf \ devfs.conf \ ddb.conf \ Modified: user/alc/pvh_global_lock/gnu/lib/libgomp/config.h ============================================================================== --- user/alc/pvh_global_lock/gnu/lib/libgomp/config.h Sun Jun 17 03:54:10 2012 (r237180) +++ user/alc/pvh_global_lock/gnu/lib/libgomp/config.h Sun Jun 17 03:59:17 2012 (r237181) @@ -59,7 +59,7 @@ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if the target supports thread-local storage. */ -#if !defined(__arm__) && !defined(__mips__) +#if !defined(__mips__) #define HAVE_TLS 1 #endif Modified: user/alc/pvh_global_lock/gnu/lib/libstdc++/config.h ============================================================================== --- user/alc/pvh_global_lock/gnu/lib/libstdc++/config.h Sun Jun 17 03:54:10 2012 (r237180) +++ user/alc/pvh_global_lock/gnu/lib/libstdc++/config.h Sun Jun 17 03:59:17 2012 (r237181) @@ -371,7 +371,7 @@ /* #undef HAVE_TANL */ /* Define to 1 if the target supports thread-local storage. */ -#if !defined(__arm__) && !defined(__mips__) +#if !defined(__mips__) #define HAVE_TLS 1 #endif Modified: user/alc/pvh_global_lock/include/paths.h ============================================================================== --- user/alc/pvh_global_lock/include/paths.h Sun Jun 17 03:54:10 2012 (r237180) +++ user/alc/pvh_global_lock/include/paths.h Sun Jun 17 03:59:17 2012 (r237181) @@ -42,7 +42,6 @@ /* Locate system binaries. */ #define _PATH_SYSPATH "/sbin:/usr/sbin" -#define _PATH_AUTHCONF "/etc/auth.conf" #define _PATH_BSHELL "/bin/sh" #define _PATH_CAPABILITY "/etc/capability" #define _PATH_CAPABILITY_DB "/etc/capability.db" Modified: user/alc/pvh_global_lock/lib/libc/arm/Symbol.map ============================================================================== --- user/alc/pvh_global_lock/lib/libc/arm/Symbol.map Sun Jun 17 03:54:10 2012 (r237180) +++ user/alc/pvh_global_lock/lib/libc/arm/Symbol.map Sun Jun 17 03:59:17 2012 (r237181) @@ -33,6 +33,10 @@ FBSD_1.0 { sbrk; }; +FBSD_1.3 { + __flt_rounds; +}; + FBSDprivate_1.0 { /* PSEUDO syscalls */ __sys_getlogin; @@ -70,7 +74,6 @@ FBSDprivate_1.0 { __divdf3; __floatsisf; __floatsidf; - __flt_rounds; __fixsfsi; __fixdfsi; __fixunssfsi; Modified: user/alc/pvh_global_lock/lib/libc/gen/fstab.c ============================================================================== --- user/alc/pvh_global_lock/lib/libc/gen/fstab.c Sun Jun 17 03:54:10 2012 (r237180) +++ user/alc/pvh_global_lock/lib/libc/gen/fstab.c Sun Jun 17 03:59:17 2012 (r237181) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -246,6 +247,8 @@ getfsfile(name) int setfsent() { + int fd; + if (_fs_fp) { rewind(_fs_fp); LineNo = 0; @@ -257,11 +260,18 @@ setfsent() else setfstab(getenv("PATH_FSTAB")); } - if ((_fs_fp = fopen(path_fstab, "r")) != NULL) { + fd = _open(path_fstab, O_RDONLY | O_CLOEXEC); + if (fd == -1) { + error(errno); + return (0); + } + _fs_fp = fdopen(fd, "r"); + if (_fs_fp != NULL) { LineNo = 0; return(1); } error(errno); + _close(fd); return(0); } Modified: user/alc/pvh_global_lock/lib/libc/gen/getnetgrent.c ============================================================================== --- user/alc/pvh_global_lock/lib/libc/gen/getnetgrent.c Sun Jun 17 03:54:10 2012 (r237180) +++ user/alc/pvh_global_lock/lib/libc/gen/getnetgrent.c Sun Jun 17 03:59:17 2012 (r237181) @@ -161,8 +161,7 @@ setnetgrent(const char *group) if (group == NULL || !strlen(group)) return; - if (grouphead.gr == (struct netgrp *)0 || - strcmp(group, grouphead.grname)) { + if (grouphead.gr == NULL || strcmp(group, grouphead.grname)) { endnetgrent(); #ifdef YP /* Presumed guilty until proven innocent. */ @@ -172,7 +171,7 @@ setnetgrent(const char *group) * use NIS exclusively. */ if (((stat(_PATH_NETGROUP, &_yp_statp) < 0) && - errno == ENOENT) || _yp_statp.st_size == 0) + errno == ENOENT) || _yp_statp.st_size == 0) _use_only_yp = _netgr_yp_enabled = 1; if ((netf = fopen(_PATH_NETGROUP,"r")) != NULL ||_use_only_yp){ /* @@ -247,27 +246,24 @@ endnetgrent(void) lp = lp->l_next; free(olp->l_groupname); free(olp->l_line); - free((char *)olp); + free(olp); } - linehead = (struct linelist *)0; + linehead = NULL; if (grouphead.grname) { free(grouphead.grname); - grouphead.grname = (char *)0; + grouphead.grname = NULL; } gp = grouphead.gr; while (gp) { ogp = gp; gp = gp->ng_next; - if (ogp->ng_str[NG_HOST]) - free(ogp->ng_str[NG_HOST]); - if (ogp->ng_str[NG_USER]) - free(ogp->ng_str[NG_USER]); - if (ogp->ng_str[NG_DOM]) - free(ogp->ng_str[NG_DOM]); - free((char *)ogp); + free(ogp->ng_str[NG_HOST]); + free(ogp->ng_str[NG_USER]); + free(ogp->ng_str[NG_DOM]); + free(ogp); } - grouphead.gr = (struct netgrp *)0; - nextgrp = (struct netgrp *)0; + grouphead.gr = NULL; + nextgrp = NULL; #ifdef YP _netgr_yp_enabled = 0; #endif @@ -282,7 +278,7 @@ _listmatch(const char *list, const char int glen = strlen(group); /* skip possible leading whitespace */ - while(isspace((unsigned char)*ptr)) + while (isspace((unsigned char)*ptr)) ptr++; while (ptr < list + len) { @@ -291,7 +287,7 @@ _listmatch(const char *list, const char ptr++; if (strncmp(cptr, group, glen) == 0 && glen == (ptr - cptr)) return (1); - while(*ptr == ',' || isspace((unsigned char)*ptr)) + while (*ptr == ',' || isspace((unsigned char)*ptr)) ptr++; } @@ -436,8 +432,7 @@ parse_netgrp(const char *group) break; lp = lp->l_next; } - if (lp == (struct linelist *)0 && - (lp = read_for_group(group)) == (struct linelist *)0) + if (lp == NULL && (lp = read_for_group(group)) == NULL) return (1); if (lp->l_parsed) { #ifdef DEBUG @@ -538,7 +533,7 @@ parse_netgrp(const char *group) static struct linelist * read_for_group(const char *group) { - char *pos, *spos, *linep; + char *linep, *olinep, *pos, *spos; int len, olen; int cont; struct linelist *lp; @@ -615,15 +610,20 @@ read_for_group(const char *group) } else cont = 0; if (len > 0) { - linep = reallocf(linep, olen + len + 1); + linep = malloc(olen + len + 1); if (linep == NULL) { free(lp->l_groupname); free(lp); return (NULL); } + if (olen > 0) { + bcopy(olinep, linep, olen); + free(olinep); + } bcopy(pos, linep + olen, len); olen += len; *(linep + olen) = '\0'; + olinep = linep; } if (cont) { if (fgets(line, LINSIZ, netf)) { Modified: user/alc/pvh_global_lock/lib/libc/gen/signal.3 ============================================================================== --- user/alc/pvh_global_lock/lib/libc/gen/signal.3 Sun Jun 17 03:54:10 2012 (r237180) +++ user/alc/pvh_global_lock/lib/libc/gen/signal.3 Sun Jun 17 03:59:17 2012 (r237181) @@ -38,20 +38,11 @@ .Lb libc .Sh SYNOPSIS .In signal.h -.\" XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX -.\" The prototype for signal(3) cannot be cleanly marked up in -mdoc -.\" without the following lower-level tweak. -.nr in-synopsis-section 0 -.Pp -.Ft "void \*(lp*" Ns -.Fo signal -.Fa "int sig" -.Fa "void \*(lp*func\*(rp\*(lpint\*(rp" -.Fc Ns -.Ft "\*(rp\*(lpint\*(rp" ; +.\" The following is Quite Ugly, but syntactically correct. +.\" Don't try to fix it. +.Ft void +.Fn \*(lp*signal "int sig" "void \*(lp*func\*(rp\*(lpint\*(rp\*(rp\*(rp\*(lpint" .Pp -.nr in-synopsis-section 1 -.\" XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX or in .Fx Ap s equivalent but easier to read typedef'd version: @@ -98,7 +89,7 @@ an interrupt. These signals are defined in the file .In signal.h : .Bl -column No ".Dv SIGVTALRM" "create core image" -.It Sy "No Name Default Action Description" +.It Sy "Num" Ta Sy "Name" Ta Sy "Default Action" Ta Sy "Description" .It 1 Ta Dv SIGHUP Ta "terminate process" Ta "terminal line hangup" .It 2 Ta Dv SIGINT Ta "terminate process" Ta "interrupt program" .It 3 Ta Dv SIGQUIT Ta "create core image" Ta "quit program" Modified: user/alc/pvh_global_lock/lib/libc/stdlib/getopt_long.c ============================================================================== --- user/alc/pvh_global_lock/lib/libc/stdlib/getopt_long.c Sun Jun 17 03:54:10 2012 (r237180) +++ user/alc/pvh_global_lock/lib/libc/stdlib/getopt_long.c Sun Jun 17 03:59:17 2012 (r237181) @@ -1,4 +1,4 @@ -/* $OpenBSD: getopt_long.c,v 1.21 2006/09/22 17:22:05 millert Exp $ */ +/* $OpenBSD: getopt_long.c,v 1.22 2006/10/04 21:29:04 jmc Exp $ */ /* $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $ */ /* @@ -35,13 +35,6 @@ * 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. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED Modified: user/alc/pvh_global_lock/lib/libcrypt/Makefile ============================================================================== --- user/alc/pvh_global_lock/lib/libcrypt/Makefile Sun Jun 17 03:54:10 2012 (r237180) +++ user/alc/pvh_global_lock/lib/libcrypt/Makefile Sun Jun 17 03:59:17 2012 (r237181) @@ -26,11 +26,7 @@ SRCS+= crypt-des.c crypt-blowfish.c blo CFLAGS+= -I${.CURDIR} -DHAS_DES -DHAS_BLOWFISH .endif -# And the auth_getval() code and support. -.PATH: ${.CURDIR}/../libutil -SRCS+= auth.c property.c -.for sym in auth_getval property_find properties_read properties_free \ - MD4Init MD4Final MD4Update MD4Pad \ +.for sym in MD4Init MD4Final MD4Update MD4Pad \ MD5Init MD5Final MD5Update MD5Pad \ SHA256_Init SHA256_Final SHA256_Update \ SHA512_Init SHA512_Final SHA512_Update Modified: user/alc/pvh_global_lock/lib/libcrypt/crypt.3 ============================================================================== --- user/alc/pvh_global_lock/lib/libcrypt/crypt.3 Sun Jun 17 03:54:10 2012 (r237180) +++ user/alc/pvh_global_lock/lib/libcrypt/crypt.3 Sun Jun 17 03:59:17 2012 (r237181) @@ -238,12 +238,6 @@ The .Fn crypt_set_format function sets the default encoding format according to the supplied .Fa string . -.Pp -The global default format can be set using the -.Pa /etc/auth.conf -file using the -.Va crypt_default -property. .Sh RETURN VALUES The .Fn crypt @@ -260,9 +254,7 @@ Otherwise, a value of 0 is returned. .Sh SEE ALSO .Xr login 1 , .Xr passwd 1 , -.Xr auth_getval 3 , .Xr getpass 3 , -.Xr auth.conf 5 , .Xr passwd 5 .Sh HISTORY A rotor-based Modified: user/alc/pvh_global_lock/lib/libcrypt/crypt.c ============================================================================== --- user/alc/pvh_global_lock/lib/libcrypt/crypt.c Sun Jun 17 03:54:10 2012 (r237180) +++ user/alc/pvh_global_lock/lib/libcrypt/crypt.c Sun Jun 17 03:59:17 2012 (r237181) @@ -79,23 +79,23 @@ static const struct { } }; +#ifdef HAS_DES +#define CRYPT_DEFAULT "des" +#else +#define CRYPT_DEFAULT "md5" +#endif + static int crypt_type = -1; static void crypt_setdefault(void) { - char *def; size_t i; if (crypt_type != -1) return; - def = auth_getval("crypt_default"); - if (def == NULL) { - crypt_type = 0; - return; - } for (i = 0; i < sizeof(crypt_types) / sizeof(crypt_types[0]) - 1; i++) { - if (strcmp(def, crypt_types[i].name) == 0) { + if (strcmp(CRYPT_DEFAULT, crypt_types[i].name) == 0) { crypt_type = (int)i; return; } Modified: user/alc/pvh_global_lock/lib/libkiconv/Makefile ============================================================================== --- user/alc/pvh_global_lock/lib/libkiconv/Makefile Sun Jun 17 03:54:10 2012 (r237180) +++ user/alc/pvh_global_lock/lib/libkiconv/Makefile Sun Jun 17 03:59:17 2012 (r237181) @@ -1,9 +1,10 @@ # $FreeBSD$ +SHLIBDIR?= /lib + .include LIB= kiconv -SHLIBDIR?= /lib SRCS= kiconv_sysctl.c xlat16_iconv.c xlat16_sysctl.c SRCS+= quirks.c Modified: user/alc/pvh_global_lock/lib/libusb/Makefile ============================================================================== --- user/alc/pvh_global_lock/lib/libusb/Makefile Sun Jun 17 03:54:10 2012 (r237180) +++ user/alc/pvh_global_lock/lib/libusb/Makefile Sun Jun 17 03:59:17 2012 (r237181) @@ -18,6 +18,9 @@ NOGCCERROR= WARNS?= 2 +DPADD= ${LIBPTHREAD} +LDADD= -lpthread + MLINKS+= libusb.3 usb.3 # libusb 0.1 compat Modified: user/alc/pvh_global_lock/lib/libusb/libusb10.c ============================================================================== --- user/alc/pvh_global_lock/lib/libusb/libusb10.c Sun Jun 17 03:54:10 2012 (r237180) +++ user/alc/pvh_global_lock/lib/libusb/libusb10.c Sun Jun 17 03:59:17 2012 (r237181) @@ -92,6 +92,7 @@ int libusb_init(libusb_context **context) { struct libusb_context *ctx; + pthread_condattr_t attr; char *debug; int ret; @@ -110,8 +111,28 @@ libusb_init(libusb_context **context) TAILQ_INIT(&ctx->pollfds); TAILQ_INIT(&ctx->tr_done); - pthread_mutex_init(&ctx->ctx_lock, NULL); - pthread_cond_init(&ctx->ctx_cond, NULL); + if (pthread_mutex_init(&ctx->ctx_lock, NULL) != 0) { + free(ctx); + return (LIBUSB_ERROR_NO_MEM); + } + if (pthread_condattr_init(&attr) != 0) { + pthread_mutex_destroy(&ctx->ctx_lock); + free(ctx); + return (LIBUSB_ERROR_NO_MEM); + } + if (pthread_condattr_setclock(&attr, CLOCK_MONOTONIC) != 0) { + pthread_mutex_destroy(&ctx->ctx_lock); + pthread_condattr_destroy(&attr); + free(ctx); + return (LIBUSB_ERROR_OTHER); + } + if (pthread_cond_init(&ctx->ctx_cond, &attr) != 0) { + pthread_mutex_destroy(&ctx->ctx_lock); + pthread_condattr_destroy(&attr); + free(ctx); + return (LIBUSB_ERROR_NO_MEM); + } + pthread_condattr_destroy(&attr); ctx->ctx_handler = NO_THREAD; Modified: user/alc/pvh_global_lock/lib/libusb/libusb10_io.c ============================================================================== --- user/alc/pvh_global_lock/lib/libusb/libusb10_io.c Sun Jun 17 03:54:10 2012 (r237180) +++ user/alc/pvh_global_lock/lib/libusb/libusb10_io.c Sun Jun 17 03:59:17 2012 (r237181) @@ -307,12 +307,16 @@ libusb_wait_for_event(libusb_context *ct &ctx->ctx_lock); return (0); } - err = clock_gettime(CLOCK_REALTIME, &ts); + err = clock_gettime(CLOCK_MONOTONIC, &ts); if (err < 0) return (LIBUSB_ERROR_OTHER); - ts.tv_sec = tv->tv_sec; - ts.tv_nsec = tv->tv_usec * 1000; + /* + * The "tv" arguments points to a relative time structure and + * not an absolute time structure. + */ + ts.tv_sec += tv->tv_sec; + ts.tv_nsec += tv->tv_usec * 1000; if (ts.tv_nsec >= 1000000000) { ts.tv_nsec -= 1000000000; ts.tv_sec++; Modified: user/alc/pvh_global_lock/lib/libutil/Makefile ============================================================================== --- user/alc/pvh_global_lock/lib/libutil/Makefile Sun Jun 17 03:54:10 2012 (r237180) +++ user/alc/pvh_global_lock/lib/libutil/Makefile Sun Jun 17 03:59:17 2012 (r237181) @@ -25,14 +25,13 @@ CFLAGS+= -DINET6 CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../libc/gen/ -MAN+= auth.3 expand_number.3 flopen.3 fparseln.3 hexdump.3 \ +MAN+= expand_number.3 flopen.3 fparseln.3 hexdump.3 \ humanize_number.3 kinfo_getallproc.3 kinfo_getfile.3 \ kinfo_getproc.3 kinfo_getvmmap.3 kld.3 login_auth.3 login_cap.3 \ login_class.3 login_ok.3 login_times.3 login_tty.3 pidfile.3 \ property.3 pty.3 quotafile.3 realhostname.3 realhostname_sa.3 \ _secure_path.3 trimdomain.3 uucplock.3 -MAN+= auth.conf.5 login.conf.5 -MLINKS+= auth.3 auth_getval.3 +MAN+= login.conf.5 MLINKS+= kld.3 kld_isloaded.3 kld.3 kld_load.3 MLINKS+=login_auth.3 auth_cat.3 login_auth.3 auth_checknologin.3 MLINKS+=login_cap.3 login_close.3 login_cap.3 login_getcapbool.3 \ Modified: user/alc/pvh_global_lock/lib/libutil/auth.c ============================================================================== --- user/alc/pvh_global_lock/lib/libutil/auth.c Sun Jun 17 03:54:10 2012 (r237180) +++ user/alc/pvh_global_lock/lib/libutil/auth.c Sun Jun 17 03:59:17 2012 (r237181) @@ -31,40 +31,14 @@ #include __FBSDID("$FreeBSD$"); -#include -#include -#include -#include -#include -#include - -static properties P; - -static int -initauthconf(const char *path) -{ - int fd; +#include - if (!P) { - if ((fd = open(path, O_RDONLY)) < 0) { - syslog(LOG_ERR, "initauthconf: unable to open file: %s", path); - return 1; - } - P = properties_read(fd); - close(fd); - if (!P) { - syslog(LOG_ERR, "initauthconf: unable to parse file: %s", path); - return 1; - } - } - return 0; -} +#include char * auth_getval(const char *name) { - if (!P && initauthconf(_PATH_AUTHCONF)) - return NULL; - else - return property_find(P, name); + + (void)name; + return (NULL); } Modified: user/alc/pvh_global_lock/lib/libutil/property.3 ============================================================================== --- user/alc/pvh_global_lock/lib/libutil/property.3 Sun Jun 17 03:54:10 2012 (r237180) +++ user/alc/pvh_global_lock/lib/libutil/property.3 Sun Jun 17 03:59:17 2012 (r237181) @@ -90,8 +90,6 @@ are desired, the entire value should be characters. Any line beginning with a # or ; character is assumed to be a comment and will be ignored. -.Sh SEE ALSO -.Xr auth_getval 3 .Sh AUTHORS .An Jordan Hubbard .Sh BUGS Modified: user/alc/pvh_global_lock/libexec/rtld-elf/map_object.c ============================================================================== --- user/alc/pvh_global_lock/libexec/rtld-elf/map_object.c Sun Jun 17 03:54:10 2012 (r237180) +++ user/alc/pvh_global_lock/libexec/rtld-elf/map_object.c Sun Jun 17 03:59:17 2012 (r237181) @@ -38,7 +38,7 @@ #include "debug.h" #include "rtld.h" -static Elf_Ehdr *get_elf_header (int, const char *); +static Elf_Ehdr *get_elf_header(int, const char *); static int convert_prot(int); /* Elf flags -> mmap protection */ static int convert_flags(int); /* Elf flags -> mmap flags */ @@ -121,7 +121,7 @@ map_object(int fd, const char *path, con if ((segs[nsegs]->p_align & (PAGE_SIZE - 1)) != 0) { _rtld_error("%s: PT_LOAD segment %d not page-aligned", path, nsegs); - return NULL; + goto error; } break; @@ -161,12 +161,12 @@ map_object(int fd, const char *path, con } if (phdyn == NULL) { _rtld_error("%s: object is not dynamically-linked", path); - return NULL; + goto error; } if (nsegs < 0) { _rtld_error("%s: too few PT_LOAD segments", path); - return NULL; + goto error; } /* @@ -183,13 +183,12 @@ map_object(int fd, const char *path, con if (mapbase == (caddr_t) -1) { _rtld_error("%s: mmap of entire address space failed: %s", path, rtld_strerror(errno)); - return NULL; + goto error; } if (base_addr != NULL && mapbase != base_addr) { _rtld_error("%s: mmap returned wrong address: wanted %p, got %p", path, base_addr, mapbase); - munmap(mapbase, mapsize); - return NULL; + goto error1; } for (i = 0; i <= nsegs; i++) { @@ -201,10 +200,10 @@ map_object(int fd, const char *path, con data_prot = convert_prot(segs[i]->p_flags); data_flags = convert_flags(segs[i]->p_flags) | MAP_FIXED; if (mmap(data_addr, data_vlimit - data_vaddr, data_prot, - data_flags, fd, data_offset) == (caddr_t) -1) { + data_flags | MAP_PREFAULT_READ, fd, data_offset) == (caddr_t) -1) { _rtld_error("%s: mmap of data failed: %s", path, rtld_strerror(errno)); - return NULL; + goto error1; } /* Do BSS setup */ @@ -221,7 +220,7 @@ map_object(int fd, const char *path, con mprotect(clear_page, PAGE_SIZE, data_prot|PROT_WRITE)) { _rtld_error("%s: mprotect failed: %s", path, rtld_strerror(errno)); - return NULL; + goto error1; } memset(clear_addr, 0, nclear); @@ -240,7 +239,7 @@ map_object(int fd, const char *path, con data_flags | MAP_ANON, -1, 0) == (caddr_t)-1) { _rtld_error("%s: mmap of bss failed: %s", path, rtld_strerror(errno)); - return NULL; + goto error1; } } } @@ -273,7 +272,7 @@ map_object(int fd, const char *path, con if (obj->phdr == NULL) { obj_free(obj); _rtld_error("%s: cannot allocate program header", path); - return NULL; + goto error1; } memcpy((char *)obj->phdr, (char *)hdr + hdr->e_phoff, phsize); obj->phdr_alloc = true; @@ -293,63 +292,72 @@ map_object(int fd, const char *path, con obj->relro_page = obj->relocbase + trunc_page(relro_page); obj->relro_size = round_page(relro_size); - return obj; + munmap(hdr, PAGE_SIZE); + return (obj); + +error1: + munmap(mapbase, mapsize); +error: + munmap(hdr, PAGE_SIZE); + return (NULL); } static Elf_Ehdr * -get_elf_header (int fd, const char *path) +get_elf_header(int fd, const char *path) { - static union { - Elf_Ehdr hdr; - char buf[PAGE_SIZE]; - } u; - ssize_t nbytes; - - if ((nbytes = pread(fd, u.buf, PAGE_SIZE, 0)) == -1) { - _rtld_error("%s: read error: %s", path, rtld_strerror(errno)); - return NULL; - } - - /* Make sure the file is valid */ - if (nbytes < (ssize_t)sizeof(Elf_Ehdr) || !IS_ELF(u.hdr)) { - _rtld_error("%s: invalid file format", path); - return NULL; - } - if (u.hdr.e_ident[EI_CLASS] != ELF_TARG_CLASS - || u.hdr.e_ident[EI_DATA] != ELF_TARG_DATA) { - _rtld_error("%s: unsupported file layout", path); - return NULL; - } - if (u.hdr.e_ident[EI_VERSION] != EV_CURRENT - || u.hdr.e_version != EV_CURRENT) { - _rtld_error("%s: unsupported file version", path); - return NULL; - } - if (u.hdr.e_type != ET_EXEC && u.hdr.e_type != ET_DYN) { - _rtld_error("%s: unsupported file type", path); - return NULL; - } - if (u.hdr.e_machine != ELF_TARG_MACH) { - _rtld_error("%s: unsupported machine", path); - return NULL; - } + Elf_Ehdr *hdr; - /* - * We rely on the program header being in the first page. This is - * not strictly required by the ABI specification, but it seems to - * always true in practice. And, it simplifies things considerably. - */ - if (u.hdr.e_phentsize != sizeof(Elf_Phdr)) { - _rtld_error( - "%s: invalid shared object: e_phentsize != sizeof(Elf_Phdr)", path); - return NULL; - } - if (u.hdr.e_phoff + u.hdr.e_phnum * sizeof(Elf_Phdr) > (size_t)nbytes) { - _rtld_error("%s: program header too large", path); - return NULL; - } + hdr = mmap(NULL, PAGE_SIZE, PROT_READ, MAP_PRIVATE | MAP_PREFAULT_READ, + fd, 0); + if (hdr == (Elf_Ehdr *)MAP_FAILED) { + _rtld_error("%s: read error: %s", path, rtld_strerror(errno)); + return (NULL); + } + + /* Make sure the file is valid */ + if (!IS_ELF(*hdr)) { + _rtld_error("%s: invalid file format", path); + goto error; + } + if (hdr->e_ident[EI_CLASS] != ELF_TARG_CLASS || + hdr->e_ident[EI_DATA] != ELF_TARG_DATA) { + _rtld_error("%s: unsupported file layout", path); + goto error; + } + if (hdr->e_ident[EI_VERSION] != EV_CURRENT || + hdr->e_version != EV_CURRENT) { + _rtld_error("%s: unsupported file version", path); + goto error; + } + if (hdr->e_type != ET_EXEC && hdr->e_type != ET_DYN) { + _rtld_error("%s: unsupported file type", path); + goto error; + } + if (hdr->e_machine != ELF_TARG_MACH) { + _rtld_error("%s: unsupported machine", path); + goto error; + } - return (&u.hdr); + /* + * We rely on the program header being in the first page. This is + * not strictly required by the ABI specification, but it seems to + * always true in practice. And, it simplifies things considerably. + */ + if (hdr->e_phentsize != sizeof(Elf_Phdr)) { + _rtld_error( + "%s: invalid shared object: e_phentsize != sizeof(Elf_Phdr)", path); + goto error; + } + if (hdr->e_phoff + hdr->e_phnum * sizeof(Elf_Phdr) > + (size_t)PAGE_SIZE) { + _rtld_error("%s: program header too large", path); + goto error; + } + return (hdr); + +error: + munmap(hdr, PAGE_SIZE); + return (NULL); } void Modified: user/alc/pvh_global_lock/release/picobsd/tinyware/passwd/passwd.c ============================================================================== --- user/alc/pvh_global_lock/release/picobsd/tinyware/passwd/passwd.c Sun Jun 17 03:54:10 2012 (r237180) +++ user/alc/pvh_global_lock/release/picobsd/tinyware/passwd/passwd.c Sun Jun 17 03:59:17 2012 (r237181) @@ -64,10 +64,6 @@ int yp_errno = YP_TRUE; extern int yp_passwd( char * ); #endif -#ifdef KERBEROS -#include "krb.h" -#endif - #include "extern.h" static void usage(void); @@ -81,26 +77,12 @@ main(argc, argv) { int ch; char *uname; -#ifdef KERBEROS - char *iflag = 0, *rflag = 0, *uflag = 0; - char *k; -#endif #ifdef YP -#ifdef KERBEROS - char realm[REALM_SZ]; -#define OPTIONS "d:h:lysfoi:r:u:" -#else #define OPTIONS "d:h:lysfo" -#endif -#else -#ifdef KERBEROS - char realm[REALM_SZ]; -#define OPTIONS "li:r:u:" #else #define OPTIONS "l" #endif -#endif #ifdef YP int res = 0; @@ -113,17 +95,6 @@ main(argc, argv) case 'l': /* change local password file */ use_local_passwd = 1; break; -#ifdef KERBEROS - case 'i': - iflag = optarg; - break; - case 'r': - rflag = optarg; - break; - case 'u': - uflag = optarg; - break; -#endif /* KERBEROS */ #ifdef YP case 'y': /* Change NIS password */ __use_yp = 1; @@ -182,46 +153,29 @@ main(argc, argv) /* * If NIS is turned on in the password database, use it, else punt. */ -#ifdef KERBEROS - if (__use_yp || (iflag == NULL && rflag == NULL && uflag == NULL)) { -#endif - res = use_yp(uname, 0, 0); - if (res == USER_YP_ONLY) { - if (!use_local_passwd) { - exit(yp_passwd(uname)); - } else { + res = use_yp(uname, 0, 0); + if (res == USER_YP_ONLY) { + if (!use_local_passwd) { + exit(yp_passwd(uname)); + } else { /* * Reject -l flag if NIS is turned on and the user * doesn't exist in the local password database. */ - errx(1, "unknown local user: %s", uname); - } - } else if (res == USER_LOCAL_ONLY) { - /* - * Reject -y flag if user only exists locally. - */ - if (__use_yp) - errx(1, "unknown NIS user: %s", uname); - } else if (res == USER_YP_AND_LOCAL) { - if (!use_local_passwd && (yp_in_pw_file || __use_yp)) - exit(yp_passwd(uname)); + errx(1, "unknown local user: %s", uname); } -#ifdef KERBEROS + } else if (res == USER_LOCAL_ONLY) { + /* + * Reject -y flag if user only exists locally. + */ + if (__use_yp) + errx(1, "unknown NIS user: %s", uname); + } else if (res == USER_YP_AND_LOCAL) { + if (!use_local_passwd && (yp_in_pw_file || __use_yp)) + exit(yp_passwd(uname)); } #endif -#endif - if (!use_local_passwd) { -#ifdef KERBEROS - k = auth_getval("auth_list"); - if (k && strstr(k, "kerberos")) - if(krb_get_lrealm(realm, 0) == KSUCCESS) { - setuid(getuid()); - fprintf(stderr, "realm %s\n", realm); - exit(krb_passwd(argv[0], iflag, rflag, uflag)); - } -#endif - } exit(local_passwd(uname)); } @@ -230,21 +184,10 @@ usage() { #ifdef YP -#ifdef KERBEROS - fprintf(stderr, "%s\n%s\n", - "usage: passwd [-l] [-i instance] [-r realm] [-u fullname]", - " passwd [-l] [-y] [-o] [-d domain [-h host]] [user]"); -#else (void)fprintf(stderr, "usage: passwd [-l] [-y] [-o] [-d domain [-h host]] [user]\n"); -#endif #else -#ifdef KERBEROS - fprintf(stderr, - "usage: passwd [-l] [-i instance] [-r realm] [-u fullname] [user]\n"); -#else - (void)fprintf(stderr, "usage: passwd user\n"); -#endif + (void)fprintf(stderr, "usage: passwd [-l] user\n"); #endif exit(1); } Modified: user/alc/pvh_global_lock/sbin/fsck_ffs/suj.c ============================================================================== --- user/alc/pvh_global_lock/sbin/fsck_ffs/suj.c Sun Jun 17 03:54:10 2012 (r237180) +++ user/alc/pvh_global_lock/sbin/fsck_ffs/suj.c Sun Jun 17 03:59:17 2012 (r237181) @@ -1789,6 +1789,20 @@ cg_trunc(struct suj_cg *sc) } } +static void +cg_adj_blk(struct suj_cg *sc) +{ + struct suj_ino *sino; + int i; + + for (i = 0; i < SUJ_HASHSIZE; i++) { + LIST_FOREACH(sino, &sc->sc_inohash[i], si_next) { + if (sino->si_blkadj) + ino_adjblks(sino); + } + } +} + /* * Free any partially allocated blocks and then resolve inode block * counts. @@ -2720,6 +2734,7 @@ suj_check(const char *filesys) printf("** Processing journal entries.\n"); cg_apply(cg_trunc); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Mon Jun 18 07:42:41 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C675106566B; Mon, 18 Jun 2012 07:42:41 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4F3D08FC12; Mon, 18 Jun 2012 07:42:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5I7gfUV062903; Mon, 18 Jun 2012 07:42:41 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5I7gfO6062902; Mon, 18 Jun 2012 07:42:41 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201206180742.q5I7gfO6062902@svn.freebsd.org> From: Peter Holm Date: Mon, 18 Jun 2012 07:42:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237221 - user/pho X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 07:42:41 -0000 Author: pho Date: Mon Jun 18 07:42:40 2012 New Revision: 237221 URL: http://svn.freebsd.org/changeset/base/237221 Log: Create /user/pho Added: user/pho/ From owner-svn-src-user@FreeBSD.ORG Mon Jun 18 07:43:24 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 77D741065688; Mon, 18 Jun 2012 07:43:24 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4B37F8FC1F; Mon, 18 Jun 2012 07:43:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5I7hO9f062971; Mon, 18 Jun 2012 07:43:24 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5I7hOlf062970; Mon, 18 Jun 2012 07:43:24 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201206180743.q5I7hOlf062970@svn.freebsd.org> From: Peter Holm Date: Mon, 18 Jun 2012 07:43:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237222 - projects/stress2 user/pho/stress2 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 07:43:24 -0000 Author: pho Date: Mon Jun 18 07:43:23 2012 New Revision: 237222 URL: http://svn.freebsd.org/changeset/base/237222 Log: Move /projects/stress2 -> /user/pho/stress2 as requested by uqs. Added: user/pho/stress2/ - copied from r237221, projects/stress2/ Changes in other areas also in this revision: Deleted: projects/stress2/ From owner-svn-src-user@FreeBSD.ORG Tue Jun 19 00:41:30 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2CB02106564A; Tue, 19 Jun 2012 00:41:30 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0C38B8FC08; Tue, 19 Jun 2012 00:41:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5J0fTlx010796; Tue, 19 Jun 2012 00:41:29 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5J0fTPi010785; Tue, 19 Jun 2012 00:41:29 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201206190041.q5J0fTPi010785@svn.freebsd.org> From: Navdeep Parhar Date: Tue, 19 Jun 2012 00:41:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237246 - in user/np/toe_iwarp/sys: net netinet ofed/include/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 00:41:30 -0000 Author: np Date: Tue Jun 19 00:41:29 2012 New Revision: 237246 URL: http://svn.freebsd.org/changeset/base/237246 Log: - Retire arp_update_event. - style(9) fixes. - More detailed comments in netinet/toecore.h Modified: user/np/toe_iwarp/sys/net/if_var.h user/np/toe_iwarp/sys/net/if_vlan.c user/np/toe_iwarp/sys/netinet/if_ether.c user/np/toe_iwarp/sys/netinet/if_ether.h user/np/toe_iwarp/sys/netinet/in.c user/np/toe_iwarp/sys/netinet/tcp_offload.c user/np/toe_iwarp/sys/netinet/tcp_offload.h user/np/toe_iwarp/sys/netinet/toecore.c user/np/toe_iwarp/sys/netinet/toecore.h user/np/toe_iwarp/sys/ofed/include/net/netevent.h Modified: user/np/toe_iwarp/sys/net/if_var.h ============================================================================== --- user/np/toe_iwarp/sys/net/if_var.h Mon Jun 18 23:18:49 2012 (r237245) +++ user/np/toe_iwarp/sys/net/if_var.h Tue Jun 19 00:41:29 2012 (r237246) @@ -209,8 +209,6 @@ struct ifnet { void *if_pspare[8]; /* 1 netmap, 7 TDB */ }; -#define TOEDEV(ifp) ((ifp)->if_llsoftc) - typedef void if_init_f_t(void *); /* @@ -714,6 +712,8 @@ drbr_inuse(struct ifnet *ifp, struct buf #define IF_MINMTU 72 #define IF_MAXMTU 65535 +#define TOEDEV(ifp) ((ifp)->if_llsoftc) + #endif /* _KERNEL */ /* Modified: user/np/toe_iwarp/sys/net/if_vlan.c ============================================================================== --- user/np/toe_iwarp/sys/net/if_vlan.c Mon Jun 18 23:18:49 2012 (r237245) +++ user/np/toe_iwarp/sys/net/if_vlan.c Tue Jun 19 00:41:29 2012 (r237246) @@ -1512,7 +1512,7 @@ vlan_capabilities(struct ifvlan *ifv) * changes then IFCAP_VLAN_TOE should be promoted to a full capability * with its own bit. */ -#define IFCAP_VLAN_TOE IFCAP_TOE +#define IFCAP_VLAN_TOE IFCAP_TOE if (p->if_capabilities & IFCAP_VLAN_TOE) ifp->if_capabilities |= p->if_capabilities & IFCAP_TOE; if (p->if_capenable & IFCAP_VLAN_TOE) { Modified: user/np/toe_iwarp/sys/netinet/if_ether.c ============================================================================== --- user/np/toe_iwarp/sys/netinet/if_ether.c Mon Jun 18 23:18:49 2012 (r237245) +++ user/np/toe_iwarp/sys/netinet/if_ether.c Tue Jun 19 00:41:29 2012 (r237246) @@ -323,7 +323,7 @@ arpresolve(struct ifnet *ifp, struct rte } retry: IF_AFDATA_RLOCK(ifp); - la = *lle = lla_lookup(LLTABLE(ifp), flags, dst); + la = lla_lookup(LLTABLE(ifp), flags, dst); IF_AFDATA_RUNLOCK(ifp); if ((la == NULL) && ((flags & LLE_EXCLUSIVE) == 0) && ((ifp->if_flags & (IFF_NOARP | IFF_STATICARP)) == 0)) { @@ -355,6 +355,7 @@ retry: la->la_preempt--; } + *lle = la; error = 0; goto done; } @@ -736,7 +737,6 @@ match: (void)memcpy(&la->ll_addr, ar_sha(ah), ifp->if_addrlen); la->la_flags |= LLE_VALID; - EVENTHANDLER_INVOKE(arp_update_event, la); EVENTHANDLER_INVOKE(lle_event, la, LLENTRY_RESOLVED); if (!(la->la_flags & LLE_STATIC)) { Modified: user/np/toe_iwarp/sys/netinet/if_ether.h ============================================================================== --- user/np/toe_iwarp/sys/netinet/if_ether.h Mon Jun 18 23:18:49 2012 (r237245) +++ user/np/toe_iwarp/sys/netinet/if_ether.h Tue Jun 19 00:41:29 2012 (r237246) @@ -122,10 +122,6 @@ void arp_ifinit2(struct ifnet *, struct void arp_ifscrub(struct ifnet *, uint32_t); #include -/* XXX: can be retired once OFED code is updated to use lle_event */ -typedef void (*llevent_arp_update_fn)(void *, struct llentry *); -EVENTHANDLER_DECLARE(arp_update_event, llevent_arp_update_fn); - enum { LLENTRY_RESOLVED, LLENTRY_TIMEDOUT, Modified: user/np/toe_iwarp/sys/netinet/in.c ============================================================================== --- user/np/toe_iwarp/sys/netinet/in.c Mon Jun 18 23:18:49 2012 (r237245) +++ user/np/toe_iwarp/sys/netinet/in.c Tue Jun 19 00:41:29 2012 (r237246) @@ -1469,7 +1469,6 @@ in_lltable_lookup(struct lltable *llt, u if (!(lle->la_flags & LLE_IFADDR) || (flags & LLE_IFADDR)) { LLE_WLOCK(lle); lle->la_flags = LLE_DELETED; - EVENTHANDLER_INVOKE(arp_update_event, lle); EVENTHANDLER_INVOKE(lle_event, lle, LLENTRY_DELETED); LLE_WUNLOCK(lle); #ifdef DIAGNOSTIC Modified: user/np/toe_iwarp/sys/netinet/tcp_offload.c ============================================================================== --- user/np/toe_iwarp/sys/netinet/tcp_offload.c Mon Jun 18 23:18:49 2012 (r237245) +++ user/np/toe_iwarp/sys/netinet/tcp_offload.c Tue Jun 19 00:41:29 2012 (r237246) @@ -111,7 +111,7 @@ tcp_offload_input(struct tcpcb *tp, stru { struct toedev *tod = tp->tod; - KASSERT(tod != NULL, ("%s: tp->tod is NULL", __func__)); + KASSERT(tod != NULL, ("%s: tp->tod is NULL, tp %p", __func__, tp)); INP_WLOCK_ASSERT(tp->t_inpcb); tod->tod_input(tod, tp, m); @@ -123,7 +123,7 @@ tcp_offload_output(struct tcpcb *tp) struct toedev *tod = tp->tod; int error, flags; - KASSERT(tod != NULL, ("%s: tp->tod is NULL", __func__)); + KASSERT(tod != NULL, ("%s: tp->tod is NULL, tp %p", __func__, tp)); INP_WLOCK_ASSERT(tp->t_inpcb); flags = tcp_outflags[tp->t_state]; @@ -147,7 +147,7 @@ tcp_offload_rcvd(struct tcpcb *tp) { struct toedev *tod = tp->tod; - KASSERT(tod != NULL, ("%s: tp->tod is NULL", __func__)); + KASSERT(tod != NULL, ("%s: tp->tod is NULL, tp %p", __func__, tp)); INP_WLOCK_ASSERT(tp->t_inpcb); tod->tod_rcvd(tod, tp); @@ -158,7 +158,7 @@ tcp_offload_ctloutput(struct tcpcb *tp, { struct toedev *tod = tp->tod; - KASSERT(tod != NULL, ("%s: tp->tod is NULL", __func__)); + KASSERT(tod != NULL, ("%s: tp->tod is NULL, tp %p", __func__, tp)); INP_WLOCK_ASSERT(tp->t_inpcb); tod->tod_ctloutput(tod, tp, sopt_dir, sopt_name); @@ -169,7 +169,7 @@ tcp_offload_detach(struct tcpcb *tp) { struct toedev *tod = tp->tod; - KASSERT(tod != NULL, ("%s: tp->tod is NULL", __func__)); + KASSERT(tod != NULL, ("%s: tp->tod is NULL, tp %p", __func__, tp)); INP_WLOCK_ASSERT(tp->t_inpcb); tod->tod_pcb_detach(tod, tp); Modified: user/np/toe_iwarp/sys/netinet/tcp_offload.h ============================================================================== --- user/np/toe_iwarp/sys/netinet/tcp_offload.h Mon Jun 18 23:18:49 2012 (r237245) +++ user/np/toe_iwarp/sys/netinet/tcp_offload.h Tue Jun 19 00:41:29 2012 (r237246) @@ -28,7 +28,7 @@ */ #ifndef _NETINET_TCP_OFFLOAD_H_ -#define _NETINET_TCP_OFFLOAD_H_ +#define _NETINET_TCP_OFFLOAD_H_ #ifndef _KERNEL #error "no user-serviceable parts inside" Modified: user/np/toe_iwarp/sys/netinet/toecore.c ============================================================================== --- user/np/toe_iwarp/sys/netinet/toecore.c Mon Jun 18 23:18:49 2012 (r237245) +++ user/np/toe_iwarp/sys/netinet/toecore.c Tue Jun 19 00:41:29 2012 (r237246) @@ -28,6 +28,9 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_inet.h" +#include "opt_inet6.h" + #include #include #include @@ -37,17 +40,19 @@ __FBSDID("$FreeBSD$"); #include #include #include + #include #include #include #include #include #include + #include #include +#include #include #include -#include #define TCPSTATES #include #include @@ -59,8 +64,10 @@ __FBSDID("$FreeBSD$"); static struct mtx toedev_lock; static TAILQ_HEAD(, toedev) toedev_list; -static eventhandler_tag listen_start_eh, listen_stop_eh; -static eventhandler_tag lle_event_eh, route_redirect_eh; +static eventhandler_tag listen_start_eh; +static eventhandler_tag listen_stop_eh; +static eventhandler_tag lle_event_eh; +static eventhandler_tag route_redirect_eh; static int toedev_connect(struct toedev *tod __unused, struct socket *so __unused, @@ -176,7 +183,7 @@ toedev_ctloutput(struct toedev *tod __un static void toe_listen_start(struct inpcb *inp, void *arg) { - struct toedev *t = arg, *tod; + struct toedev *t, *tod; struct tcpcb *tp; INP_WLOCK_ASSERT(inp); @@ -190,6 +197,7 @@ toe_listen_start(struct inpcb *inp, void if (tp->t_state != TCPS_LISTEN) return; + t = arg; mtx_lock(&toedev_lock); TAILQ_FOREACH(tod, &toedev_list, link) { if (t == NULL || t == tod) @@ -307,7 +315,7 @@ unregister_toedev(struct toedev *tod) } } KASSERT(registered_toedevs >= 0, - ("%s: registered_toedevs < 0", __func__)); + ("%s: registered_toedevs (%d) < 0", __func__, registered_toedevs)); mtx_unlock(&toedev_lock); return (rc); } @@ -374,9 +382,9 @@ toe_lle_event(void *arg __unused, struct { struct toedev *tod; struct ifnet *ifp; - uint8_t *lladdr; - uint16_t vtag = 0xfff; struct sockaddr *sa; + uint8_t *lladdr; + uint16_t vtag; LLE_WLOCK_ASSERT(lle); @@ -384,7 +392,8 @@ toe_lle_event(void *arg __unused, struct sa = L3_ADDR(lle); KASSERT(sa->sa_family == AF_INET || sa->sa_family == AF_INET6, - ("%s: lle_event but sa !INET && !INET6", __func__)); + ("%s: lle_event %d for lle %p but sa %p !INET && !INET6", + __func__, evt, lle, sa)); /* * Not interested if the interface's TOE capability is not enabled. @@ -397,6 +406,7 @@ toe_lle_event(void *arg __unused, struct if (tod == NULL) return; + vtag = 0xfff; if (evt != LLENTRY_RESOLVED) { /* @@ -426,6 +436,7 @@ static void toe_route_redirect_event(void *arg __unused, struct rtentry *rt0, struct rtentry *rt1, struct sockaddr *sa) { + return; } @@ -442,12 +453,16 @@ toe_l2_resolve(struct toedev *tod, struc int rc; switch (sa->sa_family) { +#ifdef INET case AF_INET: rc = arpresolve(ifp, NULL, NULL, sa, lladdr, &lle); break; +#endif +#ifdef INET6 case AF_INET6: rc = nd6_storelladdr(ifp, NULL, sa, lladdr, &lle); break; +#endif default: return (EPROTONOSUPPORT); } @@ -547,7 +562,7 @@ toecore_mod_handler(module_t mod, int cm if (cmd == MOD_UNLOAD) return (toecore_unload()); - return (0); + return (EOPNOTSUPP); } static moduledata_t mod_data= { Modified: user/np/toe_iwarp/sys/netinet/toecore.h ============================================================================== --- user/np/toe_iwarp/sys/netinet/toecore.h Mon Jun 18 23:18:49 2012 (r237245) +++ user/np/toe_iwarp/sys/netinet/toecore.h Tue Jun 19 00:41:29 2012 (r237246) @@ -24,11 +24,10 @@ * SUCH DAMAGE. * * $FreeBSD$ - * */ #ifndef _NETINET_TOE_H_ -#define _NETINET_TOE_H_ +#define _NETINET_TOE_H_ #ifndef _KERNEL #error "no user-serviceable parts inside" @@ -42,7 +41,10 @@ struct toedev { TAILQ_ENTRY(toedev) link; /* glue for toedev_list */ void *tod_softc; /* TOE driver private data */ - /* Active open. */ + /* + * Active open. If a failure occurs, it is reported back by the driver + * via toe_connect_failed. + */ int (*tod_connect)(struct toedev *, struct socket *, struct rtentry *, struct sockaddr *); @@ -50,25 +52,38 @@ struct toedev { int (*tod_listen_start)(struct toedev *, struct tcpcb *); int (*tod_listen_stop)(struct toedev *, struct tcpcb *); - /* Frame received by kernel for an offloaded connection */ + /* + * The kernel uses this routine to pass on any frame it receives for an + * offloaded connection to the TOE driver. This is an unusual event. + */ void (*tod_input)(struct toedev *, struct tcpcb *, struct mbuf *); - /* Some data read */ + /* + * This is called by the kernel during pru_rcvd for an offloaded TCP + * connection and provides an opportunity for the TOE driver to manage + * its rx window and credits. + */ void (*tod_rcvd)(struct toedev *, struct tcpcb *); - /* Output data, if any is waiting to be sent out. */ + /* + * Transmit routine. The kernel calls this to have the TOE driver + * evaluate whether there is data to be transmitted, and transmit it. + */ int (*tod_output)(struct toedev *, struct tcpcb *); - /* Immediate teardown, send RST to peer */ + /* Immediate teardown: send RST to peer. */ int (*tod_send_rst)(struct toedev *, struct tcpcb *); - /* Orderly disconnect, send FIN to the peer */ + /* Initiate orderly disconnect by sending FIN to the peer. */ int (*tod_send_fin)(struct toedev *, struct tcpcb *); - /* Kernel is done with the TCP PCB */ + /* Called to indicate that the kernel is done with this TCP PCB. */ void (*tod_pcb_detach)(struct toedev *, struct tcpcb *); - /* Information about an L2 entry is now available. */ + /* + * The kernel calls this once it has information about an L2 entry that + * the TOE driver enquired about previously (via toe_l2_resolve). + */ void (*tod_l2_update)(struct toedev *, struct ifnet *, struct sockaddr *, uint8_t *, uint16_t); @@ -93,13 +108,13 @@ EVENTHANDLER_DECLARE(tcp_offload_listen_ EVENTHANDLER_DECLARE(tcp_offload_listen_stop, tcp_offload_listen_stop_fn); void init_toedev(struct toedev *); -int register_toedev(struct toedev *); -int unregister_toedev(struct toedev *); +int register_toedev(struct toedev *); +int unregister_toedev(struct toedev *); /* - * General interface for looking up L2 information for an IP or IPv6 address. - * If an answer is not available right away then the TOE driver's tod_l2_update - * will be called later. + * General interface for looking up L2 information for an IP address. If an + * answer is not available right away then the TOE driver's tod_l2_update will + * be called later. */ int toe_l2_resolve(struct toedev *, struct ifnet *, struct sockaddr *, uint8_t *, uint16_t *); Modified: user/np/toe_iwarp/sys/ofed/include/net/netevent.h ============================================================================== --- user/np/toe_iwarp/sys/ofed/include/net/netevent.h Mon Jun 18 23:18:49 2012 (r237245) +++ user/np/toe_iwarp/sys/ofed/include/net/netevent.h Tue Jun 19 00:41:29 2012 (r237246) @@ -42,7 +42,7 @@ enum netevent_notif_type { struct llentry; static inline void -_handle_arp_update_event(void *arg, struct llentry *lle) +_handle_arp_update_event(void *arg, struct llentry *lle, int evt __unused) { struct notifier_block *nb; @@ -54,7 +54,7 @@ static inline int register_netevent_notifier(struct notifier_block *nb) { nb->tags[NETEVENT_NEIGH_UPDATE] = EVENTHANDLER_REGISTER( - arp_update_event, _handle_arp_update_event, nb, 0); + lle_event, _handle_arp_update_event, nb, 0); return (0); } @@ -62,8 +62,7 @@ static inline int unregister_netevent_notifier(struct notifier_block *nb) { - EVENTHANDLER_DEREGISTER(arp_update_event, - nb->tags[NETEVENT_NEIGH_UPDATE]); + EVENTHANDLER_DEREGISTER(lle_event, nb->tags[NETEVENT_NEIGH_UPDATE]); return (0); } From owner-svn-src-user@FreeBSD.ORG Tue Jun 19 23:45:18 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3683E106566B; Tue, 19 Jun 2012 23:45:18 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1711C8FC22; Tue, 19 Jun 2012 23:45:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5JNjIPF004265; Tue, 19 Jun 2012 23:45:18 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5JNjHRu004257; Tue, 19 Jun 2012 23:45:17 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206192345.q5JNjHRu004257@svn.freebsd.org> From: Adrian Chadd Date: Tue, 19 Jun 2012 23:45:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237278 - in user/adrian/ath_radar_stuff: . lib lib/libradarpkt src src/pktlog X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 23:45:18 -0000 Author: adrian Date: Tue Jun 19 23:45:17 2012 New Revision: 237278 URL: http://svn.freebsd.org/changeset/base/237278 Log: Add some locally written code to tinker with radar frame capture and decoding from userland. * lib/libradarpkt/ has some bits that I've written to decode the PHY error frame format, for AR5416 and post-AR5416. The AR9280 code is just as applicable for AR9130/AR9160. * src/pktlog will read either a radiotap interface or a capture file and dump phy errors out at you. It includes a BPF filter which limits the amount of stuff that gets pushed to userland. It doesn't output anything by default; you'll have to enable debug printing for that to happen. check the source. The code relies on the patch at http://wiki.freebsd.org/ath(4)/RadarFFT. There's hard-coded -I references to my home-directory, sorry. You should replace that with the path to your kernel tree which has the ath(4) radiotap vendor extension patch. Added: user/adrian/ath_radar_stuff/ user/adrian/ath_radar_stuff/lib/ user/adrian/ath_radar_stuff/lib/libradarpkt/ user/adrian/ath_radar_stuff/lib/libradarpkt/Makefile user/adrian/ath_radar_stuff/lib/libradarpkt/ar5416_radar.c user/adrian/ath_radar_stuff/lib/libradarpkt/ar5416_radar.h user/adrian/ath_radar_stuff/lib/libradarpkt/ar9280_radar.c user/adrian/ath_radar_stuff/lib/libradarpkt/ar9280_radar.h user/adrian/ath_radar_stuff/lib/libradarpkt/pkt.h user/adrian/ath_radar_stuff/src/ user/adrian/ath_radar_stuff/src/pktlog/ user/adrian/ath_radar_stuff/src/pktlog/Makefile user/adrian/ath_radar_stuff/src/pktlog/main.c Added: user/adrian/ath_radar_stuff/lib/libradarpkt/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/adrian/ath_radar_stuff/lib/libradarpkt/Makefile Tue Jun 19 23:45:17 2012 (r237278) @@ -0,0 +1,8 @@ +LIB= radarpkt + +SRCS= ar9280_radar.c ar5416_radar.c +CFLAGS+= -I/home/adrian/work/freebsd/ath/head/src/sys -g -ggdb + +NO_MAN= 1 + +.include Added: user/adrian/ath_radar_stuff/lib/libradarpkt/ar5416_radar.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/adrian/ath_radar_stuff/lib/libradarpkt/ar5416_radar.c Tue Jun 19 23:45:17 2012 (r237278) @@ -0,0 +1,99 @@ +/*- + * Copyright (c) 2012 Adrian Chadd + * 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, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any + * redistribution must be conditioned upon including a substantially + * similar Disclaimer requirement for further binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGES. + * + * $FreeBSD$ + */ +#include +#include +#include +#include +#include /* for memcpy() */ + +/* Headers required for the ioctl interface */ +#include +#include +#include + +//#include "net80211/ieee80211_var.h" +#include "net80211/ieee80211_radiotap.h" + +#include "dev/ath/if_athioctl.h" + +#include "pkt.h" + +#include "ar5416_radar.h" + +int +ar5416_radar_decode(struct ieee80211_radiotap_header *rh, + const unsigned char *pkt, int len, struct radar_entry *re) +{ + uint64_t tsf; + int8_t rssi, nf; + struct ath_rx_radiotap_header *rx = + (struct ath_rx_radiotap_header *) rh; + + /* XXX we should really be implementing a real radiotap parser */ + tsf = le64toh(rx->wr_tsf); + + /* + * XXX For AR5416, we should use the ctl[0] RSSI for pre Owl-2.2. + */ + rssi = rx->wr_v.rssi_ctl[0]; + nf = rx->wr_antnoise; + + /* Last byte is the pulse width */ + if (len < 1) { + printf("short radar frame\n"); + return (0); + } + +#if 0 + printf("phyerr: %d ", rx->wr_v.vh_phyerr_code); + printf("ts: %lld", tsf); + printf("\tit_present: %x", le32toh(rh->it_present)); + printf("\tlen: %d", len); + printf("\trssi: %d, nf: %d", rssi, nf); + printf("\tpri: %u", pkt[len - 1] & 0xff); + printf("\n"); +#endif + + /* + * If RSSI > 0x80, it's a negative RSSI. We store it signed + * so we can at least log that it was negative in order to + * plot it. The radar code IIRC just tosses it. + */ + re->re_rssi = rssi; + + re->re_timestamp = tsf; + /* XXX TODO: re->re_freq */ + re->re_dur = pkt[len - 1] & 0xff; + /* XXX TODO: also store ctl/ext RSSI, and some flags */ + re->re_freq = 0; + + return(1); +} Added: user/adrian/ath_radar_stuff/lib/libradarpkt/ar5416_radar.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/adrian/ath_radar_stuff/lib/libradarpkt/ar5416_radar.h Tue Jun 19 23:45:17 2012 (r237278) @@ -0,0 +1,47 @@ +/*- + * Copyright (c) 2012 Adrian Chadd + * 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, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any + * redistribution must be conditioned upon including a substantially + * similar Disclaimer requirement for further binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGES. + * + * $FreeBSD$ + */ +#ifndef __AR5416_RADAR_H__ +#define __AR5416_RADAR_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define CHIP_AR5416 1 + +extern int ar5416_radar_decode(struct ieee80211_radiotap_header *rh, + const unsigned char *pkt, int len, struct radar_entry *re); + +#ifdef __cplusplus +} +#endif + +#endif /* __AR5416_RADAR__ */ Added: user/adrian/ath_radar_stuff/lib/libradarpkt/ar9280_radar.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/adrian/ath_radar_stuff/lib/libradarpkt/ar9280_radar.c Tue Jun 19 23:45:17 2012 (r237278) @@ -0,0 +1,100 @@ +/*- + * Copyright (c) 2012 Adrian Chadd + * 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, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any + * redistribution must be conditioned upon including a substantially + * similar Disclaimer requirement for further binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGES. + * + * $FreeBSD$ + */ +#include +#include +#include +#include +#include /* for memcpy() */ + +#include +#include + +#include "net80211/ieee80211_radiotap.h" + +#include "dev/ath/if_athioctl.h" + +#include "pkt.h" +#include "ar9280_radar.h" + +/* Relevant for Sowl and later */ +#define EXT_CH_RADAR_EARLY_FOUND 0x04 +#define EXT_CH_RADAR_FOUND 0x02 +#define PRI_CH_RADAR_FOUND 0x01 + +int +ar9280_radar_decode(struct ieee80211_radiotap_header *rh, + const unsigned char *pkt, int len, struct radar_entry *re) +{ + uint64_t tsf; + int8_t comb_rssi, pri_rssi, ext_rssi, nf; + struct ath_rx_radiotap_header *rx = + (struct ath_rx_radiotap_header *) rh; + + /* XXX we should really be implementing a real radiotap parser */ + tsf = le64toh(rx->wr_tsf); + + /* + * XXX which rssi should we use? + * XXX ext rssi? + */ + comb_rssi = rx->wr_antsignal; + pri_rssi = rx->wr_v.rssi_ctl[0]; + ext_rssi = rx->wr_v.rssi_ext[0]; + nf = rx->wr_antnoise; + + /* Last three bytes are the radar parameters */ + if (len < 3) { + printf("short radar frame\n"); + return (0); + } + +#if 0 + printf("tsf: %lld", tsf); + printf(" len: %d", len); + printf(" rssi %d/%d", comb_rssi, nf); + printf(", pri/ext rssi: %d/%d", pri_rssi, ext_rssi); + printf(" pri: %u", pkt[len - 3] & 0xff); + printf(" ext: %u", pkt[len - 2] & 0xff); + printf(" flags: %s %s %s\n", + pkt[len - 1] & PRI_CH_RADAR_FOUND ? "pri" : "", + pkt[len - 1] & EXT_CH_RADAR_FOUND ? "ext" : "", + pkt[len - 1] & EXT_CH_RADAR_EARLY_FOUND ? "extearly" : "" + ); +#endif + + re->re_timestamp = tsf; + re->re_rssi = comb_rssi; /* XXX extension rssi? */ + re->re_dur = pkt[len - 3]; /* XXX extension duration? */ + /* XXX flags? */ + /* XXX freq? */ + + return(1); +} Added: user/adrian/ath_radar_stuff/lib/libradarpkt/ar9280_radar.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/adrian/ath_radar_stuff/lib/libradarpkt/ar9280_radar.h Tue Jun 19 23:45:17 2012 (r237278) @@ -0,0 +1,47 @@ +/*- + * Copyright (c) 2012 Adrian Chadd + * 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, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any + * redistribution must be conditioned upon including a substantially + * similar Disclaimer requirement for further binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGES. + * + * $FreeBSD$ + */ +#ifndef __AR9280_RADAR_H__ +#define __AR9280_RADAR_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define CHIP_AR9280 2 + +extern int ar9280_radar_decode(struct ieee80211_radiotap_header *rh, + const unsigned char *pkt, int len, struct radar_entry *re); + +#ifdef __cplusplus +} +#endif + +#endif /* __AR9280_RADAR_H__ */ Added: user/adrian/ath_radar_stuff/lib/libradarpkt/pkt.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/adrian/ath_radar_stuff/lib/libradarpkt/pkt.h Tue Jun 19 23:45:17 2012 (r237278) @@ -0,0 +1,54 @@ +/*- + * Copyright (c) 2012 Adrian Chadd + * 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, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any + * redistribution must be conditioned upon including a substantially + * similar Disclaimer requirement for further binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGES. + * + * $FreeBSD$ + */ +#ifndef __PKTHDR_PKT_H__ +#define __PKTHDR_PKT_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +struct radar_entry { + uint64_t re_timestamp; + uint32_t re_freq; + /* + * The hardware may give it to us as a negative number; + * eg CCK decode which can use self-correlation to decode + * a very very weak signal. + */ + int32_t re_rssi; + uint32_t re_dur; +}; + +#ifdef __cplusplus +} +#endif + +#endif /* __PKTHDR_PKT_H__ */ Added: user/adrian/ath_radar_stuff/src/pktlog/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/adrian/ath_radar_stuff/src/pktlog/Makefile Tue Jun 19 23:45:17 2012 (r237278) @@ -0,0 +1,12 @@ +PROG= main + +X_INCS= -I../../lib/ +X_LIBS= -L../../lib/libradarpkt/ + +SRCS= main.c +CFLAGS+= -I/home/adrian/work/freebsd/ath/head/src/sys $(X_INCS) -g -ggdb +LDADD+= $(X_LIBS) -lpcap -lradarpkt + +NO_MAN= 1 + +.include Added: user/adrian/ath_radar_stuff/src/pktlog/main.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/adrian/ath_radar_stuff/src/pktlog/main.c Tue Jun 19 23:45:17 2012 (r237278) @@ -0,0 +1,213 @@ +#include +#include +#include +#include +#include /* for ntohl etc */ + +#include + +#include "net80211/ieee80211_radiotap.h" + +#include "libradarpkt/pkt.h" +#include "libradarpkt/ar5416_radar.h" +#include "libradarpkt/ar9280_radar.h" + +/* + * Compile up a rule that's bound to be useful - it only matches on + * radar errors. + * + * tcpdump -ni wlan0 -y IEEE802_11_RADIO -x -X -s0 -v -ve \ + * 'radio[73] == 0x2 && (radio[72] == 5 || radio[72] == 24) + */ + +#define PKTRULE "radio[73] == 0x2 && (radio[72] == 5 || radio[72] == 24)" + +static int +pkt_compile(pcap_t *p, struct bpf_program *fp) +{ + if (pcap_compile(p, fp, PKTRULE, 1, 0) != 0) + return 0; + return 1; +} + +static void +pkt_print(struct radar_entry *re) +{ + printf("ts: %llu, freq=%u, rssi=%d, dur=%d\n", + re->re_timestamp, + re->re_freq, + re->re_rssi, + re->re_dur); +} + +void +pkt_handle(int chip, const char *pkt, int len) +{ + struct ieee80211_radiotap_header *rh; + uint8_t rssi, nf; + struct radar_entry re; + + /* XXX assume it's a radiotap frame */ + rh = (struct ieee80211_radiotap_header *) pkt; + + if (rh->it_version != 0) { + printf("%s: incorrect version (%d)\n", __func__, + rh->it_version); + return; + } + +#if 0 + /* XXX short frames? */ + if (len < 73) { + printf("%s: short frame (%d bytes)\n", __func__, len); + return; + } +#endif + +#if 0 + printf("%s: len=%d, present=0x%08x\n", + __func__, + (rh->it_len), /* XXX why aren't these endian-converted? */ + (rh->it_present)); +#endif + +#if 0 + /* + * XXX local hack - enable the radar checking + * XXX by assuming byte 72 is the radar status code. + */ + if (pkt[72] != 5 && pkt[72] != 24) { + printf("%s: not a radar error (code %d)?!\n", + __func__, + pkt[72]); + return; + } +#endif + + if (chip == CHIP_AR5416) + ar5416_radar_decode(rh, pkt + rh->it_len, len - rh->it_len, + &re); + else if (chip == CHIP_AR9280) + ar9280_radar_decode(rh, pkt + rh->it_len, len - rh->it_len, + &re); + + /* + * TODO: Print the summary record + */ + //pkt_print(&re); +} + +static pcap_t * +open_offline(const char *fname) +{ + pcap_t *p; + char errbuf[PCAP_ERRBUF_SIZE]; + + p = pcap_open_offline(fname, errbuf); + if (p == NULL) { + printf("pcap_create failed: %s\n", errbuf); + return (NULL); + } + + return (p); +} + +static pcap_t * +open_online(const char *ifname) +{ + pcap_t *p; + char errbuf[PCAP_ERRBUF_SIZE]; + struct bpf_program fp; + + p = pcap_open_live(ifname, 65536, 1, 1000, errbuf); + if (! p) { + err(1, "pcap_create: %s\n", errbuf); + return (NULL); + } + + if (pcap_set_datalink(p, DLT_IEEE802_11_RADIO) != 0) { + pcap_perror(p, "pcap_set_datalink"); + return (NULL); + } + + /* XXX pcap_is_swapped() ? */ + + if (! pkt_compile(p, &fp)) { + pcap_perror(p, "pkg_compile compile error\n"); + return (NULL); + } + + if (pcap_setfilter(p, &fp) != 0) { + printf("pcap_setfilter failed\n"); + return (NULL); + } + + return (p); +} + +static void +usage(const char *progname) +{ + + printf("Usage: %s \n", + progname); +} + +int +main(int argc, const char *argv[]) +{ + char *dev; + pcap_t * p; + const char *fname; + const unsigned char *pkt; + struct pcap_pkthdr *hdr; + int len, r; + int chip = 0; + + if (argc < 4) { + usage(argv[0]); + exit(255); + } + + if (strcmp(argv[1], "ar5416") == 0) { + chip = CHIP_AR5416; + } else if (strcmp(argv[1], "ar9280") == 0) { + chip = CHIP_AR9280; + } else { + usage(argv[0]); + exit(255); + } + + /* XXX verify */ + fname = argv[3]; + + if (strcmp(argv[2], "file") == 0) { + p = open_offline(fname); + } else if (strcmp(argv[2], "if") == 0) { + p = open_online(fname); + } else { + usage(argv[0]); + exit(255); + } + + if (p == NULL) + exit(255); + + /* + * Iterate over frames, looking for radiotap frames + * which have PHY errors. + * + * XXX We should compile a filter for this, but the + * XXX access method is a non-standard hack atm. + */ + while ((r = pcap_next_ex(p, &hdr, &pkt)) >= 0) { +#if 0 + printf("capture: len=%d, caplen=%d\n", + hdr->len, hdr->caplen); +#endif + if (r > 0) + pkt_handle(chip, pkt, hdr->caplen); + } + + pcap_close(p); +} From owner-svn-src-user@FreeBSD.ORG Wed Jun 20 07:38:53 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 87549106566B; Wed, 20 Jun 2012 07:38:53 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 59B018FC1A; Wed, 20 Jun 2012 07:38:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5K7cr2X026746; Wed, 20 Jun 2012 07:38:53 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5K7crUq026745; Wed, 20 Jun 2012 07:38:53 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206200738.q5K7crUq026745@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 20 Jun 2012 07:38:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237291 - user/ae/bootcode X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 07:38:53 -0000 Author: ae Date: Wed Jun 20 07:38:52 2012 New Revision: 237291 URL: http://svn.freebsd.org/changeset/base/237291 Log: Prepare a workplace for review of bootcode changes. Added: user/ae/bootcode/ - copied from r237289, head/ From owner-svn-src-user@FreeBSD.ORG Wed Jun 20 07:56:39 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4E5931065670; Wed, 20 Jun 2012 07:56:39 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 39D918FC08; Wed, 20 Jun 2012 07:56:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5K7udVW027517; Wed, 20 Jun 2012 07:56:39 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5K7ud7j027515; Wed, 20 Jun 2012 07:56:39 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206200756.q5K7ud7j027515@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 20 Jun 2012 07:56:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237292 - user/ae/bootcode/sys/boot/common X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 07:56:39 -0000 Author: ae Date: Wed Jun 20 07:56:38 2012 New Revision: 237292 URL: http://svn.freebsd.org/changeset/base/237292 Log: When primary GPT header is damaged and we are trying to find backup GPT header at the last LBA, check for GEOM metadata and skip them if found. This allows use GPT atop of the some GEOM providers and boot from. Submitted by: hrs Modified: user/ae/bootcode/sys/boot/common/gpt.c Modified: user/ae/bootcode/sys/boot/common/gpt.c ============================================================================== --- user/ae/bootcode/sys/boot/common/gpt.c Wed Jun 20 07:38:52 2012 (r237291) +++ user/ae/bootcode/sys/boot/common/gpt.c Wed Jun 20 07:56:38 2012 (r237292) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include "gpt.h" #define MAXTBLENTS 128 +#define GEOM_MAGIC "GEOM::" static struct gpt_hdr hdr_primary, hdr_backup, *gpthdr; static uint64_t hdr_primary_lba, hdr_backup_lba; @@ -345,8 +346,18 @@ gptread(const uuid_t *uuid, struct dsk * altlba = hdr_primary.hdr_lba_alt; } else { altlba = drvsize(dskp); - if (altlba > 0) - altlba--; + if (altlba > 0) { + do { + altlba--; + /* + * Check GEOM metadata and decrement + * the altlba if found. + */ + if (drvread(dskp, secbuf, altlba, 1) != 0) + break; + } while (memcmp(secbuf, GEOM_MAGIC, + sizeof(GEOM_MAGIC) - 1) == 0); + } } if (altlba == 0) printf("%s: unable to locate backup GPT header\n", BOOTPROG); From owner-svn-src-user@FreeBSD.ORG Wed Jun 20 08:02:44 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C5E151065675; Wed, 20 Jun 2012 08:02:44 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A6FBF8FC14; Wed, 20 Jun 2012 08:02:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5K82ic9027820; Wed, 20 Jun 2012 08:02:44 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5K82iRG027818; Wed, 20 Jun 2012 08:02:44 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206200802.q5K82iRG027818@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 20 Jun 2012 08:02:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237293 - user/ae/bootcode/sys/boot/i386/pmbr X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 08:02:45 -0000 Author: ae Date: Wed Jun 20 08:02:44 2012 New Revision: 237293 URL: http://svn.freebsd.org/changeset/base/237293 Log: Teach PMBR boot code read the backup GPT header and skip GEOM's metadata. Submitted by: hrs Modified: user/ae/bootcode/sys/boot/i386/pmbr/pmbr.s Modified: user/ae/bootcode/sys/boot/i386/pmbr/pmbr.s ============================================================================== --- user/ae/bootcode/sys/boot/i386/pmbr/pmbr.s Wed Jun 20 07:56:38 2012 (r237292) +++ user/ae/bootcode/sys/boot/i386/pmbr/pmbr.s Wed Jun 20 08:02:44 2012 (r237293) @@ -42,8 +42,9 @@ .set STACK,EXEC+SECSIZE*4 # Stack address .set GPT_ADDR,STACK # GPT header address .set GPT_SIG,0 - .set GPT_SIG_0,0x20494645 - .set GPT_SIG_1,0x54524150 + .set GPT_SIG_0,0x20494645 # "EFI " + .set GPT_SIG_1,0x54524150 # "PART" + .set GEOM_MAGIC,0x4d4f4547 # "GEOM" .set GPT_MYLBA,24 .set GPT_PART_LBA,72 .set GPT_NPART,80 @@ -52,6 +53,8 @@ .set PART_TYPE,0 .set PART_START_LBA,32 .set PART_END_LBA,40 + .set DPBUF,PART_ADDR+SECSIZE + .set DPBUF_SEC,0x10 # Number of sectors .set NHRDRV,0x475 # Number of hard drives @@ -91,15 +94,39 @@ main: cmpb $0x80,%dl # Drive valid? jb main.2 # Yes main.1: movb $0x80,%dl # Assume drive 0x80 # -# Load the primary GPT header from LBA 1 and verify signature. -# -main.2: movw $GPT_ADDR,%bx +# Load the GPT header and verify signature. Try LBA 1 for the primary one and +# the last LBA for the backup if it is broken. Skip the LBAs if GEOM +# metadata found at the backup location. +# +main.2: call getdrvparams # Read drive parameters + movb $1,%dh # %dh := 1 (reading primary) +main.2a: movw $GPT_ADDR,%bx movw $lba,%si - call read + call read # Read header and check GPT sig cmpl $GPT_SIG_0,GPT_ADDR+GPT_SIG - jnz err_pt + jnz main.2b cmpl $GPT_SIG_1,GPT_ADDR+GPT_SIG+4 - jnz err_pt + jnz main.2b + jmp load_part +main.2b: cmpb $1,%dh # Reading primary? + je main.3 # Try backup if yes + cmpl $GEOM_MAGIC,GPT_ADDR # GEOM sig at backup location? + jz main.3 # Skip GEOM metadata + jmp err_pt # Invalid table found +# +# Try alternative LBAs from the last sector for the GPT header. +# +main.3: movb $0,%dh # %dh := 0 (reading backup) + movw $DPBUF+DPBUF_SEC,%si # %si = last sector + 1 + movw $lba,%di # %di = $lba + cmpl $0,(%si) # + jnz main.3a # + decl 0x4(%si) # 0x4(%si) = last sec (32-64) +main.3a: decl (%si) # 0x0(%si) = last sec (0-31) + movw $2,%cx + rep + movsw # $lastsec--, copy it to $lba + jmp main.2a # Read the next sector # # Load a partition table sector from disk and look for a FreeBSD boot # partition. @@ -172,6 +199,16 @@ read: pushl 0x4(%si) # Set the LBA jc err_rd # If error ret # +# Check the number of LBAs on the drive index %dx. Trashes %ax and %si. +# +getdrvparams: + movw $DPBUF,%si # Set the address of result buf + movw $0x001e,(%si) # len + movw $0x4800,%ax # BIOS: Read Drive Parameters + int $0x13 # Call the BIOS + jc err_rd # "I/O error" if error + ret +# # Various error message entry points. # err_big: movw $msg_big,%si # "Boot loader too From owner-svn-src-user@FreeBSD.ORG Wed Jun 20 08:29:25 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 752E41065672; Wed, 20 Jun 2012 08:29:25 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6193A8FC17; Wed, 20 Jun 2012 08:29:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5K8TPnk028909; Wed, 20 Jun 2012 08:29:25 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5K8TPcK028907; Wed, 20 Jun 2012 08:29:25 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206200829.q5K8TPcK028907@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 20 Jun 2012 08:29:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237294 - user/ae/bootcode/sys/boot/i386/pmbr X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 08:29:25 -0000 Author: ae Date: Wed Jun 20 08:29:24 2012 New Revision: 237294 URL: http://svn.freebsd.org/changeset/base/237294 Log: In case when we have damaged several first sectors, GEOM_PART_GPT class will not detect GPT even if backup GPT header is ok. To recover we should write PMBR to the LBA 0. But we can't use `gpart bootcode` command until GPT is detected and geom created. We can dd(8) /boot/pmbr image and kernel will be able detect GPT. But our PMBR image contains only empty partition entries and our loader can't detect GPT when it hasn't the partition record with type PMBR. Add one partition record to the PMBR image. It covers all space after the LBA 0. It is better to have one partially correct record, than have nothing. Modified: user/ae/bootcode/sys/boot/i386/pmbr/pmbr.s Modified: user/ae/bootcode/sys/boot/i386/pmbr/pmbr.s ============================================================================== --- user/ae/bootcode/sys/boot/i386/pmbr/pmbr.s Wed Jun 20 08:02:44 2012 (r237293) +++ user/ae/bootcode/sys/boot/i386/pmbr/pmbr.s Wed Jun 20 08:29:24 2012 (r237294) @@ -255,6 +255,16 @@ boot_uuid: .long 0x83bd6b9d .org DISKSIG,0x90 sig: .long 0 # OS Disk Signature .word 0 # "Unknown" in PMBR - -partbl: .fill 0x10,0x4,0x0 # Partition table + # Partition table +partbl: .byte 0x80 # bootable flag + .byte 0x00 # CHS address + .byte 0x02 # of first + .byte 0x00 # sector + .byte 0xee # Partition type PMBR + .byte 0xff # CHS address + .byte 0xff # of last + .byte 0xff # sector + .long 1 # LBA of first sector + .long 0xffffffff # LBA of last sector + .fill 0x10,0x3,0x0 # Remaining partition records .word MAGIC # Magic number From owner-svn-src-user@FreeBSD.ORG Wed Jun 20 10:15:46 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 849411065672; Wed, 20 Jun 2012 10:15:46 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6D3C68FC14; Wed, 20 Jun 2012 10:15:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KAFkOx033622; Wed, 20 Jun 2012 10:15:46 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KAFkl0033620; Wed, 20 Jun 2012 10:15:46 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206201015.q5KAFkl0033620@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 20 Jun 2012 10:15:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237297 - user/ae/bootcode/sys/boot/common X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 10:15:46 -0000 Author: ae Date: Wed Jun 20 10:15:45 2012 New Revision: 237297 URL: http://svn.freebsd.org/changeset/base/237297 Log: Introduce machine independet code to work with partition tables from within the various loaders. The current API is under design, so any suggestions are welcome. Added: user/ae/bootcode/sys/boot/common/part.c (contents, props changed) user/ae/bootcode/sys/boot/common/part.h (contents, props changed) Added: user/ae/bootcode/sys/boot/common/part.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/ae/bootcode/sys/boot/common/part.c Wed Jun 20 10:15:45 2012 (r237297) @@ -0,0 +1,726 @@ +/*- + * Copyright (c) 2012 Andrey V. Elsukov + * 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 AUTHORS 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 AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#ifdef PART_DEBUG +static char dline[256]; +#define DEBUG(fmt, args...) do { \ + sprintf(dline, "%s: " fmt "\n" , __func__ , ## args); \ + pager_output(dline); \ +} while (0) +#else +#define DEBUG(fmt, args...) +#endif + +#ifdef LOADER_GPT_SUPPORT +#define MAXTBLSZ 64 +#define GEOM_MAGIC "GEOM::" +static const uuid_t gpt_uuid_unused = GPT_ENT_TYPE_UNUSED; +static const uuid_t gpt_uuid_ms_basic_data = GPT_ENT_TYPE_MS_BASIC_DATA; +static const uuid_t gpt_uuid_freebsd_ufs = GPT_ENT_TYPE_FREEBSD_UFS; +static const uuid_t gpt_uuid_efi = GPT_ENT_TYPE_EFI; +static const uuid_t gpt_uuid_freebsd_boot = GPT_ENT_TYPE_FREEBSD_BOOT; +static const uuid_t gpt_uuid_freebsd_swap = GPT_ENT_TYPE_FREEBSD_SWAP; +static const uuid_t gpt_uuid_freebsd_zfs = GPT_ENT_TYPE_FREEBSD_ZFS; +static const uuid_t gpt_uuid_freebsd_vinum = GPT_ENT_TYPE_FREEBSD_VINUM; +#endif + +struct pentry { + struct ptable_entry part; + uint64_t flags; + union { + uint8_t bsd; + uint8_t mbr; + uuid_t gpt; + } type; + STAILQ_ENTRY(pentry) entry; +}; + +struct ptable { + enum ptable_type type; + uint16_t sectorsize; + uint64_t sectors; + + STAILQ_HEAD(, pentry) entries; +}; + +static struct parttypes { + enum partition_type type; + const char *desc; +} ptypes[] = { + { PART_UNKNOWN, "Unknown" }, + { PART_EFI, "EFI" }, + { PART_FREEBSD, "FreeBSD" }, + { PART_FREEBSD_BOOT, "FreeBSD boot" }, + { PART_FREEBSD_UFS, "FreeBSD UFS" }, + { PART_FREEBSD_ZFS, "FreeBSD ZFS" }, + { PART_FREEBSD_SWAP, "FreeBSD swap" }, + { PART_FREEBSD_VINUM, "FreeBSD vinum" }, + { PART_LINUX, "Linux" }, + { PART_LINUX_SWAP, "Linux swap" }, + { PART_DOS, "DOS/Windows" }, +}; + +const char * +parttype2str(enum partition_type type) +{ + int i; + + for (i = 0; i < sizeof(ptypes) / sizeof(ptypes[0]); i++) + if (ptypes[i].type == type) + return (ptypes[i].desc); + return (ptypes[0].desc); +} + +#ifdef LOADER_GPT_SUPPORT +static void +uuid_letoh(uuid_t *uuid) +{ + + uuid->time_low = le32toh(uuid->time_low); + uuid->time_mid = le16toh(uuid->time_mid); + uuid->time_hi_and_version = le16toh(uuid->time_hi_and_version); +} + +static enum partition_type +gpt_parttype(uuid_t type) +{ + + if (uuid_equal(&type, &gpt_uuid_efi, NULL)) + return (PART_EFI); + else if (uuid_equal(&type, &gpt_uuid_ms_basic_data, NULL)) + return (PART_DOS); + else if (uuid_equal(&type, &gpt_uuid_freebsd_boot, NULL)) + return (PART_FREEBSD_BOOT); + else if (uuid_equal(&type, &gpt_uuid_freebsd_ufs, NULL)) + return (PART_FREEBSD_UFS); + else if (uuid_equal(&type, &gpt_uuid_freebsd_zfs, NULL)) + return (PART_FREEBSD_ZFS); + else if (uuid_equal(&type, &gpt_uuid_freebsd_swap, NULL)) + return (PART_FREEBSD_SWAP); + else if (uuid_equal(&type, &gpt_uuid_freebsd_vinum, NULL)) + return (PART_FREEBSD_VINUM); + return (PART_UNKNOWN); +} + +static struct gpt_hdr* +gpt_checkhdr(struct gpt_hdr *hdr, uint64_t lba_self, uint64_t lba_last, + uint16_t sectorsize) +{ + uint32_t sz, crc; + + if (memcmp(hdr->hdr_sig, GPT_HDR_SIG, sizeof(hdr->hdr_sig)) != 0) { + DEBUG("no GPT signature"); + return (NULL); + } + sz = le32toh(hdr->hdr_size); + if (sz < 92 || sz > sectorsize) { + DEBUG("invalid GPT header size: %d", sz); + return (NULL); + } + crc = le32toh(hdr->hdr_crc_self); + hdr->hdr_crc_self = 0; + if (crc32(hdr, sz) != crc) { + DEBUG("GPT header's CRC doesn't match"); + return (NULL); + } + hdr->hdr_crc_self = crc; + hdr->hdr_revision = le32toh(hdr->hdr_revision); + if (hdr->hdr_revision < GPT_HDR_REVISION) { + DEBUG("unsupported GPT revision %d", hdr->hdr_revision); + return (NULL); + } + hdr->hdr_lba_self = le64toh(hdr->hdr_lba_self); + if (hdr->hdr_lba_self != lba_self) { + DEBUG("self LBA doesn't match"); + return (NULL); + } + hdr->hdr_lba_alt = le64toh(hdr->hdr_lba_alt); + if (hdr->hdr_lba_alt == hdr->hdr_lba_self) { + DEBUG("invalid alternate LBA"); + return (NULL); + } + hdr->hdr_entries = le32toh(hdr->hdr_entries); + hdr->hdr_entsz = le32toh(hdr->hdr_entsz); + if (hdr->hdr_entries < 128 || + hdr->hdr_entsz < sizeof(struct gpt_ent) || + sectorsize % hdr->hdr_entsz != 0) { + DEBUG("invalid entry size or number of entries"); + return (NULL); + } + hdr->hdr_lba_start = le64toh(hdr->hdr_lba_start); + hdr->hdr_lba_end = le64toh(hdr->hdr_lba_end); + hdr->hdr_lba_table = le64toh(hdr->hdr_lba_table); + hdr->hdr_crc_table = le32toh(hdr->hdr_crc_table); + uuid_letoh(&hdr->hdr_uuid); + return (hdr); +} + +static int +gpt_checktbl(const struct gpt_hdr *hdr, u_char *tbl, size_t size, + uint64_t lba_last) +{ + struct gpt_ent *ent; + int i, cnt; + + cnt = size / hdr->hdr_entsz; + /* Check CRC only when buffer size is enough for table. */ + if (hdr->hdr_entries <= cnt && + crc32(tbl, size) != hdr->hdr_crc_table) { + DEBUG("GPT table's CRC doesn't match"); + return (-1); + } + ent = (struct gpt_ent *)tbl; + for (i = 0; i < cnt; i++, ent++) { + uuid_letoh(&ent->ent_type); + if (uuid_equal(&ent->ent_type, &gpt_uuid_unused, NULL)) + continue; + ent->ent_lba_start = le64toh(ent->ent_lba_start); + ent->ent_lba_end = le64toh(ent->ent_lba_end); + } + return (0); +} + +static struct ptable* +ptable_gptread(struct ptable *table, void *dev, diskread_t dread) +{ + struct pentry *entry; + struct gpt_hdr *phdr, hdr; + struct gpt_ent *ent; + u_char *buf, *tbl; + uint64_t offset; + int pri, sec, i; + size_t size; + + buf = malloc(table->sectorsize); + tbl = malloc(table->sectorsize * MAXTBLSZ); + /* Read the primary GPT header. */ + if (dread(dev, buf, 1, 1) != 0) { + ptable_close(table); + table = NULL; + goto out; + } + pri = sec = 0; + /* Check the primary GPT header. */ + phdr = gpt_checkhdr((struct gpt_hdr *)buf, 1, table->sectors, + table->sectorsize); + if (phdr != NULL) { + /* Read the primary GPT table. */ + size = MIN(MAXTBLSZ, + phdr->hdr_entries * phdr->hdr_entsz / table->sectorsize); + if (dread(dev, tbl, size, phdr->hdr_lba_table) == 0 && + gpt_checktbl(phdr, tbl, size * table->sectorsize, + table->sectors) == 0) { + memcpy(&hdr, phdr, sizeof(hdr)); + pri = 1; + } + } + offset = pri ? hdr.hdr_lba_alt: table->sectors - 1; + while (offset > 0) { + /* Read the backup GPT header. */ + if (dread(dev, buf, 1, offset) != 0) { + phdr = NULL; + break; + } + phdr = gpt_checkhdr((struct gpt_hdr *)buf, offset, + table->sectors, table->sectorsize); + if (phdr != NULL) + break; + /* + * Skip GEOM metadata and try to read backup + * GPT header again. + */ + if (memcmp(buf, GEOM_MAGIC, sizeof(GEOM_MAGIC) - 1) != 0) + break; + offset--; + } + if (phdr != NULL) { + /* + * Compare primary and backup headers. + * If they are equal, then we do not need to read backup + * table. If they are different, then prefer backup header + * and try to read backup table. + */ + if (pri == 0 || + uuid_equal(&hdr.hdr_uuid, &phdr->hdr_uuid, NULL) == 0 || + hdr.hdr_revision != phdr->hdr_revision || + hdr.hdr_size != phdr->hdr_size || + hdr.hdr_lba_start != phdr->hdr_lba_start || + hdr.hdr_lba_end != phdr->hdr_lba_end || + hdr.hdr_entries != phdr->hdr_entries || + hdr.hdr_entsz != phdr->hdr_entsz || + hdr.hdr_crc_table != phdr->hdr_crc_table) { + /* Read the backup GPT table. */ + size = MIN(MAXTBLSZ, phdr->hdr_entries * + phdr->hdr_entsz / table->sectorsize); + if (dread(dev, tbl, size, phdr->hdr_lba_table) == 0 && + gpt_checktbl(phdr, tbl, size * table->sectorsize, + table->sectors) == 0) { + memcpy(&hdr, phdr, sizeof(hdr)); + sec = 1; + } + } + } + if (pri == 0 && sec == 0) { + /* Both primary and backup tables are invalid. */ + table->type = PTABLE_NONE; + goto out; + } + ent = (struct gpt_ent *)tbl; + size = MIN(hdr.hdr_entries * hdr.hdr_entsz, + MAXTBLSZ * table->sectorsize); + for (i = 0; i < size / hdr.hdr_entsz; i++, ent++) { + if (uuid_equal(&ent->ent_type, &gpt_uuid_unused, NULL)) + continue; + entry = malloc(sizeof(*entry)); + entry->part.start = ent->ent_lba_start; + entry->part.end = ent->ent_lba_end; + entry->part.index = i + 1; + entry->part.type = gpt_parttype(ent->ent_type); + entry->flags = le64toh(ent->ent_attr); + memcpy(&entry->type.gpt, &ent->ent_type, sizeof(uuid_t)); + STAILQ_INSERT_TAIL(&table->entries, entry, entry); + DEBUG("new GPT partition added"); + } +out: + free(buf); + free(tbl); + return (table); +} +#endif /* LOADER_GPT_SUPPORT */ + +#ifdef LOADER_MBR_SUPPORT +/* We do not need to support too many EBR partitions in the loader */ +#define MAXEBRENTRIES 8 +static enum partition_type +mbr_parttype(uint8_t type) +{ + + switch (type) { + case DOSPTYP_386BSD: + return (PART_FREEBSD); + case DOSPTYP_LINSWP: + return (PART_LINUX_SWAP); + case DOSPTYP_LINUX: + return (PART_LINUX); + case 0x01: + case 0x04: + case 0x06: + case 0x07: + case 0x0b: + case 0x0c: + case 0x0e: + return (PART_DOS); + } + return (PART_UNKNOWN); +} + +struct ptable* +ptable_ebrread(struct ptable *table, void *dev, diskread_t dread) +{ + struct dos_partition *dp; + struct pentry *e1, *entry; + uint32_t start, end, offset; + u_char *buf; + int i, index; + + STAILQ_FOREACH(e1, &table->entries, entry) { + if (e1->type.mbr == DOSPTYP_EXT || + e1->type.mbr == DOSPTYP_EXTLBA) + break; + } + if (e1 == NULL) + return (table); + index = 5; + offset = e1->part.start; + buf = malloc(table->sectorsize); + for (i = 0; i < MAXEBRENTRIES; i++) { + if (offset > table->sectors) + break; + if (dread(dev, buf, 1, offset) != 0) + break; + dp = (struct dos_partition *)(buf + DOSPARTOFF); + if (dp[0].dp_typ == 0) + break; + start = le32toh(dp[0].dp_start); + if (dp[0].dp_typ == DOSPTYP_EXT && + dp[1].dp_typ == 0) { + offset = e1->part.start + start; + continue; + } + end = le32toh(dp[0].dp_size); + entry = malloc(sizeof(*entry)); + entry->part.start = e1->part.start + start; + entry->part.end = entry->part.start + end - 1; + entry->part.index = index++; + entry->part.type = mbr_parttype(dp[0].dp_typ); + entry->flags = dp[0].dp_flag; + entry->type.mbr = dp[0].dp_typ; + STAILQ_INSERT_TAIL(&table->entries, entry, entry); + DEBUG("new EBR partition added"); + if (dp[1].dp_typ == 0) + break; + offset = e1->part.start + le32toh(dp[1].dp_start); + } + free(buf); + return (table); +} +#endif /* LOADER_MBR_SUPPORT */ + +static enum partition_type +bsd_parttype(uint8_t type) +{ + + switch (type) { + case FS_SWAP: + return (PART_FREEBSD_SWAP); + case FS_BSDFFS: + return (PART_FREEBSD_UFS); + case FS_VINUM: + return (PART_FREEBSD_VINUM); + case FS_ZFS: + return (PART_FREEBSD_ZFS); + } + return (PART_UNKNOWN); +} + +struct ptable* +ptable_bsdread(struct ptable *table, void *dev, diskread_t dread) +{ + struct disklabel *dl; + struct partition *part; + struct pentry *entry; + u_char *buf; + uint32_t raw_offset; + int i; + + if (table->sectorsize < sizeof(struct disklabel)) { + DEBUG("Too small sectorsize"); + return (table); + } + buf = malloc(table->sectorsize); + if (dread(dev, buf, 1, 1) != 0) { + DEBUG("read failed"); + ptable_close(table); + table = NULL; + goto out; + } + dl = (struct disklabel *)buf; + if (le32toh(dl->d_magic) != DISKMAGIC && + le32toh(dl->d_magic2) != DISKMAGIC) + goto out; + if (le32toh(dl->d_secsize) != table->sectorsize) { + DEBUG("unsupported sector size"); + goto out; + } + dl->d_npartitions = le16toh(dl->d_npartitions); + if (dl->d_npartitions > 20 || dl->d_npartitions < 8) { + DEBUG("invalid number of partitions"); + goto out; + } + part = &dl->d_partitions[0]; + raw_offset = le32toh(part[RAW_PART].p_offset); + for (i = 0; i < dl->d_npartitions; i++, part++) { + if (i == RAW_PART) + continue; + if (part->p_size == 0 || part->p_fstype == 0) + continue; + entry = malloc(sizeof(*entry)); + entry->part.start = le32toh(part->p_offset) - raw_offset; + entry->part.end = entry->part.start + + le32toh(part->p_size) + 1; + entry->part.type = bsd_parttype(part->p_fstype); + entry->part.index = i; /* starts from zero */ + entry->type.bsd = part->p_fstype; + STAILQ_INSERT_TAIL(&table->entries, entry, entry); + DEBUG("new BSD partition added"); + } + table->type = PTABLE_BSD; +out: + free(buf); + return (table); +} + +struct ptable* +ptable_open(void *dev, off_t sectors, uint16_t sectorsize, + diskread_t *dread) +{ + struct dos_partition *dp; + struct ptable *table; + u_char *buf; + int i, count; +#ifdef LOADER_MBR_SUPPORT + struct pentry *entry; + uint32_t start, end; + int has_ext; +#endif + table = NULL; + buf = malloc(sectorsize); + /* First, read the MBR. */ + if (dread(dev, buf, 1, DOSBBSECTOR) != 0) { + DEBUG("read failed"); + goto out; + } + + table = malloc(sizeof(*table)); + table->sectors = sectors; + table->sectorsize = sectorsize; + table->type = PTABLE_NONE; + STAILQ_INIT(&table->entries); + + /* Check the BSD label. */ + if (ptable_bsdread(table, dev, dread) == NULL) { /* Read error. */ + table = NULL; + goto out; + } else if (table->type == PTABLE_BSD) + goto out; + +#if defined(LOADER_GPT_SUPPORT) || defined(LOADER_MBR_SUPPORT) + /* Check the MBR magic. */ + if (buf[DOSMAGICOFFSET] != 0x55 || + buf[DOSMAGICOFFSET + 1] != 0xaa) { + DEBUG("magic sequence not found"); + goto out; + } + /* Check that we have PMBR. Also do some validation. */ + dp = (struct dos_partition *)(buf + DOSPARTOFF); + for (i = 0, count = 0; i < NDOSPART; i++) { + if (dp[i].dp_flag != 0 && dp[i].dp_flag != 0x80) { + DEBUG("invalid partition flag %x", dp[i].dp_flag); + break; + } +#ifdef LOADER_GPT_SUPPORT + if (dp[i].dp_typ == DOSPTYP_PMBR) { + table->type = PTABLE_GPT; + DEBUG("PMBR detected"); + } +#endif + if (dp[i].dp_typ != 0) + count++; + } + /* Do we have some invalid values? */ + if (i != NDOSPART || + (table->type == PTABLE_GPT && count > 1)) { + table->type = PTABLE_NONE; + DEBUG("invalid values detected, ignore partition table"); + goto out; + } +#ifdef LOADER_GPT_SUPPORT + if (table->type == PTABLE_GPT) { + table = ptable_gptread(table, dev, dread); + goto out; + } +#endif +#ifdef LOADER_MBR_SUPPORT + /* Read MBR. */ + table->type = PTABLE_MBR; + for (i = has_ext = 0; i < NDOSPART; i++) { + if (dp[i].dp_typ == 0) + continue; + start = le32toh(dp[i].dp_start); + end = le32toh(dp[i].dp_size); + if (start == 0 || end == 0) + continue; + if (start + end - 1 > sectors) + continue; /* XXX: ignore */ + if (dp[i].dp_typ == DOSPTYP_EXT || + dp[i].dp_typ == DOSPTYP_EXTLBA) + has_ext = 1; + entry = malloc(sizeof(*entry)); + entry->part.start = start; + entry->part.end = start + end - 1; + entry->part.index = i + 1; + entry->part.type = mbr_parttype(dp[i].dp_typ); + entry->flags = dp[i].dp_flag; + entry->type.mbr = dp[i].dp_typ; + STAILQ_INSERT_TAIL(&table->entries, entry, entry); + DEBUG("new MBR partition added"); + } + if (has_ext) { + table = ptable_ebrread(table, dev, dread); + /* FALLTHROUGH */ + } +#endif /* LOADER_MBR_SUPPORT */ +#endif +out: + free(buf); + return (table); +} + +void +ptable_close(struct ptable *table) +{ + struct pentry *entry; + + while (!STAILQ_EMPTY(&table->entries)) { + entry = STAILQ_FIRST(&table->entries); + STAILQ_REMOVE_HEAD(&table->entries, entry); + free(entry); + } + free(table); +} + +enum ptable_type +ptable_gettype(const struct ptable *table) +{ + + return (table->type); +} + +int +ptable_getpart(const struct ptable *table, struct ptable_entry *part, int index) +{ + struct pentry *entry; + + if (part == NULL || table == NULL) + return (EINVAL); + + STAILQ_FOREACH(entry, &table->entries, entry) { + if (entry->part.index != index) + continue; + memcpy(part, &entry->part, sizeof(*part)); + return (0); + } + return (ENOENT); +} + +/* + * Search for a slice with the following preferences: + * + * 1: Active FreeBSD slice + * 2: Non-active FreeBSD slice + * 3: Active Linux slice + * 4: non-active Linux slice + * 5: Active FAT/FAT32 slice + * 6: non-active FAT/FAT32 slice + */ +#define PREF_RAWDISK 0 +#define PREF_FBSD_ACT 1 +#define PREF_FBSD 2 +#define PREF_LINUX_ACT 3 +#define PREF_LINUX 4 +#define PREF_DOS_ACT 5 +#define PREF_DOS 6 +#define PREF_NONE 7 +int +ptable_getbestpart(const struct ptable *table, struct ptable_entry *part) +{ + struct pentry *entry, *best; + int pref, preflevel; + + if (part == NULL || table == NULL) + return (EINVAL); + + best = NULL; + preflevel = pref = PREF_NONE; + STAILQ_FOREACH(entry, &table->entries, entry) { +#ifdef LOADER_MBR_SUPPORT + if (table->type == PTABLE_MBR) { + switch (entry->type.mbr) { + case DOSPTYP_386BSD: + pref = entry->flags & 0x80 ? PREF_FBSD_ACT: + PREF_FBSD; + break; + case DOSPTYP_LINUX: + pref = entry->flags & 0x80 ? PREF_LINUX_ACT: + PREF_LINUX; + break; + case 0x01: /* DOS/Windows */ + case 0x04: + case 0x06: + case 0x0c: + case 0x0e: + case DOSPTYP_FAT32: + pref = entry->flags & 0x80 ? PREF_DOS_ACT: + PREF_DOS; + break; + default: + pref = PREF_NONE; + } + } +#endif /* LOADER_MBR_SUPPORT */ +#ifdef LOADER_GPT_SUPPORT + if (table->type == PTABLE_GPT) { + if (entry->part.type == PART_DOS) + pref = PREF_DOS; + else if (entry->part.type == PART_FREEBSD_UFS || + entry->part.type == PART_FREEBSD_ZFS) + pref = PREF_FBSD; + else + pref = PREF_NONE; + } +#endif /* LOADER_GPT_SUPPORT */ + if (pref < preflevel) { + preflevel = pref; + best = entry; + } + } + if (best != NULL) { + memcpy(part, &best->part, sizeof(*part)); + return (0); + } + return (ENOENT); +} + +void +ptable_iterate(const struct ptable *table, void *arg, ptable_iterate_t *iter) +{ + struct pentry *entry; + char name[32]; + + name[0] = '\0'; + STAILQ_FOREACH(entry, &table->entries, entry) { +#ifdef LOADER_MBR_SUPPORT + if (table->type == PTABLE_MBR) + sprintf(name, "s%d", entry->part.index); + else +#endif +#ifdef LOADER_GPT_SUPPORT + if (table->type == PTABLE_GPT) + sprintf(name, "p%d", entry->part.index); + else +#endif + if (table->type == PTABLE_BSD) + sprintf(name, "%c", (u_char) 'a' + + entry->part.index); + iter(arg, name, &entry->part); + } +} + Added: user/ae/bootcode/sys/boot/common/part.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/ae/bootcode/sys/boot/common/part.h Wed Jun 20 10:15:45 2012 (r237297) @@ -0,0 +1,80 @@ +/*- + * Copyright (c) 2012 Andrey V. Elsukov + * 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 AUTHORS 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 AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _PART_H_ +#define _PART_H_ + +struct ptable; + +enum ptable_type { + PTABLE_NONE, + PTABLE_BSD, + PTABLE_MBR, + PTABLE_GPT +}; + +enum partition_type { + PART_UNKNOWN, + PART_EFI, + PART_FREEBSD, + PART_FREEBSD_BOOT, + PART_FREEBSD_UFS, + PART_FREEBSD_ZFS, + PART_FREEBSD_SWAP, + PART_FREEBSD_VINUM, + PART_LINUX, + PART_LINUX_SWAP, + PART_DOS, +}; + +struct ptable_entry { + uint64_t start; + uint64_t end; + int index; + enum partition_type type; +}; + +/* The offset and size are in sectors */ +typedef int (diskread_t)(void *arg, void *buf, size_t blocks, off_t offset); +typedef void (ptable_iterate_t)(void *arg, const char *partname, + const struct ptable_entry *part); + +struct ptable *ptable_open(void *dev, off_t sectors, uint16_t sectorsize, + diskread_t *dread); +void ptable_close(struct ptable *table); +enum ptable_type ptable_gettype(const struct ptable *table); + +int ptable_getpart(const struct ptable *table, struct ptable_entry *part, + int index); +int ptable_getbestpart(const struct ptable *table, struct ptable_entry *part); + +void ptable_iterate(const struct ptable *table, void *arg, + ptable_iterate_t *iter); +const char *parttype2str(enum partition_type type); + +#endif /* !_PART_H_ */ From owner-svn-src-user@FreeBSD.ORG Wed Jun 20 11:53:05 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A1F61065704; Wed, 20 Jun 2012 11:53:05 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 53DC48FC12; Wed, 20 Jun 2012 11:53:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KBr5mJ040377; Wed, 20 Jun 2012 11:53:05 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KBr5xV040375; Wed, 20 Jun 2012 11:53:05 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206201153.q5KBr5xV040375@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 20 Jun 2012 11:53:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237300 - user/ae/bootcode/sys/boot/i386/libi386 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 11:53:05 -0000 Author: ae Date: Wed Jun 20 11:53:04 2012 New Revision: 237300 URL: http://svn.freebsd.org/changeset/base/237300 Log: o Remove the most of code related to partition tables from biosdisk.c in preparation to moving to the MI code from part.c. o Move BIOS CHS fields from "struct open_disk" to "struct bdinfo". o Add sectors and sectorsize fields to "struct bdinfo", also add a pointer to "struct ptable". o Fix the indent according to style(9). Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Wed Jun 20 11:30:15 2012 (r237299) +++ user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Wed Jun 20 11:53:04 2012 (r237300) @@ -38,14 +38,10 @@ __FBSDID("$FreeBSD$"); */ #include - -#include -#include -#include #include +#include #include -#include #include #include @@ -68,115 +64,69 @@ __FBSDID("$FreeBSD$"); # define DEBUG(fmt, args...) #endif -#ifdef LOADER_GPT_SUPPORT -struct gpt_part { - int gp_index; - uuid_t gp_type; - uint64_t gp_start; - uint64_t gp_end; -}; -#endif - struct open_disk { - int od_dkunit; /* disk unit number */ - int od_unit; /* BIOS unit number */ - int od_cyl; /* BIOS geometry */ - int od_hds; - int od_sec; - daddr_t od_boff; /* block offset from beginning of BIOS disk */ - int od_flags; -#define BD_MODEINT13 0x0000 -#define BD_MODEEDD1 0x0001 -#define BD_MODEEDD3 0x0002 -#define BD_MODEMASK 0x0003 -#define BD_FLOPPY 0x0004 -#define BD_LABELOK 0x0008 -#define BD_PARTTABOK 0x0010 -#ifdef LOADER_GPT_SUPPORT -#define BD_GPTOK 0x0020 -#endif - union { - struct { - struct disklabel mbr_disklabel; - int mbr_nslices; /* slice count */ - struct dos_partition mbr_slicetab[NEXTDOSPART]; - } _mbr; -#ifdef LOADER_GPT_SUPPORT - struct { - int gpt_nparts; - struct gpt_part *gpt_partitions; - } _gpt; -#endif - } _data; + int od_dkunit; /* disk unit number */ + int od_unit; /* BIOS unit number */ + int od_slice; /* slice number of the parent table */ + daddr_t od_boff; /* offset from the beginning */ + daddr_t od_size; /* disk or partition size */ + struct ptable *od_ptable; }; -#define od_disklabel _data._mbr.mbr_disklabel -#define od_nslices _data._mbr.mbr_nslices -#define od_slicetab _data._mbr.mbr_slicetab -#ifdef LOADER_GPT_SUPPORT -#define od_nparts _data._gpt.gpt_nparts -#define od_partitions _data._gpt.gpt_partitions -#endif - /* * List of BIOS devices, translation from disk unit number to * BIOS unit number. */ static struct bdinfo { - int bd_unit; /* BIOS unit number */ - int bd_flags; - int bd_type; /* BIOS 'drive type' (floppy only) */ + int bd_unit; /* BIOS unit number */ + int bd_cyl; /* BIOS geometry */ + int bd_hds; + int bd_sec; + int bd_flags; +#define BD_MODEINT13 0x0000 +#define BD_MODEEDD1 0x0001 +#define BD_MODEEDD3 0x0002 +#define BD_MODEMASK 0x0003 +#define BD_FLOPPY 0x0004 + int bd_type; /* BIOS 'drive type' (floppy only) */ + uint16_t bd_sectorsize; /* Sector size */ + uint64_t bd_sectors; /* Disk size */ + struct ptable *bd_ptable; /* Partition table */ } bdinfo [MAXBDDEV]; static int nbdinfo = 0; -static int bd_getgeom(struct open_disk *od); -static int bd_read(struct open_disk *od, daddr_t dblk, int blks, - caddr_t dest); -static int bd_write(struct open_disk *od, daddr_t dblk, int blks, - caddr_t dest); - -static int bd_int13probe(struct bdinfo *bd); - -#ifdef LOADER_GPT_SUPPORT -static void bd_printgptpart(struct open_disk *od, struct gpt_part *gp, - char *prefix, int verbose); -#endif -static void bd_printslice(struct open_disk *od, struct dos_partition *dp, - char *prefix, int verbose); -static void bd_printbsdslice(struct open_disk *od, daddr_t offset, - char *prefix, int verbose); - -static int bd_init(void); -static int bd_strategy(void *devdata, int flag, daddr_t dblk, - size_t size, char *buf, size_t *rsize); -static int bd_realstrategy(void *devdata, int flag, daddr_t dblk, - size_t size, char *buf, size_t *rsize); -static int bd_open(struct open_file *f, ...); -static int bd_close(struct open_file *f); -static void bd_print(int verbose); +static int bd_getgeom(struct open_disk *od); +static int bd_read(struct open_disk *od, daddr_t dblk, int blks, + caddr_t dest); +static int bd_write(struct open_disk *od, daddr_t dblk, int blks, + caddr_t dest); +static int bd_int13probe(struct bdinfo *bd); + +static int bd_init(void); +static void bd_cleanup(void); +static int bd_strategy(void *devdata, int flag, daddr_t dblk, size_t size, + char *buf, size_t *rsize); +static int bd_realstrategy(void *devdata, int flag, daddr_t dblk, + size_t size, char *buf, size_t *rsize); +static int bd_open(struct open_file *f, ...); +static int bd_close(struct open_file *f); +static void bd_print(int verbose); struct devsw biosdisk = { - "disk", - DEVT_DISK, - bd_init, - bd_strategy, - bd_open, - bd_close, - noioctl, - bd_print, - NULL + "disk", + DEVT_DISK, + bd_init, + bd_strategy, + bd_open, + bd_close, + noioctl, + bd_print, + bd_cleanup }; -static int bd_opendisk(struct open_disk **odp, struct i386_devdesc *dev); -static void bd_closedisk(struct open_disk *od); -static int bd_open_mbr(struct open_disk *od, struct i386_devdesc *dev); -static int bd_bestslice(struct open_disk *od); -static void bd_checkextended(struct open_disk *od, int slicenum); -#ifdef LOADER_GPT_SUPPORT -static int bd_open_gpt(struct open_disk *od, struct i386_devdesc *dev); -static struct gpt_part *bd_best_gptpart(struct open_disk *od); -#endif +static int bd_opendisk(struct open_disk **odp, struct i386_devdesc *dev); +static void bd_closedisk(struct open_disk *od); /* * Translate between BIOS device numbers and our private unit numbers. @@ -355,163 +305,6 @@ display_size(uint64_t size) return (buf); } -#ifdef LOADER_GPT_SUPPORT -static uuid_t efi = GPT_ENT_TYPE_EFI; -static uuid_t freebsd_boot = GPT_ENT_TYPE_FREEBSD_BOOT; -static uuid_t freebsd_ufs = GPT_ENT_TYPE_FREEBSD_UFS; -static uuid_t freebsd_swap = GPT_ENT_TYPE_FREEBSD_SWAP; -static uuid_t freebsd_zfs = GPT_ENT_TYPE_FREEBSD_ZFS; -static uuid_t ms_basic_data = GPT_ENT_TYPE_MS_BASIC_DATA; - -static void -bd_printgptpart(struct open_disk *od, struct gpt_part *gp, char *prefix, - int verbose) -{ - char stats[80]; - char line[96]; - - if (verbose) - sprintf(stats, " %s", display_size(gp->gp_end + 1 - gp->gp_start)); - else - stats[0] = '\0'; - - if (uuid_equal(&gp->gp_type, &efi, NULL)) - sprintf(line, "%s: EFI %s\n", prefix, stats); - else if (uuid_equal(&gp->gp_type, &ms_basic_data, NULL)) - sprintf(line, "%s: FAT/NTFS %s\n", prefix, stats); - else if (uuid_equal(&gp->gp_type, &freebsd_boot, NULL)) - sprintf(line, "%s: FreeBSD boot%s\n", prefix, stats); - else if (uuid_equal(&gp->gp_type, &freebsd_ufs, NULL)) - sprintf(line, "%s: FreeBSD UFS %s\n", prefix, stats); - else if (uuid_equal(&gp->gp_type, &freebsd_zfs, NULL)) - sprintf(line, "%s: FreeBSD ZFS %s\n", prefix, stats); - else if (uuid_equal(&gp->gp_type, &freebsd_swap, NULL)) - sprintf(line, "%s: FreeBSD swap%s\n", prefix, stats); - else - sprintf(line, "%s: %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x%s\n", - prefix, - gp->gp_type.time_low, gp->gp_type.time_mid, - gp->gp_type.time_hi_and_version, - gp->gp_type.clock_seq_hi_and_reserved, gp->gp_type.clock_seq_low, - gp->gp_type.node[0], gp->gp_type.node[1], gp->gp_type.node[2], - gp->gp_type.node[3], gp->gp_type.node[4], gp->gp_type.node[5], - stats); - pager_output(line); -} -#endif - -/* - * Print information about slices on a disk. For the size calculations we - * assume a 512 byte sector. - */ -static void -bd_printslice(struct open_disk *od, struct dos_partition *dp, char *prefix, - int verbose) -{ - char stats[80]; - char line[80]; - - if (verbose) - sprintf(stats, " %s (%d - %d)", display_size(dp->dp_size), - dp->dp_start, dp->dp_start + dp->dp_size); - else - stats[0] = '\0'; - - switch (dp->dp_typ) { - case DOSPTYP_386BSD: - bd_printbsdslice(od, (daddr_t)dp->dp_start, prefix, verbose); - return; - case DOSPTYP_LINSWP: - sprintf(line, "%s: Linux swap%s\n", prefix, stats); - break; - case DOSPTYP_LINUX: - /* - * XXX - * read the superblock to confirm this is an ext2fs partition? - */ - sprintf(line, "%s: ext2fs%s\n", prefix, stats); - break; - case 0x00: /* unused partition */ - case DOSPTYP_EXT: - return; - case 0x01: - sprintf(line, "%s: FAT-12%s\n", prefix, stats); - break; - case 0x04: - case 0x06: - case 0x0e: - sprintf(line, "%s: FAT-16%s\n", prefix, stats); - break; - case 0x07: - sprintf(line, "%s: NTFS/HPFS%s\n", prefix, stats); - break; - case 0x0b: - case 0x0c: - sprintf(line, "%s: FAT-32%s\n", prefix, stats); - break; - default: - sprintf(line, "%s: Unknown fs: 0x%x %s\n", prefix, dp->dp_typ, - stats); - } - pager_output(line); -} - -/* - * Print out each valid partition in the disklabel of a FreeBSD slice. - * For size calculations, we assume a 512 byte sector size. - */ -static void -bd_printbsdslice(struct open_disk *od, daddr_t offset, char *prefix, - int verbose) -{ - char line[80]; - char buf[BIOSDISK_SECSIZE]; - struct disklabel *lp; - int i; - - /* read disklabel */ - if (bd_read(od, offset + LABELSECTOR, 1, buf)) - return; - lp =(struct disklabel *)(&buf[0]); - if (lp->d_magic != DISKMAGIC) { - sprintf(line, "%s: FFS bad disklabel\n", prefix); - pager_output(line); - return; - } - - /* Print partitions */ - for (i = 0; i < lp->d_npartitions; i++) { - /* - * For each partition, make sure we know what type of fs it is. If - * not, then skip it. However, since floppies often have bogus - * fstypes, print the 'a' partition on a floppy even if it is marked - * unused. - */ - if ((lp->d_partitions[i].p_fstype == FS_BSDFFS) || - (lp->d_partitions[i].p_fstype == FS_SWAP) || - (lp->d_partitions[i].p_fstype == FS_VINUM) || - ((lp->d_partitions[i].p_fstype == FS_UNUSED) && - (od->od_flags & BD_FLOPPY) && (i == 0))) { - - /* Only print out statistics in verbose mode */ - if (verbose) - sprintf(line, " %s%c: %s %s (%d - %d)\n", prefix, 'a' + i, - (lp->d_partitions[i].p_fstype == FS_SWAP) ? "swap " : - (lp->d_partitions[i].p_fstype == FS_VINUM) ? "vinum" : - "FFS ", - display_size(lp->d_partitions[i].p_size), - lp->d_partitions[i].p_offset, - lp->d_partitions[i].p_offset + lp->d_partitions[i].p_size); - else - sprintf(line, " %s%c: %s\n", prefix, 'a' + i, - (lp->d_partitions[i].p_fstype == FS_SWAP) ? "swap" : - (lp->d_partitions[i].p_fstype == FS_VINUM) ? "vinum" : - "FFS"); - pager_output(line); - } - } -} - /* * Attempt to open the disk described by (dev) for use by (f). @@ -580,10 +373,6 @@ bd_opendisk(struct open_disk **odp, stru } /* Determine disk layout. */ -#ifdef LOADER_GPT_SUPPORT - error = bd_open_gpt(od, dev); - if (error) -#endif error = bd_open_mbr(od, dev); out: @@ -595,439 +384,6 @@ bd_opendisk(struct open_disk **odp, stru return(error); } -static int -bd_open_mbr(struct open_disk *od, struct i386_devdesc *dev) -{ - struct dos_partition *dptr; - struct disklabel *lp; - int sector, slice, i; - int error; - char buf[BUFSIZE]; - - /* - * Following calculations attempt to determine the correct value - * for d->od_boff by looking for the slice and partition specified, - * or searching for reasonable defaults. - */ - - /* - * Find the slice in the DOS slice table. - */ - od->od_nslices = 0; - if (bd_read(od, 0, 1, buf)) { - DEBUG("error reading MBR"); - return (EIO); - } - - /* - * Check the slice table magic. - */ - if (((u_char)buf[0x1fe] != 0x55) || ((u_char)buf[0x1ff] != 0xaa)) { - /* If a slice number was explicitly supplied, this is an error */ - if (dev->d_kind.biosdisk.slice > 0) { - DEBUG("no slice table/MBR (no magic)"); - return (ENOENT); - } - sector = 0; - goto unsliced; /* may be a floppy */ - } - - /* - * copy the partition table, then pick up any extended partitions. - */ - bcopy(buf + DOSPARTOFF, &od->od_slicetab, - sizeof(struct dos_partition) * NDOSPART); - od->od_nslices = 4; /* extended slices start here */ - for (i = 0; i < NDOSPART; i++) - bd_checkextended(od, i); - od->od_flags |= BD_PARTTABOK; - dptr = &od->od_slicetab[0]; - - /* Is this a request for the whole disk? */ - if (dev->d_kind.biosdisk.slice == -1) { - sector = 0; - goto unsliced; - } - - /* - * if a slice number was supplied but not found, this is an error. - */ - if (dev->d_kind.biosdisk.slice > 0) { - slice = dev->d_kind.biosdisk.slice - 1; - if (slice >= od->od_nslices) { - DEBUG("slice %d not found", slice); - return (ENOENT); - } - } - - /* - * Check for the historically bogus MBR found on true dedicated disks - */ - if ((dptr[3].dp_typ == DOSPTYP_386BSD) && - (dptr[3].dp_start == 0) && - (dptr[3].dp_size == 50000)) { - sector = 0; - goto unsliced; - } - - /* Try to auto-detect the best slice; this should always give a slice number */ - if (dev->d_kind.biosdisk.slice == 0) { - slice = bd_bestslice(od); - if (slice == -1) { - return (ENOENT); - } - dev->d_kind.biosdisk.slice = slice; - } - - dptr = &od->od_slicetab[0]; - /* - * Accept the supplied slice number unequivocally (we may be looking - * at a DOS partition). - */ - dptr += (dev->d_kind.biosdisk.slice - 1); /* we number 1-4, offsets are 0-3 */ - sector = dptr->dp_start; - DEBUG("slice entry %d at %d, %d sectors", dev->d_kind.biosdisk.slice - 1, sector, dptr->dp_size); - - /* - * If we are looking at a BSD slice, and the partition is < 0, assume the 'a' partition - */ - if ((dptr->dp_typ == DOSPTYP_386BSD) && (dev->d_kind.biosdisk.partition < 0)) - dev->d_kind.biosdisk.partition = 0; - - unsliced: - /* - * Now we have the slice offset, look for the partition in the disklabel if we have - * a partition to start with. - * - * XXX we might want to check the label checksum. - */ - if (dev->d_kind.biosdisk.partition < 0) { - od->od_boff = sector; /* no partition, must be after the slice */ - DEBUG("opening raw slice"); - } else { - - if (bd_read(od, sector + LABELSECTOR, 1, buf)) { - DEBUG("error reading disklabel"); - return (EIO); - } - DEBUG("copy %d bytes of label from %p to %p", sizeof(struct disklabel), buf + LABELOFFSET, &od->od_disklabel); - bcopy(buf + LABELOFFSET, &od->od_disklabel, sizeof(struct disklabel)); - lp = &od->od_disklabel; - od->od_flags |= BD_LABELOK; - - if (lp->d_magic != DISKMAGIC) { - DEBUG("no disklabel"); - return (ENOENT); - } - if (dev->d_kind.biosdisk.partition >= lp->d_npartitions) { - DEBUG("partition '%c' exceeds partitions in table (a-'%c')", - 'a' + dev->d_kind.biosdisk.partition, 'a' + lp->d_npartitions); - return (EPART); - } - -#ifdef DISK_DEBUG - /* Complain if the partition is unused unless this is a floppy. */ - if ((lp->d_partitions[dev->d_kind.biosdisk.partition].p_fstype == FS_UNUSED) && - !(od->od_flags & BD_FLOPPY)) - DEBUG("warning, partition marked as unused"); -#endif - - od->od_boff = - lp->d_partitions[dev->d_kind.biosdisk.partition].p_offset - - lp->d_partitions[RAW_PART].p_offset + - sector; - } - return (0); -} - -static void -bd_checkextended(struct open_disk *od, int slicenum) -{ - char buf[BIOSDISK_SECSIZE]; - struct dos_partition *dp; - u_int base; - int i, start, end; - - dp = &od->od_slicetab[slicenum]; - start = od->od_nslices; - - if (dp->dp_size == 0) - goto done; - if (dp->dp_typ != DOSPTYP_EXT) - goto done; - if (bd_read(od, (daddr_t)dp->dp_start, 1, buf)) - goto done; - if (((u_char)buf[0x1fe] != 0x55) || ((u_char)buf[0x1ff] != 0xaa)) { - DEBUG("no magic in extended table"); - goto done; - } - base = dp->dp_start; - dp = (struct dos_partition *)(&buf[DOSPARTOFF]); - for (i = 0; i < NDOSPART; i++, dp++) { - if (dp->dp_size == 0) - continue; - if (od->od_nslices == NEXTDOSPART) - goto done; - dp->dp_start += base; - bcopy(dp, &od->od_slicetab[od->od_nslices], sizeof(*dp)); - od->od_nslices++; - } - end = od->od_nslices; - - /* - * now, recursively check the slices we just added - */ - for (i = start; i < end; i++) - bd_checkextended(od, i); -done: - return; -} - -/* - * Search for a slice with the following preferences: - * - * 1: Active FreeBSD slice - * 2: Non-active FreeBSD slice - * 3: Active Linux slice - * 4: non-active Linux slice - * 5: Active FAT/FAT32 slice - * 6: non-active FAT/FAT32 slice - */ -#define PREF_RAWDISK 0 -#define PREF_FBSD_ACT 1 -#define PREF_FBSD 2 -#define PREF_LINUX_ACT 3 -#define PREF_LINUX 4 -#define PREF_DOS_ACT 5 -#define PREF_DOS 6 -#define PREF_NONE 7 - -/* - * slicelimit is in the range 0 .. NDOSPART - */ -static int -bd_bestslice(struct open_disk *od) -{ - struct dos_partition *dp; - int pref, preflevel; - int i, prefslice; - - prefslice = 0; - preflevel = PREF_NONE; - - dp = &od->od_slicetab[0]; - for (i = 0; i < od->od_nslices; i++, dp++) { - - switch (dp->dp_typ) { - case DOSPTYP_386BSD: /* FreeBSD */ - pref = dp->dp_flag & 0x80 ? PREF_FBSD_ACT : PREF_FBSD; - break; - - case DOSPTYP_LINUX: - pref = dp->dp_flag & 0x80 ? PREF_LINUX_ACT : PREF_LINUX; - break; - - case 0x01: /* DOS/Windows */ - case 0x04: - case 0x06: - case 0x0b: - case 0x0c: - case 0x0e: - pref = dp->dp_flag & 0x80 ? PREF_DOS_ACT : PREF_DOS; - break; - - default: - pref = PREF_NONE; - } - if (pref < preflevel) { - preflevel = pref; - prefslice = i + 1; - } - } - return (prefslice); -} - -#ifdef LOADER_GPT_SUPPORT -static int -bd_open_gpt(struct open_disk *od, struct i386_devdesc *dev) -{ - struct dos_partition *dp; - struct gpt_hdr *hdr; - struct gpt_ent *ent; - struct gpt_part *gp; - int entries_per_sec, error, i, part; - daddr_t lba, elba; - char gpt[BIOSDISK_SECSIZE], tbl[BIOSDISK_SECSIZE]; - - /* - * Following calculations attempt to determine the correct value - * for d->od_boff by looking for the slice and partition specified, - * or searching for reasonable defaults. - */ - error = 0; - - /* First, read the MBR and see if we have a PMBR. */ - if (bd_read(od, 0, 1, tbl)) { - DEBUG("error reading MBR"); - return (EIO); - } - - /* Check the slice table magic. */ - if (((u_char)tbl[0x1fe] != 0x55) || ((u_char)tbl[0x1ff] != 0xaa)) - return (ENXIO); - - /* Check for GPT slice. */ - part = 0; - dp = (struct dos_partition *)(tbl + DOSPARTOFF); - for (i = 0; i < NDOSPART; i++) { - if (dp[i].dp_typ == 0xee) - part++; - else if ((part != 1) && (dp[i].dp_typ != 0x00)) - return (EINVAL); - } - if (part != 1) - return (EINVAL); - - /* Read primary GPT table header. */ - if (bd_read(od, 1, 1, gpt)) { - DEBUG("error reading GPT header"); - return (EIO); - } - hdr = (struct gpt_hdr *)gpt; - if (bcmp(hdr->hdr_sig, GPT_HDR_SIG, sizeof(hdr->hdr_sig)) != 0 || - hdr->hdr_lba_self != 1 || hdr->hdr_revision < 0x00010000 || - hdr->hdr_entsz < sizeof(*ent) || - BIOSDISK_SECSIZE % hdr->hdr_entsz != 0) { - DEBUG("Invalid GPT header\n"); - return (EINVAL); - } - - /* Now walk the partition table to count the number of valid partitions. */ - part = 0; - entries_per_sec = BIOSDISK_SECSIZE / hdr->hdr_entsz; - elba = hdr->hdr_lba_table + hdr->hdr_entries / entries_per_sec; - for (lba = hdr->hdr_lba_table; lba < elba; lba++) { - if (bd_read(od, lba, 1, tbl)) { - DEBUG("error reading GPT table"); - return (EIO); - } - for (i = 0; i < entries_per_sec; i++) { - ent = (struct gpt_ent *)(tbl + i * hdr->hdr_entsz); - if (uuid_is_nil(&ent->ent_type, NULL) || ent->ent_lba_start == 0 || - ent->ent_lba_end < ent->ent_lba_start) - continue; - part++; - } - } - - /* Save the important information about all the valid partitions. */ - od->od_nparts = part; - if (part != 0) { - od->od_partitions = malloc(part * sizeof(struct gpt_part)); - part = 0; - for (lba = hdr->hdr_lba_table; lba < elba; lba++) { - if (bd_read(od, lba, 1, tbl)) { - DEBUG("error reading GPT table"); - error = EIO; - goto out; - } - for (i = 0; i < entries_per_sec; i++) { - ent = (struct gpt_ent *)(tbl + i * hdr->hdr_entsz); - if (uuid_is_nil(&ent->ent_type, NULL) || - ent->ent_lba_start == 0 || - ent->ent_lba_end < ent->ent_lba_start) - continue; - od->od_partitions[part].gp_index = (lba - hdr->hdr_lba_table) * - entries_per_sec + i + 1; - od->od_partitions[part].gp_type = ent->ent_type; - od->od_partitions[part].gp_start = ent->ent_lba_start; - od->od_partitions[part].gp_end = ent->ent_lba_end; - part++; - } - } - } - od->od_flags |= BD_GPTOK; - - /* Is this a request for the whole disk? */ - if (dev->d_kind.biosdisk.slice < 0) { - od->od_boff = 0; - return (0); - } - - /* - * If a partition number was supplied, then the user is trying to use - * an MBR address rather than a GPT address, so fail. - */ - if (dev->d_kind.biosdisk.partition != 0xff) { - error = ENOENT; - goto out; - } - - /* If a slice number was supplied but not found, this is an error. */ - gp = NULL; - if (dev->d_kind.biosdisk.slice > 0) { - for (i = 0; i < od->od_nparts; i++) { - if (od->od_partitions[i].gp_index == dev->d_kind.biosdisk.slice) { - gp = &od->od_partitions[i]; - break; - } - } - if (gp == NULL) { - DEBUG("partition %d not found", dev->d_kind.biosdisk.slice); - error = ENOENT; - goto out; - } - } - - /* Try to auto-detect the best partition. */ - if (dev->d_kind.biosdisk.slice == 0) { - gp = bd_best_gptpart(od); - if (gp == NULL) { - error = ENOENT; - goto out; - } - dev->d_kind.biosdisk.slice = gp->gp_index; - } - od->od_boff = gp->gp_start; - -out: - if (error) { - if (od->od_nparts > 0) - free(od->od_partitions); - od->od_flags &= ~BD_GPTOK; - } - return (error); -} - -static struct gpt_part * -bd_best_gptpart(struct open_disk *od) -{ - struct gpt_part *gp, *prefpart; - int i, pref, preflevel; - - prefpart = NULL; - preflevel = PREF_NONE; - - gp = od->od_partitions; - for (i = 0; i < od->od_nparts; i++, gp++) { - /* Windows. XXX: Also Linux. */ - if (uuid_equal(&gp->gp_type, &ms_basic_data, NULL)) - pref = PREF_DOS; - /* FreeBSD */ - else if (uuid_equal(&gp->gp_type, &freebsd_ufs, NULL) || - uuid_equal(&gp->gp_type, &freebsd_zfs, NULL)) - pref = PREF_FBSD; - else - pref = PREF_NONE; - if (pref < preflevel) { - preflevel = pref; - prefpart = gp; - } - } - return (prefpart); -} -#endif - static int bd_close(struct open_file *f) { @@ -1041,15 +397,6 @@ static void bd_closedisk(struct open_disk *od) { DEBUG("open_disk %p", od); -#if 0 - /* XXX is this required? (especially if disk already open...) */ - if (od->od_flags & BD_FLOPPY) - delay(3000000); -#endif -#ifdef LOADER_GPT_SUPPORT - if (od->od_flags & BD_GPTOK && od->od_nparts > 0) - free(od->od_partitions); -#endif free(od); } From owner-svn-src-user@FreeBSD.ORG Wed Jun 20 12:22:55 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1209E106564A; Wed, 20 Jun 2012 12:22:55 +0000 (UTC) (envelope-from jceel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EF0288FC18; Wed, 20 Jun 2012 12:22:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KCMsfQ041689; Wed, 20 Jun 2012 12:22:54 GMT (envelope-from jceel@svn.freebsd.org) Received: (from jceel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KCMs6E041672; Wed, 20 Jun 2012 12:22:54 GMT (envelope-from jceel@svn.freebsd.org) Message-Id: <201206201222.q5KCMs6E041672@svn.freebsd.org> From: Jakub Wojciech Klama Date: Wed, 20 Jun 2012 12:22:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237301 - in user/jceel/soc2012_armv6/sys: arm/arm arm/at91 arm/conf arm/econa arm/include arm/mv arm/s3c2xx0 arm/sa11x0 arm/tegra arm/ti arm/xscale/i80321 arm/xscale/pxa dev/fdt X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 12:22:55 -0000 Author: jceel Date: Wed Jun 20 12:22:54 2012 New Revision: 237301 URL: http://svn.freebsd.org/changeset/base/237301 Log: Bring arm ports using old interrupt routing code back to work. Modified: user/jceel/soc2012_armv6/sys/arm/arm/intr.c user/jceel/soc2012_armv6/sys/arm/arm/nexus.c user/jceel/soc2012_armv6/sys/arm/at91/files.at91 user/jceel/soc2012_armv6/sys/arm/conf/EA3250 user/jceel/soc2012_armv6/sys/arm/econa/files.econa user/jceel/soc2012_armv6/sys/arm/include/fdt.h user/jceel/soc2012_armv6/sys/arm/include/intr.h user/jceel/soc2012_armv6/sys/arm/mv/files.mv user/jceel/soc2012_armv6/sys/arm/s3c2xx0/files.s3c2xx0 user/jceel/soc2012_armv6/sys/arm/sa11x0/files.sa11x0 user/jceel/soc2012_armv6/sys/arm/tegra/files.tegra2 user/jceel/soc2012_armv6/sys/arm/ti/files.ti user/jceel/soc2012_armv6/sys/arm/xscale/i80321/files.i80219 user/jceel/soc2012_armv6/sys/arm/xscale/i80321/files.i80321 user/jceel/soc2012_armv6/sys/arm/xscale/pxa/files.pxa user/jceel/soc2012_armv6/sys/dev/fdt/fdtbus.c Modified: user/jceel/soc2012_armv6/sys/arm/arm/intr.c ============================================================================== --- user/jceel/soc2012_armv6/sys/arm/arm/intr.c Wed Jun 20 11:53:04 2012 (r237300) +++ user/jceel/soc2012_armv6/sys/arm/arm/intr.c Wed Jun 20 12:22:54 2012 (r237301) @@ -61,6 +61,15 @@ void arm_handler_execute(struct trapfram void (*arm_post_filter)(void *) = NULL; +const char * +arm_describe_irq(int irq) +{ + static char buffer[8]; + + sprintf(buffer, "%d", irq); + return (buffer); +} + void arm_setup_irqhandler(const char *name, driver_filter_t *filt, void (*hand)(void*), void *arg, int irq, int flags, void **cookiep) Modified: user/jceel/soc2012_armv6/sys/arm/arm/nexus.c ============================================================================== --- user/jceel/soc2012_armv6/sys/arm/arm/nexus.c Wed Jun 20 11:53:04 2012 (r237300) +++ user/jceel/soc2012_armv6/sys/arm/arm/nexus.c Wed Jun 20 12:22:54 2012 (r237301) @@ -72,7 +72,9 @@ struct nexus_device { #define DEVTONX(dev) ((struct nexus_device *)device_get_ivars(dev)) static struct rman mem_rman; +#if defined(ARM_INTRNG) static device_t nexus_dev; +#endif static int nexus_probe(device_t); static int nexus_attach(device_t); @@ -85,11 +87,13 @@ static int nexus_activate_resource(devic static int nexus_setup_intr(device_t dev, device_t child, struct resource *res, int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep); static int nexus_teardown_intr(device_t, device_t, struct resource *, void *); +#if defined(ARM_INTRNG) static void nexus_pic_config(device_t, int, enum intr_trigger, enum intr_polarity); static void nexus_pic_mask(device_t, int); static void nexus_pic_unmask(device_t, int); static void nexus_pic_eoi(device_t, int); void arm_handler_execute(struct trapframe *tf, int irqnb); +#endif static device_method_t nexus_methods[] = { /* Device interface */ @@ -102,11 +106,13 @@ static device_method_t nexus_methods[] = DEVMETHOD(bus_activate_resource, nexus_activate_resource), DEVMETHOD(bus_setup_intr, nexus_setup_intr), DEVMETHOD(bus_teardown_intr, nexus_teardown_intr), +#if defined(ARM_INTRNG) /* Interrupt controller interface */ DEVMETHOD(pic_config, nexus_pic_config), DEVMETHOD(pic_mask, nexus_pic_mask), DEVMETHOD(pic_unmask, nexus_pic_unmask), DEVMETHOD(pic_eoi, nexus_pic_eoi), +#endif { 0, 0 } }; @@ -133,8 +139,13 @@ nexus_setup_intr(device_t dev, device_t if ((rman_get_flags(res) & RF_SHAREABLE) == 0) flags |= INTR_EXCL; +#if defined(ARM_INTRNG) arm_setup_irqhandler(child, filt, intr, arg, rman_get_start(res), flags, cookiep); +#else + arm_setup_irqhandler(device_get_nameunit(child), + filt, intr, arg, rman_get_start(res), flags, cookiep); +#endif return (0); } @@ -156,9 +167,11 @@ nexus_attach(device_t dev) if (rman_init(&mem_rman) || rman_manage_region(&mem_rman, 0, ~0)) panic("nexus_probe mem_rman"); +#if defined(ARM_INTRNG) /* Register core interrupt controller */ nexus_dev = dev; arm_register_pic(dev); +#endif /* * First, deal with the children we know about already @@ -266,6 +279,7 @@ nexus_activate_resource(device_t bus, de return (rman_activate_resource(r)); } +#if defined(ARM_INTRNG) static void nexus_pic_config(device_t bus, int irq, enum intr_trigger trig, enum intr_polarity pol) @@ -297,5 +311,6 @@ arm_handler_execute(struct trapframe *tf /* Dispatch root interrupt from core */ arm_dispatch_irq(nexus_dev, tf, 0); } +#endif DRIVER_MODULE(nexus, root, nexus_driver, nexus_devclass, 0, 0); Modified: user/jceel/soc2012_armv6/sys/arm/at91/files.at91 ============================================================================== --- user/jceel/soc2012_armv6/sys/arm/at91/files.at91 Wed Jun 20 11:53:04 2012 (r237300) +++ user/jceel/soc2012_armv6/sys/arm/at91/files.at91 Wed Jun 20 12:22:54 2012 (r237301) @@ -1,6 +1,7 @@ # $FreeBSD$ arm/arm/cpufunc_asm_arm9.S standard arm/arm/irq_dispatch.S standard +arm/arm/intr.c standard arm/at91/at91_machdep.c standard arm/at91/at91.c standard arm/at91/at91_cfata.c optional at91_cfata Modified: user/jceel/soc2012_armv6/sys/arm/conf/EA3250 ============================================================================== --- user/jceel/soc2012_armv6/sys/arm/conf/EA3250 Wed Jun 20 11:53:04 2012 (r237300) +++ user/jceel/soc2012_armv6/sys/arm/conf/EA3250 Wed Jun 20 12:22:54 2012 (r237301) @@ -26,6 +26,7 @@ options BOOTP_NFSROOT options BOOTP_NFSV3 options BOOTP_WIRED_TO=lpe0 options ARM_INTRNG +options VERBOSE_INIT_ARM #options ROOTDEVNAME=\"ufs:/dev/da0a\" Modified: user/jceel/soc2012_armv6/sys/arm/econa/files.econa ============================================================================== --- user/jceel/soc2012_armv6/sys/arm/econa/files.econa Wed Jun 20 11:53:04 2012 (r237300) +++ user/jceel/soc2012_armv6/sys/arm/econa/files.econa Wed Jun 20 12:22:54 2012 (r237301) @@ -7,6 +7,7 @@ arm/econa/uart_bus_ec.c optional uart arm/econa/uart_cpu_ec.c optional uart dev/uart/uart_dev_ns8250.c optional uart arm/arm/irq_dispatch.S standard +arm/arm/intr.c standard arm/arm/bus_space_generic.c standard arm/econa/ehci_ebus.c standard ehci arm/econa/ohci_ec.c standard ohci Modified: user/jceel/soc2012_armv6/sys/arm/include/fdt.h ============================================================================== --- user/jceel/soc2012_armv6/sys/arm/include/fdt.h Wed Jun 20 11:53:04 2012 (r237300) +++ user/jceel/soc2012_armv6/sys/arm/include/fdt.h Wed Jun 20 12:22:54 2012 (r237301) @@ -41,6 +41,8 @@ #include #include +#if defined(ARM_INTRNG) + /* Max interrupt number */ #define FDT_INTR_MAX (0xffff) @@ -48,6 +50,17 @@ #define FDT_MAP_IRQ(node, pin) (arm_fdt_map_irq(node, pin)) #define FDT_DESCRIBE_IRQ(irq) (arm_describe_irq(irq)) +#else + +/* Max interrupt number */ +#define FDT_INTR_MAX NIRQ + +/* Map phandle/intpin pair to global IRQ number */ +#define FDT_MAP_IRQ(node, pin) (pin) +#define FDT_DESCRIBE_IRQ(irq) (arm_describe_irq(irq)) + +#endif /* ARM_INTRNG */ + /* * Bus space tag. XXX endianess info needs to be derived from the blob. */ Modified: user/jceel/soc2012_armv6/sys/arm/include/intr.h ============================================================================== --- user/jceel/soc2012_armv6/sys/arm/include/intr.h Wed Jun 20 11:53:04 2012 (r237300) +++ user/jceel/soc2012_armv6/sys/arm/include/intr.h Wed Jun 20 12:22:54 2012 (r237301) @@ -56,7 +56,6 @@ struct arm_intr_data { }; int arm_fdt_map_irq(phandle_t ic, int irq); -const char *arm_describe_irq(int irq); void arm_register_pic(device_t dev); void arm_unregister_pic(device_t dev); void arm_dispatch_irq(device_t dev, struct trapframe *tf, int irq); @@ -93,6 +92,7 @@ extern void (*arm_post_filter)(void *); #endif /* !ARM_INTRNG */ +const char *arm_describe_irq(int irq); void gic_init_secondary(void); #endif /* _MACHINE_INTR_H */ Modified: user/jceel/soc2012_armv6/sys/arm/mv/files.mv ============================================================================== --- user/jceel/soc2012_armv6/sys/arm/mv/files.mv Wed Jun 20 11:53:04 2012 (r237300) +++ user/jceel/soc2012_armv6/sys/arm/mv/files.mv Wed Jun 20 12:22:54 2012 (r237301) @@ -21,6 +21,7 @@ arm/arm/cpufunc_asm_armv7.S standard arm/arm/cpufunc_asm_sheeva.S standard arm/arm/cpufunc_asm_pj4b.S standard arm/arm/irq_dispatch.S standard +arm/arm/intr.c standard arm/mv/bus_space.c standard arm/mv/common.c standard Modified: user/jceel/soc2012_armv6/sys/arm/s3c2xx0/files.s3c2xx0 ============================================================================== --- user/jceel/soc2012_armv6/sys/arm/s3c2xx0/files.s3c2xx0 Wed Jun 20 11:53:04 2012 (r237300) +++ user/jceel/soc2012_armv6/sys/arm/s3c2xx0/files.s3c2xx0 Wed Jun 20 12:22:54 2012 (r237301) @@ -1,6 +1,7 @@ # $FreeBSD$ arm/arm/cpufunc_asm_arm9.S standard arm/arm/irq_dispatch.S standard +arm/arm/intr.c standard arm/s3c2xx0/board_ln2410sbc.c optional board_ln2410sbc arm/s3c2xx0/s3c24x0_rtc.c standard arm/s3c2xx0/s3c24x0_machdep.c standard Modified: user/jceel/soc2012_armv6/sys/arm/sa11x0/files.sa11x0 ============================================================================== --- user/jceel/soc2012_armv6/sys/arm/sa11x0/files.sa11x0 Wed Jun 20 11:53:04 2012 (r237300) +++ user/jceel/soc2012_armv6/sys/arm/sa11x0/files.sa11x0 Wed Jun 20 12:22:54 2012 (r237301) @@ -2,6 +2,7 @@ arm/arm/bus_space_generic.c standard arm/arm/cpufunc_asm_sa1.S standard arm/arm/cpufunc_asm_sa11x0.S standard +arm/arm/intr.c standard arm/sa11x0/assabet_machdep.c optional assabet arm/sa11x0/sa11x0.c optional saip arm/sa11x0/sa11x0_ost.c optional saip Modified: user/jceel/soc2012_armv6/sys/arm/tegra/files.tegra2 ============================================================================== --- user/jceel/soc2012_armv6/sys/arm/tegra/files.tegra2 Wed Jun 20 11:53:04 2012 (r237300) +++ user/jceel/soc2012_armv6/sys/arm/tegra/files.tegra2 Wed Jun 20 12:22:54 2012 (r237301) @@ -6,6 +6,7 @@ arm/arm/cpufunc_asm_armv5.S standard arm/arm/cpufunc_asm_arm11.S standard arm/arm/cpufunc_asm_armv7.S standard arm/arm/irq_dispatch.S standard +arm/arm/intr.c standard arm/arm/gic.c standard arm/arm/mpcore_timer.c standard Modified: user/jceel/soc2012_armv6/sys/arm/ti/files.ti ============================================================================== --- user/jceel/soc2012_armv6/sys/arm/ti/files.ti Wed Jun 20 11:53:04 2012 (r237300) +++ user/jceel/soc2012_armv6/sys/arm/ti/files.ti Wed Jun 20 12:22:54 2012 (r237301) @@ -9,6 +9,7 @@ arm/arm/cpufunc_asm_arm10.S standard arm/arm/cpufunc_asm_arm11.S standard arm/arm/cpufunc_asm_armv7.S standard arm/arm/irq_dispatch.S standard +arm/arm/intr.c standard arm/ti/bus_space.c standard arm/ti/common.c standard Modified: user/jceel/soc2012_armv6/sys/arm/xscale/i80321/files.i80219 ============================================================================== --- user/jceel/soc2012_armv6/sys/arm/xscale/i80321/files.i80219 Wed Jun 20 11:53:04 2012 (r237300) +++ user/jceel/soc2012_armv6/sys/arm/xscale/i80321/files.i80219 Wed Jun 20 12:22:54 2012 (r237301) @@ -5,6 +5,7 @@ arm/arm/bus_space_generic.c standard arm/arm/cpufunc_asm_xscale.S standard arm/arm/irq_dispatch.S standard +arm/arm/intr.c standard arm/xscale/i80321/i80321.c standard arm/xscale/i80321/i80321_dma.c optional dma arm/xscale/i80321/i80321_mcu.c standard Modified: user/jceel/soc2012_armv6/sys/arm/xscale/i80321/files.i80321 ============================================================================== --- user/jceel/soc2012_armv6/sys/arm/xscale/i80321/files.i80321 Wed Jun 20 11:53:04 2012 (r237300) +++ user/jceel/soc2012_armv6/sys/arm/xscale/i80321/files.i80321 Wed Jun 20 12:22:54 2012 (r237301) @@ -2,6 +2,7 @@ arm/arm/bus_space_generic.c standard arm/arm/cpufunc_asm_xscale.S standard arm/arm/irq_dispatch.S standard +arm/arm/intr.c standard arm/xscale/i80321/i80321.c standard arm/xscale/i80321/i80321_aau.c optional aau arm/xscale/i80321/i80321_dma.c optional dma Modified: user/jceel/soc2012_armv6/sys/arm/xscale/pxa/files.pxa ============================================================================== --- user/jceel/soc2012_armv6/sys/arm/xscale/pxa/files.pxa Wed Jun 20 11:53:04 2012 (r237300) +++ user/jceel/soc2012_armv6/sys/arm/xscale/pxa/files.pxa Wed Jun 20 12:22:54 2012 (r237301) @@ -3,6 +3,7 @@ arm/arm/bus_space_generic.c standard arm/arm/cpufunc_asm_xscale.S standard arm/arm/irq_dispatch.S standard +arm/arm/intr.c standard arm/xscale/pxa/pxa_gpio.c standard arm/xscale/pxa/pxa_icu.c standard Modified: user/jceel/soc2012_armv6/sys/dev/fdt/fdtbus.c ============================================================================== --- user/jceel/soc2012_armv6/sys/dev/fdt/fdtbus.c Wed Jun 20 11:53:04 2012 (r237300) +++ user/jceel/soc2012_armv6/sys/dev/fdt/fdtbus.c Wed Jun 20 12:22:54 2012 (r237301) @@ -599,8 +599,13 @@ fdtbus_setup_intr(device_t bus, device_t cpu_establish_hardintr(device_get_nameunit(child), filter, ihand, arg, rman_get_start(res), flags, cookiep); #elif defined(__arm__) +#if defined(ARM_INTRNG) arm_setup_irqhandler(child, filter, ihand, arg, rman_get_start(res), flags, cookiep); +#else + arm_setup_irqhandler(device_get_nameunit(child), + filter, ihand, arg, rman_get_start(res), flags, cookiep); +#endif /* ARM_INTRNG */ err = 0; #endif From owner-svn-src-user@FreeBSD.ORG Wed Jun 20 12:26:21 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 880C41065677; Wed, 20 Jun 2012 12:26:21 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 5A6E18FC1F; Wed, 20 Jun 2012 12:26:21 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id C2056B943; Wed, 20 Jun 2012 08:26:20 -0400 (EDT) From: John Baldwin To: "Andrey V. Elsukov" Date: Wed, 20 Jun 2012 07:44:57 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p13; KDE/4.5.5; amd64; ; ) References: <201206200829.q5K8TPcK028907@svn.freebsd.org> In-Reply-To: <201206200829.q5K8TPcK028907@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201206200744.57808.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 20 Jun 2012 08:26:20 -0400 (EDT) Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r237294 - user/ae/bootcode/sys/boot/i386/pmbr X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 12:26:21 -0000 On Wednesday, June 20, 2012 4:29:25 am Andrey V. Elsukov wrote: > Author: ae > Date: Wed Jun 20 08:29:24 2012 > New Revision: 237294 > URL: http://svn.freebsd.org/changeset/base/237294 > > Log: > In case when we have damaged several first sectors, GEOM_PART_GPT class > will not detect GPT even if backup GPT header is ok. To recover we should > write PMBR to the LBA 0. But we can't use `gpart bootcode` command until > GPT is detected and geom created. We can dd(8) /boot/pmbr image and > kernel will be able detect GPT. But our PMBR image contains only empty > partition entries and our loader can't detect GPT when it hasn't the > partition record with type PMBR. > > Add one partition record to the PMBR image. It covers all space after > the LBA 0. It is better to have one partially correct record, than > have nothing. This latter part is not true. :( boot1 has a hardcoded partition in it (for use in dangerously dedicated mode). This has a mixed history. At one point the table entry it used caused certain SCSI BIOSes to crash due to a divide by zero (the SCSI BIOS read the MBR to try to guess what C/H/S geometry the rest of the system was expecting). I think having a hardcoded entry here can only really result in problems. I would rather you add some sort of 'restore' functionality to gpart that allowed it to build a PMBR 'from scratch' with a proper partition entry than to resort to this hack. -- John Baldwin From owner-svn-src-user@FreeBSD.ORG Wed Jun 20 12:46:28 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A5E38106564A; Wed, 20 Jun 2012 12:46:28 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9079A8FC1C; Wed, 20 Jun 2012 12:46:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KCkSPJ042718; Wed, 20 Jun 2012 12:46:28 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KCkSQk042716; Wed, 20 Jun 2012 12:46:28 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206201246.q5KCkSQk042716@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 20 Jun 2012 12:46:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237302 - user/ae/bootcode/sys/boot/i386/libi386 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 12:46:28 -0000 Author: ae Date: Wed Jun 20 12:46:27 2012 New Revision: 237302 URL: http://svn.freebsd.org/changeset/base/237302 Log: Merge bd_getgeom and bd_int13probe functions. Add BIOS call to determine disk parameters (sectors count and sector size). Also some style(9) fixes. Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Wed Jun 20 12:22:54 2012 (r237301) +++ user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Wed Jun 20 12:46:27 2012 (r237302) @@ -96,7 +96,6 @@ static struct bdinfo } bdinfo [MAXBDDEV]; static int nbdinfo = 0; -static int bd_getgeom(struct open_disk *od); static int bd_read(struct open_disk *od, daddr_t dblk, int blks, caddr_t dest); static int bd_write(struct open_disk *od, daddr_t dblk, int blks, @@ -134,58 +133,59 @@ static void bd_closedisk(struct open_dis int bd_bios2unit(int biosdev) { - int i; - - DEBUG("looking for bios device 0x%x", biosdev); - for (i = 0; i < nbdinfo; i++) { - DEBUG("bd unit %d is BIOS device 0x%x", i, bdinfo[i].bd_unit); - if (bdinfo[i].bd_unit == biosdev) - return(i); - } - return(-1); + int i; + + DEBUG("looking for bios device 0x%x", biosdev); + for (i = 0; i < nbdinfo; i++) { + DEBUG("bd unit %d is BIOS device 0x%x", i, bdinfo[i].bd_unit); + if (bdinfo[i].bd_unit == biosdev) + return (i); + } + return (-1); } int bd_unit2bios(int unit) { - if ((unit >= 0) && (unit < nbdinfo)) - return(bdinfo[unit].bd_unit); - return(-1); + if ((unit >= 0) && (unit < nbdinfo)) + return (bdinfo[unit].bd_unit); + return (-1); } -/* +/* * Quiz the BIOS for disk devices, save a little info about them. */ static int -bd_init(void) +bd_init(void) { - int base, unit, nfd = 0; + int base, unit, nfd = 0; - /* sequence 0, 0x80 */ - for (base = 0; base <= 0x80; base += 0x80) { - for (unit = base; (nbdinfo < MAXBDDEV); unit++) { + /* sequence 0, 0x80 */ + for (base = 0; base <= 0x80; base += 0x80) { + for (unit = base; (nbdinfo < MAXBDDEV); unit++) { #ifndef VIRTUALBOX - /* check the BIOS equipment list for number of fixed disks */ - if((base == 0x80) && - (nfd >= *(unsigned char *)PTOV(BIOS_NUMDRIVES))) - break; + /* + * Check the BIOS equipment list for number + * of fixed disks. + */ + if(base == 0x80 && + (nfd >= *(unsigned char *)PTOV(BIOS_NUMDRIVES))) + break; #endif - - bdinfo[nbdinfo].bd_unit = unit; - bdinfo[nbdinfo].bd_flags = (unit < 0x80) ? BD_FLOPPY : 0; - - if (!bd_int13probe(&bdinfo[nbdinfo])) - break; - - /* XXX we need "disk aliases" to make this simpler */ - printf("BIOS drive %c: is disk%d\n", - (unit < 0x80) ? ('A' + unit) : ('C' + unit - 0x80), nbdinfo); - nbdinfo++; - if (base == 0x80) - nfd++; + bdinfo[nbdinfo].bd_unit = unit; + bdinfo[nbdinfo].bd_flags = unit < 0x80 ? BD_FLOPPY: 0; + if (!bd_int13probe(&bdinfo[nbdinfo])) + break; + + /* XXX we need "disk aliases" to make this simpler */ + printf("BIOS drive %c: is disk%d\n", (unit < 0x80) ? + ('A' + unit): ('C' + unit - 0x80), nbdinfo); + nbdinfo++; + if (base == 0x80) + nfd++; + } } - } - return(0); + return(0); } /* @@ -194,36 +194,60 @@ bd_init(void) static int bd_int13probe(struct bdinfo *bd) { - v86.ctl = V86_FLAGS; - v86.addr = 0x13; - v86.eax = 0x800; - v86.edx = bd->bd_unit; - v86int(); - - if (!(V86_CY(v86.efl)) && /* carry clear */ - ((v86.edx & 0xff) > ((unsigned)bd->bd_unit & 0x7f))) { /* unit # OK */ - if ((v86.ecx & 0x3f) == 0) { /* absurd sector size */ - DEBUG("Invalid geometry for unit %d", bd->bd_unit); - return(0); /* skip device */ - } - bd->bd_flags |= BD_MODEINT13; + struct edd_params params; + + v86.ctl = V86_FLAGS; + v86.addr = 0x13; + v86.eax = 0x800; + v86.edx = bd->bd_unit; + v86int(); + + if (V86_CY(v86.efl) || /* carry set */ + (v86.ecx & 0x3f) == 0 || /* absurd sector number */ + (v86.edx & 0xff) <= (unsigned)(od->od_unit & 0x7f)) /* unit # bad */ + return (0); /* skip device */ + + /* Convert max cyl # -> # of cylinders */ + bd->bd_cyl = ((v86.ecx & 0xc0) << 2) + ((v86.ecx & 0xff00) >> 8) + 1; + /* Convert max head # -> # of heads */ + bd->bd_hds = ((v86.edx & 0xff00) >> 8) + 1; + bd->bd_sec = v86.ecx & 0x3f; bd->bd_type = v86.ebx & 0xff; + bd->bd_flags |= BD_MODEINT13; + + /* Calculate sectors count from the geometry */ + bd->bd_sectors = bd->bd_cyl * bd->bd_hds * bd->bd_sec; + bd->bd_sectorsize = BIOSDISK_SECSIZE; + DEBUG("unit 0x%x geometry %d/%d/%d", bd->bd_unit, bd->bd_cyl, + bd->bd_hds, bd->bd_sec); /* Determine if we can use EDD with this device. */ v86.eax = 0x4100; v86.edx = bd->bd_unit; v86.ebx = 0x55aa; v86int(); - if (!(V86_CY(v86.efl)) && /* carry clear */ - ((v86.ebx & 0xffff) == 0xaa55) && /* signature */ - (v86.ecx & EDD_INTERFACE_FIXED_DISK)) { /* packets mode ok */ - bd->bd_flags |= BD_MODEEDD1; - if ((v86.eax & 0xff00) >= 0x3000) - bd->bd_flags |= BD_MODEEDD3; + if (V86_CY(v86.efl) || /* carry set */ + (v86.ebx & 0xffff) != 0xaa55 || /* signature */ + (v86.ecx & EDD_INTERFACE_FIXED_DISK) == 0) + return (1); + /* EDD supported */ + bd->bd_flags |= BD_MODEEDD1; + if ((v86.eax & 0xff00) >= 0x3000) + bd->bd_flags |= BD_MODEEDD3; + /* Get disk params */ + params.len = sizeof(struct edd_params); + v86.ctl = V86_FLAGS; + v86.addr = 0x13; + v86.eax = 0x4800; + v86.edx = bd->bd_unit; + v86.ds = VTOPSEG(¶ms); + v86.esi = VTOPOFF(¶ms); + v86int(); + if (!V86_CY(v86.efl)) { + bd->bd_sectors = params.sectors; + bd->bd_sectorsize = params.sector_size; } - return(1); - } - return(0); + return (1); } /* @@ -648,30 +672,6 @@ bd_write(struct open_disk *od, daddr_t d return (bd_io(od, dblk, blks, dest, 1)); } -static int -bd_getgeom(struct open_disk *od) -{ - - v86.ctl = V86_FLAGS; - v86.addr = 0x13; - v86.eax = 0x800; - v86.edx = od->od_unit; - v86int(); - - if ((V86_CY(v86.efl)) || /* carry set */ - ((v86.edx & 0xff) <= (unsigned)(od->od_unit & 0x7f))) /* unit # bad */ - return(1); - - /* convert max cyl # -> # of cylinders */ - od->od_cyl = ((v86.ecx & 0xc0) << 2) + ((v86.ecx & 0xff00) >> 8) + 1; - /* convert max head # -> # of heads */ - od->od_hds = ((v86.edx & 0xff00) >> 8) + 1; - od->od_sec = v86.ecx & 0x3f; - - DEBUG("unit 0x%x geometry %d/%d/%d", od->od_unit, od->od_cyl, od->od_hds, od->od_sec); - return(0); -} - /* * Return the BIOS geometry of a given "fixed drive" in a format * suitable for the legacy bootinfo structure. Since the kernel is From owner-svn-src-user@FreeBSD.ORG Wed Jun 20 12:55:20 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5C4CC106566B; Wed, 20 Jun 2012 12:55:20 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mail.kirov.so-ups.ru (ns.kirov.so-ups.ru [178.74.170.1]) by mx1.freebsd.org (Postfix) with ESMTP id 01F008FC1F; Wed, 20 Jun 2012 12:55:20 +0000 (UTC) Received: from kas30pipe.localhost (localhost.kirov.so-ups.ru [127.0.0.1]) by mail.kirov.so-ups.ru (Postfix) with SMTP id DC17DB8026; Wed, 20 Jun 2012 16:55:18 +0400 (MSK) Received: from kirov.so-ups.ru (unknown [172.21.81.1]) by mail.kirov.so-ups.ru (Postfix) with ESMTP id D64D8B8024; Wed, 20 Jun 2012 16:55:18 +0400 (MSK) Received: by ns.kirov.so-ups.ru (Postfix, from userid 1010) id CE48DBA04D; Wed, 20 Jun 2012 16:55:18 +0400 (MSK) Received: from [127.0.0.1] (unknown [10.118.3.52]) by ns.kirov.so-ups.ru (Postfix) with ESMTP id 98230BA03F; Wed, 20 Jun 2012 16:55:18 +0400 (MSK) Message-ID: <4FE1C832.7000805@FreeBSD.org> Date: Wed, 20 Jun 2012 16:55:14 +0400 From: "Andrey V. Elsukov" User-Agent: Mozilla Thunderbird 1.5 (FreeBSD/20051231) MIME-Version: 1.0 To: John Baldwin References: <201206200829.q5K8TPcK028907@svn.freebsd.org> <201206200744.57808.jhb@freebsd.org> In-Reply-To: <201206200744.57808.jhb@freebsd.org> X-Enigmail-Version: 1.4.1 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig77C56D2D75F794C3D5B406AE" X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0284], KAS30/Release X-SpamTest-Info: Not protected Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r237294 - user/ae/bootcode/sys/boot/i386/pmbr X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 12:55:20 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig77C56D2D75F794C3D5B406AE Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: quoted-printable On 20.06.2012 15:44, John Baldwin wrote: >> Add one partition record to the PMBR image. It covers all space afte= r >> the LBA 0. It is better to have one partially correct record, than >> have nothing. >=20 > This latter part is not true. :( >=20 > boot1 has a hardcoded partition in it (for use in dangerously dedicated= mode). > This has a mixed history. At one point the table entry it used caused = certain > SCSI BIOSes to crash due to a divide by zero (the SCSI BIOS read the MB= R to=20 > try to guess what C/H/S geometry the rest of the system was expecting).= I=20 > think having a hardcoded entry here can only really result in problems.= I=20 > would rather you add some sort of 'restore' functionality to gpart that= =20 > allowed it to build a PMBR 'from scratch' with a proper partition entry= than=20 > to resort to this hack. AFAIK, DD mode is not supported now. As another solution we can remove checking for PMBR partition type existe= nce when detecting GPT (like the kernel does). --=20 WBR, Andrey V. Elsukov --------------enig77C56D2D75F794C3D5B406AE Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (MingW32) iQEcBAEBAgAGBQJP4cg2AAoJEAHF6gQQyKF6abUH/RKp1q4gan+iOtmdHlepPgO6 IpqUy/VG2Q2DZlqckT5beQYTW9QYa19NeoxSfVwpCMdQRpHssKN5uE/NAhsWUF1F Zr534VohXONjgAIFhYGxduI3DpiFHFONaaNqTWo7d9eQR1m9LnCqI9GMzEC/9J7z CgsJNS7p8RkjS3e5kdXBhSNtKzTImKbJXuPMNBjab7nJ6vtrzvTMUL5FYyQeICy1 495DwyaqNf01zjGUUaGkAfl6H1+bfwnynjMrXcGQP6UuPpB84XqrxFwk1DS2wp44 EfZVU08w+I/uVZu/SrHEyoI+rselDqu3n2syQX/o5FHi3nwymCUeK8LKBn8nqpc= =WBuk -----END PGP SIGNATURE----- --------------enig77C56D2D75F794C3D5B406AE-- From owner-svn-src-user@FreeBSD.ORG Wed Jun 20 13:35:28 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E25D71065674; Wed, 20 Jun 2012 13:35:28 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id B6A878FC0C; Wed, 20 Jun 2012 13:35:28 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 10444B911; Wed, 20 Jun 2012 09:35:28 -0400 (EDT) From: John Baldwin To: "Andrey V. Elsukov" Date: Wed, 20 Jun 2012 09:30:03 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p13; KDE/4.5.5; amd64; ; ) References: <201206200829.q5K8TPcK028907@svn.freebsd.org> <201206200744.57808.jhb@freebsd.org> <4FE1C832.7000805@FreeBSD.org> In-Reply-To: <4FE1C832.7000805@FreeBSD.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201206200930.03176.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 20 Jun 2012 09:35:28 -0400 (EDT) Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r237294 - user/ae/bootcode/sys/boot/i386/pmbr X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 13:35:29 -0000 On Wednesday, June 20, 2012 8:55:14 am Andrey V. Elsukov wrote: > On 20.06.2012 15:44, John Baldwin wrote: > >> Add one partition record to the PMBR image. It covers all space after > >> the LBA 0. It is better to have one partially correct record, than > >> have nothing. > > > > This latter part is not true. :( > > > > boot1 has a hardcoded partition in it (for use in dangerously dedicated mode). > > This has a mixed history. At one point the table entry it used caused certain > > SCSI BIOSes to crash due to a divide by zero (the SCSI BIOS read the MBR to > > try to guess what C/H/S geometry the rest of the system was expecting). I > > think having a hardcoded entry here can only really result in problems. I > > would rather you add some sort of 'restore' functionality to gpart that > > allowed it to build a PMBR 'from scratch' with a proper partition entry than > > to resort to this hack. > > AFAIK, DD mode is not supported now. Correct, because it was a disasater. Let's not create a new disaster. > As another solution we can remove checking for PMBR partition type existence > when detecting GPT (like the kernel does). I think adding a suitable command to gpart to let it recover a disk is the way to go. -- John Baldwin From owner-svn-src-user@FreeBSD.ORG Wed Jun 20 13:35:30 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4F5CF1065676; Wed, 20 Jun 2012 13:35:30 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 25AC08FC12; Wed, 20 Jun 2012 13:35:30 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 837B5B96C; Wed, 20 Jun 2012 09:35:29 -0400 (EDT) From: John Baldwin To: "Andrey V. Elsukov" Date: Wed, 20 Jun 2012 09:30:58 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p13; KDE/4.5.5; amd64; ; ) References: <201206201246.q5KCkSQk042716@svn.freebsd.org> In-Reply-To: <201206201246.q5KCkSQk042716@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201206200930.58029.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 20 Jun 2012 09:35:29 -0400 (EDT) Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r237302 - user/ae/bootcode/sys/boot/i386/libi386 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 13:35:30 -0000 On Wednesday, June 20, 2012 8:46:28 am Andrey V. Elsukov wrote: > Author: ae > Date: Wed Jun 20 12:46:27 2012 > New Revision: 237302 > URL: http://svn.freebsd.org/changeset/base/237302 > > Log: > Merge bd_getgeom and bd_int13probe functions. Add BIOS call to > determine disk parameters (sectors count and sector size). > Also some style(9) fixes. Do not mix style changes in with code changes. It makes the diff far harder to read. -- John Baldwin From owner-svn-src-user@FreeBSD.ORG Wed Jun 20 15:12:31 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D98B7106564A; Wed, 20 Jun 2012 15:12:31 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C4D3F8FC12; Wed, 20 Jun 2012 15:12:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KFCVwh050070; Wed, 20 Jun 2012 15:12:31 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KFCVST050068; Wed, 20 Jun 2012 15:12:31 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206201512.q5KFCVST050068@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 20 Jun 2012 15:12:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237321 - user/ae/bootcode/sys/boot/i386/libi386 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 15:12:32 -0000 Author: ae Date: Wed Jun 20 15:12:31 2012 New Revision: 237321 URL: http://svn.freebsd.org/changeset/base/237321 Log: Style fixes. Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Wed Jun 20 14:47:39 2012 (r237320) +++ user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Wed Jun 20 15:12:31 2012 (r237321) @@ -147,6 +147,7 @@ bd_bios2unit(int biosdev) int bd_unit2bios(int unit) { + if ((unit >= 0) && (unit < nbdinfo)) return (bdinfo[unit].bd_unit); return (-1); @@ -340,26 +341,24 @@ display_size(uint64_t size) * sliced - are they after the first BSD slice, or the DOS * slice before it?) */ -static int +static int bd_open(struct open_file *f, ...) { - va_list ap; - struct i386_devdesc *dev; - struct open_disk *od; - int error; - - va_start(ap, f); - dev = va_arg(ap, struct i386_devdesc *); - va_end(ap); - if ((error = bd_opendisk(&od, dev))) - return(error); - - /* - * Save our context - */ - ((struct i386_devdesc *)(f->f_devdata))->d_kind.biosdisk.data = od; - DEBUG("open_disk %p, partition at 0x%x", od, od->od_boff); - return(0); + struct i386_devdesc *dev; + struct open_disk *od; + va_list ap; + int error; + + va_start(ap, f); + dev = va_arg(ap, struct i386_devdesc *); + va_end(ap); + if ((error = bd_opendisk(&od, dev)) != 0) + return (error); + + /* Save our context */ + ((struct i386_devdesc *)(f->f_devdata))->d_kind.biosdisk.data = od; + DEBUG("open_disk %p, partition at 0x%x", od, od->od_boff); + return (0); } static int @@ -408,13 +407,15 @@ bd_opendisk(struct open_disk **odp, stru return(error); } -static int +static int bd_close(struct open_file *f) { - struct open_disk *od = (struct open_disk *)(((struct i386_devdesc *)(f->f_devdata))->d_kind.biosdisk.data); + struct open_disk *od; - bd_closedisk(od); - return(0); + od = (struct open_disk *) + (((struct i386_devdesc *)(f->f_devdata))->d_kind.biosdisk.data); + bd_closedisk(od); + return (0); } static void @@ -424,15 +425,18 @@ bd_closedisk(struct open_disk *od) free(od); } -static int +static int bd_strategy(void *devdata, int rw, daddr_t dblk, size_t size, char *buf, size_t *rsize) { - struct bcache_devdata bcd; - struct open_disk *od = (struct open_disk *)(((struct i386_devdesc *)devdata)->d_kind.biosdisk.data); + struct bcache_devdata bcd; + struct open_disk *od; - bcd.dv_strategy = bd_realstrategy; - bcd.dv_devdata = devdata; - return(bcache_strategy(&bcd, od->od_unit, rw, dblk+od->od_boff, size, buf, rsize)); + od = (struct open_disk *) + (((struct i386_devdesc *)devdata)->d_kind.biosdisk.data); + bcd.dv_strategy = bd_realstrategy; + bcd.dv_devdata = devdata; + return (bcache_strategy(&bcd, od->od_unit, rw, dblk + od->od_boff, + size, buf, rsize)); } static int @@ -662,14 +666,14 @@ static int bd_read(struct open_disk *od, daddr_t dblk, int blks, caddr_t dest) { - return (bd_io(od, dblk, blks, dest, 0)); + return (bd_io(od, dblk, blks, dest, 0)); } static int bd_write(struct open_disk *od, daddr_t dblk, int blks, caddr_t dest) { - return (bd_io(od, dblk, blks, dest, 1)); + return (bd_io(od, dblk, blks, dest, 1)); } /* From owner-svn-src-user@FreeBSD.ORG Wed Jun 20 15:55:43 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B38231065670; Wed, 20 Jun 2012 15:55:43 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 94CB78FC08; Wed, 20 Jun 2012 15:55:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KFthQb051947; Wed, 20 Jun 2012 15:55:43 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KFthgG051945; Wed, 20 Jun 2012 15:55:43 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206201555.q5KFthgG051945@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 20 Jun 2012 15:55:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237323 - user/ae/bootcode/sys/boot/i386/libi386 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 15:55:43 -0000 Author: ae Date: Wed Jun 20 15:55:43 2012 New Revision: 237323 URL: http://svn.freebsd.org/changeset/base/237323 Log: Reimplement bd_opendisk and bd_closedisk functins using new API to get access to partition tables. Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Wed Jun 20 15:45:50 2012 (r237322) +++ user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Wed Jun 20 15:55:43 2012 (r237323) @@ -96,6 +96,9 @@ static struct bdinfo } bdinfo [MAXBDDEV]; static int nbdinfo = 0; +#define BDSZ(od) (bdinfo[(od)->od_dkunit].bd_sectors) +#define BDSECSZ(od) (bdinfo[(od)->od_dkunit].bd_sectorsize) + static int bd_read(struct open_disk *od, daddr_t dblk, int blks, caddr_t dest); static int bd_write(struct open_disk *od, daddr_t dblk, int blks, @@ -362,49 +365,123 @@ bd_open(struct open_file *f, ...) } static int -bd_opendisk(struct open_disk **odp, struct i386_devdesc *dev) +diskread(void *dev, void *buf, size_t blocks, off_t offset) { - struct open_disk *od; - int error; - if (dev->d_unit >= nbdinfo) { - DEBUG("attempt to open nonexistent disk"); - return(ENXIO); - } - - od = (struct open_disk *)malloc(sizeof(struct open_disk)); - if (!od) { - DEBUG("no memory"); - return (ENOMEM); - } + return (bd_read(dev, offset, blocks, buf)); +} - /* Look up BIOS unit number, initalise open_disk structure */ - od->od_dkunit = dev->d_unit; - od->od_unit = bdinfo[od->od_dkunit].bd_unit; - od->od_flags = bdinfo[od->od_dkunit].bd_flags; - od->od_boff = 0; - error = 0; - DEBUG("open '%s', unit 0x%x slice %d partition %d", - i386_fmtdev(dev), dev->d_unit, - dev->d_kind.biosdisk.slice, dev->d_kind.biosdisk.partition); - - /* Get geometry for this open (removable device may have changed) */ - if (bd_getgeom(od)) { - DEBUG("can't get geometry"); - error = ENXIO; - goto out; - } +static int +bd_opendisk(struct open_disk **odp, struct i386_devdesc *dev) +{ + struct open_disk *od; + struct ptable_entry part; + int error; - /* Determine disk layout. */ - error = bd_open_mbr(od, dev); - - out: - if (error) { - free(od); - } else { - *odp = od; /* return the open disk */ - } - return(error); + if (dev->d_unit >= nbdinfo) { + DEBUG("attempt to open nonexistent disk"); + return (ENXIO); + } + od = (struct open_disk *)malloc(sizeof(struct open_disk)); + if (!od) { + DEBUG("no memory"); + return (ENOMEM); + } + + /* Look up BIOS unit number, initalize open_disk structure */ + od->od_dkunit = dev->d_unit; + od->od_unit = bdinfo[od->od_dkunit].bd_unit; + od->od_ptable = bdinfo[od->od_dkunit].bd_ptable; + od->od_slice = 0; + od->od_boff = 0; + error = 0; + DEBUG("open '%s', unit 0x%x slice %d partition %d", + i386_fmtdev(dev), dev->d_unit, dev->d_kind.biosdisk.slice, + dev->d_kind.biosdisk.partition); + + /* Determine disk layout. */ + if (od->od_ptable == NULL) { + od->od_ptable = ptable_open(od, BDSZ(od), BDSECSZ(od), + diskread); + if (od->od_ptable == NULL) { + DEBUG("Can't read partition table"); + error = ENXIO; + goto out; + } + /* Save the result */ + bdinfo[od->od_dkunit].bd_ptable = od->od_ptable; + } + /* + * What we want to open: + * a whole disk: + * slice = -1 + * + * a MBR slice: + * slice = 1 .. 4 + * partition = -1 + * + * an EBR slice: + * slice = 5 .. N + * partition = -1 + * + * a GPT partition: + * slice = 1 .. N + * partition = 255 + * + * BSD partition within an MBR slice: + * slice = 1 .. N + * partition = 0 .. 19 + */ + if (dev->d_kind.biosdisk.slice > 0) { + /* Try to get information about partition */ + error = ptable_getpart(od->od_ptable, &part, + dev->d_kind.biosdisk.slice); + if (error != 0) /* Partition isn't exists */ + goto out; + /* Adjust open_disk's offset within the biosdisk */ + od->od_boff = part.start; + if (dev->d_kind.biosdisk.partition == -1 || + dev->d_kind.biosdisk.partition == 255) + goto out; /* Nothing more to do */ + + /* Try to read BSD label */ + od->od_ptable = ptable_open(od, part.end - part.start + 1, + SECSZ(od), diskread); + if (od->od_ptable == NULL) { + DEBUG("Can't read BSD label"); + error = ENXIO; + /* Keep parent partition table opened */ + goto out; + } + /* Save the slice number of the parent partition */ + od->od_slice = part.index; + error = ptable_getpart(od->od_ptable, &part, + dev->d_kind.biosdisk.partition); + if (error != 0) { + /* + * Keep parent partition table opened, but + * close this one (BSD label). + */ + ptable_close(od->od_ptable); + goto out; + } + /* Adjust open_disk's offset within the biosdisk */ + od->od_boff += part.start; + } else if (dev->d_kind.biosdisk.slice == 0) { + error = ptable_getbestpart(od->od_ptable, &part); + if (error != 0) + goto out; + /* Save the slice number of best partition to dev */ + dev->d_kind.biosdisk.slice = part.index; + od->od_boff = part.start; + } +out: + if (error != 0) { + free(od); + } else { + *odp = od; /* return the open disk */ + } + return (error); } static int @@ -421,8 +498,12 @@ bd_close(struct open_file *f) static void bd_closedisk(struct open_disk *od) { - DEBUG("open_disk %p", od); - free(od); + + DEBUG("close_disk %p", od); + /* Close only nested ptables */ + if (od->od_slice != 0 && od->od_ptable != NULL) + ptable_close(od->od_ptable); + free(od); } static int From owner-svn-src-user@FreeBSD.ORG Wed Jun 20 15:59:43 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1CCCA1065687; Wed, 20 Jun 2012 15:59:43 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0764C8FC29; Wed, 20 Jun 2012 15:59:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KFxgQp052143; Wed, 20 Jun 2012 15:59:42 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KFxgWM052141; Wed, 20 Jun 2012 15:59:42 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206201559.q5KFxgWM052141@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 20 Jun 2012 15:59:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237324 - user/ae/bootcode/sys/boot/i386/libi386 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 15:59:43 -0000 Author: ae Date: Wed Jun 20 15:59:42 2012 New Revision: 237324 URL: http://svn.freebsd.org/changeset/base/237324 Log: Fix the name of macro. Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Wed Jun 20 15:55:43 2012 (r237323) +++ user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Wed Jun 20 15:59:42 2012 (r237324) @@ -446,7 +446,7 @@ bd_opendisk(struct open_disk **odp, stru /* Try to read BSD label */ od->od_ptable = ptable_open(od, part.end - part.start + 1, - SECSZ(od), diskread); + BDSECSZ(od), diskread); if (od->od_ptable == NULL) { DEBUG("Can't read BSD label"); error = ENXIO; From owner-svn-src-user@FreeBSD.ORG Wed Jun 20 16:21:09 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9D54C106564A; Wed, 20 Jun 2012 16:21:09 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 890618FC08; Wed, 20 Jun 2012 16:21:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KGL94R053070; Wed, 20 Jun 2012 16:21:09 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KGL9Nc053068; Wed, 20 Jun 2012 16:21:09 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206201621.q5KGL9Nc053068@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 20 Jun 2012 16:21:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237325 - user/ae/bootcode/sys/boot/i386/libi386 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 16:21:09 -0000 Author: ae Date: Wed Jun 20 16:21:08 2012 New Revision: 237325 URL: http://svn.freebsd.org/changeset/base/237325 Log: Use sector size from the bdinfo structure instead of BIOSDISK_SECSIZE. Also BIOS geometry now in the bdinfo, not in the open_disk structure. Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Wed Jun 20 15:59:42 2012 (r237324) +++ user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Wed Jun 20 16:21:08 2012 (r237325) @@ -96,6 +96,7 @@ static struct bdinfo } bdinfo [MAXBDDEV]; static int nbdinfo = 0; +#define BD(od) (bdinfo[(od)->od_dkunit]) #define BDSZ(od) (bdinfo[(od)->od_dkunit].bd_sectors) #define BDSECSZ(od) (bdinfo[(od)->od_dkunit].bd_sectorsize) @@ -525,18 +526,18 @@ bd_realstrategy(void *devdata, int rw, d { struct open_disk *od = (struct open_disk *)(((struct i386_devdesc *)devdata)->d_kind.biosdisk.data); int blks; -#ifdef BD_SUPPORT_FRAGS +#ifdef BD_SUPPORT_FRAGS /* XXX: sector size */ char fragbuf[BIOSDISK_SECSIZE]; size_t fragsize; fragsize = size % BIOSDISK_SECSIZE; #else - if (size % BIOSDISK_SECSIZE) + if (size % BDSECSZ(od)) panic("bd_strategy: %d bytes I/O not multiple of block size", size); #endif DEBUG("open_disk %p", od); - blks = size / BIOSDISK_SECSIZE; + blks = size / BDSECSZ(od); if (rsize) *rsize = 0; @@ -548,7 +549,7 @@ bd_realstrategy(void *devdata, int rw, d DEBUG("read error"); return (EIO); } -#ifdef BD_SUPPORT_FRAGS +#ifdef BD_SUPPORT_FRAGS /* XXX: sector size */ DEBUG("bd_strategy: frag read %d from %d+%d to %p", fragsize, dblk, blks, buf + (blks * BIOSDISK_SECSIZE)); if (fragsize && bd_read(od, dblk + blks, 1, fragsize)) { @@ -614,12 +615,12 @@ bd_chs_io(struct open_disk *od, daddr_t { u_int x, bpc, cyl, hd, sec; - bpc = (od->od_sec * od->od_hds); /* blocks per cylinder */ + bpc = BD(od).bd_sec * BD(od).bd_hds; /* blocks per cylinder */ x = dblk; cyl = x / bpc; /* block # / blocks per cylinder */ x %= bpc; /* block offset into cylinder */ - hd = x / od->od_sec; /* offset / blocks per track */ - sec = x % od->od_sec; /* offset into track */ + hd = x / BD(od).bd_sec; /* offset / blocks per track */ + sec = x % BD(od).bd_sec; /* offset into track */ /* correct sector number for 1-based BIOS numbering */ sec++; @@ -657,7 +658,7 @@ bd_io(struct open_disk *od, daddr_t dblk /* Decide whether we have to bounce */ if (VTOP(dest) >> 20 != 0 || ((od->od_unit < 0x80) && - ((VTOP(dest) >> 16) != (VTOP(dest + blks * BIOSDISK_SECSIZE) >> 16)))) { + ((VTOP(dest) >> 16) != (VTOP(dest + blks * BDSECSZ(od)) >> 16)))) { /* * There is a 64k physical boundary somewhere in the @@ -668,12 +669,12 @@ bd_io(struct open_disk *od, daddr_t dblk * there, in which case we use the top half. */ x = min(FLOPPY_BOUNCEBUF, (unsigned)blks); - bbuf = alloca(x * 2 * BIOSDISK_SECSIZE); + bbuf = alloca(x * 2 * BDSECSZ(od)); if (((u_int32_t)VTOP(bbuf) & 0xffff0000) == - ((u_int32_t)VTOP(bbuf + x * BIOSDISK_SECSIZE) & 0xffff0000)) { + ((u_int32_t)VTOP(bbuf + x * BDSECSZ(od)) & 0xffff0000)) { breg = bbuf; } else { - breg = bbuf + x * BIOSDISK_SECSIZE; + breg = bbuf + x * BDSECSZ(od); } maxfer = x; /* limit transfers to bounce region size */ } else { @@ -686,8 +687,8 @@ bd_io(struct open_disk *od, daddr_t dblk * Play it safe and don't cross track boundaries. * (XXX this is probably unnecessary) */ - sec = dblk % od->od_sec; /* offset into track */ - x = min(od->od_sec - sec, resid); + sec = dblk % BD(od).bd_sec; /* offset into track */ + x = min(BD(od).bd_sec - sec, resid); if (maxfer > 0) x = min(x, maxfer); /* fit bounce buffer */ @@ -699,7 +700,7 @@ bd_io(struct open_disk *od, daddr_t dblk * Put your Data In, and shake it all about */ if (write && bbuf != NULL) - bcopy(p, breg, x * BIOSDISK_SECSIZE); + bcopy(p, breg, x * BDSECSZ(od)); /* * Loop retrying the operation a couple of times. The BIOS @@ -733,13 +734,13 @@ bd_io(struct open_disk *od, daddr_t dblk return(-1); } if (!write && bbuf != NULL) - bcopy(breg, p, x * BIOSDISK_SECSIZE); - p += (x * BIOSDISK_SECSIZE); + bcopy(breg, p, x * BDSECSZ(od)); + p += (x * BDSECSZ(od)); dblk += x; resid -= x; } -/* hexdump(dest, (blks * BIOSDISK_SECSIZE)); */ +/* hexdump(dest, (blks * BDSECSZ(od))); */ return(0); } From owner-svn-src-user@FreeBSD.ORG Wed Jun 20 16:24:03 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 187271065672; Wed, 20 Jun 2012 16:24:03 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 045878FC15; Wed, 20 Jun 2012 16:24:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KGO2pa053223; Wed, 20 Jun 2012 16:24:02 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KGO2Rs053221; Wed, 20 Jun 2012 16:24:02 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206201624.q5KGO2Rs053221@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 20 Jun 2012 16:24:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237326 - user/ae/bootcode/sys/boot/i386/libi386 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 16:24:03 -0000 Author: ae Date: Wed Jun 20 16:24:02 2012 New Revision: 237326 URL: http://svn.freebsd.org/changeset/base/237326 Log: Add bd_cleanup function. Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Wed Jun 20 16:21:08 2012 (r237325) +++ user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Wed Jun 20 16:24:02 2012 (r237326) @@ -193,6 +193,19 @@ bd_init(void) return(0); } +static void +bd_cleanup(void) +{ + int i; + + for (i = 0; i < nbdinfo; i++) { + if (bdinfo[i].bd_ptable != NULL) { + ptable_close(bdinfo[i].bd_ptable); + bdinfo[i].bd_ptable = NULL; + } + } +} + /* * Try to detect a device supported by the legacy int13 BIOS */ From owner-svn-src-user@FreeBSD.ORG Wed Jun 20 17:45:54 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 27E8A106566C; Wed, 20 Jun 2012 17:45:53 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C1C128FC0A; Wed, 20 Jun 2012 17:45:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5KHjrVD058339; Wed, 20 Jun 2012 17:45:53 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5KHjriA058337; Wed, 20 Jun 2012 17:45:53 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206201745.q5KHjriA058337@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 20 Jun 2012 17:45:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237331 - user/ae/bootcode/sys/boot/i386/libi386 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 17:45:54 -0000 Author: ae Date: Wed Jun 20 17:45:53 2012 New Revision: 237331 URL: http://svn.freebsd.org/changeset/base/237331 Log: Reimplement bd_print function using new API. Use actual sector size in the display_size function. Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Wed Jun 20 17:26:22 2012 (r237330) +++ user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Wed Jun 20 17:45:53 2012 (r237331) @@ -268,86 +268,80 @@ bd_int13probe(struct bdinfo *bd) return (1); } +/* Convert the size to a human-readable number. */ +static char * +display_size(uint64_t size, uint16_t sectorsize) +{ + static char buf[80]; + char unit; + + size = size * sectorsize / 1024; + unit = 'K'; + if (size >= 10485760000LL) { + size /= 1073741824; + unit = 'T'; + } else if (size >= 10240000) { + size /= 1048576; + unit = 'G'; + } else if (size >= 10000) { + size /= 1024; + unit = 'M'; + } + sprintf(buf, "%.6ld%cB", (long)size, unit); + return (buf); +} + +static void +printpartition(void *arg, const char *pname, const struct ptable_entry *part) +{ + struct open_disk *od, *bsd; + struct i386_devdesc dev; + static char line[80]; + + od = (struct open_disk *)arg; + sprintf(line, "\tdisk%d%s: %s %s\n", od->od_dkunit, pname, + parttype2str(part->type), + display_size(part->end - part->start + 1, BDSECSZ(od))); + pager_output(line); + if (part->type == PART_FREEBSD) { + /* Open slice with BSD label */ + dev.d_unit = od->od_dkunit; + dev.d_kind.biosdisk.slice = part->index; + dev.d_kind.biosdisk.partition = -1; + if (!bd_opendisk(&bsd, &dev)) { + ptable_iterate(bsd->od_ptable, bsd, printpartition); + bd_closedisk(bsd); + } + } +} /* * Print information about disks */ static void bd_print(int verbose) { - int i, j; - char line[80]; - struct i386_devdesc dev; - struct open_disk *od; - struct dos_partition *dptr; - - for (i = 0; i < nbdinfo; i++) { - sprintf(line, " disk%d: BIOS drive %c:\n", i, - (bdinfo[i].bd_unit < 0x80) ? ('A' + bdinfo[i].bd_unit) : ('C' + bdinfo[i].bd_unit - 0x80)); - pager_output(line); + static char line[80]; + struct i386_devdesc dev; + struct open_disk *od; + int i; - /* try to open the whole disk */ - dev.d_unit = i; - dev.d_kind.biosdisk.slice = -1; - dev.d_kind.biosdisk.partition = -1; - - if (!bd_opendisk(&od, &dev)) { - -#ifdef LOADER_GPT_SUPPORT - /* Do we have a GPT table? */ - if (od->od_flags & BD_GPTOK) { - for (j = 0; j < od->od_nparts; j++) { - sprintf(line, " disk%dp%d", i, - od->od_partitions[j].gp_index); - bd_printgptpart(od, &od->od_partitions[j], line, verbose); + for (i = 0; i < nbdinfo; i++) { + sprintf(line, " disk%d: BIOS drive %c:\n", i, + (bdinfo[i].bd_unit < 0x80) ? ('A' + bdinfo[i].bd_unit): + ('C' + bdinfo[i].bd_unit - 0x80)); + pager_output(line); + + /* try to open the whole disk */ + dev.d_unit = i; + dev.d_kind.biosdisk.slice = -1; + dev.d_kind.biosdisk.partition = -1; + if (!bd_opendisk(&od, &dev)) { + ptable_iterate(od->od_ptable, od, printpartition); + bd_closedisk(od); } - } else -#endif - /* Do we have a partition table? */ - if (od->od_flags & BD_PARTTABOK) { - dptr = &od->od_slicetab[0]; - - /* Check for a "dedicated" disk */ - if ((dptr[3].dp_typ == DOSPTYP_386BSD) && - (dptr[3].dp_start == 0) && - (dptr[3].dp_size == 50000)) { - sprintf(line, " disk%d", i); - bd_printbsdslice(od, 0, line, verbose); - } else { - for (j = 0; j < od->od_nslices; j++) { - sprintf(line, " disk%ds%d", i, j + 1); - bd_printslice(od, &dptr[j], line, verbose); - } - } - } - bd_closedisk(od); } - } } -/* Given a size in 512 byte sectors, convert it to a human-readable number. */ -static char * -display_size(uint64_t size) -{ - static char buf[80]; - char unit; - - size /= 2; - unit = 'K'; - if (size >= 10485760000LL) { - size /= 1073741824; - unit = 'T'; - } else if (size >= 10240000) { - size /= 1048576; - unit = 'G'; - } else if (size >= 10000) { - size /= 1024; - unit = 'M'; - } - sprintf(buf, "%.6ld%cB", (long)size, unit); - return (buf); -} - - /* * Attempt to open the disk described by (dev) for use by (f). * From owner-svn-src-user@FreeBSD.ORG Thu Jun 21 04:28:58 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A255106566B; Thu, 21 Jun 2012 04:28:58 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 750A48FC14; Thu, 21 Jun 2012 04:28:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5L4Swla088503; Thu, 21 Jun 2012 04:28:58 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5L4Swej088501; Thu, 21 Jun 2012 04:28:58 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206210428.q5L4Swej088501@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 21 Jun 2012 04:28:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237353 - user/ae/bootcode/sys/boot/i386/libi386 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 04:28:58 -0000 Author: ae Date: Thu Jun 21 04:28:57 2012 New Revision: 237353 URL: http://svn.freebsd.org/changeset/base/237353 Log: Fix copy/paste bug. Also od_flags now in the bdinfo structure, fix this. Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Thu Jun 21 04:02:07 2012 (r237352) +++ user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Thu Jun 21 04:28:57 2012 (r237353) @@ -222,7 +222,7 @@ bd_int13probe(struct bdinfo *bd) if (V86_CY(v86.efl) || /* carry set */ (v86.ecx & 0x3f) == 0 || /* absurd sector number */ - (v86.edx & 0xff) <= (unsigned)(od->od_unit & 0x7f)) /* unit # bad */ + (v86.edx & 0xff) <= (unsigned)(bd->bd_unit & 0x7f)) /* unit # bad */ return (0); /* skip device */ /* Convert max cyl # -> # of cylinders */ @@ -723,7 +723,7 @@ bd_io(struct open_disk *od, daddr_t dblk v86int(); } - if (od->od_flags & BD_MODEEDD1) + if (BD(od).bd_flags & BD_MODEEDD1) result = bd_edd_io(od, dblk, x, xp, write); else result = bd_chs_io(od, dblk, x, xp, write); From owner-svn-src-user@FreeBSD.ORG Thu Jun 21 04:39:11 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3753D1065670; Thu, 21 Jun 2012 04:39:11 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 225478FC16; Thu, 21 Jun 2012 04:39:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5L4dAi5088987; Thu, 21 Jun 2012 04:39:10 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5L4dAhw088985; Thu, 21 Jun 2012 04:39:10 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206210439.q5L4dAhw088985@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 21 Jun 2012 04:39:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237354 - user/ae/bootcode/sys/boot/i386/libi386 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 04:39:11 -0000 Author: ae Date: Thu Jun 21 04:39:10 2012 New Revision: 237354 URL: http://svn.freebsd.org/changeset/base/237354 Log: BD_LABELOK flag was removed, also internal information from disklabel now isn't accessible. So, remove its last usage. It seems that doesn't matter is it SCSI or IDE disk. Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Thu Jun 21 04:28:57 2012 (r237353) +++ user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Thu Jun 21 04:39:10 2012 (r237354) @@ -808,7 +808,7 @@ bd_getdev(struct i386_devdesc *dev) int major; int rootdev; char *nip, *cp; - int unitofs = 0, i, unit; + int i, unit; biosdev = bd_unit2bios(dev->d_unit); DEBUG("unit %d BIOS device %d", dev->d_unit, biosdev); @@ -827,24 +827,11 @@ bd_getdev(struct i386_devdesc *dev) major = FDMAJOR; } } else { - /* harddisk */ - if ((od->od_flags & BD_LABELOK) && (od->od_disklabel.d_type == DTYPE_SCSI)) { - /* label OK, disk labelled as SCSI */ - major = DAMAJOR; - /* check for unit number correction hint, now deprecated */ - if ((nip = getenv("num_ide_disks")) != NULL) { - i = strtol(nip, &cp, 0); - /* check for parse error */ - if ((cp != nip) && (*cp == 0)) - unitofs = i; - } - } else { /* assume an IDE disk */ major = WDMAJOR; - } } /* default root disk unit number */ - unit = (biosdev & 0x7f) - unitofs; + unit = biosdev & 0x7f; /* XXX a better kludge to set the root disk unit number */ if ((nip = getenv("root_disk_unit")) != NULL) { From owner-svn-src-user@FreeBSD.ORG Thu Jun 21 04:51:35 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A8641065670; Thu, 21 Jun 2012 04:51:35 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 15A328FC15; Thu, 21 Jun 2012 04:51:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5L4pY7X089532; Thu, 21 Jun 2012 04:51:34 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5L4pYT5089530; Thu, 21 Jun 2012 04:51:34 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206210451.q5L4pYT5089530@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 21 Jun 2012 04:51:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237355 - user/ae/bootcode/sys/boot/common X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 04:51:35 -0000 Author: ae Date: Thu Jun 21 04:51:34 2012 New Revision: 237355 URL: http://svn.freebsd.org/changeset/base/237355 Log: Connect part.c to the build. Also, GPT support needs crc32. Modified: user/ae/bootcode/sys/boot/common/Makefile.inc Modified: user/ae/bootcode/sys/boot/common/Makefile.inc ============================================================================== --- user/ae/bootcode/sys/boot/common/Makefile.inc Thu Jun 21 04:39:10 2012 (r237354) +++ user/ae/bootcode/sys/boot/common/Makefile.inc Thu Jun 21 04:51:34 2012 (r237355) @@ -1,8 +1,8 @@ # $FreeBSD$ -SRCS+= boot.c commands.c console.c devopen.c disk.c interp.c +SRCS+= boot.c commands.c console.c crc32.c devopen.c disk.c interp.c SRCS+= interp_backslash.c interp_parse.c ls.c misc.c -SRCS+= module.c panic.c +SRCS+= module.c panic.c part.c .if ${MACHINE} == "i386" || ${MACHINE_CPUARCH} == "amd64" SRCS+= load_elf32.c load_elf32_obj.c reloc_elf32.c From owner-svn-src-user@FreeBSD.ORG Thu Jun 21 04:52:27 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51120106566C; Thu, 21 Jun 2012 04:52:27 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3CD688FC15; Thu, 21 Jun 2012 04:52:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5L4qRWm089605; Thu, 21 Jun 2012 04:52:27 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5L4qRvj089603; Thu, 21 Jun 2012 04:52:27 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206210452.q5L4qRvj089603@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 21 Jun 2012 04:52:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237356 - user/ae/bootcode/sys/boot/i386/loader X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 04:52:27 -0000 Author: ae Date: Thu Jun 21 04:52:26 2012 New Revision: 237356 URL: http://svn.freebsd.org/changeset/base/237356 Log: Enable MBR support by default. Modified: user/ae/bootcode/sys/boot/i386/loader/Makefile Modified: user/ae/bootcode/sys/boot/i386/loader/Makefile ============================================================================== --- user/ae/bootcode/sys/boot/i386/loader/Makefile Thu Jun 21 04:51:34 2012 (r237355) +++ user/ae/bootcode/sys/boot/i386/loader/Makefile Thu Jun 21 04:52:26 2012 (r237356) @@ -50,6 +50,9 @@ CFLAGS+= -DLOADER_BZIP2_SUPPORT .if !defined(LOADER_NO_GZIP_SUPPORT) CFLAGS+= -DLOADER_GZIP_SUPPORT .endif +.if !defined(LOADER_NO_MBR_SUPPORT) +CFLAGS+= -DLOADER_MBR_SUPPORT +.endif .if !defined(LOADER_NO_GPT_SUPPORT) CFLAGS+= -DLOADER_GPT_SUPPORT .endif From owner-svn-src-user@FreeBSD.ORG Thu Jun 21 07:16:12 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DE40C106564A; Thu, 21 Jun 2012 07:16:12 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C7D2F8FC0C; Thu, 21 Jun 2012 07:16:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5L7GCcl095662; Thu, 21 Jun 2012 07:16:12 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5L7GCRt095655; Thu, 21 Jun 2012 07:16:12 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206210716.q5L7GCRt095655@svn.freebsd.org> From: Adrian Chadd Date: Thu, 21 Jun 2012 07:16:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237358 - user/adrian/ath_radar_stuff/src/qt-pktlog X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 07:16:13 -0000 Author: adrian Date: Thu Jun 21 07:16:12 2012 New Revision: 237358 URL: http://svn.freebsd.org/changeset/base/237358 Log: Initial hacky qt4 experiment in plotting some pcap data. This is very dirty but it's good enough to look over some basic packet captures. Added: user/adrian/ath_radar_stuff/src/qt-pktlog/ user/adrian/ath_radar_stuff/src/qt-pktlog/Makefile user/adrian/ath_radar_stuff/src/qt-pktlog/PktLogData.cpp user/adrian/ath_radar_stuff/src/qt-pktlog/PktLogData.h user/adrian/ath_radar_stuff/src/qt-pktlog/PktLogDataRadiotap.cpp user/adrian/ath_radar_stuff/src/qt-pktlog/PktLogDataRadiotap.h user/adrian/ath_radar_stuff/src/qt-pktlog/main.cpp user/adrian/ath_radar_stuff/src/qt-pktlog/qt-pktlog.pro Added: user/adrian/ath_radar_stuff/src/qt-pktlog/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/adrian/ath_radar_stuff/src/qt-pktlog/Makefile Thu Jun 21 07:16:12 2012 (r237358) @@ -0,0 +1,214 @@ +############################################################################# +# Makefile for building: qt-pktlog +# Generated by qmake (2.01a) (Qt 4.7.4) on: Wed Jun 20 22:53:05 2012 +# Project: qt-pktlog.pro +# Template: app +# Command: /usr/local/bin/qmake-qt4 -o Makefile qt-pktlog.pro +############################################################################# + +####### Compiler, tools and options + +CC = gcc +CXX = g++ +DEFINES = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED +CFLAGS = -pipe -O2 -Wall -W $(DEFINES) +CXXFLAGS = -pipe -O2 -Wall -W $(DEFINES) +INCPATH = -I/usr/local/share/qt4/mkspecs/freebsd-g++ -I. -I/usr/local/include/qt4/QtCore -I/usr/local/include/qt4/QtGui -I/usr/local/include/qt4 -I. -I../../lib -I/usr/local/include/qt4 -I/usr/local/include/qwt6 -I. -I/usr/local/include/qt4 -I/usr/local/include +LINK = g++ +LFLAGS = -Wl,-O1 -pthread -Wl,-rpath,/usr/local/lib/qt4 +LIBS = $(SUBLIBS) -L/usr/local/lib/qt4 -L/usr/local/lib -L../../lib/libradarpkt -lpcap -lradarpkt -lqwt6 -lQtGui -L/usr/local/lib -L/usr/local/lib/qt4 -lQtCore +AR = ar cqs +RANLIB = +QMAKE = /usr/local/bin/qmake-qt4 +TAR = tar -cf +COMPRESS = gzip -9f +COPY = cp -f +SED = sed +COPY_FILE = $(COPY) +COPY_DIR = $(COPY) -R +STRIP = +INSTALL_FILE = $(COPY_FILE) +INSTALL_DIR = $(COPY_DIR) +INSTALL_PROGRAM = $(COPY_FILE) +DEL_FILE = rm -f +SYMLINK = ln -f -s +DEL_DIR = rmdir +MOVE = mv -f +CHK_DIR_EXISTS= test -d +MKDIR = mkdir -p + +####### Output directory + +OBJECTS_DIR = ./ + +####### Files + +SOURCES = main.cpp \ + PktLogData.cpp \ + PktLogDataRadiotap.cpp +OBJECTS = main.o \ + PktLogData.o \ + PktLogDataRadiotap.o +DIST = /usr/local/share/qt4/mkspecs/common/g++.conf \ + /usr/local/share/qt4/mkspecs/common/unix.conf \ + /usr/local/share/qt4/mkspecs/qconfig.pri \ + /usr/local/share/qt4/mkspecs/modules/qt_phonon.pri \ + /usr/local/share/qt4/mkspecs/modules/qt_webkit_version.pri \ + /usr/local/share/qt4/mkspecs/features/qt_functions.prf \ + /usr/local/share/qt4/mkspecs/features/qt_config.prf \ + /usr/local/share/qt4/mkspecs/features/exclusive_builds.prf \ + /usr/local/share/qt4/mkspecs/features/default_pre.prf \ + /usr/local/share/qt4/mkspecs/features/release.prf \ + /usr/local/share/qt4/mkspecs/features/default_post.prf \ + /usr/local/share/qt4/mkspecs/features/unix/thread.prf \ + /usr/local/share/qt4/mkspecs/features/warn_on.prf \ + /usr/local/share/qt4/mkspecs/features/qt.prf \ + /usr/local/share/qt4/mkspecs/features/moc.prf \ + /usr/local/share/qt4/mkspecs/features/resources.prf \ + /usr/local/share/qt4/mkspecs/features/uic.prf \ + /usr/local/share/qt4/mkspecs/features/yacc.prf \ + /usr/local/share/qt4/mkspecs/features/lex.prf \ + /usr/local/share/qt4/mkspecs/features/include_source_dir.prf \ + qt-pktlog.pro +QMAKE_TARGET = qt-pktlog +DESTDIR = +TARGET = qt-pktlog + +first: all +####### Implicit rules + +.SUFFIXES: .o .c .cpp .cc .cxx .C + +.cpp.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.cc.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.cxx.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.C.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.c.o: + $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" + +####### Build rules + +all: Makefile $(TARGET) + +$(TARGET): $(OBJECTS) + $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) + +Makefile: qt-pktlog.pro /usr/local/share/qt4/mkspecs/freebsd-g++/qmake.conf /usr/local/share/qt4/mkspecs/common/g++.conf \ + /usr/local/share/qt4/mkspecs/common/unix.conf \ + /usr/local/share/qt4/mkspecs/qconfig.pri \ + /usr/local/share/qt4/mkspecs/modules/qt_phonon.pri \ + /usr/local/share/qt4/mkspecs/modules/qt_webkit_version.pri \ + /usr/local/share/qt4/mkspecs/features/qt_functions.prf \ + /usr/local/share/qt4/mkspecs/features/qt_config.prf \ + /usr/local/share/qt4/mkspecs/features/exclusive_builds.prf \ + /usr/local/share/qt4/mkspecs/features/default_pre.prf \ + /usr/local/share/qt4/mkspecs/features/release.prf \ + /usr/local/share/qt4/mkspecs/features/default_post.prf \ + /usr/local/share/qt4/mkspecs/features/unix/thread.prf \ + /usr/local/share/qt4/mkspecs/features/warn_on.prf \ + /usr/local/share/qt4/mkspecs/features/qt.prf \ + /usr/local/share/qt4/mkspecs/features/moc.prf \ + /usr/local/share/qt4/mkspecs/features/resources.prf \ + /usr/local/share/qt4/mkspecs/features/uic.prf \ + /usr/local/share/qt4/mkspecs/features/yacc.prf \ + /usr/local/share/qt4/mkspecs/features/lex.prf \ + /usr/local/share/qt4/mkspecs/features/include_source_dir.prf \ + /usr/local/lib/qt4/libQtGui.prl \ + /usr/local/lib/qt4/libQtCore.prl + $(QMAKE) -o Makefile qt-pktlog.pro +/usr/local/share/qt4/mkspecs/common/g++.conf: +/usr/local/share/qt4/mkspecs/common/unix.conf: +/usr/local/share/qt4/mkspecs/qconfig.pri: +/usr/local/share/qt4/mkspecs/modules/qt_phonon.pri: +/usr/local/share/qt4/mkspecs/modules/qt_webkit_version.pri: +/usr/local/share/qt4/mkspecs/features/qt_functions.prf: +/usr/local/share/qt4/mkspecs/features/qt_config.prf: +/usr/local/share/qt4/mkspecs/features/exclusive_builds.prf: +/usr/local/share/qt4/mkspecs/features/default_pre.prf: +/usr/local/share/qt4/mkspecs/features/release.prf: +/usr/local/share/qt4/mkspecs/features/default_post.prf: +/usr/local/share/qt4/mkspecs/features/unix/thread.prf: +/usr/local/share/qt4/mkspecs/features/warn_on.prf: +/usr/local/share/qt4/mkspecs/features/qt.prf: +/usr/local/share/qt4/mkspecs/features/moc.prf: +/usr/local/share/qt4/mkspecs/features/resources.prf: +/usr/local/share/qt4/mkspecs/features/uic.prf: +/usr/local/share/qt4/mkspecs/features/yacc.prf: +/usr/local/share/qt4/mkspecs/features/lex.prf: +/usr/local/share/qt4/mkspecs/features/include_source_dir.prf: +/usr/local/lib/qt4/libQtGui.prl: +/usr/local/lib/qt4/libQtCore.prl: +qmake: FORCE + @$(QMAKE) -o Makefile qt-pktlog.pro + +dist: + @$(CHK_DIR_EXISTS) .tmp/qt-pktlog1.0.0 || $(MKDIR) .tmp/qt-pktlog1.0.0 + $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/qt-pktlog1.0.0/ && $(COPY_FILE) --parents PktLogData.h PktLogDataRadiotap.h .tmp/qt-pktlog1.0.0/ && $(COPY_FILE) --parents main.cpp PktLogData.cpp PktLogDataRadiotap.cpp .tmp/qt-pktlog1.0.0/ && (cd `dirname .tmp/qt-pktlog1.0.0` && $(TAR) qt-pktlog1.0.0.tar qt-pktlog1.0.0 && $(COMPRESS) qt-pktlog1.0.0.tar) && $(MOVE) `dirname .tmp/qt-pktlog1.0.0`/qt-pktlog1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/qt-pktlog1.0.0 + + +clean:compiler_clean + -$(DEL_FILE) $(OBJECTS) + -$(DEL_FILE) *~ core *.core + + +####### Sub-libraries + +distclean: clean + -$(DEL_FILE) $(TARGET) + -$(DEL_FILE) Makefile + + +check: first + +mocclean: compiler_moc_header_clean compiler_moc_source_clean + +mocables: compiler_moc_header_make_all compiler_moc_source_make_all + +compiler_moc_header_make_all: +compiler_moc_header_clean: +compiler_rcc_make_all: +compiler_rcc_clean: +compiler_image_collection_make_all: qmake_image_collection.cpp +compiler_image_collection_clean: + -$(DEL_FILE) qmake_image_collection.cpp +compiler_moc_source_make_all: +compiler_moc_source_clean: +compiler_uic_make_all: +compiler_uic_clean: +compiler_yacc_decl_make_all: +compiler_yacc_decl_clean: +compiler_yacc_impl_make_all: +compiler_yacc_impl_clean: +compiler_lex_make_all: +compiler_lex_clean: +compiler_clean: + +####### Compile + +main.o: main.cpp PktLogData.h \ + PktLogDataRadiotap.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp + +PktLogData.o: PktLogData.cpp PktLogData.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o PktLogData.o PktLogData.cpp + +PktLogDataRadiotap.o: PktLogDataRadiotap.cpp PktLogData.h \ + PktLogDataRadiotap.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o PktLogDataRadiotap.o PktLogDataRadiotap.cpp + +####### Install + +install: FORCE + +uninstall: FORCE + +FORCE: + Added: user/adrian/ath_radar_stuff/src/qt-pktlog/PktLogData.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/adrian/ath_radar_stuff/src/qt-pktlog/PktLogData.cpp Thu Jun 21 07:16:12 2012 (r237358) @@ -0,0 +1,66 @@ + +#include +#include +#include + +#include "libradarpkt/pkt.h" +#include "PktLogData.h" + +void +PktLogData::Clear() +{ + + RadarEntries.clear(); +} + +void +PktLogData::Load(const char *file) +{ + + // XXX TODO +} + +void +PktLogData::AddEntry(struct radar_entry re) +{ + + // Is this correctly creating a copy of 're' and adding that + // to the vector? + RadarEntries.push_back(re); +} + +// +// XXX there has to be a clearer way to do this... +// +std::vector +PktLogData::GetRssi() +{ + int i; + + std::vector t; + + t.resize(RadarEntries.size()); + + for (i = 0; i < RadarEntries.size(); i++) { + t[i] = (double) RadarEntries[i].re_rssi; + } + + return t; +} + +std::vector +PktLogData::GetDuration() +{ + int i; + + std::vector t; + + t.resize(RadarEntries.size()); + + for (i = 0; i < RadarEntries.size(); i++) { + t[i] = (double) RadarEntries[i].re_dur; + } + + return t; + +} Added: user/adrian/ath_radar_stuff/src/qt-pktlog/PktLogData.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/adrian/ath_radar_stuff/src/qt-pktlog/PktLogData.h Thu Jun 21 07:16:12 2012 (r237358) @@ -0,0 +1,25 @@ +#ifndef __PKT_LOG_DATA_H__ +#define __PKT_LOG_DATA_H__ + +#include +#include + +#include "libradarpkt/pkt.h" + +class PktLogData { +public: + /* XXX should be private! */ + std::vector RadarEntries; + + void Clear(); + void Load(const char *filename); + std::vector GetRssi(); + std::vector GetDuration(); + std::vector GetTimestamp(); + std::vector GetFreq(); + int Size() { return RadarEntries.size(); } +//private: + void AddEntry(struct radar_entry re); +}; + +#endif /* __PKT_LOG_DATA_H__ */ Added: user/adrian/ath_radar_stuff/src/qt-pktlog/PktLogDataRadiotap.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/adrian/ath_radar_stuff/src/qt-pktlog/PktLogDataRadiotap.cpp Thu Jun 21 07:16:12 2012 (r237358) @@ -0,0 +1,88 @@ +#include +#include +#include + +#include +#include + +#include "net80211/ieee80211_radiotap.h" + +#include "libradarpkt/pkt.h" +#include "libradarpkt/ar5416_radar.h" +#include "libradarpkt/ar9280_radar.h" + +#include "PktLogData.h" +#include "PktLogDataRadiotap.h" + +PktLogDataRadiotap::~PktLogDataRadiotap() +{ + + this->Close(); +} + +bool +PktLogDataRadiotap::LoadPcapOffline(const char *file, int type) +{ + char errbuf[PCAP_ERRBUF_SIZE]; + unsigned const char *pkt; + struct pcap_pkthdr *hdr; + int r; + struct ieee80211_radiotap_header *rt; + struct radar_entry re; + + this->Close(); + PcapHdl = pcap_open_offline(file, errbuf); + if (PcapHdl == NULL) { + printf("pcap_open_offline failed: %s\n", errbuf); + return false; + } + + // Grab data, assume AR5416 for now + while ((r = pcap_next_ex(PcapHdl, &hdr, &pkt)) >= 0) { + //printf("read: %d byte frame, r=%d\n", hdr->caplen, r); + if (r <= 0) + continue; + + rt = (struct ieee80211_radiotap_header *) pkt; + //printf("read: %d byte frame, r=%d, version=%d\n", hdr->caplen, r, rt->it_version); + if (rt->it_version != 0) + continue; + + /* XXX length checks, phyerr checks, etc */ + switch (type) { + case CHIP_AR5416: + r = ar5416_radar_decode(rt, + (pkt + le16toh(rt->it_len)), + hdr->caplen - le16toh(rt->it_len), &re); + break; + case CHIP_AR9280: + r = ar9280_radar_decode(rt, + (pkt + le16toh(rt->it_len)), + hdr->caplen - le16toh(rt->it_len), &re); + break; + default: + fprintf(stderr, "%s: unknown chip! (%d) \n", + __func__, + type); + return (false); + } + if (r == 0) + continue; + AddEntry(re); + } + + this->Close(); + + return true; +} + +void +PktLogDataRadiotap::Close() +{ + + if (PcapHdl != NULL) { + pcap_close(PcapHdl); + PcapHdl = NULL; + } +} + Added: user/adrian/ath_radar_stuff/src/qt-pktlog/PktLogDataRadiotap.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/adrian/ath_radar_stuff/src/qt-pktlog/PktLogDataRadiotap.h Thu Jun 21 07:16:12 2012 (r237358) @@ -0,0 +1,21 @@ +#ifndef __PKT_LOG_DATA_RADIOTAP_H__ +#define __PKT_LOG_DATA_RADIOTAP_H__ + +#include "PktLogData.h" +#include + +class PktLogDataRadiotap : public PktLogData { + +private: + pcap_t *PcapHdl; + +public: + ~PktLogDataRadiotap(); + PktLogDataRadiotap() : PcapHdl(NULL) { }; + bool LoadPcapOffline(const char *file, int type); + bool LoadPcapOnline(const char *ifname, int type); + void Close(); +}; + + +#endif /* __PKT_LOG_DATA_RADIOTAP_H__ */ Added: user/adrian/ath_radar_stuff/src/qt-pktlog/main.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/adrian/ath_radar_stuff/src/qt-pktlog/main.cpp Thu Jun 21 07:16:12 2012 (r237358) @@ -0,0 +1,90 @@ +#include +#include +#include + +#include + +#include "qwt_plot.h" +#include "qwt_plot_curve.h" +#include "qwt_plot_histogram.h" + +#include "libradarpkt/pkt.h" +#include "PktLogData.h" +#include "PktLogDataRadiotap.h" + +#include "libradarpkt/ar5416_radar.h" +#include "libradarpkt/ar9280_radar.h" + +/* + * XXX eww, using pointers rather than references. + */ +void +plotSet(QwtPlot *p, PktLogData *pl) +{ + QwtPlotCurve *c = new QwtPlotCurve("curve"); + + std::vector dur; + std::vector rssi; + + p->setTitle("Example"); + //p->setAutoLegend(true); + //p->setLegendPos(Qwt::Bottom); + + // Curve Plot - dots, == scatterplot + c->setStyle(QwtPlotCurve::Dots); + + /* Load in values */ + dur = pl->GetDuration(); + rssi = pl->GetRssi(); +// for (int i = 0; i < dur.size(); i++) +// printf("%d: dur=%f, rssi=%f\n", i, dur[i], rssi[i]); + + printf("dur size=%d, rssi size=%d\n", dur.size(), rssi.size()); + + // Plot them + c->setSamples(&dur[0], &rssi[0], dur.size()); + c->attach(p); + + /* Plot */ + p->replot(); + p->show(); +} + +static void +usage() +{ + printf("usage: \n"); + exit(127); +} + +int +main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + PktLogDataRadiotap pr; + int type = 0; + + if (argc < 3) + usage(); + + if (strcmp(argv[1], "ar5416")== 0) + type = CHIP_AR5416; + else if (strcmp(argv[1], "ar9280")== 0) + type = CHIP_AR9280; + else + usage(); + + pr.LoadPcapOffline(argv[2], type); + + QwtPlot plot(QwtText("example")); + + // Default size + plot.setGeometry(0, 0, 640, 400); + + // Scale + plot.setAxisScale(QwtPlot::xBottom, 0.0, 256.0); + + plotSet(&plot, &pr); + + return a.exec(); +} Added: user/adrian/ath_radar_stuff/src/qt-pktlog/qt-pktlog.pro ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/adrian/ath_radar_stuff/src/qt-pktlog/qt-pktlog.pro Thu Jun 21 07:16:12 2012 (r237358) @@ -0,0 +1,14 @@ +###################################################################### +# Automatically generated by qmake (2.01a) Tue Feb 14 14:16:07 2012 +###################################################################### + +TEMPLATE = app +TARGET = +DEPENDPATH += . +INCLUDEPATH += . ../../lib/ /usr/local/include/qt4 /usr/local/include/qwt6 +LIBS+= -L../../lib/libradarpkt -lpcap -lradarpkt -lqwt6 + +# Input +HEADERS += PktLogData.h PktLogDataRadiotap.h +# FORMS += PlotWindow.ui MainWindow.ui +SOURCES += main.cpp PktLogData.cpp PktLogDataRadiotap.cpp From owner-svn-src-user@FreeBSD.ORG Thu Jun 21 07:19:40 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 08C70106564A; Thu, 21 Jun 2012 07:19:40 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E878B8FC12; Thu, 21 Jun 2012 07:19:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5L7JdVZ095834; Thu, 21 Jun 2012 07:19:39 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5L7JdVV095832; Thu, 21 Jun 2012 07:19:39 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206210719.q5L7JdVV095832@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 21 Jun 2012 07:19:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237359 - user/ae/bootcode/sys/boot/i386/libi386 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 07:19:40 -0000 Author: ae Date: Thu Jun 21 07:19:39 2012 New Revision: 237359 URL: http://svn.freebsd.org/changeset/base/237359 Log: When we read partition tables we use bd_read, that directly reads from device bypassing bd_strategy. So we need add od_boff if we want read nested partition tables. Also, when we open MBR slice, try to detect nested partition table. Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Thu Jun 21 07:16:12 2012 (r237358) +++ user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Thu Jun 21 07:19:39 2012 (r237359) @@ -375,8 +375,9 @@ bd_open(struct open_file *f, ...) static int diskread(void *dev, void *buf, size_t blocks, off_t offset) { + struct open_disk *od = dev; - return (bd_read(dev, offset, blocks, buf)); + return (bd_read(dev, offset + od->od_boff, blocks, buf)); } static int @@ -448,8 +449,7 @@ bd_opendisk(struct open_disk **odp, stru goto out; /* Adjust open_disk's offset within the biosdisk */ od->od_boff = part.start; - if (dev->d_kind.biosdisk.partition == -1 || - dev->d_kind.biosdisk.partition == 255) + if (dev->d_kind.biosdisk.partition == 255) goto out; /* Nothing more to do */ /* Try to read BSD label */ @@ -463,6 +463,8 @@ bd_opendisk(struct open_disk **odp, stru } /* Save the slice number of the parent partition */ od->od_slice = part.index; + if (dev->d_kind.biosdisk.partition == -1) + goto out; /* Nothing more to do */ error = ptable_getpart(od->od_ptable, &part, dev->d_kind.biosdisk.partition); if (error != 0) { From owner-svn-src-user@FreeBSD.ORG Thu Jun 21 07:48:15 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 47C38106566B; Thu, 21 Jun 2012 07:48:15 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 197098FC12; Thu, 21 Jun 2012 07:48:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5L7mEEt097113; Thu, 21 Jun 2012 07:48:14 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5L7mESg097111; Thu, 21 Jun 2012 07:48:14 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206210748.q5L7mESg097111@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 21 Jun 2012 07:48:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237360 - user/ae/bootcode/sys/boot/i386/libi386 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 07:48:15 -0000 Author: ae Date: Thu Jun 21 07:48:14 2012 New Revision: 237360 URL: http://svn.freebsd.org/changeset/base/237360 Log: Pass additional arguments to the printing function via bd_print_args structure. Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Thu Jun 21 07:19:39 2012 (r237359) +++ user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Thu Jun 21 07:48:14 2012 (r237360) @@ -116,6 +116,12 @@ static int bd_open(struct open_file *f, static int bd_close(struct open_file *f); static void bd_print(int verbose); +struct bd_print_args { + struct open_disk *od; + const char *prefix; + int verbose; +}; + struct devsw biosdisk = { "disk", DEVT_DISK, @@ -294,23 +300,27 @@ display_size(uint64_t size, uint16_t sec static void printpartition(void *arg, const char *pname, const struct ptable_entry *part) { - struct open_disk *od, *bsd; + struct bd_print_args *pa, bsd; struct i386_devdesc dev; - static char line[80]; + char line[80]; - od = (struct open_disk *)arg; - sprintf(line, "\tdisk%d%s: %s %s\n", od->od_dkunit, pname, - parttype2str(part->type), - display_size(part->end - part->start + 1, BDSECSZ(od))); + pa = (struct bd_print_args *)arg; + sprintf(line, " %s%s: %s %s\n", pa->prefix, pname, + parttype2str(part->type), pa->verbose == 0 ? "": + display_size(part->end - part->start + 1, BDSECSZ(pa->od))); pager_output(line); if (part->type == PART_FREEBSD) { /* Open slice with BSD label */ - dev.d_unit = od->od_dkunit; + dev.d_unit = pa->od->od_dkunit; dev.d_kind.biosdisk.slice = part->index; dev.d_kind.biosdisk.partition = -1; - if (!bd_opendisk(&bsd, &dev)) { - ptable_iterate(bsd->od_ptable, bsd, printpartition); - bd_closedisk(bsd); + if (!bd_opendisk(&bsd.od, &dev)) { + sprintf(line, " %s%s", pa->prefix, pname); + bsd.prefix = line; + bsd.verbose = pa->verbose; + ptable_iterate(bsd.od->od_ptable, &bsd, + printpartition); + bd_closedisk(bsd.od); } } } @@ -320,9 +330,9 @@ printpartition(void *arg, const char *pn static void bd_print(int verbose) { + struct bd_print_args pa; static char line[80]; struct i386_devdesc dev; - struct open_disk *od; int i; for (i = 0; i < nbdinfo; i++) { @@ -335,9 +345,13 @@ bd_print(int verbose) dev.d_unit = i; dev.d_kind.biosdisk.slice = -1; dev.d_kind.biosdisk.partition = -1; - if (!bd_opendisk(&od, &dev)) { - ptable_iterate(od->od_ptable, od, printpartition); - bd_closedisk(od); + if (!bd_opendisk(&pa.od, &dev)) { + sprintf(line, " disk%d", i); + pa.prefix = line; + pa.verbose = verbose; + ptable_iterate(pa.od->od_ptable, &pa, + printpartition); + bd_closedisk(pa.od); } } } From owner-svn-src-user@FreeBSD.ORG Thu Jun 21 10:03:49 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0C6C61065678; Thu, 21 Jun 2012 10:03:49 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EB0488FC15; Thu, 21 Jun 2012 10:03:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5LA3mit004042; Thu, 21 Jun 2012 10:03:48 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LA3mbV004040; Thu, 21 Jun 2012 10:03:48 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206211003.q5LA3mbV004040@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 21 Jun 2012 10:03:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237374 - user/ae/bootcode/sys/boot/i386/libi386 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 10:03:49 -0000 Author: ae Date: Thu Jun 21 10:03:48 2012 New Revision: 237374 URL: http://svn.freebsd.org/changeset/base/237374 Log: Implement DIOSGSECTORSIZE and DIOCGMEDIASIZE ioctls for biosdisk. Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Thu Jun 21 09:57:34 2012 (r237373) +++ user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Thu Jun 21 10:03:48 2012 (r237374) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); * */ +#include #include #include @@ -114,6 +115,7 @@ static int bd_realstrategy(void *devdata size_t size, char *buf, size_t *rsize); static int bd_open(struct open_file *f, ...); static int bd_close(struct open_file *f); +static int bd_ioctl(struct open_file *f, u_long cmd, void *data); static void bd_print(int verbose); struct bd_print_args { @@ -519,6 +521,26 @@ bd_close(struct open_file *f) return (0); } +static int +bd_ioctl(struct open_file *f, u_long cmd, void *data) +{ + struct open_disk *od; + + od = (struct open_disk *) + (((struct i386_devdesc *)(f->f_devdata))->d_kind.biosdisk.data); + switch (cmd) { + case DIOCGSECTORSIZE: + *(u_int *)data = BDSECSZ(od); + break; + case DIOCGMEDIASIZE: + *(off_t *)data = BDSZ(od) * BDSECSZ(od); + break; + default: + return (ENOTTY); + } + return (0); +} + static void bd_closedisk(struct open_disk *od) { From owner-svn-src-user@FreeBSD.ORG Thu Jun 21 10:06:01 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 82D341065672; Thu, 21 Jun 2012 10:06:01 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 64AC38FC15; Thu, 21 Jun 2012 10:06:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5LA6115004183; Thu, 21 Jun 2012 10:06:01 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LA61Xn004180; Thu, 21 Jun 2012 10:06:01 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206211006.q5LA61Xn004180@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 21 Jun 2012 10:06:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237375 - in user/ae/bootcode/sys/boot: i386/loader zfs X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 10:06:01 -0000 Author: ae Date: Thu Jun 21 10:06:00 2012 New Revision: 237375 URL: http://svn.freebsd.org/changeset/base/237375 Log: Teach ZFS code iterate partition tables on device probe using new API. Modified: user/ae/bootcode/sys/boot/i386/loader/main.c user/ae/bootcode/sys/boot/zfs/zfs.c Modified: user/ae/bootcode/sys/boot/i386/loader/main.c ============================================================================== --- user/ae/bootcode/sys/boot/i386/loader/main.c Thu Jun 21 10:03:48 2012 (r237374) +++ user/ae/bootcode/sys/boot/i386/loader/main.c Thu Jun 21 10:06:00 2012 (r237375) @@ -355,26 +355,18 @@ isa_outb(int port, int value) static void i386_zfs_probe(void) { - char devname[32]; - int unit, slice; + char devname[32]; + int unit; - /* - * Open all the disks we can find and see if we can reconstruct - * ZFS pools from them. Bogusly assumes that the disks are named - * diskN, diskNpM or diskNsM. - */ - for (unit = 0; unit < MAXBDDEV; unit++) { - sprintf(devname, "disk%d:", unit); - if (zfs_probe_dev(devname, NULL) == ENXIO) - continue; - for (slice = 1; slice <= 128; slice++) { - sprintf(devname, "disk%dp%d:", unit, slice); - zfs_probe_dev(devname, NULL); + /* + * Open all the disks we can find and see if we can reconstruct + * ZFS pools from them. + */ + for (unit = 0; unit < MAXBDDEV; unit++) { + if (bd_unit2bios(unit) == -1) + break; + sprintf(devname, "disk%d:", unit); + zfs_probe_dev(devname, NULL); } - for (slice = 1; slice <= 4; slice++) { - sprintf(devname, "disk%ds%d:", unit, slice); - zfs_probe_dev(devname, NULL); - } - } } #endif Modified: user/ae/bootcode/sys/boot/zfs/zfs.c ============================================================================== --- user/ae/bootcode/sys/boot/zfs/zfs.c Thu Jun 21 10:03:48 2012 (r237374) +++ user/ae/bootcode/sys/boot/zfs/zfs.c Thu Jun 21 10:06:00 2012 (r237375) @@ -33,10 +33,11 @@ __FBSDID("$FreeBSD$"); * Stand-alone file reading package. */ +#include #include -#include #include #include +#include #include #include #include @@ -376,21 +377,103 @@ zfs_dev_init(void) return (0); } -int -zfs_probe_dev(const char *devname, uint64_t *pool_guid) +struct zfs_probe_args { + int fd; + const char *devname; + uint64_t *pool_guid; + uint16_t secsz; +}; + +static int +zfs_diskread(void *arg, void *buf, size_t blocks, off_t offset) +{ + struct zfs_probe_args *ppa; + + ppa = (struct zfs_probe_args *)arg; + return (vdev_read(NULL, (void *)(uintptr_t)ppa->fd, + offset * ppa->secsz, buf, blocks * ppa->secsz)); +} + +static int +zfs_probe(int fd, uint64_t *pool_guid) { spa_t *spa; - int fd; int ret; - fd = open(devname, O_RDONLY); - if (fd == -1) - return (ENXIO); ret = vdev_probe(vdev_read, (void *)(uintptr_t)fd, &spa); - if (ret != 0) - close(fd); - else if (pool_guid != NULL) + if (ret == 0 && pool_guid != NULL) *pool_guid = spa->spa_guid; + return (ret); +} + +static void +zfs_probe_partition(void *arg, const char *partname, + const struct ptable_entry *part) +{ + struct zfs_probe_args *ppa, pa; + struct ptable *table; + char devname[32]; + int ret; + + /* Probe only freebsd-zfs and freebsd partitions */ + if (part->type != PART_FREEBSD && + part->type != PART_FREEBSD_ZFS) + return; + + ppa = (struct zfs_probe_args *)arg; + strncpy(devname, ppa->devname, strlen(ppa->devname) - 1); + sprintf(devname, "%s%s:", devname, partname); + pa.fd = open(devname, O_RDONLY); + if (pa.fd == -1) + return; + ret = zfs_probe(pa.fd, ppa->pool_guid); + if (ret == 0) + return; + /* Do we have BSD label here? */ + if (part->type == PART_FREEBSD) { + pa.devname = devname; + pa.pool_guid = ppa->pool_guid; + pa.secsz = ppa->secsz; + table = ptable_open(&pa, part->end - part->start + 1, + ppa->secsz, zfs_diskread); + if (table != NULL) { + ptable_iterate(table, &pa, zfs_probe_partition); + ptable_close(table); + } + } + close(pa.fd); +} + +int +zfs_probe_dev(const char *devname, uint64_t *pool_guid) +{ + struct ptable *table; + struct zfs_probe_args pa; + off_t mediasz; + int ret; + + pa.fd = open(devname, O_RDONLY); + if (pa.fd == -1) + return (ENXIO); + /* Probe the whole disk */ + ret = zfs_probe(pa.fd, pool_guid); + if (ret == 0) + return (0); + /* Probe each partition */ + ret = ioctl(pa.fd, DIOCGMEDIASIZE, &mediasz); + if (ret == 0) + ret = ioctl(pa.fd, DIOCGSECTORSIZE, &pa.secsz); + if (ret == 0) { + pa.devname = devname; + pa.pool_guid = pool_guid; + table = ptable_open(&pa, mediasz / pa.secsz, pa.secsz, + zfs_diskread); + if (table != NULL) { + ptable_iterate(table, &pa, zfs_probe_partition); + ptable_close(table); + } + } + close(pa.fd); return (0); } From owner-svn-src-user@FreeBSD.ORG Thu Jun 21 10:11:03 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D7349106566C; Thu, 21 Jun 2012 10:11:03 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mail.kirov.so-ups.ru (ns.kirov.so-ups.ru [178.74.170.1]) by mx1.freebsd.org (Postfix) with ESMTP id 80A748FC0A; Thu, 21 Jun 2012 10:11:03 +0000 (UTC) Received: from kas30pipe.localhost (localhost.kirov.so-ups.ru [127.0.0.1]) by mail.kirov.so-ups.ru (Postfix) with SMTP id 374F8B806B; Thu, 21 Jun 2012 14:10:56 +0400 (MSK) Received: from kirov.so-ups.ru (unknown [172.21.81.1]) by mail.kirov.so-ups.ru (Postfix) with ESMTP id 32184B806A; Thu, 21 Jun 2012 14:10:56 +0400 (MSK) Received: by ns.kirov.so-ups.ru (Postfix, from userid 1010) id 2E891BA051; Thu, 21 Jun 2012 14:10:56 +0400 (MSK) Received: from [127.0.0.1] (unknown [10.118.3.52]) by ns.kirov.so-ups.ru (Postfix) with ESMTP id F0E9CBA042; Thu, 21 Jun 2012 14:10:55 +0400 (MSK) Message-ID: <4FE2F32F.7050302@FreeBSD.org> Date: Thu, 21 Jun 2012 14:10:55 +0400 From: "Andrey V. Elsukov" User-Agent: Mozilla Thunderbird 1.5 (FreeBSD/20051231) MIME-Version: 1.0 To: src-committers@freebsd.org, svn-src-user@freebsd.org References: <201206211006.q5LA61Xn004180@svn.freebsd.org> In-Reply-To: <201206211006.q5LA61Xn004180@svn.freebsd.org> X-Enigmail-Version: 1.4.2 Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0284], KAS30/Release X-SpamTest-Info: Not protected Cc: Subject: Re: svn commit: r237375 - in user/ae/bootcode/sys/boot: i386/loader zfs X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 10:11:03 -0000 On 21.06.2012 14:06, Andrey V. Elsukov wrote: > Author: ae > Date: Thu Jun 21 10:06:00 2012 > New Revision: 237375 > URL: http://svn.freebsd.org/changeset/base/237375 > > Log: > Teach ZFS code iterate partition tables on device probe using new API. I have tested this zfsloader on VMWare with 5 virtual disk. With old zfsloader the system start takes about 100 seconds, but with patched zfsloader - 53 seconds. -- WBR, Andrey V. Elsukov From owner-svn-src-user@FreeBSD.ORG Thu Jun 21 10:21:34 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7FA261065680; Thu, 21 Jun 2012 10:21:34 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6A8CF8FC0C; Thu, 21 Jun 2012 10:21:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5LALY6U006504; Thu, 21 Jun 2012 10:21:34 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LALYdg006502; Thu, 21 Jun 2012 10:21:34 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206211021.q5LALYdg006502@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 21 Jun 2012 10:21:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237377 - user/ae/bootcode/sys/boot/i386/libi386 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 10:21:34 -0000 Author: ae Date: Thu Jun 21 10:21:33 2012 New Revision: 237377 URL: http://svn.freebsd.org/changeset/base/237377 Log: Include ioctl in devsw. Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Modified: user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Thu Jun 21 10:21:14 2012 (r237376) +++ user/ae/bootcode/sys/boot/i386/libi386/biosdisk.c Thu Jun 21 10:21:33 2012 (r237377) @@ -131,7 +131,7 @@ struct devsw biosdisk = { bd_strategy, bd_open, bd_close, - noioctl, + bd_ioctl, bd_print, bd_cleanup }; From owner-svn-src-user@FreeBSD.ORG Thu Jun 21 12:26:13 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8BEA71065674; Thu, 21 Jun 2012 12:26:13 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 705C38FC2D; Thu, 21 Jun 2012 12:26:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5LCQDNU012514; Thu, 21 Jun 2012 12:26:13 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LCQDPL012511; Thu, 21 Jun 2012 12:26:13 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206211226.q5LCQDPL012511@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 21 Jun 2012 12:26:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237390 - user/ae/bootcode/sys/boot/common X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 12:26:13 -0000 Author: ae Date: Thu Jun 21 12:26:12 2012 New Revision: 237390 URL: http://svn.freebsd.org/changeset/base/237390 Log: Add VTOC8 support. Modified: user/ae/bootcode/sys/boot/common/part.c user/ae/bootcode/sys/boot/common/part.h Modified: user/ae/bootcode/sys/boot/common/part.c ============================================================================== --- user/ae/bootcode/sys/boot/common/part.c Thu Jun 21 12:10:09 2012 (r237389) +++ user/ae/bootcode/sys/boot/common/part.c Thu Jun 21 12:26:12 2012 (r237390) @@ -33,7 +33,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include @@ -69,6 +71,7 @@ struct pentry { uint8_t bsd; uint8_t mbr; uuid_t gpt; + uint16_t vtoc8; } type; STAILQ_ENTRY(pentry) entry; }; @@ -478,6 +481,83 @@ out: return (table); } +#ifdef LOADER_VTOC8_SUPPORT +static enum partition_type +vtoc8_parttype(uint16_t type) +{ + + switch (type) { + case VTOC_TAG_FREEBSD_SWAP: + return (PART_FREEBSD_SWAP); + case VTOC_TAG_FREEBSD_UFS: + return (PART_FREEBSD_UFS); + case VTOC_TAG_FREEBSD_VINUM: + return (PART_FREEBSD_VINUM); + case VTOC_TAG_FREEBSD_ZFS: + return (PART_FREEBSD_ZFS); + }; + return (PART_UNKNOWN); +} + +static struct ptable* +ptable_vtoc8read(struct ptable *table, void *dev, diskread_t dread) +{ + struct pentry *entry; + struct vtoc8 *dl; + u_char *buf; + uint16_t sum, heads, sectors; + int i; + + if (table->sectorsize != sizeof(struct vtoc8)) + return (table); + buf = malloc(table->sectorsize); + if (dread(dev, buf, 1, 0) != 0) { + DEBUG("read failed"); + ptable_close(table); + table = NULL; + goto out; + } + dl = (struct vtoc8 *)buf; + /* Check the sum */ + for (i = sum = 0; i < sizeof(struct vtoc8); i += sizeof(sum)) + sum ^= be16dec(buf + i); + if (sum != 0) { + DEBUG("incorrect checksum"); + goto out; + } + if (be16toh(dl->nparts) != VTOC8_NPARTS) { + DEBUG("invalid number of entries"); + goto out; + } + sectors = be16toh(dl->nsecs); + heads = be16toh(dl->nheads); + if (sectors * heads == 0) { + DEBUG("invalid geometry"); + goto out; + } + for (i = 0; i < VTOC8_NPARTS; i++) { + dl->part[i].tag = be16toh(dl->part[i].tag); + if (i == VTOC_RAW_PART || + dl->part[i].tag == VTOC_TAG_UNASSIGNED) + continue; + entry = malloc(sizeof(*entry)); + entry->part.start = be32toh(dl->map[i].cyl) * heads * sectors; + entry->part.end = be32toh(dl->map[i].nblks) + + entry->part.start - 1; + entry->part.type = vtoc8_parttype(dl->part[i].tag); + entry->part.index = i; /* starts from zero */ + entry->type.vtoc8 = dl->part[i].tag; + STAILQ_INSERT_TAIL(&table->entries, entry, entry); + DEBUG("new VTOC8 partition added"); + } + table->type = PTABLE_VTOC8; +out: + free(buf); + return (table); + +} +#endif /* LOADER_VTOC8_SUPPORT */ + struct ptable* ptable_open(void *dev, off_t sectors, uint16_t sectorsize, diskread_t *dread) @@ -505,6 +585,16 @@ ptable_open(void *dev, off_t sectors, ui table->type = PTABLE_NONE; STAILQ_INIT(&table->entries); +#ifdef LOADER_VTOC8_SUPPORT + if (be16dec(buf + offsetof(struct vtoc8, magic)) == VTOC_MAGIC) { + if (ptable_vtoc8read(table, dev, dread) == NULL) { + /* Read error. */ + table = NULL; + goto out; + } else if (table->type == PTABLE_VTOC8) + goto out; + } +#endif /* Check the BSD label. */ if (ptable_bsdread(table, dev, dread) == NULL) { /* Read error. */ table = NULL; @@ -578,7 +668,7 @@ ptable_open(void *dev, off_t sectors, ui /* FALLTHROUGH */ } #endif /* LOADER_MBR_SUPPORT */ -#endif +#endif /* LOADER_MBR_SUPPORT || LOADER_GPT_SUPPORT */ out: free(buf); return (table); @@ -717,6 +807,12 @@ ptable_iterate(const struct ptable *tabl sprintf(name, "p%d", entry->part.index); else #endif +#ifdef LOADER_VTOC8_SUPPORT + if (table->type == PTABLE_VTOC8) + sprintf(name, "%c", (u_char) 'a' + + entry->part.index); + else +#endif if (table->type == PTABLE_BSD) sprintf(name, "%c", (u_char) 'a' + entry->part.index); Modified: user/ae/bootcode/sys/boot/common/part.h ============================================================================== --- user/ae/bootcode/sys/boot/common/part.h Thu Jun 21 12:10:09 2012 (r237389) +++ user/ae/bootcode/sys/boot/common/part.h Thu Jun 21 12:26:12 2012 (r237390) @@ -35,7 +35,8 @@ enum ptable_type { PTABLE_NONE, PTABLE_BSD, PTABLE_MBR, - PTABLE_GPT + PTABLE_GPT, + PTABLE_VTOC8 }; enum partition_type { From owner-svn-src-user@FreeBSD.ORG Thu Jun 21 14:37:06 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CBFD11065673; Thu, 21 Jun 2012 14:37:06 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B27C38FC1B; Thu, 21 Jun 2012 14:37:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5LEb67f018517; Thu, 21 Jun 2012 14:37:06 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LEb64f018491; Thu, 21 Jun 2012 14:37:06 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206211437.q5LEb64f018491@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 21 Jun 2012 14:37:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237399 - in user/ae/bootcode: bin/rm etc/periodic/daily lib/libc/string share/man/man4 sys/amd64/amd64 sys/boot/common sys/cam sys/cam/scsi sys/dev/puc sys/dev/viawd sys/dev/xen/balloo... X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 14:37:06 -0000 Author: ae Date: Thu Jun 21 14:37:05 2012 New Revision: 237399 URL: http://svn.freebsd.org/changeset/base/237399 Log: Sync with head/. Modified: user/ae/bootcode/bin/rm/rm.c user/ae/bootcode/etc/periodic/daily/400.status-disks user/ae/bootcode/lib/libc/string/strcasecmp.3 user/ae/bootcode/lib/libc/string/strcoll.3 user/ae/bootcode/lib/libc/string/strstr.3 user/ae/bootcode/lib/libc/string/strxfrm.3 user/ae/bootcode/share/man/man4/cpufreq.4 user/ae/bootcode/sys/amd64/amd64/pmap.c user/ae/bootcode/sys/boot/common/load_elf.c user/ae/bootcode/sys/boot/common/load_elf_obj.c user/ae/bootcode/sys/cam/cam_periph.c user/ae/bootcode/sys/cam/cam_xpt.c user/ae/bootcode/sys/cam/cam_xpt_periph.h user/ae/bootcode/sys/cam/scsi/scsi_cd.c user/ae/bootcode/sys/cam/scsi/scsi_da.c user/ae/bootcode/sys/cam/scsi/scsi_enc.c user/ae/bootcode/sys/cam/scsi/scsi_pass.c user/ae/bootcode/sys/dev/puc/puc_cfg.h user/ae/bootcode/sys/dev/puc/pucdata.c user/ae/bootcode/sys/dev/viawd/viawd.c user/ae/bootcode/sys/dev/xen/balloon/balloon.c user/ae/bootcode/sys/fs/nfsclient/nfs_clbio.c user/ae/bootcode/sys/fs/nfsclient/nfs_clvfsops.c user/ae/bootcode/sys/kern/vfs_vnops.c user/ae/bootcode/sys/netinet/sctp_usrreq.c user/ae/bootcode/sys/ufs/ffs/ffs_vnops.c user/ae/bootcode/sys/vm/vm_map.c user/ae/bootcode/sys/vm/vm_page.c user/ae/bootcode/sys/vm/vm_page.h user/ae/bootcode/tools/regression/usr.bin/make/common.sh user/ae/bootcode/usr.bin/makewhatis/makewhatis.c user/ae/bootcode/usr.sbin/mfiutil/mfi_drive.c Directory Properties: user/ae/bootcode/ (props changed) user/ae/bootcode/lib/libc/ (props changed) user/ae/bootcode/share/man/man4/ (props changed) user/ae/bootcode/sys/ (props changed) user/ae/bootcode/sys/boot/ (props changed) Modified: user/ae/bootcode/bin/rm/rm.c ============================================================================== --- user/ae/bootcode/bin/rm/rm.c Thu Jun 21 14:35:46 2012 (r237398) +++ user/ae/bootcode/bin/rm/rm.c Thu Jun 21 14:37:05 2012 (r237399) @@ -301,10 +301,16 @@ rm_tree(char **argv) if (fflag) continue; /* FALLTHROUGH */ - default: + + case FTS_F: + case FTS_NSOK: if (Pflag) - if (!rm_overwrite(p->fts_accpath, NULL)) + if (!rm_overwrite(p->fts_accpath, p->fts_info == + FTS_NSOK ? NULL : p->fts_statp)) continue; + /* FALLTHROUGH */ + + default: rval = unlink(p->fts_accpath); if (rval == 0 || (fflag && errno == ENOENT)) { if (rval == 0 && vflag) Modified: user/ae/bootcode/etc/periodic/daily/400.status-disks ============================================================================== --- user/ae/bootcode/etc/periodic/daily/400.status-disks Thu Jun 21 14:35:46 2012 (r237398) +++ user/ae/bootcode/etc/periodic/daily/400.status-disks Thu Jun 21 14:37:05 2012 (r237399) @@ -19,12 +19,15 @@ case "$daily_status_disks_enable" in df $daily_status_disks_df_flags && rc=1 || rc=3 # display which filesystems need backing up - if ! [ -f /etc/fstab ]; then - export PATH_FSTAB=/dev/null - fi + if [ -s /etc/dumpdates ]; then + if ! [ -f /etc/fstab ]; then + export PATH_FSTAB=/dev/null + fi - echo "" - dump W || rc=3;; + echo "" + dump W || rc=3 + fi + ;; *) rc=0;; esac Modified: user/ae/bootcode/lib/libc/string/strcasecmp.3 ============================================================================== --- user/ae/bootcode/lib/libc/string/strcasecmp.3 Thu Jun 21 14:35:46 2012 (r237398) +++ user/ae/bootcode/lib/libc/string/strcasecmp.3 Thu Jun 21 14:37:05 2012 (r237399) @@ -45,6 +45,12 @@ .Fn strcasecmp "const char *s1" "const char *s2" .Ft int .Fn strncasecmp "const char *s1" "const char *s2" "size_t len" +.In string.h +.In xlocale.h +.Ft int +.Fn strcasecmp_l "const char *s1" "const char *s2" "locale_t loc" +.Ft int +.Fn strncasecmp_l "const char *s1" "const char *s2" "site_t len" "locale_t loc" .Sh DESCRIPTION The .Fn strcasecmp @@ -58,16 +64,22 @@ and .Pp The .Fn strncasecmp -compares at most +function compares at most .Fa len characters. -.Sh RETURN VALUES The +.Fn strcasecmp_l +and +.Fn strncasecmp_l +functions do the same as their non-locale versions above, but take an +explicit locale rather than using the current locale. +.Sh RETURN VALUES +The functions .Fn strcasecmp and .Fn strncasecmp return an integer greater than, equal to, or less than 0, -according as +depending on whether .Fa s1 is lexicographically greater than, equal to, or less than .Fa s2 @@ -77,6 +89,11 @@ The comparison is done using unsigned ch .Sq Li \e200 is greater than .Ql \e0 . +The functions +.Fn strcasecmp_l +and +.Fn strncasecmp_l +do the same but take explicit locales. .Sh SEE ALSO .Xr bcmp 3 , .Xr memcmp 3 , Modified: user/ae/bootcode/lib/libc/string/strcoll.3 ============================================================================== --- user/ae/bootcode/lib/libc/string/strcoll.3 Thu Jun 21 14:35:46 2012 (r237398) +++ user/ae/bootcode/lib/libc/string/strcoll.3 Thu Jun 21 14:37:05 2012 (r237399) @@ -44,6 +44,8 @@ .In string.h .Ft int .Fn strcoll "const char *s1" "const char *s2" +.Ft int +.Fn strcoll_l "const char *s1" "const char *s2" "locale_t loc" .Sh DESCRIPTION The .Fn strcoll @@ -54,7 +56,7 @@ and .Fa s2 according to the current locale collation and returns an integer greater than, equal to, or less than 0, -according as +depending on whether .Fa s1 is greater than, equal to, or less than .Fa s2 . @@ -62,6 +64,9 @@ If information about the current locale the value of .Fn strcmp s1 s2 is returned. +The +.Fn strcoll_l +function uses an explicit locale argument rather than the system locale. .Sh SEE ALSO .Xr setlocale 3 , .Xr strcmp 3 , @@ -70,6 +75,9 @@ is returned. .Sh STANDARDS The .Fn strcoll -function -conforms to +function conforms to .St -isoC . +The +.Fn strcoll_l +function conforms to +.St -p1003.1-2008 . Modified: user/ae/bootcode/lib/libc/string/strstr.3 ============================================================================== --- user/ae/bootcode/lib/libc/string/strstr.3 Thu Jun 21 14:35:46 2012 (r237398) +++ user/ae/bootcode/lib/libc/string/strstr.3 Thu Jun 21 14:37:05 2012 (r237399) @@ -49,6 +49,10 @@ .Fn strcasestr "const char *big" "const char *little" .Ft char * .Fn strnstr "const char *big" "const char *little" "size_t len" +.In string.h +.In xlocale.h +.Ft char * +.Fn strcasestr_l "const char *big" "const char *little" "locale_t loc" .Sh DESCRIPTION The .Fn strstr @@ -65,6 +69,12 @@ function is similar to but ignores the case of both strings. .Pp The +.Fn strcasestr_l +function does the same as +.Fn strcasestr +but takes an explicit locale rather than using the current locale. +.Pp +The .Fn strnstr function locates the first occurrence of the null-terminated string Modified: user/ae/bootcode/lib/libc/string/strxfrm.3 ============================================================================== --- user/ae/bootcode/lib/libc/string/strxfrm.3 Thu Jun 21 14:35:46 2012 (r237398) +++ user/ae/bootcode/lib/libc/string/strxfrm.3 Thu Jun 21 14:37:05 2012 (r237399) @@ -44,6 +44,8 @@ .In string.h .Ft size_t .Fn strxfrm "char * restrict dst" "const char * restrict src" "size_t n" +.Ft size_t +.Fn strxfrm_l "char * restrict dst" "const char *restrict src" "size_t n" "locale_t loc" .Sh DESCRIPTION The .Fn strxfrm @@ -73,10 +75,16 @@ after is equal to comparing two original strings with .Fn strcoll . +.Pp +.Fn strxfrm_l +does the same, however takes an explicit locale rather than the global +locale. .Sh RETURN VALUES Upon successful completion, .Fn strxfrm -returns the length of the transformed string not including +and +.Fn strxfrm_l +return the length of the transformed string not including the terminating null character. If this value is .Fa n @@ -94,3 +102,7 @@ The function conforms to .St -isoC . +The +.Fn strxfrm_l +function conforms to +.St -p1003.1-2008 . Modified: user/ae/bootcode/share/man/man4/cpufreq.4 ============================================================================== --- user/ae/bootcode/share/man/man4/cpufreq.4 Thu Jun 21 14:35:46 2012 (r237398) +++ user/ae/bootcode/share/man/man4/cpufreq.4 Thu Jun 21 14:37:05 2012 (r237399) @@ -286,6 +286,7 @@ then it should set all elements to .Dv CPUFREQ_VAL_UNKNOWN . .Sh SEE ALSO .Xr acpi 4 , +.Xr est 4 , .Xr timecounters 4 , .Xr powerd 8 , .Xr sysctl 8 Modified: user/ae/bootcode/sys/amd64/amd64/pmap.c ============================================================================== --- user/ae/bootcode/sys/amd64/amd64/pmap.c Thu Jun 21 14:35:46 2012 (r237398) +++ user/ae/bootcode/sys/amd64/amd64/pmap.c Thu Jun 21 14:37:05 2012 (r237399) @@ -241,7 +241,8 @@ static void free_pv_chunk(struct pv_chun static void free_pv_entry(pmap_t pmap, pv_entry_t pv); static pv_entry_t get_pv_entry(pmap_t pmap, boolean_t try); static void pmap_pv_demote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa); -static boolean_t pmap_pv_insert_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa); +static boolean_t pmap_pv_insert_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa, + struct rwlock **lockp); static void pmap_pv_promote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa); static void pmap_pvh_free(struct md_page *pvh, pmap_t pmap, vm_offset_t va); static pv_entry_t pmap_pvh_remove(struct md_page *pvh, pmap_t pmap, @@ -253,9 +254,9 @@ static boolean_t pmap_demote_pde(pmap_t static boolean_t pmap_demote_pdpe(pmap_t pmap, pdp_entry_t *pdpe, vm_offset_t va); static boolean_t pmap_enter_pde(pmap_t pmap, vm_offset_t va, vm_page_t m, - vm_prot_t prot); + vm_prot_t prot, struct rwlock **lockp); static vm_page_t pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, - vm_page_t m, vm_prot_t prot, vm_page_t mpte); + vm_page_t m, vm_prot_t prot, vm_page_t mpte, struct rwlock **lockp); static void pmap_fill_ptp(pt_entry_t *firstpte, pt_entry_t newpte); static void pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte); static boolean_t pmap_is_modified_pvh(struct md_page *pvh); @@ -278,7 +279,7 @@ static void pmap_remove_entry(struct pma vm_offset_t va); static void pmap_insert_entry(pmap_t pmap, vm_offset_t va, vm_page_t m); static boolean_t pmap_try_insert_pv_entry(pmap_t pmap, vm_offset_t va, - vm_page_t m); + vm_page_t m, struct rwlock **lockp); static void pmap_update_pde(pmap_t pmap, vm_offset_t va, pd_entry_t *pde, pd_entry_t newpde); static void pmap_update_pde_invalidate(vm_offset_t va, pd_entry_t newpde); @@ -2463,14 +2464,23 @@ pmap_insert_entry(pmap_t pmap, vm_offset * Conditionally create a pv entry. */ static boolean_t -pmap_try_insert_pv_entry(pmap_t pmap, vm_offset_t va, vm_page_t m) +pmap_try_insert_pv_entry(pmap_t pmap, vm_offset_t va, vm_page_t m, + struct rwlock **lockp) { + struct rwlock *new_lock; pv_entry_t pv; - rw_assert(&pvh_global_lock, RA_WLOCKED); + rw_assert(&pvh_global_lock, RA_LOCKED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); if ((pv = get_pv_entry(pmap, TRUE)) != NULL) { pv->pv_va = va; + new_lock = VM_PAGE_TO_PV_LIST_LOCK(m); + if (new_lock != *lockp) { + if (*lockp != NULL) + rw_wunlock(*lockp); + *lockp = new_lock; + rw_wlock(*lockp); + } TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list); return (TRUE); } else @@ -2481,14 +2491,23 @@ pmap_try_insert_pv_entry(pmap_t pmap, vm * Create the pv entry for a 2MB page mapping. */ static boolean_t -pmap_pv_insert_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa) +pmap_pv_insert_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa, + struct rwlock **lockp) { struct md_page *pvh; + struct rwlock *new_lock; pv_entry_t pv; - rw_assert(&pvh_global_lock, RA_WLOCKED); + rw_assert(&pvh_global_lock, RA_LOCKED); if ((pv = get_pv_entry(pmap, TRUE)) != NULL) { pv->pv_va = va; + new_lock = PHYS_TO_PV_LIST_LOCK(pa); + if (new_lock != *lockp) { + if (*lockp != NULL) + rw_wunlock(*lockp); + *lockp = new_lock; + rw_wlock(*lockp); + } pvh = pa_to_pvh(pa); TAILQ_INSERT_TAIL(&pvh->pv_list, pv, pv_list); return (TRUE); @@ -3434,12 +3453,13 @@ validate: * (3) a pv entry cannot be allocated without reclaiming another pv entry. */ static boolean_t -pmap_enter_pde(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot) +pmap_enter_pde(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, + struct rwlock **lockp) { pd_entry_t *pde, newpde; vm_page_t free, mpde; - rw_assert(&pvh_global_lock, RA_WLOCKED); + rw_assert(&pvh_global_lock, RA_LOCKED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); if ((mpde = pmap_allocpde(pmap, va, M_NOWAIT)) == NULL) { CTR2(KTR_PMAP, "pmap_enter_pde: failure for va %#lx" @@ -3464,7 +3484,8 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t /* * Abort this mapping if its PV entry could not be created. */ - if (!pmap_pv_insert_pde(pmap, va, VM_PAGE_TO_PHYS(m))) { + if (!pmap_pv_insert_pde(pmap, va, VM_PAGE_TO_PHYS(m), + lockp)) { free = NULL; if (pmap_unwire_pte_hold(pmap, va, mpde, &free)) { pmap_invalidate_page(pmap, va); @@ -3490,7 +3511,7 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t */ pde_store(pde, newpde); - pmap_pde_mappings++; + atomic_add_long(&pmap_pde_mappings, 1); CTR2(KTR_PMAP, "pmap_enter_pde: success for va %#lx" " in pmap %p", va, pmap); return (TRUE); @@ -3512,6 +3533,7 @@ void pmap_enter_object(pmap_t pmap, vm_offset_t start, vm_offset_t end, vm_page_t m_start, vm_prot_t prot) { + struct rwlock *lock; vm_offset_t va; vm_page_t m, mpte; vm_pindex_t diff, psize; @@ -3520,21 +3542,24 @@ pmap_enter_object(pmap_t pmap, vm_offset psize = atop(end - start); mpte = NULL; m = m_start; - rw_wlock(&pvh_global_lock); + lock = NULL; + rw_rlock(&pvh_global_lock); PMAP_LOCK(pmap); while (m != NULL && (diff = m->pindex - m_start->pindex) < psize) { va = start + ptoa(diff); if ((va & PDRMASK) == 0 && va + NBPDR <= end && (VM_PAGE_TO_PHYS(m) & PDRMASK) == 0 && pg_ps_enabled && vm_reserv_level_iffullpop(m) == 0 && - pmap_enter_pde(pmap, va, m, prot)) + pmap_enter_pde(pmap, va, m, prot, &lock)) m = &m[NBPDR / PAGE_SIZE - 1]; else mpte = pmap_enter_quick_locked(pmap, va, m, prot, - mpte); + mpte, &lock); m = TAILQ_NEXT(m, listq); } - rw_wunlock(&pvh_global_lock); + if (lock != NULL) + rw_wunlock(lock); + rw_runlock(&pvh_global_lock); PMAP_UNLOCK(pmap); } @@ -3550,17 +3575,21 @@ pmap_enter_object(pmap_t pmap, vm_offset void pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot) { + struct rwlock *lock; - rw_wlock(&pvh_global_lock); + lock = NULL; + rw_rlock(&pvh_global_lock); PMAP_LOCK(pmap); - (void)pmap_enter_quick_locked(pmap, va, m, prot, NULL); - rw_wunlock(&pvh_global_lock); + (void)pmap_enter_quick_locked(pmap, va, m, prot, NULL, &lock); + if (lock != NULL) + rw_wunlock(lock); + rw_runlock(&pvh_global_lock); PMAP_UNLOCK(pmap); } static vm_page_t pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, - vm_prot_t prot, vm_page_t mpte) + vm_prot_t prot, vm_page_t mpte, struct rwlock **lockp) { vm_page_t free; pt_entry_t *pte; @@ -3569,7 +3598,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_ KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva || (m->oflags & VPO_UNMANAGED) != 0, ("pmap_enter_quick_locked: managed mapping within the clean submap")); - rw_assert(&pvh_global_lock, RA_WLOCKED); + rw_assert(&pvh_global_lock, RA_LOCKED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); /* @@ -3626,7 +3655,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_ * Enter on the PV list if part of our managed memory. */ if ((m->oflags & VPO_UNMANAGED) == 0 && - !pmap_try_insert_pv_entry(pmap, va, m)) { + !pmap_try_insert_pv_entry(pmap, va, m, lockp)) { if (mpte != NULL) { free = NULL; if (pmap_unwire_pte_hold(pmap, va, mpte, &free)) { @@ -3825,6 +3854,7 @@ void pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, vm_offset_t src_addr) { + struct rwlock *lock; vm_page_t free; vm_offset_t addr; vm_offset_t end_addr = src_addr + len; @@ -3833,7 +3863,8 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm if (dst_addr != src_addr) return; - rw_wlock(&pvh_global_lock); + lock = NULL; + rw_rlock(&pvh_global_lock); if (dst_pmap < src_pmap) { PMAP_LOCK(dst_pmap); PMAP_LOCK(src_pmap); @@ -3885,7 +3916,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm pde = &pde[pmap_pde_index(addr)]; if (*pde == 0 && ((srcptepaddr & PG_MANAGED) == 0 || pmap_pv_insert_pde(dst_pmap, addr, srcptepaddr & - PG_PS_FRAME))) { + PG_PS_FRAME, &lock))) { *pde = srcptepaddr & ~PG_W; pmap_resident_count_inc(dst_pmap, NBPDR / PAGE_SIZE); } else @@ -3922,7 +3953,8 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm dst_pte = &dst_pte[pmap_pte_index(addr)]; if (*dst_pte == 0 && pmap_try_insert_pv_entry(dst_pmap, addr, - PHYS_TO_VM_PAGE(ptetemp & PG_FRAME))) { + PHYS_TO_VM_PAGE(ptetemp & PG_FRAME), + &lock)) { /* * Clear the wired, modified, and * accessed (referenced) bits @@ -3949,7 +3981,9 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm } } out: - rw_wunlock(&pvh_global_lock); + if (lock != NULL) + rw_wunlock(lock); + rw_runlock(&pvh_global_lock); PMAP_UNLOCK(src_pmap); PMAP_UNLOCK(dst_pmap); } @@ -4158,9 +4192,9 @@ pmap_remove_pages(pmap_t pmap) printf("warning: pmap_remove_pages called with non-current pmap\n"); return; } + lock = NULL; rw_rlock(&pvh_global_lock); PMAP_LOCK(pmap); - lock = NULL; TAILQ_FOREACH_SAFE(pc, &pmap->pm_pvchunk, pc_list, npc) { allfree = 1; freed = 0; @@ -4268,10 +4302,6 @@ pmap_remove_pages(pmap_t pmap) PV_STAT(atomic_add_int(&pv_entry_spare, freed)); PV_STAT(atomic_subtract_long(&pv_entry_count, freed)); if (allfree) { - if (lock != NULL) { - rw_wunlock(lock); - lock = NULL; - } TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list); free_pv_chunk(pc); } Modified: user/ae/bootcode/sys/boot/common/load_elf.c ============================================================================== --- user/ae/bootcode/sys/boot/common/load_elf.c Thu Jun 21 14:35:46 2012 (r237398) +++ user/ae/bootcode/sys/boot/common/load_elf.c Thu Jun 21 14:37:05 2012 (r237399) @@ -612,7 +612,7 @@ __elfN(parse_modmetadata)(struct preload Elf_Addr v, p, p_stop; if (__elfN(lookup_symbol)(fp, ef, "__start_set_modmetadata_set", &sym) != 0) - return ENOENT; + return 0; p = sym.st_value + ef->off; if (__elfN(lookup_symbol)(fp, ef, "__stop_set_modmetadata_set", &sym) != 0) return ENOENT; Modified: user/ae/bootcode/sys/boot/common/load_elf_obj.c ============================================================================== --- user/ae/bootcode/sys/boot/common/load_elf_obj.c Thu Jun 21 14:35:46 2012 (r237398) +++ user/ae/bootcode/sys/boot/common/load_elf_obj.c Thu Jun 21 14:37:05 2012 (r237399) @@ -369,7 +369,7 @@ __elfN(obj_parse_modmetadata)(struct pre if (__elfN(obj_lookup_set)(fp, ef, "modmetadata_set", &p, &p_stop, &modcnt) != 0) - return ENOENT; + return 0; modcnt = 0; while (p < p_stop) { Modified: user/ae/bootcode/sys/cam/cam_periph.c ============================================================================== --- user/ae/bootcode/sys/cam/cam_periph.c Thu Jun 21 14:35:46 2012 (r237398) +++ user/ae/bootcode/sys/cam/cam_periph.c Thu Jun 21 14:37:05 2012 (r237399) @@ -258,7 +258,7 @@ failure: break; case 3: CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph destroyed\n")); - xpt_remove_periph(periph); + xpt_remove_periph(periph, /*topology_lock_held*/ 0); /* FALLTHROUGH */ case 2: xpt_lock_buses(); @@ -610,13 +610,38 @@ camperiphfree(struct cam_periph *periph) return; } - TAILQ_REMOVE(&(*p_drv)->units, periph, unit_links); - (*p_drv)->generation++; + /* + * The peripheral destructor semantics dictate calling with only the + * SIM mutex held. Since it might sleep, it should not be called + * with the topology lock held. + */ xpt_unlock_buses(); + /* + * We need to call the peripheral destructor prior to removing the + * peripheral from the list. Otherwise, we risk running into a + * scenario where the peripheral unit number may get reused + * (because it has been removed from the list), but some resources + * used by the peripheral are still hanging around. In particular, + * the devfs nodes used by some peripherals like the pass(4) driver + * aren't fully cleaned up until the destructor is run. If the + * unit number is reused before the devfs instance is fully gone, + * devfs will panic. + */ if (periph->periph_dtor != NULL) periph->periph_dtor(periph); - xpt_remove_periph(periph); + + /* + * The peripheral list is protected by the topology lock. + */ + xpt_lock_buses(); + + TAILQ_REMOVE(&(*p_drv)->units, periph, unit_links); + (*p_drv)->generation++; + + xpt_remove_periph(periph, /*topology_lock_held*/ 1); + + xpt_unlock_buses(); CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph destroyed\n")); if (periph->flags & CAM_PERIPH_NEW_DEV_FOUND) { Modified: user/ae/bootcode/sys/cam/cam_xpt.c ============================================================================== --- user/ae/bootcode/sys/cam/cam_xpt.c Thu Jun 21 14:35:46 2012 (r237398) +++ user/ae/bootcode/sys/cam/cam_xpt.c Thu Jun 21 14:37:05 2012 (r237399) @@ -1026,7 +1026,7 @@ xpt_add_periph(struct cam_periph *periph } void -xpt_remove_periph(struct cam_periph *periph) +xpt_remove_periph(struct cam_periph *periph, int topology_lock_held) { struct cam_ed *device; @@ -1047,9 +1047,13 @@ xpt_remove_periph(struct cam_periph *per SLIST_REMOVE(periph_head, periph, cam_periph, periph_links); } - mtx_lock(&xsoftc.xpt_topo_lock); + if (topology_lock_held == 0) + mtx_lock(&xsoftc.xpt_topo_lock); + xsoftc.xpt_generation++; - mtx_unlock(&xsoftc.xpt_topo_lock); + + if (topology_lock_held == 0) + mtx_unlock(&xsoftc.xpt_topo_lock); } Modified: user/ae/bootcode/sys/cam/cam_xpt_periph.h ============================================================================== --- user/ae/bootcode/sys/cam/cam_xpt_periph.h Thu Jun 21 14:35:46 2012 (r237398) +++ user/ae/bootcode/sys/cam/cam_xpt_periph.h Thu Jun 21 14:37:05 2012 (r237399) @@ -42,7 +42,8 @@ void xpt_polled_action(union ccb *ccb); void xpt_release_ccb(union ccb *released_ccb); void xpt_schedule(struct cam_periph *perph, u_int32_t new_priority); int32_t xpt_add_periph(struct cam_periph *periph); -void xpt_remove_periph(struct cam_periph *periph); +void xpt_remove_periph(struct cam_periph *periph, + int topology_lock_held); void xpt_announce_periph(struct cam_periph *periph, char *announce_string); #endif Modified: user/ae/bootcode/sys/cam/scsi/scsi_cd.c ============================================================================== --- user/ae/bootcode/sys/cam/scsi/scsi_cd.c Thu Jun 21 14:35:46 2012 (r237398) +++ user/ae/bootcode/sys/cam/scsi/scsi_cd.c Thu Jun 21 14:37:05 2012 (r237399) @@ -1049,7 +1049,11 @@ cdclose(struct disk *dp) softc = (struct cd_softc *)periph->softc; cam_periph_lock(periph); - cam_periph_hold(periph, PRIBIO); + if (cam_periph_hold(periph, PRIBIO) != 0) { + cam_periph_unlock(periph); + cam_periph_release(periph); + return (0); + } CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH, ("cdclose\n")); Modified: user/ae/bootcode/sys/cam/scsi/scsi_da.c ============================================================================== --- user/ae/bootcode/sys/cam/scsi/scsi_da.c Thu Jun 21 14:35:46 2012 (r237398) +++ user/ae/bootcode/sys/cam/scsi/scsi_da.c Thu Jun 21 14:37:05 2012 (r237399) @@ -982,14 +982,13 @@ daclose(struct disk *dp) { struct cam_periph *periph; struct da_softc *softc; - int error; periph = (struct cam_periph *)dp->d_drv1; if (periph == NULL) return (0); cam_periph_lock(periph); - if ((error = cam_periph_hold(periph, PRIBIO)) != 0) { + if (cam_periph_hold(periph, PRIBIO) != 0) { cam_periph_unlock(periph); cam_periph_release(periph); return (0); Modified: user/ae/bootcode/sys/cam/scsi/scsi_enc.c ============================================================================== --- user/ae/bootcode/sys/cam/scsi/scsi_enc.c Thu Jun 21 14:35:46 2012 (r237398) +++ user/ae/bootcode/sys/cam/scsi/scsi_enc.c Thu Jun 21 14:37:05 2012 (r237399) @@ -114,6 +114,16 @@ enc_init(void) } static void +enc_devgonecb(void *arg) +{ + struct cam_periph *periph; + + periph = (struct cam_periph *)arg; + + cam_periph_release(periph); +} + +static void enc_oninvalidate(struct cam_periph *periph) { struct enc_softc *enc; @@ -141,6 +151,8 @@ enc_oninvalidate(struct cam_periph *peri } callout_drain(&enc->status_updater); + destroy_dev_sched_cb(enc->enc_dev, enc_devgonecb, periph); + xpt_print(periph->path, "lost device\n"); } @@ -152,9 +164,7 @@ enc_dtor(struct cam_periph *periph) enc = periph->softc; xpt_print(periph->path, "removing device entry\n"); - cam_periph_unlock(periph); - destroy_dev(enc->enc_dev); - cam_periph_lock(periph); + /* If the sub-driver has a cleanup routine, call it */ if (enc->enc_vec.softc_cleanup != NULL) @@ -951,9 +961,19 @@ enc_ctor(struct cam_periph *periph, void goto out; } } + + if (cam_periph_acquire(periph) != CAM_REQ_CMP) { + xpt_print(periph->path, "%s: lost periph during " + "registration!\n", __func__); + cam_periph_lock(periph); + + return (CAM_REQ_CMP_ERR); + } + enc->enc_dev = make_dev(&enc_cdevsw, periph->unit_number, UID_ROOT, GID_OPERATOR, 0600, "%s%d", periph->periph_name, periph->unit_number); + cam_periph_lock(periph); enc->enc_dev->si_drv1 = periph; Modified: user/ae/bootcode/sys/cam/scsi/scsi_pass.c ============================================================================== --- user/ae/bootcode/sys/cam/scsi/scsi_pass.c Thu Jun 21 14:35:46 2012 (r237398) +++ user/ae/bootcode/sys/cam/scsi/scsi_pass.c Thu Jun 21 14:37:05 2012 (r237399) @@ -55,7 +55,8 @@ __FBSDID("$FreeBSD$"); typedef enum { PASS_FLAG_OPEN = 0x01, PASS_FLAG_LOCKED = 0x02, - PASS_FLAG_INVALID = 0x04 + PASS_FLAG_INVALID = 0x04, + PASS_FLAG_INITIAL_PHYSPATH = 0x08 } pass_flags; typedef enum { @@ -133,7 +134,18 @@ passinit(void) printf("pass: Failed to attach master async callback " "due to status 0x%x!\n", status); } - + +} + +static void +passdevgonecb(void *arg) +{ + struct cam_periph *periph; + + periph = (struct cam_periph *)arg; + + xpt_print(periph->path, "%s: devfs entry is gone\n", __func__); + cam_periph_release(periph); } static void @@ -151,6 +163,12 @@ passoninvalidate(struct cam_periph *peri softc->flags |= PASS_FLAG_INVALID; /* + * Tell devfs this device has gone away, and ask for a callback + * when it has cleaned up its state. + */ + destroy_dev_sched_cb(softc->dev, passdevgonecb, periph); + + /* * XXX Return all queued I/O with ENXIO. * XXX Handle any transactions queued to the card * with XPT_ABORT_CCB. @@ -176,11 +194,6 @@ passcleanup(struct cam_periph *periph) cam_periph_unlock(periph); taskqueue_drain(taskqueue_thread, &softc->add_physpath_task); - /* - * passcleanup() is indirectly a d_close method via passclose, - * so using destroy_dev(9) directly can result in deadlock. - */ - destroy_dev_sched(softc->dev); cam_periph_lock(periph); free(softc, M_DEVBUF); @@ -199,6 +212,12 @@ pass_add_physpath(void *context, int pen */ periph = context; softc = periph->softc; + cam_periph_lock(periph); + if (periph->flags & CAM_PERIPH_INVALID) { + cam_periph_unlock(periph); + return; + } + cam_periph_unlock(periph); physpath = malloc(MAXPATHLEN, M_DEVBUF, M_WAITOK); if (xpt_getattr(physpath, MAXPATHLEN, "GEOM::physpath", periph->path) == 0 @@ -208,6 +227,19 @@ pass_add_physpath(void *context, int pen softc->dev, softc->alias_dev, physpath); } free(physpath, M_DEVBUF); + + /* + * Now that we've made our alias, we no longer have to have a + * reference to the device. + */ + cam_periph_lock(periph); + if ((softc->flags & PASS_FLAG_INITIAL_PHYSPATH) == 0) { + softc->flags |= PASS_FLAG_INITIAL_PHYSPATH; + cam_periph_unlock(periph); + dev_rel(softc->dev); + } + else + cam_periph_unlock(periph); } static void @@ -281,12 +313,12 @@ passregister(struct cam_periph *periph, cgd = (struct ccb_getdev *)arg; if (periph == NULL) { - printf("passregister: periph was NULL!!\n"); + printf("%s: periph was NULL!!\n", __func__); return(CAM_REQ_CMP_ERR); } if (cgd == NULL) { - printf("passregister: no getdev CCB, can't register device\n"); + printf("%s: no getdev CCB, can't register device\n", __func__); return(CAM_REQ_CMP_ERR); } @@ -294,8 +326,8 @@ passregister(struct cam_periph *periph, M_DEVBUF, M_NOWAIT); if (softc == NULL) { - printf("passregister: Unable to probe new device. " - "Unable to allocate softc\n"); + printf("%s: Unable to probe new device. " + "Unable to allocate softc\n", __func__); return(CAM_REQ_CMP_ERR); } @@ -331,10 +363,31 @@ passregister(struct cam_periph *periph, DEVSTAT_TYPE_PASS, DEVSTAT_PRIORITY_PASS); + /* + * Acquire a reference to the periph before we create the devfs + * instance for it. We'll release this reference once the devfs + * instance has been freed. + */ + if (cam_periph_acquire(periph) != CAM_REQ_CMP) { + xpt_print(periph->path, "%s: lost periph during " + "registration!\n", __func__); + mtx_lock(periph->sim->mtx); + return (CAM_REQ_CMP_ERR); + } + /* Register the device */ softc->dev = make_dev(&pass_cdevsw, periph->unit_number, UID_ROOT, GID_OPERATOR, 0600, "%s%d", periph->periph_name, periph->unit_number); + + /* + * Now that we have made the devfs instance, hold a reference to it + * until the task queue has run to setup the physical path alias. + * That way devfs won't get rid of the device before we add our + * alias. + */ + dev_ref(softc->dev); + mtx_lock(periph->sim->mtx); softc->dev->si_drv1 = periph; Modified: user/ae/bootcode/sys/dev/puc/puc_cfg.h ============================================================================== --- user/ae/bootcode/sys/dev/puc/puc_cfg.h Thu Jun 21 14:35:46 2012 (r237398) +++ user/ae/bootcode/sys/dev/puc/puc_cfg.h Thu Jun 21 14:37:05 2012 (r237399) @@ -79,7 +79,7 @@ struct puc_cfg { int8_t ports; int8_t rid; /* Rid of first port */ int8_t d_rid; /* Delta rid of next ports */ - int8_t d_ofs; /* Delta offset of next ports */ + int16_t d_ofs; /* Delta offset of next ports */ puc_config_f *config_function; }; Modified: user/ae/bootcode/sys/dev/puc/pucdata.c ============================================================================== --- user/ae/bootcode/sys/dev/puc/pucdata.c Thu Jun 21 14:35:46 2012 (r237398) +++ user/ae/bootcode/sys/dev/puc/pucdata.c Thu Jun 21 14:37:05 2012 (r237399) @@ -507,6 +507,18 @@ const struct puc_cfg puc_pci_devices[] = .config_function = puc_config_quatech }, + { 0x1393, 0x1024, 0xffff, 0, + "Moxa Technologies, Smartio CP-102E/PCIe", + DEFAULT_RCLK * 8, + PUC_PORT_2S, 0x14, 0, 0x200 + }, + + { 0x1393, 0x1025, 0xffff, 0, + "Moxa Technologies, Smartio CP-102EL/PCIe", + DEFAULT_RCLK * 8, + PUC_PORT_2S, 0x14, 0, 0x200, + }, + { 0x1393, 0x1040, 0xffff, 0, "Moxa Technologies, Smartio C104H/PCI", DEFAULT_RCLK * 8, @@ -550,6 +562,19 @@ const struct puc_cfg puc_pci_devices[] = PUC_PORT_4S, 0x18, 0, 8, }, + { 0x1393, 0x1144, 0xffff, 0, + "Moxa Technologies, Smartio CP-114EL/PCIe", + DEFAULT_RCLK * 8, + PUC_PORT_4S, 0x14, 0, -1, + .config_function = puc_config_moxa + }, + + { 0x1393, 0x1182, 0xffff, 0, + "Moxa Technologies, Smartio CP-118EL-A/PCIe", + DEFAULT_RCLK * 8, + PUC_PORT_8S, 0x14, 0, 0x200, + }, + { 0x1393, 0x1680, 0xffff, 0, "Moxa Technologies, C168H/PCI", DEFAULT_RCLK * 8, @@ -568,6 +593,12 @@ const struct puc_cfg puc_pci_devices[] = PUC_PORT_8S, 0x18, 0, 8, }, + { 0x1393, 0x1683, 0xffff, 0, + "Moxa Technologies, Smartio CP-168EL-A/PCIe", + DEFAULT_RCLK * 8, + PUC_PORT_8S, 0x14, 0, 0x200, + }, + { 0x13a8, 0x0152, 0xffff, 0, "Exar XR17C/D152", DEFAULT_RCLK * 8, @@ -1127,9 +1158,7 @@ static int puc_config_moxa(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port, intptr_t *res) { - const struct puc_cfg *cfg = sc->sc_cfg; - - if (cmd == PUC_CFG_GET_OFS && cfg->device == 0x1045) { + if (cmd == PUC_CFG_GET_OFS) { *res = ((port == 3) ? 7 : port) * 0x200; return 0; } Modified: user/ae/bootcode/sys/dev/viawd/viawd.c ============================================================================== --- user/ae/bootcode/sys/dev/viawd/viawd.c Thu Jun 21 14:35:46 2012 (r237398) +++ user/ae/bootcode/sys/dev/viawd/viawd.c Thu Jun 21 14:37:05 2012 (r237399) @@ -168,14 +168,18 @@ viawd_attach(device_t dev) } /* Allocate I/O register space. */ - sc->wd_rid = 0; - sc->wd_res = bus_alloc_resource(dev, SYS_RES_MEMORY, &sc->wd_rid, - pmbase, pmbase + VIAWD_MEM_LEN - 1, VIAWD_MEM_LEN, + sc->wd_rid = VIAWD_CONFIG_BASE; + sc->wd_res = bus_alloc_resource_any(sb_dev, SYS_RES_MEMORY, &sc->wd_rid, RF_ACTIVE | RF_SHAREABLE); if (sc->wd_res == NULL) { device_printf(dev, "Unable to map watchdog memory\n"); goto fail; } + if (rman_get_size(sc->wd_res) < VIAWD_MEM_LEN) { + device_printf(dev, "Bad size for watchdog memory: %#x\n", + (unsigned)rman_get_size(sc->wd_res)); + goto fail; + } /* Check if watchdog fired last boot. */ reg = viawd_read_4(sc, VIAWD_MEM_CTRL); @@ -192,7 +196,7 @@ viawd_attach(device_t dev) return (0); fail: if (sc->wd_res != NULL) - bus_release_resource(dev, SYS_RES_MEMORY, + bus_release_resource(sb_dev, SYS_RES_MEMORY, sc->wd_rid, sc->wd_res); return (ENXIO); } @@ -224,7 +228,7 @@ viawd_detach(device_t dev) } if (sc->wd_res != NULL) - bus_release_resource(sc->dev, SYS_RES_MEMORY, + bus_release_resource(sc->sb_dev, SYS_RES_MEMORY, sc->wd_rid, sc->wd_res); return (0); Modified: user/ae/bootcode/sys/dev/xen/balloon/balloon.c ============================================================================== --- user/ae/bootcode/sys/dev/xen/balloon/balloon.c Thu Jun 21 14:35:46 2012 (r237398) +++ user/ae/bootcode/sys/dev/xen/balloon/balloon.c Thu Jun 21 14:37:05 2012 (r237399) @@ -436,6 +436,9 @@ balloon_init_watcher(void *arg) { int err; + if (!is_running_on_xen()) + return; + err = xs_register_watch(&target_watch); if (err) printf("Failed to set balloon watcher\n"); Modified: user/ae/bootcode/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- user/ae/bootcode/sys/fs/nfsclient/nfs_clbio.c Thu Jun 21 14:35:46 2012 (r237398) +++ user/ae/bootcode/sys/fs/nfsclient/nfs_clbio.c Thu Jun 21 14:37:05 2012 (r237399) @@ -722,7 +722,7 @@ ncl_bioread(struct vnode *vp, struct uio }; if (n > 0) { - error = uiomove(bp->b_data + on, (int)n, uio); + error = vn_io_fault_uiomove(bp->b_data + on, (int)n, uio); } if (vp->v_type == VLNK) n = 0; @@ -1203,7 +1203,7 @@ again: } local_resid = uio->uio_resid; - error = uiomove((char *)bp->b_data + on, n, uio); + error = vn_io_fault_uiomove((char *)bp->b_data + on, n, uio); if (error != 0 && !bp_cached) { /* Modified: user/ae/bootcode/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- user/ae/bootcode/sys/fs/nfsclient/nfs_clvfsops.c Thu Jun 21 14:35:46 2012 (r237398) +++ user/ae/bootcode/sys/fs/nfsclient/nfs_clvfsops.c Thu Jun 21 14:37:05 2012 (r237399) @@ -1136,7 +1136,8 @@ nfs_mount(struct mount *mp) out: if (!error) { MNT_ILOCK(mp); - mp->mnt_kern_flag |= (MNTK_MPSAFE|MNTK_LOOKUP_SHARED); + mp->mnt_kern_flag |= MNTK_MPSAFE | MNTK_LOOKUP_SHARED | + MNTK_NO_IOPF; MNT_IUNLOCK(mp); } return (error); Modified: user/ae/bootcode/sys/kern/vfs_vnops.c ============================================================================== --- user/ae/bootcode/sys/kern/vfs_vnops.c Thu Jun 21 14:35:46 2012 (r237398) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Thu Jun 21 16:53:53 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B13CB1065672; Thu, 21 Jun 2012 16:53:53 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7F93F8FC1A; Thu, 21 Jun 2012 16:53:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5LGrrXT025124; Thu, 21 Jun 2012 16:53:53 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LGrrhI025123; Thu, 21 Jun 2012 16:53:53 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201206211653.q5LGrrhI025123@svn.freebsd.org> From: Peter Holm Date: Thu, 21 Jun 2012 16:53:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237407 - user/pho/stress2/misc X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 16:53:53 -0000 Author: pho Date: Thu Jun 21 16:53:52 2012 New Revision: 237407 URL: http://svn.freebsd.org/changeset/base/237407 Log: Regression test for r237366 added. Added: user/pho/stress2/misc/extattr_set_fd.sh (contents, props changed) Added: user/pho/stress2/misc/extattr_set_fd.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/extattr_set_fd.sh Thu Jun 21 16:53:52 2012 (r237407) @@ -0,0 +1,80 @@ +#!/bin/sh + +# +# Copyright (c) 2012 Peter Holm +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +# "panic: kmem_malloc(2069012480): kmem_map too small" seen. +# Fixed in r237366. + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +. ../default.cfg + +here=`pwd` +cd /tmp +sed '1,/^EOF/d' < $here/$0 > extattr_set_fd.c +cc -o extattr_set_fd -Wall -Wextra -O2 extattr_set_fd.c +rm -f extattr_set_fd.c + +mount | grep -q "$mntpoint" && umount $mntpoint +mdconfig -l | grep -q $mdstart && mdconfig -d -u $mdstart +mdconfig -a -t swap -s 1g -u $mdstart +bsdlabel -w md${mdstart} auto +newfs -U md${mdstart}${part} > /dev/null +mount /dev/md${mdstart}${part} $mntpoint +chmod 777 $mntpoint + +(cd $mntpoint; /tmp/extattr_set_fd) + +while mount | grep -q $mntpoint; do + umount $mntpoint || sleep 1 +done +mdconfig -d -u $mdstart +rm -f /tmp/extattr_set_fd +exit 0 +EOF +#include +#include +#include +#include +#include + +char buf[4096]; + +int +main(void) +{ + int fd; + + if ((fd = open("theFile", O_RDWR | O_CREAT, 0622)) == -1) + err(1, "open(%s)", "theFile"); + + (void) extattr_set_fd(fd, 1, "test", buf, 0x7b5294a6); + + return (0); +} From owner-svn-src-user@FreeBSD.ORG Fri Jun 22 00:41:38 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 048521065672; Fri, 22 Jun 2012 00:41:38 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E3A818FC19; Fri, 22 Jun 2012 00:41:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5M0fboO045485; Fri, 22 Jun 2012 00:41:37 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5M0fbsQ045483; Fri, 22 Jun 2012 00:41:37 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206220041.q5M0fbsQ045483@svn.freebsd.org> From: Adrian Chadd Date: Fri, 22 Jun 2012 00:41:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237413 - user/adrian/ath_radar_stuff/src/qt-pktlog X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 00:41:38 -0000 Author: adrian Date: Fri Jun 22 00:41:37 2012 New Revision: 237413 URL: http://svn.freebsd.org/changeset/base/237413 Log: Change the plot type to be a small cross rather than a single pixel point. Modified: user/adrian/ath_radar_stuff/src/qt-pktlog/main.cpp Modified: user/adrian/ath_radar_stuff/src/qt-pktlog/main.cpp ============================================================================== --- user/adrian/ath_radar_stuff/src/qt-pktlog/main.cpp Fri Jun 22 00:40:44 2012 (r237412) +++ user/adrian/ath_radar_stuff/src/qt-pktlog/main.cpp Fri Jun 22 00:41:37 2012 (r237413) @@ -7,6 +7,7 @@ #include "qwt_plot.h" #include "qwt_plot_curve.h" #include "qwt_plot_histogram.h" +#include "qwt_symbol.h" #include "libradarpkt/pkt.h" #include "PktLogData.h" @@ -22,16 +23,25 @@ void plotSet(QwtPlot *p, PktLogData *pl) { QwtPlotCurve *c = new QwtPlotCurve("curve"); - + QwtSymbol *s = new QwtSymbol(); std::vector dur; std::vector rssi; + // The default is a single 1 pixel dot. + // This makes it very difficult to see. + s->setStyle(QwtSymbol::Cross); + s->setSize(2, 2); + p->setTitle("Example"); + //p->setAutoLegend(true); //p->setLegendPos(Qwt::Bottom); // Curve Plot - dots, == scatterplot c->setStyle(QwtPlotCurve::Dots); + // And set the symbol type, a default dot is not really + // all that helpful. + c->setSymbol(s); /* Load in values */ dur = pl->GetDuration(); From owner-svn-src-user@FreeBSD.ORG Fri Jun 22 07:53:42 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 34B2C1065673; Fri, 22 Jun 2012 07:53:42 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1F6588FC15; Fri, 22 Jun 2012 07:53:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5M7rgIv064902; Fri, 22 Jun 2012 07:53:42 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5M7rfLR064894; Fri, 22 Jun 2012 07:53:41 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206220753.q5M7rfLR064894@svn.freebsd.org> From: Adrian Chadd Date: Fri, 22 Jun 2012 07:53:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237437 - user/adrian/ath_radar_stuff/src/qt-hpktlog X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 07:53:42 -0000 Author: adrian Date: Fri Jun 22 07:53:41 2012 New Revision: 237437 URL: http://svn.freebsd.org/changeset/base/237437 Log: This is tonight's hack - a time-series version of the scatterplot. Right now this just plots data points from an existing pcap and inserts a 1ms delay in there. Don't take this as any example of good C++ (new() ? Really?), nor good QT4. I'm a very big novice. However, as a basic proof of concept, this is actually working. Added: user/adrian/ath_radar_stuff/src/qt-hpktlog/ user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.cpp user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.h user/adrian/ath_radar_stuff/src/qt-hpktlog/Makefile user/adrian/ath_radar_stuff/src/qt-hpktlog/PktSource.cpp user/adrian/ath_radar_stuff/src/qt-hpktlog/PktSource.h user/adrian/ath_radar_stuff/src/qt-hpktlog/main.c user/adrian/ath_radar_stuff/src/qt-hpktlog/main.cpp user/adrian/ath_radar_stuff/src/qt-hpktlog/qt-hpktlog.pro Added: user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.cpp Fri Jun 22 07:53:41 2012 (r237437) @@ -0,0 +1,91 @@ +#include +#include +#include +#include + +#include "qwt_plot.h" +#include "qwt_plot_curve.h" +#include "qwt_plot_histogram.h" +#include "qwt_symbol.h" + +#include "MainApp.h" + +MainApp::MainApp(QMainWindow *parent) +{ + + // How many entries to keep in the FIFO + num_entries = 128; + + // Create window + q_plot = new QwtPlot(QwtText("example")); + q_plot->setTitle("Example"); + + // Default size + q_plot->setGeometry(0, 0, 640, 400); + + // Scale + // y-scale? + q_plot->setAxisScale(QwtPlot::xBottom, 0.0, 256.0); + q_plot->setAxisScale(QwtPlot::yLeft, -128.0, 128.0); + + // The default is a single 1 pixel dot. + // This makes it very difficult to see. + q_symbol = new QwtSymbol(); + q_symbol->setStyle(QwtSymbol::Cross); + q_symbol->setSize(2, 2); + + // And now, the default curve + q_curve = new QwtPlotCurve("curve"); + q_curve->setStyle(QwtPlotCurve::Dots); + q_curve->setSymbol(q_symbol); + q_curve->attach(q_plot); + + q_plot->show(); +} + +MainApp::~MainApp() +{ + + /* XXX TIDYUP */ +} + +// +// This causes the radar entry to get received and replotted. +// It's quite possible we should just fire off a 1ms timer event +// _after_ this occurs, in case we get squeezed a whole set of +// radar entries. Noone will notice if we only update every 1ms, +// right? +void +MainApp::getRadarEntry(struct radar_entry re) +{ + + //printf("%s: called!\n", __func__); + + // Add it to the start duration/rssi array + q_dur.insert(q_dur.begin(), (float) re.re_dur); + q_rssi.insert(q_rssi.begin(), (float) re.re_rssi); + + // If we're too big, delete the first entry + if (q_dur.size() > num_entries) { + q_dur.pop_back(); + q_rssi.pop_back(); + } + + + // Trim the head entries if the array is too big + // (maybe we should use a queue, not a vector?) + + // Replot! + RePlot(); +} + +void +MainApp::RePlot() +{ + // Plot them + q_curve->setSamples(&q_dur[0], &q_rssi[0], q_dur.size()); + + /* Plot */ + q_plot->replot(); + q_plot->show(); +} Added: user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.h Fri Jun 22 07:53:41 2012 (r237437) @@ -0,0 +1,46 @@ +#ifndef __MAINAPP_H__ +#define __MAINAPP_H__ + +#include + +#include + +#include +#include + +#include "qwt_plot.h" +#include "qwt_plot_curve.h" +#include "qwt_plot_histogram.h" +#include "qwt_symbol.h" + +#include "libradarpkt/pkt.h" + +class MainApp : public QMainWindow +{ + Q_OBJECT + + private: + // Why can't we just use references, rather than + // pointers? + QwtPlot *q_plot; + QwtPlotCurve *q_curve; + QwtSymbol *q_symbol; + + // How many entries to keep in the histogram + size_t num_entries; + + // Our histogram data + std::vector q_dur; + std::vector q_rssi; + + public: + MainApp(QMainWindow *parent = 0); + ~MainApp(); + void RePlot(); + + public slots: + void getRadarEntry(struct radar_entry re); + +}; + +#endif /* __MAINAPP_H__ */ Added: user/adrian/ath_radar_stuff/src/qt-hpktlog/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/adrian/ath_radar_stuff/src/qt-hpktlog/Makefile Fri Jun 22 07:53:41 2012 (r237437) @@ -0,0 +1,229 @@ +############################################################################# +# Makefile for building: qt-hpktlog +# Generated by qmake (2.01a) (Qt 4.7.4) on: Fri Jun 22 00:53:09 2012 +# Project: qt-hpktlog.pro +# Template: app +# Command: /usr/local/bin/qmake-qt4 -o Makefile qt-hpktlog.pro +############################################################################# + +####### Compiler, tools and options + +CC = gcc +CXX = g++ +DEFINES = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED +CFLAGS = -pipe -O2 -Wall -W $(DEFINES) +CXXFLAGS = -pipe -O2 -Wall -W $(DEFINES) +INCPATH = -I/usr/local/share/qt4/mkspecs/freebsd-g++ -I. -I/usr/local/include/qt4/QtCore -I/usr/local/include/qt4/QtGui -I/usr/local/include/qt4 -I. -I../../lib -I/usr/local/include/qt4 -I/usr/local/include/qwt6 -I. -I/usr/local/include/qt4 -I/usr/local/include +LINK = g++ +LFLAGS = -Wl,-O1 -pthread -Wl,-rpath,/usr/local/lib/qt4 +LIBS = $(SUBLIBS) -L/usr/local/lib/qt4 -L/usr/local/lib -L../../lib/libradarpkt -lpcap -lradarpkt -lqwt6 -lQtGui -L/usr/local/lib -L/usr/local/lib/qt4 -lQtCore +AR = ar cqs +RANLIB = +QMAKE = /usr/local/bin/qmake-qt4 +TAR = tar -cf +COMPRESS = gzip -9f +COPY = cp -f +SED = sed +COPY_FILE = $(COPY) +COPY_DIR = $(COPY) -R +STRIP = +INSTALL_FILE = $(COPY_FILE) +INSTALL_DIR = $(COPY_DIR) +INSTALL_PROGRAM = $(COPY_FILE) +DEL_FILE = rm -f +SYMLINK = ln -f -s +DEL_DIR = rmdir +MOVE = mv -f +CHK_DIR_EXISTS= test -d +MKDIR = mkdir -p + +####### Output directory + +OBJECTS_DIR = ./ + +####### Files + +SOURCES = MainApp.cpp \ + PktSource.cpp \ + main.cpp moc_MainApp.cpp \ + moc_PktSource.cpp +OBJECTS = MainApp.o \ + PktSource.o \ + main.o \ + moc_MainApp.o \ + moc_PktSource.o +DIST = /usr/local/share/qt4/mkspecs/common/g++.conf \ + /usr/local/share/qt4/mkspecs/common/unix.conf \ + /usr/local/share/qt4/mkspecs/qconfig.pri \ + /usr/local/share/qt4/mkspecs/modules/qt_phonon.pri \ + /usr/local/share/qt4/mkspecs/modules/qt_webkit_version.pri \ + /usr/local/share/qt4/mkspecs/features/qt_functions.prf \ + /usr/local/share/qt4/mkspecs/features/qt_config.prf \ + /usr/local/share/qt4/mkspecs/features/exclusive_builds.prf \ + /usr/local/share/qt4/mkspecs/features/default_pre.prf \ + /usr/local/share/qt4/mkspecs/features/release.prf \ + /usr/local/share/qt4/mkspecs/features/default_post.prf \ + /usr/local/share/qt4/mkspecs/features/unix/thread.prf \ + /usr/local/share/qt4/mkspecs/features/warn_on.prf \ + /usr/local/share/qt4/mkspecs/features/qt.prf \ + /usr/local/share/qt4/mkspecs/features/moc.prf \ + /usr/local/share/qt4/mkspecs/features/resources.prf \ + /usr/local/share/qt4/mkspecs/features/uic.prf \ + /usr/local/share/qt4/mkspecs/features/yacc.prf \ + /usr/local/share/qt4/mkspecs/features/lex.prf \ + /usr/local/share/qt4/mkspecs/features/include_source_dir.prf \ + qt-hpktlog.pro +QMAKE_TARGET = qt-hpktlog +DESTDIR = +TARGET = qt-hpktlog + +first: all +####### Implicit rules + +.SUFFIXES: .o .c .cpp .cc .cxx .C + +.cpp.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.cc.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.cxx.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.C.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.c.o: + $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" + +####### Build rules + +all: Makefile $(TARGET) + +$(TARGET): $(OBJECTS) + $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) + +Makefile: qt-hpktlog.pro /usr/local/share/qt4/mkspecs/freebsd-g++/qmake.conf /usr/local/share/qt4/mkspecs/common/g++.conf \ + /usr/local/share/qt4/mkspecs/common/unix.conf \ + /usr/local/share/qt4/mkspecs/qconfig.pri \ + /usr/local/share/qt4/mkspecs/modules/qt_phonon.pri \ + /usr/local/share/qt4/mkspecs/modules/qt_webkit_version.pri \ + /usr/local/share/qt4/mkspecs/features/qt_functions.prf \ + /usr/local/share/qt4/mkspecs/features/qt_config.prf \ + /usr/local/share/qt4/mkspecs/features/exclusive_builds.prf \ + /usr/local/share/qt4/mkspecs/features/default_pre.prf \ + /usr/local/share/qt4/mkspecs/features/release.prf \ + /usr/local/share/qt4/mkspecs/features/default_post.prf \ + /usr/local/share/qt4/mkspecs/features/unix/thread.prf \ + /usr/local/share/qt4/mkspecs/features/warn_on.prf \ + /usr/local/share/qt4/mkspecs/features/qt.prf \ + /usr/local/share/qt4/mkspecs/features/moc.prf \ + /usr/local/share/qt4/mkspecs/features/resources.prf \ + /usr/local/share/qt4/mkspecs/features/uic.prf \ + /usr/local/share/qt4/mkspecs/features/yacc.prf \ + /usr/local/share/qt4/mkspecs/features/lex.prf \ + /usr/local/share/qt4/mkspecs/features/include_source_dir.prf \ + /usr/local/lib/qt4/libQtGui.prl \ + /usr/local/lib/qt4/libQtCore.prl + $(QMAKE) -o Makefile qt-hpktlog.pro +/usr/local/share/qt4/mkspecs/common/g++.conf: +/usr/local/share/qt4/mkspecs/common/unix.conf: +/usr/local/share/qt4/mkspecs/qconfig.pri: +/usr/local/share/qt4/mkspecs/modules/qt_phonon.pri: +/usr/local/share/qt4/mkspecs/modules/qt_webkit_version.pri: +/usr/local/share/qt4/mkspecs/features/qt_functions.prf: +/usr/local/share/qt4/mkspecs/features/qt_config.prf: +/usr/local/share/qt4/mkspecs/features/exclusive_builds.prf: +/usr/local/share/qt4/mkspecs/features/default_pre.prf: +/usr/local/share/qt4/mkspecs/features/release.prf: +/usr/local/share/qt4/mkspecs/features/default_post.prf: +/usr/local/share/qt4/mkspecs/features/unix/thread.prf: +/usr/local/share/qt4/mkspecs/features/warn_on.prf: +/usr/local/share/qt4/mkspecs/features/qt.prf: +/usr/local/share/qt4/mkspecs/features/moc.prf: +/usr/local/share/qt4/mkspecs/features/resources.prf: +/usr/local/share/qt4/mkspecs/features/uic.prf: +/usr/local/share/qt4/mkspecs/features/yacc.prf: +/usr/local/share/qt4/mkspecs/features/lex.prf: +/usr/local/share/qt4/mkspecs/features/include_source_dir.prf: +/usr/local/lib/qt4/libQtGui.prl: +/usr/local/lib/qt4/libQtCore.prl: +qmake: FORCE + @$(QMAKE) -o Makefile qt-hpktlog.pro + +dist: + @$(CHK_DIR_EXISTS) .tmp/qt-hpktlog1.0.0 || $(MKDIR) .tmp/qt-hpktlog1.0.0 + $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/qt-hpktlog1.0.0/ && $(COPY_FILE) --parents MainApp.h PktSource.h .tmp/qt-hpktlog1.0.0/ && $(COPY_FILE) --parents MainApp.cpp PktSource.cpp main.cpp .tmp/qt-hpktlog1.0.0/ && (cd `dirname .tmp/qt-hpktlog1.0.0` && $(TAR) qt-hpktlog1.0.0.tar qt-hpktlog1.0.0 && $(COMPRESS) qt-hpktlog1.0.0.tar) && $(MOVE) `dirname .tmp/qt-hpktlog1.0.0`/qt-hpktlog1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/qt-hpktlog1.0.0 + + +clean:compiler_clean + -$(DEL_FILE) $(OBJECTS) + -$(DEL_FILE) *~ core *.core + + +####### Sub-libraries + +distclean: clean + -$(DEL_FILE) $(TARGET) + -$(DEL_FILE) Makefile + + +check: first + +mocclean: compiler_moc_header_clean compiler_moc_source_clean + +mocables: compiler_moc_header_make_all compiler_moc_source_make_all + +compiler_moc_header_make_all: moc_MainApp.cpp moc_PktSource.cpp +compiler_moc_header_clean: + -$(DEL_FILE) moc_MainApp.cpp moc_PktSource.cpp +moc_MainApp.cpp: MainApp.h + /usr/local/bin/moc-qt4 $(DEFINES) $(INCPATH) MainApp.h -o moc_MainApp.cpp + +moc_PktSource.cpp: PktSource.h + /usr/local/bin/moc-qt4 $(DEFINES) $(INCPATH) PktSource.h -o moc_PktSource.cpp + +compiler_rcc_make_all: +compiler_rcc_clean: +compiler_image_collection_make_all: qmake_image_collection.cpp +compiler_image_collection_clean: + -$(DEL_FILE) qmake_image_collection.cpp +compiler_moc_source_make_all: +compiler_moc_source_clean: +compiler_uic_make_all: +compiler_uic_clean: +compiler_yacc_decl_make_all: +compiler_yacc_decl_clean: +compiler_yacc_impl_make_all: +compiler_yacc_impl_clean: +compiler_lex_make_all: +compiler_lex_clean: +compiler_clean: compiler_moc_header_clean + +####### Compile + +MainApp.o: MainApp.cpp MainApp.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o MainApp.o MainApp.cpp + +PktSource.o: PktSource.cpp PktSource.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o PktSource.o PktSource.cpp + +main.o: main.cpp MainApp.h \ + PktSource.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp + +moc_MainApp.o: moc_MainApp.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_MainApp.o moc_MainApp.cpp + +moc_PktSource.o: moc_PktSource.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_PktSource.o moc_PktSource.cpp + +####### Install + +install: FORCE + +uninstall: FORCE + +FORCE: + Added: user/adrian/ath_radar_stuff/src/qt-hpktlog/PktSource.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/adrian/ath_radar_stuff/src/qt-hpktlog/PktSource.cpp Fri Jun 22 07:53:41 2012 (r237437) @@ -0,0 +1,109 @@ + +#include +#include + +#include "net80211/ieee80211_radiotap.h" + +#include "PktSource.h" + +#include "libradarpkt/pkt.h" +#include "libradarpkt/ar5416_radar.h" + +PktSource::~PktSource() +{ + + this->Close(); +} + +bool +PktSource::Load(const char *filename) +{ + char errbuf[PCAP_ERRBUF_SIZE]; + + this->Close(); + + PcapHdl = pcap_open_offline(filename, errbuf); + + if (PcapHdl == NULL) + return (false); + + // TODO: turn this into a method + if (timerId != -1) + killTimer(timerId); + + //Kick-start the first timer! + timerId = startTimer(1); + + return (true); +} + +void +PktSource::Close() +{ + + if (PcapHdl != NULL) { + pcap_close(PcapHdl); + PcapHdl = NULL; + } +} + +// Periodically read some more frames and pass them up as events. +// Right now this reads one event. +// Eventually it should pace the events based on their timestamps. +void +PktSource::timerEvent(QTimerEvent *event) +{ + int r; + struct pcap_pkthdr *hdr; + unsigned const char *pkt; + struct ieee80211_radiotap_header *rt; + struct radar_entry re; + +// printf("%s: timer event!\n", __func__); + + r = pcap_next_ex(PcapHdl, &hdr, &pkt); + + // Error? Delete the timer. + // TODO: this should handle the "error/EOF" versus "none just for now, + // but more are coming" errors correctly! + if (r <= 0) { + killTimer(timerId); + timerId = -1; + printf("%s: final event (r=%d), finish timer!\n", + __func__, + r); + this->Close(); + return; + } + + rt = (struct ieee80211_radiotap_header *) pkt; + if (rt->it_version != 0) { + printf("%s: unknown version (%d)\n", + __func__, + rt->it_version); + return; + } + + // TODO: just assume AR5416 for now.. + r = ar5416_radar_decode(rt, + (pkt + le16toh(rt->it_len)), + hdr->caplen - le16toh(rt->it_len), &re); + + // Error? Just wait for the next one? + if (r == 0) { + printf("%s: parse failed\n", __func__); + return; + } + +#if 0 + printf("%s: parsed: tsf=%llu, rssi=%d, dur=%d\n", + __func__, + (unsigned long long) re.re_timestamp, + re.re_rssi, + re.re_dur); +#endif + + // The actual event may be delayed; so i either have + // to pass a reference (not pointer), _or_ a copy. + emit emitRadarEntry(re); +} Added: user/adrian/ath_radar_stuff/src/qt-hpktlog/PktSource.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/adrian/ath_radar_stuff/src/qt-hpktlog/PktSource.h Fri Jun 22 07:53:41 2012 (r237437) @@ -0,0 +1,43 @@ +#ifndef __PKTSOURCE_H__ +#define __PKTSOURCE_H__ + +#include +#include + +#include + +#include "libradarpkt/pkt.h" + +// +// This class provides a source of packet events. +// +// It's designed to be a base class for a packet source; +// this may include (say) a live pcap source, or a recorded +// pcap with timer events to "pace" how frequently the events +// come in. +// +// This class requires some destination to send each pcap entry +// to. +// +class PktSource : public QObject { + + Q_OBJECT + + private: + pcap_t *PcapHdl; + int timerId; + + public: + PktSource() : PcapHdl(NULL), timerId(-1) { }; + ~PktSource(); + bool Load(const char *filename); + void Close(); + + signals: + void emitRadarEntry(struct radar_entry re); + + protected: + void timerEvent(QTimerEvent *event); +}; + +#endif /* __PKTSOURCE_H__ */ Added: user/adrian/ath_radar_stuff/src/qt-hpktlog/main.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/adrian/ath_radar_stuff/src/qt-hpktlog/main.c Fri Jun 22 07:53:41 2012 (r237437) @@ -0,0 +1,53 @@ + +static pcap_t * +open_online(const char *ifname) +{ + pcap_t *p; + char errbuf[PCAP_ERRBUF_SIZE]; + struct bpf_program fp; + + p = pcap_open_live(ifname, 65536, 1, 1000, errbuf); + if (! p) { + err(1, "pcap_create: %s\n", errbuf); + return (NULL); + } + + if (pcap_set_datalink(p, DLT_IEEE802_11_RADIO) != 0) { + pcap_perror(p, "pcap_set_datalink"); + return (NULL); + } + + /* XXX pcap_is_swapped() ? */ + + if (! pkt_compile(p, &fp)) { + pcap_perror(p, "pkg_compile compile error\n"); + return (NULL); + } + + if (pcap_setfilter(p, &fp) != 0) { + printf("pcap_setfilter failed\n"); + return (NULL); + } + + return (p); +} + +{ + /* + * Iterate over frames, looking for radiotap frames + * which have PHY errors. + * + * XXX We should compile a filter for this, but the + * XXX access method is a non-standard hack atm. + */ + while ((r = pcap_next_ex(p, &hdr, &pkt)) >= 0) { +#if 0 + printf("capture: len=%d, caplen=%d\n", + hdr->len, hdr->caplen); +#endif + if (r > 0) + pkt_handle(chip, pkt, hdr->caplen); + } + + pcap_close(p); +} Added: user/adrian/ath_radar_stuff/src/qt-hpktlog/main.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/adrian/ath_radar_stuff/src/qt-hpktlog/main.cpp Fri Jun 22 07:53:41 2012 (r237437) @@ -0,0 +1,123 @@ +#include +#include +#include + +#include +#include + +#include "qwt_plot.h" +#include "qwt_plot_curve.h" +#include "qwt_plot_histogram.h" +#include "qwt_symbol.h" + +#include "libradarpkt/pkt.h" +#include "libradarpkt/ar5416_radar.h" +#include "libradarpkt/ar9280_radar.h" + + +#include "MainApp.h" +#include "PktSource.h" + +#if 0 +/* + * XXX eww, using pointers rather than references. + */ +void +plotSet(QwtPlot *p, PktLogData *pl) +{ + QwtPlotCurve *c = new QwtPlotCurve("curve"); + QwtSymbol *s = new QwtSymbol(); + std::vector dur; + std::vector rssi; + + // The default is a single 1 pixel dot. + // This makes it very difficult to see. + s->setStyle(QwtSymbol::Cross); + s->setSize(2, 2); + + p->setTitle("Example"); + + //p->setAutoLegend(true); + //p->setLegendPos(Qwt::Bottom); + + // Curve Plot - dots, == scatterplot + c->setStyle(QwtPlotCurve::Dots); + // And set the symbol type, a default dot is not really + // all that helpful. + c->setSymbol(s); + + /* Load in values */ + dur = pl->GetDuration(); + rssi = pl->GetRssi(); +// for (int i = 0; i < dur.size(); i++) +// printf("%d: dur=%f, rssi=%f\n", i, dur[i], rssi[i]); + + printf("dur size=%d, rssi size=%d\n", dur.size(), rssi.size()); + + // Plot them + c->setSamples(&dur[0], &rssi[0], dur.size()); + c->attach(p); + + /* Plot */ + p->replot(); + p->show(); +} +#endif + +// + +static void +usage() +{ + printf("usage: \n"); + exit(127); +} + +int +main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + PktSource ps; + MainApp m; + + int type = 0; + + if (argc < 3) + usage(); + + if (strcmp(argv[1], "ar5416")== 0) + type = CHIP_AR5416; + else if (strcmp(argv[1], "ar9280")== 0) + type = CHIP_AR9280; + else + usage(); + + // Connect the ps source -> mainapp handler + QObject::connect(&ps, SIGNAL(emitRadarEntry(struct radar_entry)), + &m, SLOT(getRadarEntry(struct radar_entry))); + + // Now that it's connected, begin firing off events + // by opening a file + if (ps.Load(argv[2]) == false) { + err(1, "open"); + } + +#if 0 + pr.LoadPcapOffline(argv[2], type); + + QwtPlot plot(QwtText("example")); + + // Default size + plot.setGeometry(0, 0, 640, 400); + + // Scale + plot.setAxisScale(QwtPlot::xBottom, 0.0, 256.0); + + plotSet(&plot, &pr); +#endif + + // Show main application window + m.show(); + + return a.exec(); +} Added: user/adrian/ath_radar_stuff/src/qt-hpktlog/qt-hpktlog.pro ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/adrian/ath_radar_stuff/src/qt-hpktlog/qt-hpktlog.pro Fri Jun 22 07:53:41 2012 (r237437) @@ -0,0 +1,14 @@ +###################################################################### +# Automatically generated by qmake (2.01a) Tue Feb 14 14:16:07 2012 +###################################################################### + +TEMPLATE = app +TARGET = +DEPENDPATH += . +INCLUDEPATH += . ../../lib/ /usr/local/include/qt4 /usr/local/include/qwt6 +LIBS+= -L../../lib/libradarpkt -lpcap -lradarpkt -lqwt6 + +# Input +HEADERS += MainApp.h PktSource.h +# FORMS += PlotWindow.ui MainWindow.ui +SOURCES += MainApp.cpp PktSource.cpp main.cpp From owner-svn-src-user@FreeBSD.ORG Fri Jun 22 07:53:51 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9A10C10656A3; Fri, 22 Jun 2012 07:53:51 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8624C8FC25; Fri, 22 Jun 2012 07:53:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5M7rp9B064944; Fri, 22 Jun 2012 07:53:51 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5M7rpW5064941; Fri, 22 Jun 2012 07:53:51 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206220753.q5M7rpW5064941@svn.freebsd.org> From: Adrian Chadd Date: Fri, 22 Jun 2012 07:53:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237438 - user/adrian/ath_radar_stuff/src/pktlog X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 07:53:51 -0000 Author: adrian Date: Fri Jun 22 07:53:51 2012 New Revision: 237438 URL: http://svn.freebsd.org/changeset/base/237438 Log: Print the packet! Modified: user/adrian/ath_radar_stuff/src/pktlog/main.c Modified: user/adrian/ath_radar_stuff/src/pktlog/main.c ============================================================================== --- user/adrian/ath_radar_stuff/src/pktlog/main.c Fri Jun 22 07:53:41 2012 (r237437) +++ user/adrian/ath_radar_stuff/src/pktlog/main.c Fri Jun 22 07:53:51 2012 (r237438) @@ -94,7 +94,7 @@ pkt_handle(int chip, const char *pkt, in /* * TODO: Print the summary record */ - //pkt_print(&re); + pkt_print(&re); } static pcap_t * From owner-svn-src-user@FreeBSD.ORG Fri Jun 22 12:15:39 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0CF98106566B; Fri, 22 Jun 2012 12:15:39 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D38EA8FC14; Fri, 22 Jun 2012 12:15:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5MCFcEY077622; Fri, 22 Jun 2012 12:15:38 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5MCFcNs077621; Fri, 22 Jun 2012 12:15:38 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201206221215.q5MCFcNs077621@svn.freebsd.org> From: Peter Holm Date: Fri, 22 Jun 2012 12:15:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237441 - user/pho/stress2/misc X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 12:15:39 -0000 Author: pho Date: Fri Jun 22 12:15:38 2012 New Revision: 237441 URL: http://svn.freebsd.org/changeset/base/237441 Log: Added missing x bit to script. Modified: Directory Properties: user/pho/stress2/misc/ext2fs.sh (props changed) From owner-svn-src-user@FreeBSD.ORG Fri Jun 22 22:45:35 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D6F681065670; Fri, 22 Jun 2012 22:45:35 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 867238FC17; Fri, 22 Jun 2012 22:45:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5MMjZdn004617; Fri, 22 Jun 2012 22:45:35 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5MMjZ05004615; Fri, 22 Jun 2012 22:45:35 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201206222245.q5MMjZ05004615@svn.freebsd.org> From: Attilio Rao Date: Fri, 22 Jun 2012 22:45:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237461 - user/attilio/vmcontention/sys/vm X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 22:45:36 -0000 Author: attilio Date: Fri Jun 22 22:45:34 2012 New Revision: 237461 URL: http://svn.freebsd.org/changeset/base/237461 Log: Fix a bug where the start address is not correctly pointing to the "next" index, scanning 2 times in a row the same object. This was hidden because when cache and resident tries are merged together there is a check to skip different objects in all the vm_radix_lookupn() usages, in order to fix a race with RED nodes. Modified: user/attilio/vmcontention/sys/vm/vm_radix.c Modified: user/attilio/vmcontention/sys/vm/vm_radix.c ============================================================================== --- user/attilio/vmcontention/sys/vm/vm_radix.c Fri Jun 22 21:46:41 2012 (r237460) +++ user/attilio/vmcontention/sys/vm/vm_radix.c Fri Jun 22 22:45:34 2012 (r237461) @@ -768,9 +768,8 @@ vm_radix_lookupn(struct vm_radix *rtree, "lookupn: tree %p " KFRMT64(index) " slot %d found child %p", rtree, KSPLT64L(start), KSPLT64H(start), slot, val); out[outidx] = val; - if (++outidx == cnt) - goto out; - if ((VM_RADIX_MAXVAL - start) == 0) { + if (++outidx == cnt || + (VM_RADIX_MAXVAL - start) == 0) { start++; goto out; } From owner-svn-src-user@FreeBSD.ORG Fri Jun 22 22:50:50 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E0733106564A; Fri, 22 Jun 2012 22:50:50 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CA5DC8FC0A; Fri, 22 Jun 2012 22:50:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5MMoock004860; Fri, 22 Jun 2012 22:50:50 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5MMooJN004853; Fri, 22 Jun 2012 22:50:50 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206222250.q5MMooJN004853@svn.freebsd.org> From: Adrian Chadd Date: Fri, 22 Jun 2012 22:50:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237462 - user/adrian/ath_radar_stuff/src/qt-hpktlog X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 22:50:51 -0000 Author: adrian Date: Fri Jun 22 22:50:50 2012 New Revision: 237462 URL: http://svn.freebsd.org/changeset/base/237462 Log: Flesh out some basic 'live' pcap support. * Add a new method to pktsource that opens a live pcap handle and sets it to non blocking; * Correct handle the "nothing available at the moment" case from pcap rather than just erroring out. TODO: * I should create derived classes of PktSource; * I should support non-blocking socket notification of the pcap socket, as well as having an occasional "check and flush" timer. * I am only handling one event every 2ms, which is just plain stupid; I should handle all the events from pcap when in live mode, rather than only one. * I'm still rendering it on each received event, whichi is also plain stupid. Modified: user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.cpp user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.h user/adrian/ath_radar_stuff/src/qt-hpktlog/Makefile user/adrian/ath_radar_stuff/src/qt-hpktlog/PktSource.cpp user/adrian/ath_radar_stuff/src/qt-hpktlog/PktSource.h user/adrian/ath_radar_stuff/src/qt-hpktlog/main.cpp Modified: user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.cpp ============================================================================== --- user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.cpp Fri Jun 22 22:45:34 2012 (r237461) +++ user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.cpp Fri Jun 22 22:50:50 2012 (r237462) @@ -26,7 +26,7 @@ MainApp::MainApp(QMainWindow *parent) // Scale // y-scale? q_plot->setAxisScale(QwtPlot::xBottom, 0.0, 256.0); - q_plot->setAxisScale(QwtPlot::yLeft, -128.0, 128.0); + q_plot->setAxisScale(QwtPlot::yLeft, -16.0, 80.0); // The default is a single 1 pixel dot. // This makes it very difficult to see. @@ -89,3 +89,9 @@ MainApp::RePlot() q_plot->replot(); q_plot->show(); } + +void +MainApp::timerEvent(QTimerEvent *event) +{ + +} Modified: user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.h ============================================================================== --- user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.h Fri Jun 22 22:45:34 2012 (r237461) +++ user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.h Fri Jun 22 22:50:50 2012 (r237462) @@ -33,11 +33,22 @@ class MainApp : public QMainWindow std::vector q_dur; std::vector q_rssi; + // TODO When rendering the screen, we only want to do it + // every say, 3ms. + public: MainApp(QMainWindow *parent = 0); ~MainApp(); + + // Replot the screen. This does the actual work of + // taking the current set of dur/rssi values and plotting + // them. + + // It doesn't do any pacing of the rendering requests. void RePlot(); + void timerEvent(QTimerEvent *event); + public slots: void getRadarEntry(struct radar_entry re); Modified: user/adrian/ath_radar_stuff/src/qt-hpktlog/Makefile ============================================================================== --- user/adrian/ath_radar_stuff/src/qt-hpktlog/Makefile Fri Jun 22 22:45:34 2012 (r237461) +++ user/adrian/ath_radar_stuff/src/qt-hpktlog/Makefile Fri Jun 22 22:50:50 2012 (r237462) @@ -1,6 +1,6 @@ ############################################################################# # Makefile for building: qt-hpktlog -# Generated by qmake (2.01a) (Qt 4.7.4) on: Fri Jun 22 00:53:09 2012 +# Generated by qmake (2.01a) (Qt 4.7.4) on: Fri Jun 22 14:06:40 2012 # Project: qt-hpktlog.pro # Template: app # Command: /usr/local/bin/qmake-qt4 -o Makefile qt-hpktlog.pro Modified: user/adrian/ath_radar_stuff/src/qt-hpktlog/PktSource.cpp ============================================================================== --- user/adrian/ath_radar_stuff/src/qt-hpktlog/PktSource.cpp Fri Jun 22 22:45:34 2012 (r237461) +++ user/adrian/ath_radar_stuff/src/qt-hpktlog/PktSource.cpp Fri Jun 22 22:50:50 2012 (r237462) @@ -1,6 +1,7 @@ #include #include +#include #include "net80211/ieee80211_radiotap.h" @@ -8,6 +9,12 @@ #include "libradarpkt/pkt.h" #include "libradarpkt/ar5416_radar.h" +#include "libradarpkt/ar9280_radar.h" + +// +// This particular class _should_ just be a base class that +// a couple of derivates use for the live versus load stuff. +// So yes, I should do that. PktSource::~PktSource() { @@ -37,6 +44,65 @@ PktSource::Load(const char *filename) return (true); } +#define PKTRULE "radio[73] == 0x2 && (radio[72] == 5 || radio[72] == 24)" + +bool +PktSource::OpenLive(const char *ifname) +{ + char errbuf[PCAP_ERRBUF_SIZE]; + struct bpf_program fp; + + this->Close(); + + PcapHdl = pcap_open_live(ifname, 65536, 1, 1000, errbuf); + if (! PcapHdl) { + err(1, "pcap_create: %s\n", errbuf); + return (false); + } + + if (pcap_set_datalink(PcapHdl, DLT_IEEE802_11_RADIO) != 0) { + pcap_perror(PcapHdl, (char *) "pcap_set_datalink"); + return (false); + } + + /* XXX pcap_is_swapped() ? */ + + if (pcap_compile(PcapHdl, &fp, PKTRULE, 1, 0) != 0) { + pcap_perror(PcapHdl, (char *) "pkg_compile compile error\n"); + this->Close(); + return (false); + } + + if (pcap_setfilter(PcapHdl, &fp) != 0) { + pcap_perror(PcapHdl, (char *) "pcap_setfilter error\n"); + this->Close(); + return (false); + } + + // Register a timer event _and_ make the socket non-blocking. + if (pcap_setnonblock(PcapHdl, 1, errbuf) == -1) { + pcap_perror(PcapHdl, (char *) "pcap_set_nonblock error\n"); + this->Close(); + return (false); + } + + // For now, we'll just do a 2ms check to see what's going on. + // Eventually we'll do a 1s timer event to flush the queue + // _and_ do non-blocking IO via QT. + + // TODO: turn this into a method + if (timerId != -1) + killTimer(timerId); + + //Kick-start the first timer! + timerId = startTimer(2); + + return (true); + +} + +#undef PKTRULE + void PktSource::Close() { @@ -64,9 +130,7 @@ PktSource::timerEvent(QTimerEvent *event r = pcap_next_ex(PcapHdl, &hdr, &pkt); // Error? Delete the timer. - // TODO: this should handle the "error/EOF" versus "none just for now, - // but more are coming" errors correctly! - if (r <= 0) { + if (r < 0) { killTimer(timerId); timerId = -1; printf("%s: final event (r=%d), finish timer!\n", @@ -76,6 +140,11 @@ PktSource::timerEvent(QTimerEvent *event return; } + // Nothing available? Just skip + if (r == 0) { + return; + } + rt = (struct ieee80211_radiotap_header *) pkt; if (rt->it_version != 0) { printf("%s: unknown version (%d)\n", @@ -85,10 +154,22 @@ PktSource::timerEvent(QTimerEvent *event } // TODO: just assume AR5416 for now.. - r = ar5416_radar_decode(rt, - (pkt + le16toh(rt->it_len)), - hdr->caplen - le16toh(rt->it_len), &re); - + switch (chipid) { + case CHIP_AR5416: + r = ar5416_radar_decode(rt, + (pkt + le16toh(rt->it_len)), + hdr->caplen - le16toh(rt->it_len), &re); + break; + case CHIP_AR9280: + r = ar9280_radar_decode(rt, + (pkt + le16toh(rt->it_len)), + hdr->caplen - le16toh(rt->it_len), &re); + break; + default: + printf("%s: unknown chip id? (%d)\n", + __func__, + chipid); + } // Error? Just wait for the next one? if (r == 0) { printf("%s: parse failed\n", __func__); Modified: user/adrian/ath_radar_stuff/src/qt-hpktlog/PktSource.h ============================================================================== --- user/adrian/ath_radar_stuff/src/qt-hpktlog/PktSource.h Fri Jun 22 22:45:34 2012 (r237461) +++ user/adrian/ath_radar_stuff/src/qt-hpktlog/PktSource.h Fri Jun 22 22:50:50 2012 (r237462) @@ -26,11 +26,15 @@ class PktSource : public QObject { private: pcap_t *PcapHdl; int timerId; + int chipid; public: - PktSource() : PcapHdl(NULL), timerId(-1) { }; + PktSource() : PcapHdl(NULL), timerId(-1), chipid(0) { }; ~PktSource(); + void SetChipId(int chip_id) { chipid = chip_id; }; + int GetChipId() { return (chipid); }; bool Load(const char *filename); + bool OpenLive(const char *ifname); void Close(); signals: Modified: user/adrian/ath_radar_stuff/src/qt-hpktlog/main.cpp ============================================================================== --- user/adrian/ath_radar_stuff/src/qt-hpktlog/main.cpp Fri Jun 22 22:45:34 2012 (r237461) +++ user/adrian/ath_radar_stuff/src/qt-hpktlog/main.cpp Fri Jun 22 22:50:50 2012 (r237462) @@ -92,13 +92,16 @@ main(int argc, char *argv[]) else usage(); + // Ensure the chip is correct + ps.SetChipId(type); + // Connect the ps source -> mainapp handler QObject::connect(&ps, SIGNAL(emitRadarEntry(struct radar_entry)), &m, SLOT(getRadarEntry(struct radar_entry))); // Now that it's connected, begin firing off events // by opening a file - if (ps.Load(argv[2]) == false) { + if (ps.OpenLive(argv[2]) == false) { err(1, "open"); } From owner-svn-src-user@FreeBSD.ORG Sat Jun 23 01:08:47 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 43695106564A; Sat, 23 Jun 2012 01:08:47 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2ECFF8FC0A; Sat, 23 Jun 2012 01:08:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5N18l9M010598; Sat, 23 Jun 2012 01:08:47 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5N18kRg010595; Sat, 23 Jun 2012 01:08:46 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201206230108.q5N18kRg010595@svn.freebsd.org> From: Attilio Rao Date: Sat, 23 Jun 2012 01:08:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237465 - user/attilio/vmcontention/sys/vm X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 01:08:47 -0000 Author: attilio Date: Sat Jun 23 01:08:46 2012 New Revision: 237465 URL: http://svn.freebsd.org/changeset/base/237465 Log: Restart the scan from the busy page rather than 0. Modified: user/attilio/vmcontention/sys/vm/vm_object.c Modified: user/attilio/vmcontention/sys/vm/vm_object.c ============================================================================== --- user/attilio/vmcontention/sys/vm/vm_object.c Sat Jun 23 00:37:32 2012 (r237464) +++ user/attilio/vmcontention/sys/vm/vm_object.c Sat Jun 23 01:08:46 2012 (r237465) @@ -1972,7 +1972,7 @@ restart: continue; } if (vm_page_sleep_if_busy(p, TRUE, "vmopar")) { - start = 0; + start = p->pindex; goto restart; } KASSERT((p->flags & PG_FICTITIOUS) == 0, From owner-svn-src-user@FreeBSD.ORG Sat Jun 23 01:30:52 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5BBE7106566B; Sat, 23 Jun 2012 01:30:52 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 44B5A8FC0A; Sat, 23 Jun 2012 01:30:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5N1Uqqg011523; Sat, 23 Jun 2012 01:30:52 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5N1Uqij011519; Sat, 23 Jun 2012 01:30:52 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201206230130.q5N1Uqij011519@svn.freebsd.org> From: Attilio Rao Date: Sat, 23 Jun 2012 01:30:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237466 - user/attilio/vmcontention/sys/vm X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 01:30:52 -0000 Author: attilio Date: Sat Jun 23 01:30:51 2012 New Revision: 237466 URL: http://svn.freebsd.org/changeset/base/237466 Log: Give vm_radix_lookupn() a way to specify that the whole range has been exhausted while searching and when a "maximum" value is passed as end (or end == 0). This allow for avoiding starting address overflow while searching through and avoids livelock with "start" wrapping up to "end". Reported by: pho (supposedly) Modified: user/attilio/vmcontention/sys/vm/vm_object.c user/attilio/vmcontention/sys/vm/vm_radix.c user/attilio/vmcontention/sys/vm/vm_radix.h Modified: user/attilio/vmcontention/sys/vm/vm_object.c ============================================================================== --- user/attilio/vmcontention/sys/vm/vm_object.c Sat Jun 23 01:08:46 2012 (r237465) +++ user/attilio/vmcontention/sys/vm/vm_object.c Sat Jun 23 01:30:51 2012 (r237466) @@ -679,6 +679,7 @@ vm_object_terminate(vm_object_t object) vm_page_t pa[VM_RADIX_STACK]; vm_page_t p; vm_pindex_t start; + u_int exhausted; int n, i; VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); @@ -725,8 +726,10 @@ vm_object_terminate(vm_object_t object) * the object, the page and object are reset to any empty state. */ start = 0; - while ((n = vm_radix_lookupn(&object->rtree, start, 0, VM_RADIX_ANY, - (void **)pa, VM_RADIX_STACK, &start)) != 0) { + exhausted = 0; + while (exhausted == 0 && (n = vm_radix_lookupn(&object->rtree, start, + 0, VM_RADIX_ANY, (void **)pa, VM_RADIX_STACK, &start, + &exhausted)) != 0) { for (i = 0; i < n; i++) { p = pa[i]; /* @@ -1315,6 +1318,7 @@ vm_object_split(vm_map_entry_t entry) vm_object_t orig_object, new_object, source; vm_pindex_t idx, offidxstart, start; vm_size_t size; + u_int exhausted; int i, n; orig_object = entry->object.vm_object; @@ -1370,9 +1374,10 @@ vm_object_split(vm_map_entry_t entry) } start = offidxstart; retry: - while ((n = vm_radix_lookupn(&orig_object->rtree, start, - offidxstart + size, VM_RADIX_ANY, (void **)ma, VM_RADIX_STACK, - &start)) != 0) { + exhausted = 0; + while (exhausted == 0 && (n = vm_radix_lookupn(&orig_object->rtree, + start, offidxstart + size, VM_RADIX_ANY, (void **)ma, + VM_RADIX_STACK, &start, &exhausted)) != 0) { for (i = 0; i < n; i++) { m = ma[i]; idx = m->pindex - offidxstart; @@ -1457,6 +1462,7 @@ vm_object_backing_scan(vm_object_t objec vm_object_t backing_object; vm_pindex_t backing_offset_index, new_pindex; vm_pindex_t start; + u_int exhausted; int color, i, n; int r = 1; @@ -1495,13 +1501,15 @@ vm_object_backing_scan(vm_object_t objec restart: start = 0; i = n = VM_RADIX_STACK; + exhausted = 0; for (;;) { if (i == n) { if (n < VM_RADIX_STACK) break; - if ((n = vm_radix_lookupn(&backing_object->rtree, + if (exhausted != 0 && + (n = vm_radix_lookupn(&backing_object->rtree, start, 0, color, (void **)pa, VM_RADIX_STACK, - &start)) == 0) + &start, &exhausted)) == 0) break; i = 0; } @@ -1909,6 +1917,7 @@ vm_object_page_remove(vm_object_t object struct vnode *vp; vm_page_t pa[VM_RADIX_STACK]; vm_page_t p; + u_int exhausted; int i, n; int wirings; @@ -1921,8 +1930,10 @@ vm_object_page_remove(vm_object_t object vp = NULL; vm_object_pip_add(object, 1); restart: - while ((n = vm_radix_lookupn(&object->rtree, start, end, VM_RADIX_ANY, - (void **)pa, VM_RADIX_STACK, &start)) != 0) { + exhausted = 0; + while (exhausted == 0 && (n = vm_radix_lookupn(&object->rtree, start, + end, VM_RADIX_ANY, (void **)pa, VM_RADIX_STACK, &start, + &exhausted)) != 0) { for (i = 0; i < n; i++) { p = pa[i]; /* Modified: user/attilio/vmcontention/sys/vm/vm_radix.c ============================================================================== --- user/attilio/vmcontention/sys/vm/vm_radix.c Sat Jun 23 01:08:46 2012 (r237465) +++ user/attilio/vmcontention/sys/vm/vm_radix.c Sat Jun 23 01:30:51 2012 (r237466) @@ -726,7 +726,8 @@ out: */ int vm_radix_lookupn(struct vm_radix *rtree, vm_pindex_t start, - vm_pindex_t end, int color, void **out, int cnt, vm_pindex_t *next) + vm_pindex_t end, int color, void **out, int cnt, vm_pindex_t *next, + u_int *exhausted) { struct vm_radix_node *rnode; void *val; @@ -736,6 +737,8 @@ vm_radix_lookupn(struct vm_radix *rtree, CTR5(KTR_VM, "lookupn: tree %p, " KFRMT64(start) ", " KFRMT64(end), rtree, KSPLT64L(start), KSPLT64H(start), KSPLT64L(end), KSPLT64H(end)); + if (end == 0) + *exhausted = 0; if (rtree->rt_root == 0) return (0); outidx = 0; @@ -760,6 +763,8 @@ vm_radix_lookupn(struct vm_radix *rtree, */ if ((VM_RADIX_MAXVAL - start) == 0) { start++; + if (end == 0) + *exhausted = 1; goto out; } continue; @@ -771,6 +776,8 @@ vm_radix_lookupn(struct vm_radix *rtree, if (++outidx == cnt || (VM_RADIX_MAXVAL - start) == 0) { start++; + if (end == 0) + *exhausted = 1; goto out; } } Modified: user/attilio/vmcontention/sys/vm/vm_radix.h ============================================================================== --- user/attilio/vmcontention/sys/vm/vm_radix.h Sat Jun 23 01:08:46 2012 (r237465) +++ user/attilio/vmcontention/sys/vm/vm_radix.h Sat Jun 23 01:30:51 2012 (r237466) @@ -60,7 +60,7 @@ int vm_radix_insert(struct vm_radix *, void *vm_radix_color(struct vm_radix *, vm_pindex_t, int); void *vm_radix_lookup(struct vm_radix *, vm_pindex_t, int); int vm_radix_lookupn(struct vm_radix *, vm_pindex_t, vm_pindex_t, int, - void **, int, vm_pindex_t *); + void **, int, vm_pindex_t *, u_int *); void *vm_radix_lookup_le(struct vm_radix *, vm_pindex_t, int); void vm_radix_reclaim_allnodes(struct vm_radix *); void vm_radix_remove(struct vm_radix *, vm_pindex_t, int); @@ -72,8 +72,9 @@ static inline void * vm_radix_lookup_ge(struct vm_radix *rtree, vm_pindex_t index, int color) { void *val; + u_int dummy; - if (vm_radix_lookupn(rtree, index, 0, color, &val, 1, &index)) + if (vm_radix_lookupn(rtree, index, 0, color, &val, 1, &index, &dummy)) return (val); return (NULL); } From owner-svn-src-user@FreeBSD.ORG Sat Jun 23 02:08:16 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D987E106566B; Sat, 23 Jun 2012 02:08:16 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BFF888FC14; Sat, 23 Jun 2012 02:08:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5N28G47013174; Sat, 23 Jun 2012 02:08:16 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5N28GEO013136; Sat, 23 Jun 2012 02:08:16 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201206230208.q5N28GEO013136@svn.freebsd.org> From: Attilio Rao Date: Sat, 23 Jun 2012 02:08:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237467 - in user/attilio/vmcontention: bin/rm contrib/bsnmp/lib contrib/bsnmp/snmp_target contrib/bsnmp/snmp_usm contrib/bsnmp/snmp_vacm contrib/gcc contrib/telnet/telnet etc etc/mtree... X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 02:08:17 -0000 Author: attilio Date: Sat Jun 23 02:08:15 2012 New Revision: 237467 URL: http://svn.freebsd.org/changeset/base/237467 Log: MFC Added: user/attilio/vmcontention/lib/libc/amd64/sys/__vdso_gettc.c - copied unchanged from r237466, head/lib/libc/amd64/sys/__vdso_gettc.c user/attilio/vmcontention/lib/libc/i386/sys/__vdso_gettc.c - copied unchanged from r237466, head/lib/libc/i386/sys/__vdso_gettc.c user/attilio/vmcontention/lib/libc/sys/__vdso_gettimeofday.c - copied unchanged from r237466, head/lib/libc/sys/__vdso_gettimeofday.c user/attilio/vmcontention/lib/libc/sys/clock_gettime.c - copied unchanged from r237466, head/lib/libc/sys/clock_gettime.c user/attilio/vmcontention/lib/libc/sys/gettimeofday.c - copied unchanged from r237466, head/lib/libc/sys/gettimeofday.c user/attilio/vmcontention/lib/libz/test/ - copied from r237466, head/lib/libz/test/ user/attilio/vmcontention/sbin/camcontrol/progress.c - copied unchanged from r237466, head/sbin/camcontrol/progress.c user/attilio/vmcontention/sbin/camcontrol/progress.h - copied unchanged from r237466, head/sbin/camcontrol/progress.h user/attilio/vmcontention/share/man/man4/est.4 - copied unchanged from r237466, head/share/man/man4/est.4 user/attilio/vmcontention/sys/amd64/include/vdso.h - copied unchanged from r237466, head/sys/amd64/include/vdso.h user/attilio/vmcontention/sys/arm/include/vdso.h - copied unchanged from r237466, head/sys/arm/include/vdso.h user/attilio/vmcontention/sys/contrib/dev/acpica/common/ahpredef.c - copied unchanged from r237466, head/sys/contrib/dev/acpica/common/ahpredef.c user/attilio/vmcontention/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_ib_intfc.h - copied unchanged from r237466, head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_ib_intfc.h user/attilio/vmcontention/sys/dev/cxgbe/tom/ - copied from r237466, head/sys/dev/cxgbe/tom/ user/attilio/vmcontention/sys/i386/include/vdso.h - copied unchanged from r237466, head/sys/i386/include/vdso.h user/attilio/vmcontention/sys/ia64/include/vdso.h - copied unchanged from r237466, head/sys/ia64/include/vdso.h user/attilio/vmcontention/sys/kern/subr_dummy_vdso_tc.c - copied unchanged from r237466, head/sys/kern/subr_dummy_vdso_tc.c user/attilio/vmcontention/sys/mips/include/vdso.h - copied unchanged from r237466, head/sys/mips/include/vdso.h user/attilio/vmcontention/sys/modules/cxgbe/tom/ - copied from r237466, head/sys/modules/cxgbe/tom/ user/attilio/vmcontention/sys/modules/toecore/ - copied from r237466, head/sys/modules/toecore/ user/attilio/vmcontention/sys/netinet/toecore.c - copied unchanged from r237466, head/sys/netinet/toecore.c user/attilio/vmcontention/sys/netinet/toecore.h - copied unchanged from r237466, head/sys/netinet/toecore.h user/attilio/vmcontention/sys/pc98/include/vdso.h - copied unchanged from r237466, head/sys/pc98/include/vdso.h user/attilio/vmcontention/sys/powerpc/include/vdso.h - copied unchanged from r237466, head/sys/powerpc/include/vdso.h user/attilio/vmcontention/sys/sparc64/include/vdso.h - copied unchanged from r237466, head/sys/sparc64/include/vdso.h user/attilio/vmcontention/sys/sys/vdso.h - copied unchanged from r237466, head/sys/sys/vdso.h user/attilio/vmcontention/sys/x86/include/vdso.h - copied unchanged from r237466, head/sys/x86/include/vdso.h Deleted: user/attilio/vmcontention/lib/libz/example.c user/attilio/vmcontention/lib/libz/minigzip.c user/attilio/vmcontention/sys/dev/cxgb/cxgb_offload.c user/attilio/vmcontention/sys/dev/cxgb/t3cdev.h user/attilio/vmcontention/sys/dev/cxgb/ulp/toecore/ user/attilio/vmcontention/sys/dev/cxgb/ulp/tom/cxgb_cpl_socket.c user/attilio/vmcontention/sys/dev/cxgb/ulp/tom/cxgb_ddp.c user/attilio/vmcontention/sys/dev/cxgb/ulp/tom/cxgb_defs.h user/attilio/vmcontention/sys/dev/cxgb/ulp/tom/cxgb_t3_ddp.h user/attilio/vmcontention/sys/dev/cxgb/ulp/tom/cxgb_tcp.h user/attilio/vmcontention/sys/dev/cxgb/ulp/tom/cxgb_tcp_offload.c user/attilio/vmcontention/sys/dev/cxgb/ulp/tom/cxgb_tcp_offload.h user/attilio/vmcontention/sys/dev/cxgb/ulp/tom/cxgb_tom_sysctl.c user/attilio/vmcontention/sys/modules/cxgb/toecore/ user/attilio/vmcontention/sys/netinet/toedev.h Modified: user/attilio/vmcontention/bin/rm/rm.c user/attilio/vmcontention/contrib/bsnmp/lib/bsnmpclient.3 user/attilio/vmcontention/contrib/bsnmp/lib/bsnmplib.3 user/attilio/vmcontention/contrib/bsnmp/snmp_target/snmp_target.3 user/attilio/vmcontention/contrib/bsnmp/snmp_usm/snmp_usm.3 user/attilio/vmcontention/contrib/bsnmp/snmp_vacm/snmp_vacm.3 user/attilio/vmcontention/contrib/gcc/ChangeLog.gcc43 user/attilio/vmcontention/contrib/gcc/fold-const.c user/attilio/vmcontention/contrib/gcc/gimplify.c user/attilio/vmcontention/contrib/gcc/tree-ssa-ccp.c user/attilio/vmcontention/contrib/gcc/tree-ssa-pre.c user/attilio/vmcontention/contrib/telnet/telnet/telnet.1 user/attilio/vmcontention/etc/login.conf user/attilio/vmcontention/etc/mtree/BSD.include.dist user/attilio/vmcontention/etc/periodic/daily/400.status-disks user/attilio/vmcontention/include/Makefile user/attilio/vmcontention/lib/libc/amd64/sys/Makefile.inc user/attilio/vmcontention/lib/libc/gen/aux.c user/attilio/vmcontention/lib/libc/gen/syslog.c user/attilio/vmcontention/lib/libc/i386/sys/Makefile.inc user/attilio/vmcontention/lib/libc/include/libc_private.h user/attilio/vmcontention/lib/libc/net/Makefile.inc user/attilio/vmcontention/lib/libc/stdtime/strftime.c user/attilio/vmcontention/lib/libc/string/Makefile.inc user/attilio/vmcontention/lib/libc/string/strcasecmp.3 user/attilio/vmcontention/lib/libc/string/strcoll.3 user/attilio/vmcontention/lib/libc/string/strstr.3 user/attilio/vmcontention/lib/libc/string/strxfrm.3 user/attilio/vmcontention/lib/libc/sys/Makefile.inc user/attilio/vmcontention/lib/libc/sys/posix_fadvise.2 user/attilio/vmcontention/lib/libedit/common.c user/attilio/vmcontention/lib/libedit/editline.3 user/attilio/vmcontention/lib/libedit/editrc.5 user/attilio/vmcontention/lib/libedit/el.c user/attilio/vmcontention/lib/libedit/el.h user/attilio/vmcontention/lib/libedit/histedit.h user/attilio/vmcontention/lib/libedit/history.c user/attilio/vmcontention/lib/libedit/key.c user/attilio/vmcontention/lib/libedit/key.h user/attilio/vmcontention/lib/libedit/prompt.c user/attilio/vmcontention/lib/libedit/prompt.h user/attilio/vmcontention/lib/libedit/read.c user/attilio/vmcontention/lib/libedit/refresh.c user/attilio/vmcontention/lib/libedit/search.c user/attilio/vmcontention/lib/libedit/sig.c user/attilio/vmcontention/lib/libedit/sig.h user/attilio/vmcontention/lib/libedit/term.c user/attilio/vmcontention/lib/libedit/term.h user/attilio/vmcontention/lib/libedit/tty.c user/attilio/vmcontention/lib/libedit/vi.c user/attilio/vmcontention/lib/libstand/Makefile user/attilio/vmcontention/lib/libutil/login.conf.5 user/attilio/vmcontention/lib/libutil/pw_util.c user/attilio/vmcontention/lib/libz/ChangeLog user/attilio/vmcontention/lib/libz/FAQ user/attilio/vmcontention/lib/libz/FREEBSD-upgrade (contents, props changed) user/attilio/vmcontention/lib/libz/Makefile (contents, props changed) user/attilio/vmcontention/lib/libz/README user/attilio/vmcontention/lib/libz/Symbol.map (contents, props changed) user/attilio/vmcontention/lib/libz/Versions.def (contents, props changed) user/attilio/vmcontention/lib/libz/adler32.c user/attilio/vmcontention/lib/libz/contrib/asm686/match.S (contents, props changed) user/attilio/vmcontention/lib/libz/crc32.c user/attilio/vmcontention/lib/libz/crc32.h user/attilio/vmcontention/lib/libz/deflate.c user/attilio/vmcontention/lib/libz/deflate.h user/attilio/vmcontention/lib/libz/doc/algorithm.txt (contents, props changed) user/attilio/vmcontention/lib/libz/gzguts.h (contents, props changed) user/attilio/vmcontention/lib/libz/gzlib.c user/attilio/vmcontention/lib/libz/gzread.c user/attilio/vmcontention/lib/libz/gzwrite.c user/attilio/vmcontention/lib/libz/infback.c user/attilio/vmcontention/lib/libz/inffixed.h user/attilio/vmcontention/lib/libz/inflate.c user/attilio/vmcontention/lib/libz/inftrees.c user/attilio/vmcontention/lib/libz/trees.c user/attilio/vmcontention/lib/libz/zconf.h user/attilio/vmcontention/lib/libz/zlib.3 user/attilio/vmcontention/lib/libz/zlib.h user/attilio/vmcontention/lib/libz/zopen.c (contents, props changed) user/attilio/vmcontention/lib/libz/zutil.c user/attilio/vmcontention/lib/libz/zutil.h user/attilio/vmcontention/sbin/camcontrol/Makefile user/attilio/vmcontention/sbin/camcontrol/camcontrol.8 user/attilio/vmcontention/sbin/camcontrol/camcontrol.c user/attilio/vmcontention/sbin/camcontrol/camcontrol.h user/attilio/vmcontention/sbin/camcontrol/fwdownload.c user/attilio/vmcontention/sbin/ifconfig/ifconfig.c user/attilio/vmcontention/share/man/man4/Makefile user/attilio/vmcontention/share/man/man4/ahci.4 user/attilio/vmcontention/share/man/man4/ata.4 user/attilio/vmcontention/share/man/man4/cpufreq.4 user/attilio/vmcontention/share/man/man4/hptrr.4 user/attilio/vmcontention/share/man/man4/ng_netflow.4 user/attilio/vmcontention/sys/amd64/amd64/pmap.c user/attilio/vmcontention/sys/amd64/amd64/trap.c user/attilio/vmcontention/sys/amd64/conf/GENERIC user/attilio/vmcontention/sys/amd64/include/elf.h user/attilio/vmcontention/sys/amd64/include/pmap.h user/attilio/vmcontention/sys/arm/at91/at91_machdep.c user/attilio/vmcontention/sys/arm/at91/at91_spi.c user/attilio/vmcontention/sys/arm/at91/at91_twi.c user/attilio/vmcontention/sys/arm/at91/at91reg.h user/attilio/vmcontention/sys/arm/at91/at91sam9260.c user/attilio/vmcontention/sys/arm/include/elf.h user/attilio/vmcontention/sys/arm/include/pmap.h user/attilio/vmcontention/sys/boot/common/load_elf.c user/attilio/vmcontention/sys/boot/common/load_elf_obj.c user/attilio/vmcontention/sys/boot/userboot/libstand/Makefile user/attilio/vmcontention/sys/cam/cam_periph.c user/attilio/vmcontention/sys/cam/cam_xpt.c user/attilio/vmcontention/sys/cam/cam_xpt_periph.h user/attilio/vmcontention/sys/cam/scsi/scsi_cd.c user/attilio/vmcontention/sys/cam/scsi/scsi_da.c user/attilio/vmcontention/sys/cam/scsi/scsi_da.h user/attilio/vmcontention/sys/cam/scsi/scsi_enc.c user/attilio/vmcontention/sys/cam/scsi/scsi_pass.c user/attilio/vmcontention/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c user/attilio/vmcontention/sys/conf/NOTES user/attilio/vmcontention/sys/conf/files user/attilio/vmcontention/sys/conf/files.arm user/attilio/vmcontention/sys/conf/files.ia64 user/attilio/vmcontention/sys/conf/files.mips user/attilio/vmcontention/sys/conf/files.powerpc user/attilio/vmcontention/sys/conf/files.sparc64 user/attilio/vmcontention/sys/conf/options user/attilio/vmcontention/sys/contrib/dev/acpica/changes.txt (contents, props changed) user/attilio/vmcontention/sys/contrib/dev/acpica/common/dmextern.c user/attilio/vmcontention/sys/contrib/dev/acpica/common/dmrestag.c user/attilio/vmcontention/sys/contrib/dev/acpica/compiler/aslcompile.c user/attilio/vmcontention/sys/contrib/dev/acpica/compiler/aslerror.c user/attilio/vmcontention/sys/contrib/dev/acpica/compiler/aslfiles.c user/attilio/vmcontention/sys/contrib/dev/acpica/compiler/asllookup.c user/attilio/vmcontention/sys/contrib/dev/acpica/compiler/aslmain.c user/attilio/vmcontention/sys/contrib/dev/acpica/compiler/aslsupport.l user/attilio/vmcontention/sys/contrib/dev/acpica/compiler/aslutils.c user/attilio/vmcontention/sys/contrib/dev/acpica/compiler/dttemplate.c user/attilio/vmcontention/sys/contrib/dev/acpica/components/debugger/dbdisply.c user/attilio/vmcontention/sys/contrib/dev/acpica/components/debugger/dbexec.c user/attilio/vmcontention/sys/contrib/dev/acpica/components/debugger/dbutils.c user/attilio/vmcontention/sys/contrib/dev/acpica/components/disassembler/dmopcode.c user/attilio/vmcontention/sys/contrib/dev/acpica/components/disassembler/dmwalk.c user/attilio/vmcontention/sys/contrib/dev/acpica/components/dispatcher/dsfield.c user/attilio/vmcontention/sys/contrib/dev/acpica/components/dispatcher/dsopcode.c user/attilio/vmcontention/sys/contrib/dev/acpica/components/events/evgpe.c user/attilio/vmcontention/sys/contrib/dev/acpica/components/events/evgpeutil.c user/attilio/vmcontention/sys/contrib/dev/acpica/components/events/evxfgpe.c user/attilio/vmcontention/sys/contrib/dev/acpica/components/executer/exconfig.c user/attilio/vmcontention/sys/contrib/dev/acpica/components/utilities/utmisc.c user/attilio/vmcontention/sys/contrib/dev/acpica/include/acdebug.h user/attilio/vmcontention/sys/contrib/dev/acpica/include/acdisasm.h user/attilio/vmcontention/sys/contrib/dev/acpica/include/acglobal.h user/attilio/vmcontention/sys/contrib/dev/acpica/include/aclocal.h user/attilio/vmcontention/sys/contrib/dev/acpica/include/acpixf.h user/attilio/vmcontention/sys/contrib/dev/acpica/include/acpredef.h user/attilio/vmcontention/sys/contrib/dev/acpica/include/acutils.h user/attilio/vmcontention/sys/contrib/rdma/krping/krping.c user/attilio/vmcontention/sys/contrib/rdma/krping/krping.h user/attilio/vmcontention/sys/contrib/rdma/krping/krping_dev.c user/attilio/vmcontention/sys/contrib/rdma/rdma_addr.c user/attilio/vmcontention/sys/contrib/rdma/rdma_cache.c user/attilio/vmcontention/sys/dev/acpica/acpi_video.c user/attilio/vmcontention/sys/dev/ath/ath_hal/ah_internal.h user/attilio/vmcontention/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c user/attilio/vmcontention/sys/dev/ath/ath_hal/ar9002/ar9287_reset.c user/attilio/vmcontention/sys/dev/ath/if_ath.c user/attilio/vmcontention/sys/dev/ath/if_ath_tx_ht.c user/attilio/vmcontention/sys/dev/cxgb/common/cxgb_ctl_defs.h user/attilio/vmcontention/sys/dev/cxgb/cxgb_adapter.h user/attilio/vmcontention/sys/dev/cxgb/cxgb_main.c user/attilio/vmcontention/sys/dev/cxgb/cxgb_offload.h user/attilio/vmcontention/sys/dev/cxgb/cxgb_osdep.h user/attilio/vmcontention/sys/dev/cxgb/cxgb_sge.c user/attilio/vmcontention/sys/dev/cxgb/sys/mvec.h user/attilio/vmcontention/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c user/attilio/vmcontention/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.h user/attilio/vmcontention/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_cm.c user/attilio/vmcontention/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_cm.h user/attilio/vmcontention/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_cq.c user/attilio/vmcontention/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_dbg.c user/attilio/vmcontention/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_ev.c user/attilio/vmcontention/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_hal.c user/attilio/vmcontention/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_hal.h user/attilio/vmcontention/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_mem.c user/attilio/vmcontention/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c user/attilio/vmcontention/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.h user/attilio/vmcontention/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_qp.c user/attilio/vmcontention/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_resource.c user/attilio/vmcontention/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_user.h user/attilio/vmcontention/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_wr.h user/attilio/vmcontention/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c user/attilio/vmcontention/sys/dev/cxgb/ulp/tom/cxgb_l2t.c user/attilio/vmcontention/sys/dev/cxgb/ulp/tom/cxgb_l2t.h user/attilio/vmcontention/sys/dev/cxgb/ulp/tom/cxgb_listen.c user/attilio/vmcontention/sys/dev/cxgb/ulp/tom/cxgb_toepcb.h user/attilio/vmcontention/sys/dev/cxgb/ulp/tom/cxgb_tom.c user/attilio/vmcontention/sys/dev/cxgb/ulp/tom/cxgb_tom.h user/attilio/vmcontention/sys/dev/cxgbe/adapter.h user/attilio/vmcontention/sys/dev/cxgbe/common/common.h user/attilio/vmcontention/sys/dev/cxgbe/common/t4_hw.c user/attilio/vmcontention/sys/dev/cxgbe/common/t4_msg.h user/attilio/vmcontention/sys/dev/cxgbe/firmware/t4fw_cfg.txt user/attilio/vmcontention/sys/dev/cxgbe/firmware/t4fw_cfg_uwire.txt user/attilio/vmcontention/sys/dev/cxgbe/firmware/t4fw_interface.h user/attilio/vmcontention/sys/dev/cxgbe/offload.h user/attilio/vmcontention/sys/dev/cxgbe/osdep.h user/attilio/vmcontention/sys/dev/cxgbe/t4_l2t.c user/attilio/vmcontention/sys/dev/cxgbe/t4_l2t.h user/attilio/vmcontention/sys/dev/cxgbe/t4_main.c user/attilio/vmcontention/sys/dev/cxgbe/t4_sge.c user/attilio/vmcontention/sys/dev/drm2/drm_pciids.h user/attilio/vmcontention/sys/dev/fb/fbreg.h user/attilio/vmcontention/sys/dev/flash/at45d.c user/attilio/vmcontention/sys/dev/hptrr/hptrr_osm_bsd.c user/attilio/vmcontention/sys/dev/hwpmc/hwpmc_intel.c user/attilio/vmcontention/sys/dev/isp/isp.c user/attilio/vmcontention/sys/dev/isp/isp_freebsd.h user/attilio/vmcontention/sys/dev/isp/isp_pci.c user/attilio/vmcontention/sys/dev/isp/ispmbox.h user/attilio/vmcontention/sys/dev/isp/ispreg.h user/attilio/vmcontention/sys/dev/isp/ispvar.h user/attilio/vmcontention/sys/dev/ispfw/asm_2400.h user/attilio/vmcontention/sys/dev/ispfw/asm_2500.h user/attilio/vmcontention/sys/dev/pci/pci_pci.c user/attilio/vmcontention/sys/dev/puc/puc_cfg.h user/attilio/vmcontention/sys/dev/puc/pucdata.c user/attilio/vmcontention/sys/dev/twa/tw_osl_cam.c user/attilio/vmcontention/sys/dev/usb/serial/uftdi.c user/attilio/vmcontention/sys/dev/usb/serial/uftdi_reg.h user/attilio/vmcontention/sys/dev/viawd/viawd.c user/attilio/vmcontention/sys/dev/xen/balloon/balloon.c user/attilio/vmcontention/sys/fs/nfsclient/nfs_clbio.c user/attilio/vmcontention/sys/fs/nfsclient/nfs_clnode.c user/attilio/vmcontention/sys/fs/nfsclient/nfs_clvfsops.c user/attilio/vmcontention/sys/i386/conf/GENERIC user/attilio/vmcontention/sys/i386/conf/XEN user/attilio/vmcontention/sys/i386/i386/elf_machdep.c user/attilio/vmcontention/sys/i386/i386/machdep.c user/attilio/vmcontention/sys/i386/include/elf.h user/attilio/vmcontention/sys/i386/include/pmap.h user/attilio/vmcontention/sys/i386/include/vmparam.h user/attilio/vmcontention/sys/ia64/include/elf.h user/attilio/vmcontention/sys/ia64/include/pmap.h user/attilio/vmcontention/sys/kern/imgact_elf.c user/attilio/vmcontention/sys/kern/kern_descrip.c user/attilio/vmcontention/sys/kern/kern_exec.c user/attilio/vmcontention/sys/kern/kern_fork.c user/attilio/vmcontention/sys/kern/kern_tc.c user/attilio/vmcontention/sys/kern/sys_generic.c user/attilio/vmcontention/sys/kern/sys_procdesc.c user/attilio/vmcontention/sys/kern/tty.c user/attilio/vmcontention/sys/kern/vfs_syscalls.c user/attilio/vmcontention/sys/kern/vfs_vnops.c user/attilio/vmcontention/sys/mips/include/elf.h user/attilio/vmcontention/sys/mips/include/pmap.h user/attilio/vmcontention/sys/modules/Makefile user/attilio/vmcontention/sys/modules/cxgb/Makefile user/attilio/vmcontention/sys/modules/cxgb/cxgb/Makefile user/attilio/vmcontention/sys/modules/cxgb/iw_cxgb/Makefile user/attilio/vmcontention/sys/modules/cxgb/tom/Makefile user/attilio/vmcontention/sys/modules/cxgbe/Makefile user/attilio/vmcontention/sys/modules/rdma/krping/Makefile user/attilio/vmcontention/sys/net/if_var.h user/attilio/vmcontention/sys/net/if_vlan.c user/attilio/vmcontention/sys/net80211/ieee80211_radiotap.c user/attilio/vmcontention/sys/net80211/ieee80211_var.h user/attilio/vmcontention/sys/netgraph/netflow/netflow.c user/attilio/vmcontention/sys/netgraph/netflow/ng_netflow.c user/attilio/vmcontention/sys/netgraph/netflow/ng_netflow.h user/attilio/vmcontention/sys/netinet/icmp_var.h user/attilio/vmcontention/sys/netinet/if_ether.c user/attilio/vmcontention/sys/netinet/if_ether.h user/attilio/vmcontention/sys/netinet/in.c user/attilio/vmcontention/sys/netinet/ip_icmp.c user/attilio/vmcontention/sys/netinet/sctp_input.c user/attilio/vmcontention/sys/netinet/sctp_usrreq.c user/attilio/vmcontention/sys/netinet/sctputil.c user/attilio/vmcontention/sys/netinet/tcp_input.c user/attilio/vmcontention/sys/netinet/tcp_offload.c user/attilio/vmcontention/sys/netinet/tcp_offload.h user/attilio/vmcontention/sys/netinet/tcp_output.c user/attilio/vmcontention/sys/netinet/tcp_subr.c user/attilio/vmcontention/sys/netinet/tcp_syncache.c user/attilio/vmcontention/sys/netinet/tcp_syncache.h user/attilio/vmcontention/sys/netinet/tcp_timer.c user/attilio/vmcontention/sys/netinet/tcp_usrreq.c user/attilio/vmcontention/sys/netinet/tcp_var.h user/attilio/vmcontention/sys/netinet6/in6_src.c user/attilio/vmcontention/sys/ofed/drivers/infiniband/core/cma.c user/attilio/vmcontention/sys/ofed/drivers/infiniband/core/iwcm.c user/attilio/vmcontention/sys/ofed/include/linux/net.h user/attilio/vmcontention/sys/ofed/include/net/netevent.h user/attilio/vmcontention/sys/ofed/include/rdma/iw_cm.h user/attilio/vmcontention/sys/powerpc/include/elf.h user/attilio/vmcontention/sys/powerpc/include/pmap.h user/attilio/vmcontention/sys/sparc64/include/elf.h user/attilio/vmcontention/sys/sparc64/include/pmap.h user/attilio/vmcontention/sys/sys/file.h user/attilio/vmcontention/sys/sys/sysent.h user/attilio/vmcontention/sys/ufs/ffs/ffs_vnops.c user/attilio/vmcontention/sys/vm/pmap.h user/attilio/vmcontention/sys/vm/swap_pager.c user/attilio/vmcontention/sys/vm/vm_map.c user/attilio/vmcontention/sys/vm/vm_object.h user/attilio/vmcontention/sys/vm/vm_page.c user/attilio/vmcontention/sys/vm/vm_page.h user/attilio/vmcontention/sys/vm/vm_pageout.c user/attilio/vmcontention/sys/vm/vnode_pager.c user/attilio/vmcontention/sys/x86/x86/tsc.c user/attilio/vmcontention/tools/regression/usr.bin/make/common.sh user/attilio/vmcontention/usr.bin/make/Makefile user/attilio/vmcontention/usr.bin/makewhatis/makewhatis.c user/attilio/vmcontention/usr.bin/minigzip/Makefile user/attilio/vmcontention/usr.bin/netstat/inet.c user/attilio/vmcontention/usr.bin/sockstat/sockstat.c user/attilio/vmcontention/usr.sbin/acpi/iasl/Makefile user/attilio/vmcontention/usr.sbin/bsdinstall/partedit/diskeditor.c user/attilio/vmcontention/usr.sbin/bsdinstall/partedit/part_wizard.c user/attilio/vmcontention/usr.sbin/crunch/crunchide/exec_elf32.c user/attilio/vmcontention/usr.sbin/ctladm/ctladm.c user/attilio/vmcontention/usr.sbin/ifmcstat/ifmcstat.c user/attilio/vmcontention/usr.sbin/kbdmap/kbdmap.c user/attilio/vmcontention/usr.sbin/kldxref/ef.c user/attilio/vmcontention/usr.sbin/mfiutil/Makefile user/attilio/vmcontention/usr.sbin/mfiutil/mfi_cmd.c user/attilio/vmcontention/usr.sbin/mfiutil/mfi_config.c user/attilio/vmcontention/usr.sbin/mfiutil/mfi_drive.c user/attilio/vmcontention/usr.sbin/mfiutil/mfi_evt.c user/attilio/vmcontention/usr.sbin/mfiutil/mfi_flash.c user/attilio/vmcontention/usr.sbin/mfiutil/mfi_patrol.c user/attilio/vmcontention/usr.sbin/mfiutil/mfi_show.c user/attilio/vmcontention/usr.sbin/mfiutil/mfi_volume.c user/attilio/vmcontention/usr.sbin/mfiutil/mfiutil.c user/attilio/vmcontention/usr.sbin/mfiutil/mfiutil.h Directory Properties: user/attilio/vmcontention/ (props changed) user/attilio/vmcontention/contrib/gcc/ (props changed) user/attilio/vmcontention/lib/libc/ (props changed) user/attilio/vmcontention/lib/libc/stdtime/ (props changed) user/attilio/vmcontention/lib/libutil/ (props changed) user/attilio/vmcontention/lib/libz/ (props changed) user/attilio/vmcontention/lib/libz/contrib/ (props changed) user/attilio/vmcontention/lib/libz/contrib/README.contrib (props changed) user/attilio/vmcontention/lib/libz/contrib/asm686/ (props changed) user/attilio/vmcontention/lib/libz/contrib/asm686/README.686 (props changed) user/attilio/vmcontention/lib/libz/contrib/gcc_gvmat64/ (props changed) user/attilio/vmcontention/lib/libz/contrib/gcc_gvmat64/gvmat64.S (props changed) user/attilio/vmcontention/lib/libz/doc/ (props changed) user/attilio/vmcontention/lib/libz/doc/rfc1950.txt (props changed) user/attilio/vmcontention/lib/libz/doc/rfc1951.txt (props changed) user/attilio/vmcontention/lib/libz/doc/rfc1952.txt (props changed) user/attilio/vmcontention/lib/libz/doc/txtvsbin.txt (props changed) user/attilio/vmcontention/lib/libz/gzclose.c (props changed) user/attilio/vmcontention/sbin/ (props changed) user/attilio/vmcontention/share/man/man4/ (props changed) user/attilio/vmcontention/sys/ (props changed) user/attilio/vmcontention/sys/boot/ (props changed) user/attilio/vmcontention/sys/cddl/contrib/opensolaris/ (props changed) user/attilio/vmcontention/sys/conf/ (props changed) user/attilio/vmcontention/sys/contrib/dev/acpica/ (props changed) user/attilio/vmcontention/sys/contrib/dev/acpica/common/ (props changed) user/attilio/vmcontention/sys/contrib/dev/acpica/compiler/ (props changed) user/attilio/vmcontention/sys/contrib/dev/acpica/components/debugger/ (props changed) user/attilio/vmcontention/sys/contrib/dev/acpica/components/disassembler/ (props changed) user/attilio/vmcontention/sys/contrib/dev/acpica/components/dispatcher/ (props changed) user/attilio/vmcontention/sys/contrib/dev/acpica/components/events/ (props changed) user/attilio/vmcontention/sys/contrib/dev/acpica/components/executer/ (props changed) user/attilio/vmcontention/sys/contrib/dev/acpica/components/utilities/ (props changed) user/attilio/vmcontention/sys/contrib/dev/acpica/include/ (props changed) Modified: user/attilio/vmcontention/bin/rm/rm.c ============================================================================== --- user/attilio/vmcontention/bin/rm/rm.c Sat Jun 23 01:30:51 2012 (r237466) +++ user/attilio/vmcontention/bin/rm/rm.c Sat Jun 23 02:08:15 2012 (r237467) @@ -301,10 +301,16 @@ rm_tree(char **argv) if (fflag) continue; /* FALLTHROUGH */ - default: + + case FTS_F: + case FTS_NSOK: if (Pflag) - if (!rm_overwrite(p->fts_accpath, NULL)) + if (!rm_overwrite(p->fts_accpath, p->fts_info == + FTS_NSOK ? NULL : p->fts_statp)) continue; + /* FALLTHROUGH */ + + default: rval = unlink(p->fts_accpath); if (rval == 0 || (fflag && errno == ENOENT)) { if (rval == 0 && vflag) @@ -408,7 +414,7 @@ rm_file(char **argv) int rm_overwrite(char *file, struct stat *sbp) { - struct stat sb; + struct stat sb, sb2; struct statfs fsb; off_t len; int bsize, fd, wlen; @@ -427,8 +433,15 @@ rm_overwrite(char *file, struct stat *sb file, sbp->st_ino); return (0); } - if ((fd = open(file, O_WRONLY, 0)) == -1) + if ((fd = open(file, O_WRONLY|O_NONBLOCK|O_NOFOLLOW, 0)) == -1) + goto err; + if (fstat(fd, &sb2)) goto err; + if (sb2.st_dev != sbp->st_dev || sb2.st_ino != sbp->st_ino || + !S_ISREG(sb2.st_mode)) { + errno = EPERM; + goto err; + } if (fstatfs(fd, &fsb) == -1) goto err; bsize = MAX(fsb.f_iosize, 1024); Modified: user/attilio/vmcontention/contrib/bsnmp/lib/bsnmpclient.3 ============================================================================== --- user/attilio/vmcontention/contrib/bsnmp/lib/bsnmpclient.3 Sat Jun 23 01:30:51 2012 (r237466) +++ user/attilio/vmcontention/contrib/bsnmp/lib/bsnmpclient.3 Sat Jun 23 02:08:15 2012 (r237467) @@ -368,7 +368,7 @@ This format expects an argument of type and appends the length of the string (as computed by .Xr strlen 3 ) and each of the characters in the string to the OID. -.It Li ( Va N Ns Li ) +.It ( Va N Ns ) This format expects no argument. .Va N must be a decimal number and is stored into an internal variable Modified: user/attilio/vmcontention/contrib/bsnmp/lib/bsnmplib.3 ============================================================================== --- user/attilio/vmcontention/contrib/bsnmp/lib/bsnmplib.3 Sat Jun 23 01:30:51 2012 (r237466) +++ user/attilio/vmcontention/contrib/bsnmp/lib/bsnmplib.3 Sat Jun 23 02:08:15 2012 (r237467) @@ -161,7 +161,6 @@ is not zero, .Fa v.octetstring.octets points to a string allocated by .Xr malloc 3 . -.Pp .Bd -literal -offset indent #define SNMP_ENGINE_ID_SIZ 32 @@ -176,7 +175,6 @@ struct snmp_engine { .Pp This structure represents an SNMP engine as specified by the SNMP Management Architecture described in RFC 3411. -.Pp .Bd -literal -offset indent #define SNMP_ADM_STR32_SIZ (32 + 1) #define SNMP_AUTH_KEY_SIZ 40 @@ -225,7 +223,6 @@ enum snmp_privacy { and .Fa priv_key contain the authentication and privacy keys for the user. -.Pp .Bd -literal -offset indent #define SNMP_COMMUNITY_MAXLEN 128 #define SNMP_MAX_BINDINGS 100 @@ -389,7 +386,7 @@ If successfull, a plain text scoped PDU The function .Fn snmp_pdu_init_secparams calculates the initialization vector for the privacy protocol in use before -the PDU pointed to by +the PDU pointed to by .Fa pdu may be encrypted or decrypted. .Pp @@ -504,7 +501,7 @@ the cryptographic functions from The library may optionally be built without references to the .Xr crypto 3 library. In such case only plain text SNMPv3 PDUs without message digests -may be proccessed correctly. +may be proccessed correctly. .Sh STANDARDS This implementation conforms to the applicable IETF RFCs and ITU-T recommendations. Modified: user/attilio/vmcontention/contrib/bsnmp/snmp_target/snmp_target.3 ============================================================================== --- user/attilio/vmcontention/contrib/bsnmp/snmp_target/snmp_target.3 Sat Jun 23 01:30:51 2012 (r237466) +++ user/attilio/vmcontention/contrib/bsnmp/snmp_target/snmp_target.3 Sat Jun 23 02:08:15 2012 (r237467) @@ -33,7 +33,7 @@ .Os .Sh NAME .Nm snmp_target -.Nd "Target addresses and notifications module for +.Nd "Target addresses and notifications module for" .Xr bsnmpd 1 .Sh LIBRARY .Pq begemotSnmpdModulePath."target" = "/usr/lib/snmp_target.so" Modified: user/attilio/vmcontention/contrib/bsnmp/snmp_usm/snmp_usm.3 ============================================================================== --- user/attilio/vmcontention/contrib/bsnmp/snmp_usm/snmp_usm.3 Sat Jun 23 01:30:51 2012 (r237466) +++ user/attilio/vmcontention/contrib/bsnmp/snmp_usm/snmp_usm.3 Sat Jun 23 02:08:15 2012 (r237467) @@ -33,7 +33,7 @@ .Os .Sh NAME .Nm snmp_usm -.Nd "user-based security module for +.Nd "user-based security module for" .Xr bsnmpd 1 .Sh LIBRARY .Pq begemotSnmpdModulePath."usm" = "/usr/lib/snmp_usm.so" @@ -79,7 +79,7 @@ supported. .It Va usmUserAuthProtocol The value of this column contains the OID corresponding to the authentication protocol used by the USM user. The following protocols and their OIDs are known to -.Nm +.Nm module .Bl -tag -width ".It Va NoAuthProtocol" .It NoAuthProtocol 1.3.6.1.6.3.10.1.1.1 @@ -91,7 +91,7 @@ These columns may be used to change the .It Va usmUserPrivProtocol The value of this column contains the OID corresponding to the privacy protocol used by the USM user. The following protocols and their OIDs are known to -.Nm +.Nm module .Bl -tag -width ".It Va NoPrivProtocol" .It NoPrivProtocol 1.3.6.1.6.3.10.1.2.1 Modified: user/attilio/vmcontention/contrib/bsnmp/snmp_vacm/snmp_vacm.3 ============================================================================== --- user/attilio/vmcontention/contrib/bsnmp/snmp_vacm/snmp_vacm.3 Sat Jun 23 01:30:51 2012 (r237466) +++ user/attilio/vmcontention/contrib/bsnmp/snmp_vacm/snmp_vacm.3 Sat Jun 23 02:08:15 2012 (r237467) @@ -33,7 +33,7 @@ .Os .Sh NAME .Nm snmp_vacm -.Nd "View-based Access Control module for +.Nd "View-based Access Control module for" .Xr bsnmpd 1 .Sh LIBRARY .Pq begemotSnmpdModulePath."vacm" = "/usr/lib/snmp_vacm.so" Modified: user/attilio/vmcontention/contrib/gcc/ChangeLog.gcc43 ============================================================================== --- user/attilio/vmcontention/contrib/gcc/ChangeLog.gcc43 Sat Jun 23 01:30:51 2012 (r237466) +++ user/attilio/vmcontention/contrib/gcc/ChangeLog.gcc43 Sat Jun 23 02:08:15 2012 (r237467) @@ -5,6 +5,18 @@ with SSE3 instruction set support. * doc/invoke.texi: Likewise. +2007-04-12 Richard Guenther (r123736) + + PR tree-optimization/24689 + PR tree-optimization/31307 + * fold-const.c (operand_equal_p): Compare INTEGER_CST array + indices by value. + * gimplify.c (canonicalize_addr_expr): To be consistent with + gimplify_compound_lval only set operands two and three of + ARRAY_REFs if they are not gimple_min_invariant. This makes + it never at this place. + * tree-ssa-ccp.c (maybe_fold_offset_to_array_ref): Likewise. + 2007-04-07 H.J. Lu (r123639) * config/i386/i386.c (ix86_handle_option): Handle SSSE3. @@ -96,7 +108,7 @@ * doc/invoke.texi: Add entry about geode processor. -2006-10-24 Richard Guenther +2006-10-24 Richard Guenther (r118001) PR middle-end/28796 * builtins.c (fold_builtin_classify): Use HONOR_INFINITIES @@ -170,7 +182,13 @@ * doc/invoke.texi: Document -mssse3/-mno-ssse3 switches. -2006-10-21 Richard Guenther +2006-10-21 Richard Guenther (r117932) + + PR tree-optimization/3511 + * tree-ssa-pre.c (phi_translate): Fold CALL_EXPRs that + got new invariant arguments during PHI translation. + +2006-10-21 Richard Guenther (r117929) * builtins.c (fold_builtin_classify): Fix typo. Modified: user/attilio/vmcontention/contrib/gcc/fold-const.c ============================================================================== --- user/attilio/vmcontention/contrib/gcc/fold-const.c Sat Jun 23 01:30:51 2012 (r237466) +++ user/attilio/vmcontention/contrib/gcc/fold-const.c Sat Jun 23 02:08:15 2012 (r237467) @@ -2802,9 +2802,13 @@ operand_equal_p (tree arg0, tree arg1, u case ARRAY_REF: case ARRAY_RANGE_REF: - /* Operands 2 and 3 may be null. */ + /* Operands 2 and 3 may be null. + Compare the array index by value if it is constant first as we + may have different types but same value here. */ return (OP_SAME (0) - && OP_SAME (1) + && (tree_int_cst_equal (TREE_OPERAND (arg0, 1), + TREE_OPERAND (arg1, 1)) + || OP_SAME (1)) && OP_SAME_WITH_NULL (2) && OP_SAME_WITH_NULL (3)); Modified: user/attilio/vmcontention/contrib/gcc/gimplify.c ============================================================================== --- user/attilio/vmcontention/contrib/gcc/gimplify.c Sat Jun 23 01:30:51 2012 (r237466) +++ user/attilio/vmcontention/contrib/gcc/gimplify.c Sat Jun 23 02:08:15 2012 (r237467) @@ -1600,9 +1600,7 @@ canonicalize_addr_expr (tree *expr_p) /* All checks succeeded. Build a new node to merge the cast. */ *expr_p = build4 (ARRAY_REF, dctype, obj_expr, TYPE_MIN_VALUE (TYPE_DOMAIN (datype)), - TYPE_MIN_VALUE (TYPE_DOMAIN (datype)), - size_binop (EXACT_DIV_EXPR, TYPE_SIZE_UNIT (dctype), - size_int (TYPE_ALIGN_UNIT (dctype)))); + NULL_TREE, NULL_TREE); *expr_p = build1 (ADDR_EXPR, ctype, *expr_p); } Modified: user/attilio/vmcontention/contrib/gcc/tree-ssa-ccp.c ============================================================================== --- user/attilio/vmcontention/contrib/gcc/tree-ssa-ccp.c Sat Jun 23 01:30:51 2012 (r237466) +++ user/attilio/vmcontention/contrib/gcc/tree-ssa-ccp.c Sat Jun 23 02:08:15 2012 (r237467) @@ -1621,9 +1621,7 @@ maybe_fold_offset_to_array_ref (tree bas if (!integer_zerop (elt_offset)) idx = int_const_binop (PLUS_EXPR, idx, elt_offset, 0); - return build4 (ARRAY_REF, orig_type, base, idx, min_idx, - size_int (tree_low_cst (elt_size, 1) - / (TYPE_ALIGN_UNIT (elt_type)))); + return build4 (ARRAY_REF, orig_type, base, idx, NULL_TREE, NULL_TREE); } Modified: user/attilio/vmcontention/contrib/gcc/tree-ssa-pre.c ============================================================================== --- user/attilio/vmcontention/contrib/gcc/tree-ssa-pre.c Sat Jun 23 01:30:51 2012 (r237466) +++ user/attilio/vmcontention/contrib/gcc/tree-ssa-pre.c Sat Jun 23 02:08:15 2012 (r237467) @@ -1076,6 +1076,7 @@ phi_translate (tree expr, value_set_t se tree newexpr; tree vh = get_value_handle (expr); bool listchanged = false; + bool invariantarg = false; VEC (tree, gc) *vuses = VALUE_HANDLE_VUSES (vh); VEC (tree, gc) *tvuses; @@ -1134,10 +1135,26 @@ phi_translate (tree expr, value_set_t se if (newval != oldval) { listchanged = true; + invariantarg |= is_gimple_min_invariant (newval); TREE_VALUE (newwalker) = get_value_handle (newval); } } } + + /* In case of new invariant args we might try to fold the call + again. */ + if (invariantarg) + { + tree tmp = fold_ternary (CALL_EXPR, TREE_TYPE (expr), + newop0, newarglist, newop2); + if (tmp) + { + STRIP_TYPE_NOPS (tmp); + if (is_gimple_min_invariant (tmp)) + return tmp; + } + } + if (listchanged) vn_lookup_or_add (newarglist, NULL); Modified: user/attilio/vmcontention/contrib/telnet/telnet/telnet.1 ============================================================================== --- user/attilio/vmcontention/contrib/telnet/telnet/telnet.1 Sat Jun 23 01:30:51 2012 (r237466) +++ user/attilio/vmcontention/contrib/telnet/telnet/telnet.1 Sat Jun 23 02:08:15 2012 (r237467) @@ -344,7 +344,6 @@ Only enough of each command to uniquely and .Ic display commands). -.Pp .Bl -tag -width "mode type" .It Ic auth Ar argument ... The auth command manipulates the information sent through the @@ -664,7 +663,6 @@ An end of file (in command mode) will al Sends one or more special character sequences to the remote host. The following are the arguments which may be specified (more than one argument may be specified at a time): -.Pp .Bl -tag -width escape .It Ic abort Sends the Modified: user/attilio/vmcontention/etc/login.conf ============================================================================== --- user/attilio/vmcontention/etc/login.conf Sat Jun 23 01:30:51 2012 (r237466) +++ user/attilio/vmcontention/etc/login.conf Sat Jun 23 02:08:15 2012 (r237467) @@ -23,10 +23,10 @@ # AND SEMANTICS'' section of getcap(3) for more escape sequences). default:\ - :passwd_format=md5:\ + :passwd_format=sha512:\ :copyright=/etc/COPYRIGHT:\ :welcome=/etc/motd:\ - :setenv=MAIL=/var/mail/$,BLOCKSIZE=K,FTP_PASSIVE_MODE=YES:\ + :setenv=MAIL=/var/mail/$,BLOCKSIZE=K:\ :path=/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin ~/bin:\ :nologin=/var/run/nologin:\ :cputime=unlimited:\ Modified: user/attilio/vmcontention/etc/mtree/BSD.include.dist ============================================================================== --- user/attilio/vmcontention/etc/mtree/BSD.include.dist Sat Jun 23 01:30:51 2012 (r237466) +++ user/attilio/vmcontention/etc/mtree/BSD.include.dist Sat Jun 23 02:08:15 2012 (r237467) @@ -102,6 +102,8 @@ .. ciss .. + filemon + .. firewire .. hwpmc Modified: user/attilio/vmcontention/etc/periodic/daily/400.status-disks ============================================================================== --- user/attilio/vmcontention/etc/periodic/daily/400.status-disks Sat Jun 23 01:30:51 2012 (r237466) +++ user/attilio/vmcontention/etc/periodic/daily/400.status-disks Sat Jun 23 02:08:15 2012 (r237467) @@ -19,12 +19,15 @@ case "$daily_status_disks_enable" in df $daily_status_disks_df_flags && rc=1 || rc=3 # display which filesystems need backing up - if ! [ -f /etc/fstab ]; then - export PATH_FSTAB=/dev/null - fi + if [ -s /etc/dumpdates ]; then + if ! [ -f /etc/fstab ]; then + export PATH_FSTAB=/dev/null + fi - echo "" - dump W || rc=3;; + echo "" + dump W || rc=3 + fi + ;; *) rc=0;; esac Modified: user/attilio/vmcontention/include/Makefile ============================================================================== --- user/attilio/vmcontention/include/Makefile Sat Jun 23 01:30:51 2012 (r237466) +++ user/attilio/vmcontention/include/Makefile Sat Jun 23 02:08:15 2012 (r237467) @@ -39,7 +39,7 @@ LDIRS= bsm cam geom net net80211 netatal sys vm LSUBDIRS= cam/ata cam/scsi \ - dev/acpica dev/an dev/bktr dev/ciss dev/firewire dev/hwpmc \ + dev/acpica dev/an dev/bktr dev/ciss dev/filemon dev/firewire dev/hwpmc \ dev/ic dev/iicbus ${_dev_ieee488} dev/io dev/lmc dev/mfi dev/ofw \ dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/smbus \ dev/speaker dev/usb dev/utopia dev/vkbd dev/wi \ Modified: user/attilio/vmcontention/lib/libc/amd64/sys/Makefile.inc ============================================================================== --- user/attilio/vmcontention/lib/libc/amd64/sys/Makefile.inc Sat Jun 23 01:30:51 2012 (r237466) +++ user/attilio/vmcontention/lib/libc/amd64/sys/Makefile.inc Sat Jun 23 02:08:15 2012 (r237467) @@ -1,7 +1,8 @@ # from: Makefile.inc,v 1.1 1993/09/03 19:04:23 jtc Exp # $FreeBSD$ -SRCS+= amd64_get_fsbase.c amd64_get_gsbase.c amd64_set_fsbase.c amd64_set_gsbase.c +SRCS+= amd64_get_fsbase.c amd64_get_gsbase.c amd64_set_fsbase.c \ + amd64_set_gsbase.c __vdso_gettc.c MDASM= vfork.S brk.S cerror.S exect.S getcontext.S pipe.S ptrace.S \ reboot.S sbrk.S setlogin.S sigreturn.S Copied: user/attilio/vmcontention/lib/libc/amd64/sys/__vdso_gettc.c (from r237466, head/lib/libc/amd64/sys/__vdso_gettc.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/attilio/vmcontention/lib/libc/amd64/sys/__vdso_gettc.c Sat Jun 23 02:08:15 2012 (r237467, copy of r237466, head/lib/libc/amd64/sys/__vdso_gettc.c) @@ -0,0 +1,49 @@ +/*- + * Copyright (c) 2012 Konstantin Belousov + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +static u_int +__vdso_gettc_low(const struct vdso_timehands *th) +{ + uint32_t rv; + + __asm __volatile("rdtsc; shrd %%cl, %%edx, %0" + : "=a" (rv) : "c" (th->th_x86_shift) : "edx"); + return (rv); +} + +u_int +__vdso_gettc(const struct vdso_timehands *th) +{ + + return (th->th_x86_shift > 0 ? __vdso_gettc_low(th) : rdtsc32()); +} Modified: user/attilio/vmcontention/lib/libc/gen/aux.c ============================================================================== --- user/attilio/vmcontention/lib/libc/gen/aux.c Sat Jun 23 01:30:51 2012 (r237466) +++ user/attilio/vmcontention/lib/libc/gen/aux.c Sat Jun 23 02:08:15 2012 (r237467) @@ -66,6 +66,7 @@ __init_elf_aux_vector(void) static pthread_once_t aux_once = PTHREAD_ONCE_INIT; static int pagesize, osreldate, canary_len, ncpus, pagesizes_len; static char *canary, *pagesizes; +static void *timekeep; static void init_aux(void) @@ -101,6 +102,10 @@ init_aux(void) case AT_NCPUS: ncpus = aux->a_un.a_val; break; + + case AT_TIMEKEEP: + timekeep = aux->a_un.a_ptr; + break; } } } @@ -163,6 +168,16 @@ _elf_aux_info(int aux, void *buf, int bu } else res = EINVAL; break; + case AT_TIMEKEEP: + if (buflen == sizeof(void *)) { + if (timekeep != NULL) { + *(void **)buf = timekeep; + res = 0; + } else + res = ENOENT; + } else + res = EINVAL; + break; default: res = ENOENT; break; Modified: user/attilio/vmcontention/lib/libc/gen/syslog.c ============================================================================== --- user/attilio/vmcontention/lib/libc/gen/syslog.c Sat Jun 23 01:30:51 2012 (r237466) +++ user/attilio/vmcontention/lib/libc/gen/syslog.c Sat Jun 23 02:08:15 2012 (r237467) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -413,8 +414,11 @@ void closelog(void) { THREAD_LOCK(); - (void)_close(LogFile); - LogFile = -1; + assert(LogFile >= -1); + if (LogFile != -1) { + (void)_close(LogFile); + LogFile = -1; + } LogTag = NULL; status = NOCONN; THREAD_UNLOCK(); Modified: user/attilio/vmcontention/lib/libc/i386/sys/Makefile.inc ============================================================================== --- user/attilio/vmcontention/lib/libc/i386/sys/Makefile.inc Sat Jun 23 01:30:51 2012 (r237466) +++ user/attilio/vmcontention/lib/libc/i386/sys/Makefile.inc Sat Jun 23 02:08:15 2012 (r237467) @@ -5,7 +5,8 @@ SRCS+= i386_clr_watch.c i386_set_watch.c i386_vm86.c .endif SRCS+= i386_get_fsbase.c i386_get_gsbase.c i386_get_ioperm.c i386_get_ldt.c \ - i386_set_fsbase.c i386_set_gsbase.c i386_set_ioperm.c i386_set_ldt.c + i386_set_fsbase.c i386_set_gsbase.c i386_set_ioperm.c i386_set_ldt.c \ + __vdso_gettc.c MDASM= Ovfork.S brk.S cerror.S exect.S getcontext.S pipe.S ptrace.S \ reboot.S sbrk.S setlogin.S sigreturn.S syscall.S Copied: user/attilio/vmcontention/lib/libc/i386/sys/__vdso_gettc.c (from r237466, head/lib/libc/i386/sys/__vdso_gettc.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/attilio/vmcontention/lib/libc/i386/sys/__vdso_gettc.c Sat Jun 23 02:08:15 2012 (r237467, copy of r237466, head/lib/libc/i386/sys/__vdso_gettc.c) @@ -0,0 +1,50 @@ +/*- + * Copyright (c) 2012 Konstantin Belousov + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +static u_int +__vdso_gettc_low(const struct vdso_timehands *th) +{ + uint32_t rv; + + __asm __volatile("rdtsc; shrd %%cl, %%edx, %0" + : "=a" (rv) : "c" (th->th_x86_shift) : "edx"); + return (rv); +} + +#pragma weak __vdso_gettc +u_int +__vdso_gettc(const struct vdso_timehands *th) +{ + + return (th->th_x86_shift > 0 ? __vdso_gettc_low(th) : rdtsc32()); +} Modified: user/attilio/vmcontention/lib/libc/include/libc_private.h ============================================================================== --- user/attilio/vmcontention/lib/libc/include/libc_private.h Sat Jun 23 01:30:51 2012 (r237466) +++ user/attilio/vmcontention/lib/libc/include/libc_private.h Sat Jun 23 02:08:15 2012 (r237467) @@ -34,6 +34,7 @@ #ifndef _LIBC_PRIVATE_H_ #define _LIBC_PRIVATE_H_ +#include #include /* @@ -245,6 +246,12 @@ extern void * __sys_freebsd6_mmap(void * /* Without back-compat translation */ extern int __sys_fcntl(int, int, ...); +struct timespec; +struct timeval; +struct timezone; +int __sys_gettimeofday(struct timeval *, struct timezone *); +int __sys_clock_gettime(__clockid_t, struct timespec *ts); + /* execve() with PATH processing to implement posix_spawnp() */ int _execvpe(const char *, char * const *, char * const *); Modified: user/attilio/vmcontention/lib/libc/net/Makefile.inc ============================================================================== --- user/attilio/vmcontention/lib/libc/net/Makefile.inc Sat Jun 23 01:30:51 2012 (r237466) +++ user/attilio/vmcontention/lib/libc/net/Makefile.inc Sat Jun 23 02:08:15 2012 (r237467) @@ -36,7 +36,7 @@ LFLAGS+=-P_nsyy CLEANFILES+=nslexer.c -nslexer.c: nslexer.l +nslexer.c: nslexer.l nsparser.h ${LEX} ${LFLAGS} -o/dev/stdout ${.IMPSRC} | \ sed -e '/YY_BUF_SIZE/s/16384/1024/' >${.TARGET} Modified: user/attilio/vmcontention/lib/libc/stdtime/strftime.c ============================================================================== --- user/attilio/vmcontention/lib/libc/stdtime/strftime.c Sat Jun 23 01:30:51 2012 (r237466) +++ user/attilio/vmcontention/lib/libc/stdtime/strftime.c Sat Jun 23 02:08:15 2012 (r237467) @@ -67,7 +67,7 @@ extern char * tzname[]; #define PAD_SPACE 2 #define PAD_ZERO 3 -static const char* fmt_padding[][4] = { +static const char fmt_padding[][4][5] = { /* DEFAULT, LESS, SPACE, ZERO */ #define PAD_FMT_MONTHDAY 0 #define PAD_FMT_HMS 0 Modified: user/attilio/vmcontention/lib/libc/string/Makefile.inc ============================================================================== --- user/attilio/vmcontention/lib/libc/string/Makefile.inc Sat Jun 23 01:30:51 2012 (r237466) +++ user/attilio/vmcontention/lib/libc/string/Makefile.inc Sat Jun 23 02:08:15 2012 (r237467) @@ -42,10 +42,13 @@ MLINKS+=ffs.3 ffsl.3 \ ffs.3 flsll.3 MLINKS+=index.3 rindex.3 MLINKS+=memchr.3 memrchr.3 -MLINKS+=strcasecmp.3 strncasecmp.3 +MLINKS+=strcasecmp.3 strncasecmp.3 \ + strcasecmp.3 strcasecmp_l.3 \ + strcasecmp.3 strncasecmp_l.3 MLINKS+=strcat.3 strncat.3 MLINKS+=strchr.3 strrchr.3 MLINKS+=strcmp.3 strncmp.3 +MLINKS+=strcoll.3 strcoll_l.3 MLINKS+=strcpy.3 stpcpy.3 \ strcpy.3 stpncpy.3 \ strcpy.3 strncpy.3 @@ -57,8 +60,10 @@ MLINKS+=strerror.3 perror.3 \ MLINKS+=strlcpy.3 strlcat.3 MLINKS+=strlen.3 strnlen.3 MLINKS+=strstr.3 strcasestr.3 \ - strstr.3 strnstr.3 + strstr.3 strnstr.3 \ + strstr.3 strcasestr_l.3 MLINKS+=strtok.3 strtok_r.3 +MLINKS+=strxfrm.3 strxfrm_l.3 MLINKS+=wmemchr.3 wcpcpy.3 \ wmemchr.3 wcpncpy.3 \ wmemchr.3 wcscasecmp.3 \ Modified: user/attilio/vmcontention/lib/libc/string/strcasecmp.3 ============================================================================== --- user/attilio/vmcontention/lib/libc/string/strcasecmp.3 Sat Jun 23 01:30:51 2012 (r237466) +++ user/attilio/vmcontention/lib/libc/string/strcasecmp.3 Sat Jun 23 02:08:15 2012 (r237467) @@ -45,6 +45,12 @@ .Fn strcasecmp "const char *s1" "const char *s2" .Ft int .Fn strncasecmp "const char *s1" "const char *s2" "size_t len" +.In string.h +.In xlocale.h +.Ft int +.Fn strcasecmp_l "const char *s1" "const char *s2" "locale_t loc" +.Ft int +.Fn strncasecmp_l "const char *s1" "const char *s2" "site_t len" "locale_t loc" .Sh DESCRIPTION The .Fn strcasecmp @@ -58,16 +64,22 @@ and .Pp The .Fn strncasecmp -compares at most +function compares at most .Fa len characters. -.Sh RETURN VALUES The +.Fn strcasecmp_l +and +.Fn strncasecmp_l +functions do the same as their non-locale versions above, but take an +explicit locale rather than using the current locale. +.Sh RETURN VALUES +The functions .Fn strcasecmp and .Fn strncasecmp return an integer greater than, equal to, or less than 0, -according as +depending on whether .Fa s1 is lexicographically greater than, equal to, or less than .Fa s2 @@ -77,6 +89,11 @@ The comparison is done using unsigned ch .Sq Li \e200 is greater than .Ql \e0 . +The functions +.Fn strcasecmp_l +and +.Fn strncasecmp_l +do the same but take explicit locales. .Sh SEE ALSO .Xr bcmp 3 , .Xr memcmp 3 , Modified: user/attilio/vmcontention/lib/libc/string/strcoll.3 ============================================================================== --- user/attilio/vmcontention/lib/libc/string/strcoll.3 Sat Jun 23 01:30:51 2012 (r237466) +++ user/attilio/vmcontention/lib/libc/string/strcoll.3 Sat Jun 23 02:08:15 2012 (r237467) @@ -44,6 +44,8 @@ .In string.h .Ft int .Fn strcoll "const char *s1" "const char *s2" +.Ft int +.Fn strcoll_l "const char *s1" "const char *s2" "locale_t loc" .Sh DESCRIPTION The .Fn strcoll @@ -54,7 +56,7 @@ and .Fa s2 according to the current locale collation and returns an integer greater than, equal to, or less than 0, -according as +depending on whether .Fa s1 is greater than, equal to, or less than .Fa s2 . @@ -62,6 +64,9 @@ If information about the current locale the value of .Fn strcmp s1 s2 is returned. +The +.Fn strcoll_l +function uses an explicit locale argument rather than the system locale. .Sh SEE ALSO .Xr setlocale 3 , .Xr strcmp 3 , @@ -70,6 +75,9 @@ is returned. .Sh STANDARDS The .Fn strcoll -function -conforms to +function conforms to .St -isoC . +The +.Fn strcoll_l +function conforms to +.St -p1003.1-2008 . Modified: user/attilio/vmcontention/lib/libc/string/strstr.3 ============================================================================== --- user/attilio/vmcontention/lib/libc/string/strstr.3 Sat Jun 23 01:30:51 2012 (r237466) +++ user/attilio/vmcontention/lib/libc/string/strstr.3 Sat Jun 23 02:08:15 2012 (r237467) @@ -49,6 +49,10 @@ .Fn strcasestr "const char *big" "const char *little" .Ft char * .Fn strnstr "const char *big" "const char *little" "size_t len" +.In string.h +.In xlocale.h +.Ft char * +.Fn strcasestr_l "const char *big" "const char *little" "locale_t loc" .Sh DESCRIPTION The .Fn strstr @@ -65,6 +69,12 @@ function is similar to but ignores the case of both strings. .Pp The +.Fn strcasestr_l +function does the same as +.Fn strcasestr +but takes an explicit locale rather than using the current locale. +.Pp +The .Fn strnstr function locates the first occurrence of the null-terminated string Modified: user/attilio/vmcontention/lib/libc/string/strxfrm.3 ============================================================================== --- user/attilio/vmcontention/lib/libc/string/strxfrm.3 Sat Jun 23 01:30:51 2012 (r237466) +++ user/attilio/vmcontention/lib/libc/string/strxfrm.3 Sat Jun 23 02:08:15 2012 (r237467) @@ -44,6 +44,8 @@ .In string.h .Ft size_t .Fn strxfrm "char * restrict dst" "const char * restrict src" "size_t n" +.Ft size_t +.Fn strxfrm_l "char * restrict dst" "const char *restrict src" "size_t n" "locale_t loc" .Sh DESCRIPTION The .Fn strxfrm @@ -73,10 +75,16 @@ after is equal to comparing two original strings with .Fn strcoll . +.Pp +.Fn strxfrm_l +does the same, however takes an explicit locale rather than the global +locale. .Sh RETURN VALUES Upon successful completion, .Fn strxfrm -returns the length of the transformed string not including +and +.Fn strxfrm_l +return the length of the transformed string not including the terminating null character. If this value is .Fa n @@ -94,3 +102,7 @@ The function conforms to .St -isoC . +The +.Fn strxfrm_l +function conforms to +.St -p1003.1-2008 . Modified: user/attilio/vmcontention/lib/libc/sys/Makefile.inc ============================================================================== --- user/attilio/vmcontention/lib/libc/sys/Makefile.inc Sat Jun 23 01:30:51 2012 (r237466) +++ user/attilio/vmcontention/lib/libc/sys/Makefile.inc Sat Jun 23 02:08:15 2012 (r237467) @@ -15,6 +15,10 @@ # .sinclude "${.CURDIR}/${LIBC_ARCH}/sys/Makefile.inc" +SRCS+= clock_gettime.c gettimeofday.c __vdso_gettimeofday.c +NOASM+= clock_gettime.o gettimeofday.o +PSEUDO+= _clock_gettime.o _gettimeofday.o + # Sources common to both syscall interfaces: SRCS+= stack_protector.c stack_protector_compat.c __error.c .if !defined(WITHOUT_SYSCALL_COMPAT) Copied: user/attilio/vmcontention/lib/libc/sys/__vdso_gettimeofday.c (from r237466, head/lib/libc/sys/__vdso_gettimeofday.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/attilio/vmcontention/lib/libc/sys/__vdso_gettimeofday.c Sat Jun 23 02:08:15 2012 (r237467, copy of r237466, head/lib/libc/sys/__vdso_gettimeofday.c) @@ -0,0 +1,142 @@ +/*- + * Copyright (c) 2012 Konstantin Belousov + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include "libc_private.h" + +static u_int +tc_delta(const struct vdso_timehands *th) +{ + + return ((__vdso_gettc(th) - th->th_offset_count) & + th->th_counter_mask); +} + +static int +binuptime(struct bintime *bt, struct vdso_timekeep *tk, int abs) +{ + struct vdso_timehands *th; + uint32_t curr, gen; + + do { + if (!tk->tk_enabled) + return (ENOSYS); + + /* + * XXXKIB. The load of tk->tk_current should use + * atomic_load_acq_32 to provide load barrier. But + * since tk points to r/o mapped page, x86 + * implementation of atomic_load_acq faults. + */ + curr = tk->tk_current; + rmb(); + th = &tk->tk_th[curr]; + if (th->th_algo != VDSO_TH_ALGO_1) + return (ENOSYS); + gen = th->th_gen; + *bt = th->th_offset; + bintime_addx(bt, th->th_scale * tc_delta(th)); + if (abs) + bintime_add(bt, &th->th_boottime); + + /* + * Barrier for load of both tk->tk_current and th->th_gen. + */ + rmb(); + } while (curr != tk->tk_current || gen == 0 || gen != th->th_gen); + return (0); +} + +static struct vdso_timekeep *tk; + +int +__vdso_gettimeofday(struct timeval *tv, struct timezone *tz) +{ + struct bintime bt; + int error; + + if (tz != NULL) + return (ENOSYS); + if (tk == NULL) { + error = _elf_aux_info(AT_TIMEKEEP, &tk, sizeof(tk)); + if (error != 0 || tk == NULL) + return (ENOSYS); + } + if (tk->tk_ver != VDSO_TK_VER_CURR) + return (ENOSYS); + error = binuptime(&bt, tk, 1); + if (error != 0) + return (error); + bintime2timeval(&bt, tv); + return (0); +} + +int +__vdso_clock_gettime(clockid_t clock_id, struct timespec *ts) +{ + struct bintime bt; + int abs, error; + + if (tk == NULL) { + error = _elf_aux_info(AT_TIMEKEEP, &tk, sizeof(tk)); + if (error != 0 || tk == NULL) + return (ENOSYS); + } + if (tk->tk_ver != VDSO_TK_VER_CURR) + return (ENOSYS); + switch (clock_id) { + case CLOCK_REALTIME: + case CLOCK_REALTIME_PRECISE: + case CLOCK_REALTIME_FAST: + case CLOCK_SECOND: + abs = 1; + break; + case CLOCK_MONOTONIC: + case CLOCK_MONOTONIC_PRECISE: + case CLOCK_MONOTONIC_FAST: + case CLOCK_UPTIME: + case CLOCK_UPTIME_PRECISE: + case CLOCK_UPTIME_FAST: + abs = 0; + break; + default: + return (ENOSYS); + } + error = binuptime(&bt, tk, abs); + if (error != 0) + return (error); + bintime2timespec(&bt, ts); + if (clock_id == CLOCK_SECOND) + ts->tv_nsec = 0; + return (0); +} Copied: user/attilio/vmcontention/lib/libc/sys/clock_gettime.c (from r237466, head/lib/libc/sys/clock_gettime.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/attilio/vmcontention/lib/libc/sys/clock_gettime.c Sat Jun 23 02:08:15 2012 (r237467, copy of r237466, head/lib/libc/sys/clock_gettime.c) @@ -0,0 +1,52 @@ +/*- + * Copyright (c) 2012 Konstantin Belousov + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include "libc_private.h" + +int __clock_gettime(clockid_t, struct timespec *ts); + +__weak_reference(__clock_gettime, clock_gettime); + +int +__clock_gettime(clockid_t clock_id, struct timespec *ts) +{ + int error; + + if (__vdso_clock_gettime != NULL && __vdso_gettc != NULL) + error = __vdso_clock_gettime(clock_id, ts); + else + error = ENOSYS; + if (error == ENOSYS) + error = __sys_clock_gettime(clock_id, ts); + return (error); +} Copied: user/attilio/vmcontention/lib/libc/sys/gettimeofday.c (from r237466, head/lib/libc/sys/gettimeofday.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/attilio/vmcontention/lib/libc/sys/gettimeofday.c Sat Jun 23 02:08:15 2012 (r237467, copy of r237466, head/lib/libc/sys/gettimeofday.c) @@ -0,0 +1,51 @@ +/*- + * Copyright (c) 2012 Konstantin Belousov + * + * Redistribution and use in source and binary forms, with or without *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Sat Jun 23 04:47:42 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 52F18106566C; Sat, 23 Jun 2012 04:47:42 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3D4578FC0A; Sat, 23 Jun 2012 04:47:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5N4lgqu020017; Sat, 23 Jun 2012 04:47:42 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5N4lf3f020012; Sat, 23 Jun 2012 04:47:41 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206230447.q5N4lf3f020012@svn.freebsd.org> From: Adrian Chadd Date: Sat, 23 Jun 2012 04:47:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237468 - user/adrian/ath_radar_stuff/src/qt-hpktlog X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 04:47:42 -0000 Author: adrian Date: Sat Jun 23 04:47:41 2012 New Revision: 237468 URL: http://svn.freebsd.org/changeset/base/237468 Log: * Migrate the pcap code to loop over the pcap if in live mode, rather than handling one every 2ms. * Move to using the QwtPlotSpectroCurve, which is an example (but does what I want, thankfully!) 3d plotting widget, which implements 'color' as the z dimension. * For now, just use RSSI as the z dimension. Eventually this should be the "density" rather than RSSI.. Modified: user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.cpp user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.h user/adrian/ath_radar_stuff/src/qt-hpktlog/PktSource.cpp user/adrian/ath_radar_stuff/src/qt-hpktlog/PktSource.h Modified: user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.cpp ============================================================================== --- user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.cpp Sat Jun 23 02:08:15 2012 (r237467) +++ user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.cpp Sat Jun 23 04:47:41 2012 (r237468) @@ -5,6 +5,7 @@ #include "qwt_plot.h" #include "qwt_plot_curve.h" +#include "qwt_plot_spectrocurve.h" #include "qwt_plot_histogram.h" #include "qwt_symbol.h" @@ -35,9 +36,10 @@ MainApp::MainApp(QMainWindow *parent) q_symbol->setSize(2, 2); // And now, the default curve - q_curve = new QwtPlotCurve("curve"); - q_curve->setStyle(QwtPlotCurve::Dots); - q_curve->setSymbol(q_symbol); + q_curve = new QwtPlotSpectroCurve("curve"); + //q_curve->setStyle(QwtPlotCurve::Dots); + //q_curve->setSymbol(q_symbol); + q_curve->setPenWidth(4); q_curve->attach(q_plot); q_plot->show(); @@ -46,7 +48,13 @@ MainApp::MainApp(QMainWindow *parent) MainApp::~MainApp() { - /* XXX TIDYUP */ + /* XXX correct order? */ + if (q_symbol) + delete q_symbol; + if (q_curve) + delete q_curve; + if (q_plot) + delete q_plot; } // @@ -65,13 +73,19 @@ MainApp::getRadarEntry(struct radar_entr q_dur.insert(q_dur.begin(), (float) re.re_dur); q_rssi.insert(q_rssi.begin(), (float) re.re_rssi); + q_points.insert(q_points.begin(), + QwtPoint3D( + (float) re.re_dur, + (float) re.re_rssi, + (float) re.re_rssi * 25.0)); + // If we're too big, delete the first entry - if (q_dur.size() > num_entries) { + if (q_points.size() > num_entries) { q_dur.pop_back(); q_rssi.pop_back(); + q_points.pop_back(); } - // Trim the head entries if the array is too big // (maybe we should use a queue, not a vector?) @@ -83,7 +97,7 @@ void MainApp::RePlot() { // Plot them - q_curve->setSamples(&q_dur[0], &q_rssi[0], q_dur.size()); + q_curve->setSamples(q_points); /* Plot */ q_plot->replot(); Modified: user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.h ============================================================================== --- user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.h Sat Jun 23 02:08:15 2012 (r237467) +++ user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.h Sat Jun 23 04:47:41 2012 (r237468) @@ -7,11 +7,14 @@ #include #include +#include #include "qwt_plot.h" #include "qwt_plot_curve.h" +#include "qwt_plot_spectrocurve.h" #include "qwt_plot_histogram.h" #include "qwt_symbol.h" +#include "qwt_point_3d.h" #include "libradarpkt/pkt.h" @@ -23,7 +26,7 @@ class MainApp : public QMainWindow // Why can't we just use references, rather than // pointers? QwtPlot *q_plot; - QwtPlotCurve *q_curve; + QwtPlotSpectroCurve *q_curve; QwtSymbol *q_symbol; // How many entries to keep in the histogram @@ -32,6 +35,7 @@ class MainApp : public QMainWindow // Our histogram data std::vector q_dur; std::vector q_rssi; + QVector q_points; // TODO When rendering the screen, we only want to do it // every say, 3ms. Modified: user/adrian/ath_radar_stuff/src/qt-hpktlog/PktSource.cpp ============================================================================== --- user/adrian/ath_radar_stuff/src/qt-hpktlog/PktSource.cpp Sat Jun 23 02:08:15 2012 (r237467) +++ user/adrian/ath_radar_stuff/src/qt-hpktlog/PktSource.cpp Sat Jun 23 04:47:41 2012 (r237468) @@ -41,6 +41,8 @@ PktSource::Load(const char *filename) //Kick-start the first timer! timerId = startTimer(1); + isLive = false; + return (true); } @@ -96,6 +98,7 @@ PktSource::OpenLive(const char *ifname) //Kick-start the first timer! timerId = startTimer(2); + isLive = true; return (true); @@ -127,64 +130,62 @@ PktSource::timerEvent(QTimerEvent *event // printf("%s: timer event!\n", __func__); - r = pcap_next_ex(PcapHdl, &hdr, &pkt); + while (1) { + r = pcap_next_ex(PcapHdl, &hdr, &pkt); - // Error? Delete the timer. - if (r < 0) { - killTimer(timerId); - timerId = -1; - printf("%s: final event (r=%d), finish timer!\n", - __func__, - r); - this->Close(); - return; + // Error? Delete the timer. + if (r < 0) { + killTimer(timerId); + timerId = -1; + printf("%s: final event (r=%d), finish timer!\n", + __func__, + r); + this->Close(); + return; + } + + // Nothing available? Just skip until the next + // check. + if (r == 0) + break; + + rt = (struct ieee80211_radiotap_header *) pkt; + if (rt->it_version != 0) { + printf("%s: unknown version (%d)\n", + __func__, + rt->it_version); + break; + } + + // TODO: just assume AR5416 for now.. + switch (chipid) { + case CHIP_AR5416: + r = ar5416_radar_decode(rt, + (pkt + le16toh(rt->it_len)), + hdr->caplen - le16toh(rt->it_len), &re); + break; + case CHIP_AR9280: + r = ar9280_radar_decode(rt, + (pkt + le16toh(rt->it_len)), + hdr->caplen - le16toh(rt->it_len), &re); + break; + default: + printf("%s: unknown chip id? (%d)\n", + __func__, + chipid); + } + + // Error? Skip to the next one. + if (r <= 0) { + printf("%s: parse failed\n", __func__); + } else { + // The actual event may be delayed; so i either have + // to pass a reference (not pointer), _or_ a copy. + emit emitRadarEntry(re); + } + + // Break out of the loop if we're not live + if (! isLive) + break; } - - // Nothing available? Just skip - if (r == 0) { - return; - } - - rt = (struct ieee80211_radiotap_header *) pkt; - if (rt->it_version != 0) { - printf("%s: unknown version (%d)\n", - __func__, - rt->it_version); - return; - } - - // TODO: just assume AR5416 for now.. - switch (chipid) { - case CHIP_AR5416: - r = ar5416_radar_decode(rt, - (pkt + le16toh(rt->it_len)), - hdr->caplen - le16toh(rt->it_len), &re); - break; - case CHIP_AR9280: - r = ar9280_radar_decode(rt, - (pkt + le16toh(rt->it_len)), - hdr->caplen - le16toh(rt->it_len), &re); - break; - default: - printf("%s: unknown chip id? (%d)\n", - __func__, - chipid); - } - // Error? Just wait for the next one? - if (r == 0) { - printf("%s: parse failed\n", __func__); - return; - } - -#if 0 - printf("%s: parsed: tsf=%llu, rssi=%d, dur=%d\n", - __func__, - (unsigned long long) re.re_timestamp, - re.re_rssi, - re.re_dur); -#endif - - // The actual event may be delayed; so i either have - // to pass a reference (not pointer), _or_ a copy. - emit emitRadarEntry(re); } Modified: user/adrian/ath_radar_stuff/src/qt-hpktlog/PktSource.h ============================================================================== --- user/adrian/ath_radar_stuff/src/qt-hpktlog/PktSource.h Sat Jun 23 02:08:15 2012 (r237467) +++ user/adrian/ath_radar_stuff/src/qt-hpktlog/PktSource.h Sat Jun 23 04:47:41 2012 (r237468) @@ -27,9 +27,12 @@ class PktSource : public QObject { pcap_t *PcapHdl; int timerId; int chipid; + bool isLive; public: - PktSource() : PcapHdl(NULL), timerId(-1), chipid(0) { }; + PktSource() : PcapHdl(NULL), timerId(-1), chipid(0), + isLive(false) { }; + ~PktSource(); void SetChipId(int chip_id) { chipid = chip_id; }; int GetChipId() { return (chipid); }; From owner-svn-src-user@FreeBSD.ORG Sat Jun 23 08:36:50 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6C455106567B; Sat, 23 Jun 2012 08:36:50 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 461DF8FC21; Sat, 23 Jun 2012 08:36:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5N8aoaJ030050; Sat, 23 Jun 2012 08:36:50 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5N8aoxl030048; Sat, 23 Jun 2012 08:36:50 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201206230836.q5N8aoxl030048@svn.freebsd.org> From: Doug Barton Date: Sat, 23 Jun 2012 08:36:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237473 - user/dougb/portmaster X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 08:36:50 -0000 Author: dougb Date: Sat Jun 23 08:36:49 2012 New Revision: 237473 URL: http://svn.freebsd.org/changeset/base/237473 Log: Various fixes to IPC_SAVE: 1. In safe_exit() always zero out the file before writing. This is probably redundant now given the following change, but I'll leave it in to be safe for now. 2. Zero out the file after reading it. The change in r236996 could lead to the parent process reading a stale file under certain circumstances. The combination of things that need to happen for this to occur are complex, but not impossible. 3. Move the writing of $PM_BUILD_ONLY_LIST - related variables into safe_exit(). When originally put in the previous location it saved what could have been a spurious test, but that test was long ago added to safe_exit(). Also, by not writing it there it could be missed in certain circumstances where the exit happened without reaching that code in the main script. This brings all the code that writes to the file into safe_exit() 4. NB_DELETE can only be set while building, so move writing it to that section. When -F, and the port has no distfiles, report that explicitly Modified: user/dougb/portmaster/portmaster Modified: user/dougb/portmaster/portmaster ============================================================================== --- user/dougb/portmaster/portmaster Sat Jun 23 07:49:10 2012 (r237472) +++ user/dougb/portmaster/portmaster Sat Jun 23 08:36:49 2012 (r237473) @@ -261,8 +261,8 @@ safe_exit () { [ -n "$grep_deps" ] && pm_unlink $grep_deps # Save state for the parent process to read back in + > $IPC_SAVE if [ -z "$PM_FIRST_PASS" ]; then - > $IPC_SAVE echo "DISPLAY_LIST='$DISPLAY_LIST'" >> $IPC_SAVE echo "INSTALLED_LIST='$INSTALLED_LIST'" >> $IPC_SAVE @@ -273,9 +273,21 @@ safe_exit () { [ "$i" = "$portdir" ] && continue pnu_temp="${pnu_temp}${i} " done - PM_NEEDS_UPDATE=" ${pnu_temp}" + + [ -z "$NO_BACKUP" -a -z "$BACKUP" ] && echo "NB_DELETE='$NB_DELETE'" >> $IPC_SAVE else + if [ "$PM_BUILD_ONLY_LIST" = pmp_doing_build_deps ]; then + echo "build_only_dl_g='$build_only_dl_g'" >> $IPC_SAVE + echo "run_dl_g='$run_dl_g'" >> $IPC_SAVE + rundep_list=`uniquify_list $rundep_list` + echo "rundep_list='$rundep_list'" >> $IPC_SAVE + for f in $rundep_list; do + eval echo "export $f=\'\$$f\'" >> $IPC_SAVE + eval echo "export ${f}_p=\'\$${f}_p\'" >> $IPC_SAVE + done + fi + # Do these here so +IGNOREME can modify them echo "num_of_deps='$num_of_deps'" >> $IPC_SAVE echo "build_l='$build_l'" >> $IPC_SAVE @@ -284,7 +296,6 @@ safe_exit () { echo "CUR_DEPS='$CUR_DEPS'" >> $IPC_SAVE echo "dep_of_deps='$dep_of_deps'" >> $IPC_SAVE echo "PM_NEEDS_UPDATE='$PM_NEEDS_UPDATE'" >> $IPC_SAVE - [ -z "$NO_BACKUP" -a -z "$BACKUP" ] && echo "NB_DELETE='$NB_DELETE'" >> $IPC_SAVE if [ -n "$INTERACTIVE_UPDATE" ]; then echo "INTERACTIVE_YES='$INTERACTIVE_YES'" >> $IPC_SAVE echo "INTERACTIVE_NO='$INTERACTIVE_NO'" >> $IPC_SAVE @@ -2316,7 +2327,7 @@ update_port () { if [ -z "$NO_ACTION" -o -n "$PM_FIRST_PASS" ]; then ($0 $ARGS $1) || update_failed=update_failed - . $IPC_SAVE + . $IPC_SAVE && > $IPC_SAVE [ -n "$update_failed" ] && fail "Update for $1 failed" else pm_v "===>>> Build canceled due to -n flag" @@ -2815,7 +2826,7 @@ multiport () { num=$(( $num + 1 )) init_term_printf "$port ${num}/${numports}" ($0 $ARGS $port) || update_failed=update_failed - . $IPC_SAVE + . $IPC_SAVE && > $IPC_SAVE [ -n "$update_failed" ] && fail "Update for $port failed" case "$PM_NEEDS_UPDATE" in @@ -2859,7 +2870,7 @@ multiport () { num=$(( $num + 1 )) init_term_printf "$port ${num}/${numports}" ($0 $ARGS $port) || update_failed=update_failed - . $IPC_SAVE + . $IPC_SAVE && > $IPC_SAVE [ -n "$update_failed" ] && fail "Update for $port failed" done @@ -3281,6 +3292,8 @@ if [ -z "$PM_INDEX_ONLY" -a -z "$PM_BUIL rm -f ${TMPDIR}/f-${PM_PARENT_PID}-*-${portdir#*/}.* )& fi unset master_sites distfiles file DONT_FETCH fetchlog allfiles + elif [ -n "$FETCH_ONLY" ]; then + echo "===>>> No distfiles to fetch" fi if [ -z "$FETCH_ONLY" -a ! "$PM_PACKAGES" = only ]; then @@ -3319,22 +3332,7 @@ if [ -n "$PM_FIRST_PASS" ]; then [ -n "$PM_URB" -o -n "$PM_URB_UP" ] && PM_URB_DONE="${PM_URB_DONE}${upg_port}:" - if [ ! "$$" -eq "$PM_PARENT_PID" ]; then - # Save state for the parent process to read back in - > $IPC_SAVE - if [ "$PM_BUILD_ONLY_LIST" = pmp_doing_build_deps ]; then - echo "build_only_dl_g='$build_only_dl_g'" >> $IPC_SAVE - echo "run_dl_g='$run_dl_g'" >> $IPC_SAVE - rundep_list=`uniquify_list $rundep_list` - echo "rundep_list='$rundep_list'" >> $IPC_SAVE - for f in $rundep_list; do - eval echo "export $f=\'\$$f\'" >> $IPC_SAVE - eval echo "export ${f}_p=\'\$${f}_p\'" >> $IPC_SAVE - done - fi - - safe_exit - fi + [ "$$" -eq "$PM_PARENT_PID" ] || safe_exit check_fetch_only post_first_pass $portdir From owner-svn-src-user@FreeBSD.ORG Sat Jun 23 09:50:42 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0C124106566C; Sat, 23 Jun 2012 09:50:41 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 89AFD8FC15; Sat, 23 Jun 2012 09:50:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5N9of3S033181; Sat, 23 Jun 2012 09:50:41 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5N9ofXN033178; Sat, 23 Jun 2012 09:50:41 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201206230950.q5N9ofXN033178@svn.freebsd.org> From: Doug Barton Date: Sat, 23 Jun 2012 09:50:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237475 - user/dougb/portmaster X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 09:50:42 -0000 Author: dougb Date: Sat Jun 23 09:50:41 2012 New Revision: 237475 URL: http://svn.freebsd.org/changeset/base/237475 Log: Restore the line from -av that prints each port as we work on it. This was removed in r236996 because at that point in the development of the new term_printf() code it was indeed too verbose. But subsequent changes to that code made this no-longer redundant, and I forgot to put it back. Modified: user/dougb/portmaster/portmaster Modified: user/dougb/portmaster/portmaster ============================================================================== --- user/dougb/portmaster/portmaster Sat Jun 23 09:33:06 2012 (r237474) +++ user/dougb/portmaster/portmaster Sat Jun 23 09:50:41 2012 (r237475) @@ -2992,6 +2992,8 @@ all_first_pass () { local iport origin for iport in "$@"; do + pm_v "===>>> $iport" + case "$CUR_DEPS" in *:${iport}:*) continue ;; esac origin=`origin_from_pdb $iport` || { From owner-svn-src-user@FreeBSD.ORG Sat Jun 23 14:09:53 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A88A106571A; Sat, 23 Jun 2012 14:09:53 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 55EDB8FC1E; Sat, 23 Jun 2012 14:09:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NE9rOT045110; Sat, 23 Jun 2012 14:09:53 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NE9rEs045108; Sat, 23 Jun 2012 14:09:53 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201206231409.q5NE9rEs045108@svn.freebsd.org> From: Attilio Rao Date: Sat, 23 Jun 2012 14:09:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237481 - user/attilio/vmcontention/sys/vm X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 14:09:53 -0000 Author: attilio Date: Sat Jun 23 14:09:52 2012 New Revision: 237481 URL: http://svn.freebsd.org/changeset/base/237481 Log: Fix a bug in the logic, otherwise exhausted is set everytime that outidx == cnt. Reported by: pho Modified: user/attilio/vmcontention/sys/vm/vm_radix.c Modified: user/attilio/vmcontention/sys/vm/vm_radix.c ============================================================================== --- user/attilio/vmcontention/sys/vm/vm_radix.c Sat Jun 23 13:52:44 2012 (r237480) +++ user/attilio/vmcontention/sys/vm/vm_radix.c Sat Jun 23 14:09:52 2012 (r237481) @@ -776,7 +776,7 @@ vm_radix_lookupn(struct vm_radix *rtree, if (++outidx == cnt || (VM_RADIX_MAXVAL - start) == 0) { start++; - if (end == 0) + if ((VM_RADIX_MAXVAL - start) == 0 && end == 0) *exhausted = 1; goto out; } From owner-svn-src-user@FreeBSD.ORG Sat Jun 23 14:15:14 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 06DE7106566B; Sat, 23 Jun 2012 14:15:14 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E2BE78FC0C; Sat, 23 Jun 2012 14:15:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NEFDRp045470; Sat, 23 Jun 2012 14:15:13 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NEFDKc045456; Sat, 23 Jun 2012 14:15:13 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201206231415.q5NEFDKc045456@svn.freebsd.org> From: Attilio Rao Date: Sat, 23 Jun 2012 14:15:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237482 - in user/attilio/vmcontention/sys: cam cam/scsi conf dev/adb kern netinet/ipfw sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 14:15:14 -0000 Author: attilio Date: Sat Jun 23 14:15:13 2012 New Revision: 237482 URL: http://svn.freebsd.org/changeset/base/237482 Log: MFC Added: user/attilio/vmcontention/sys/kern/kern_sharedpage.c - copied unchanged from r237481, head/sys/kern/kern_sharedpage.c Modified: user/attilio/vmcontention/sys/cam/cam_periph.c user/attilio/vmcontention/sys/cam/scsi/scsi_all.c user/attilio/vmcontention/sys/cam/scsi/scsi_all.h user/attilio/vmcontention/sys/cam/scsi/scsi_cd.c user/attilio/vmcontention/sys/cam/scsi/scsi_da.c user/attilio/vmcontention/sys/conf/files user/attilio/vmcontention/sys/dev/adb/adb_kbd.c user/attilio/vmcontention/sys/kern/kern_exec.c user/attilio/vmcontention/sys/kern/kern_tc.c user/attilio/vmcontention/sys/netinet/ipfw/ip_fw_table.c user/attilio/vmcontention/sys/sys/sysent.h user/attilio/vmcontention/sys/sys/vdso.h Directory Properties: user/attilio/vmcontention/ (props changed) user/attilio/vmcontention/sys/ (props changed) user/attilio/vmcontention/sys/conf/ (props changed) Modified: user/attilio/vmcontention/sys/cam/cam_periph.c ============================================================================== --- user/attilio/vmcontention/sys/cam/cam_periph.c Sat Jun 23 14:09:52 2012 (r237481) +++ user/attilio/vmcontention/sys/cam/cam_periph.c Sat Jun 23 14:15:13 2012 (r237482) @@ -1147,22 +1147,15 @@ camperiphdone(struct cam_periph *periph, union ccb *saved_ccb; cam_status status; struct scsi_start_stop_unit *scsi_cmd; + int error_code, sense_key, asc, ascq; scsi_cmd = (struct scsi_start_stop_unit *) &done_ccb->csio.cdb_io.cdb_bytes; status = done_ccb->ccb_h.status; if ((status & CAM_STATUS_MASK) != CAM_REQ_CMP) { - if ((status & CAM_STATUS_MASK) == CAM_SCSI_STATUS_ERROR && - (status & CAM_AUTOSNS_VALID)) { - struct scsi_sense_data *sense; - int error_code, sense_key, asc, ascq, sense_len; - - sense = &done_ccb->csio.sense_data; - sense_len = done_ccb->csio.sense_len - - done_ccb->csio.sense_resid; - scsi_extract_sense_len(sense, sense_len, &error_code, - &sense_key, &asc, &ascq, /*show_errors*/ 1); + if (scsi_extract_sense_ccb(done_ccb, + &error_code, &sense_key, &asc, &ascq)) { /* * If the error is "invalid field in CDB", * and the load/eject flag is set, turn the @@ -1421,12 +1414,8 @@ camperiphscsisenseerror(union ccb *ccb, cgd.ccb_h.func_code = XPT_GDEV_TYPE; xpt_action((union ccb *)&cgd); - if ((ccb->ccb_h.status & CAM_AUTOSNS_VALID) != 0) - err_action = scsi_error_action(&ccb->csio, - &cgd.inq_data, - sense_flags); - else - err_action = SS_RETRY|SSQ_DECREMENT_COUNT|EIO; + err_action = scsi_error_action(&ccb->csio, &cgd.inq_data, + sense_flags); error = err_action & SS_ERRMASK; /* Modified: user/attilio/vmcontention/sys/cam/scsi/scsi_all.c ============================================================================== --- user/attilio/vmcontention/sys/cam/scsi/scsi_all.c Sat Jun 23 14:09:52 2012 (r237481) +++ user/attilio/vmcontention/sys/cam/scsi/scsi_all.c Sat Jun 23 14:15:13 2012 (r237482) @@ -2834,11 +2834,10 @@ scsi_error_action(struct ccb_scsiio *csi int error_code, sense_key, asc, ascq; scsi_sense_action action; - scsi_extract_sense_len(&csio->sense_data, csio->sense_len - - csio->sense_resid, &error_code, - &sense_key, &asc, &ascq, /*show_errors*/ 1); - - if ((error_code == SSD_DEFERRED_ERROR) + if (!scsi_extract_sense_ccb((union ccb *)csio, + &error_code, &sense_key, &asc, &ascq)) { + action = SS_RETRY | SSQ_DECREMENT_COUNT | SSQ_PRINT_SENSE | EIO; + } else if ((error_code == SSD_DEFERRED_ERROR) || (error_code == SSD_DESC_DEFERRED_ERROR)) { /* * XXX dufault@FreeBSD.org @@ -4622,6 +4621,36 @@ scsi_extract_sense(struct scsi_sense_dat } /* + * Extract basic sense information from SCSI I/O CCB structure. + */ +int +scsi_extract_sense_ccb(union ccb *ccb, + int *error_code, int *sense_key, int *asc, int *ascq) +{ + struct scsi_sense_data *sense_data; + + /* Make sure there are some sense data we can access. */ + if (ccb->ccb_h.func_code != XPT_SCSI_IO || + (ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_SCSI_STATUS_ERROR || + (ccb->csio.scsi_status != SCSI_STATUS_CHECK_COND) || + (ccb->ccb_h.status & CAM_AUTOSNS_VALID) == 0 || + (ccb->ccb_h.flags & CAM_SENSE_PHYS)) + return (0); + + if (ccb->ccb_h.flags & CAM_SENSE_PTR) + bcopy(&ccb->csio.sense_data, &sense_data, + sizeof(struct scsi_sense_data *)); + else + sense_data = &ccb->csio.sense_data; + scsi_extract_sense_len(sense_data, + ccb->csio.sense_len - ccb->csio.sense_resid, + error_code, sense_key, asc, ascq, 1); + if (*error_code == -1) + return (0); + return (1); +} + +/* * Extract basic sense information. If show_errors is set, sense values * will be set to -1 if they are not present. */ Modified: user/attilio/vmcontention/sys/cam/scsi/scsi_all.h ============================================================================== --- user/attilio/vmcontention/sys/cam/scsi/scsi_all.h Sat Jun 23 14:09:52 2012 (r237481) +++ user/attilio/vmcontention/sys/cam/scsi/scsi_all.h Sat Jun 23 14:15:13 2012 (r237482) @@ -2388,6 +2388,8 @@ int scsi_devid_match(uint8_t *rhs, size void scsi_extract_sense(struct scsi_sense_data *sense, int *error_code, int *sense_key, int *asc, int *ascq); +int scsi_extract_sense_ccb(union ccb *ccb, int *error_code, int *sense_key, + int *asc, int *ascq); void scsi_extract_sense_len(struct scsi_sense_data *sense, u_int sense_len, int *error_code, int *sense_key, int *asc, int *ascq, int show_errors); Modified: user/attilio/vmcontention/sys/cam/scsi/scsi_cd.c ============================================================================== --- user/attilio/vmcontention/sys/cam/scsi/scsi_cd.c Sat Jun 23 14:09:52 2012 (r237481) +++ user/attilio/vmcontention/sys/cam/scsi/scsi_cd.c Sat Jun 23 14:15:13 2012 (r237482) @@ -1676,7 +1676,6 @@ cddone(struct cam_periph *periph, union return; } else if (error != 0) { - struct scsi_sense_data *sense; int asc, ascq; int sense_key, error_code; int have_sense; @@ -1699,20 +1698,12 @@ cddone(struct cam_periph *periph, union cgd.ccb_h.func_code = XPT_GDEV_TYPE; xpt_action((union ccb *)&cgd); - if (((csio->ccb_h.flags & CAM_SENSE_PHYS) != 0) - || ((csio->ccb_h.flags & CAM_SENSE_PTR) != 0) - || ((status & CAM_AUTOSNS_VALID) == 0)) - have_sense = FALSE; - else + if (scsi_extract_sense_ccb(done_ccb, + &error_code, &sense_key, &asc, &ascq)) have_sense = TRUE; + else + have_sense = FALSE; - if (have_sense) { - sense = &csio->sense_data; - scsi_extract_sense_len(sense, - csio->sense_len - csio->sense_resid, - &error_code, &sense_key, &asc, - &ascq, /*show_errors*/ 1); - } /* * Attach to anything that claims to be a * CDROM or WORM device, as long as it @@ -3138,7 +3129,7 @@ cderror(union ccb *ccb, u_int32_t cam_fl { struct cd_softc *softc; struct cam_periph *periph; - int error; + int error, error_code, sense_key, asc, ascq; periph = xpt_path_periph(ccb->ccb_h.path); softc = (struct cd_softc *)periph->softc; @@ -3152,19 +3143,10 @@ cderror(union ccb *ccb, u_int32_t cam_fl */ if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_INVALID) { error = cd6byteworkaround(ccb); - } else if (((ccb->ccb_h.status & CAM_STATUS_MASK) == - CAM_SCSI_STATUS_ERROR) - && (ccb->ccb_h.status & CAM_AUTOSNS_VALID) - && (ccb->csio.scsi_status == SCSI_STATUS_CHECK_COND) - && ((ccb->ccb_h.flags & CAM_SENSE_PHYS) == 0) - && ((ccb->ccb_h.flags & CAM_SENSE_PTR) == 0)) { - int sense_key, error_code, asc, ascq; - - scsi_extract_sense_len(&ccb->csio.sense_data, - ccb->csio.sense_len - ccb->csio.sense_resid, &error_code, - &sense_key, &asc, &ascq, /*show_errors*/ 1); + } else if (scsi_extract_sense_ccb(ccb, + &error_code, &sense_key, &asc, &ascq)) { if (sense_key == SSD_KEY_ILLEGAL_REQUEST) - error = cd6byteworkaround(ccb); + error = cd6byteworkaround(ccb); } if (error == ERESTART) Modified: user/attilio/vmcontention/sys/cam/scsi/scsi_da.c ============================================================================== --- user/attilio/vmcontention/sys/cam/scsi/scsi_da.c Sat Jun 23 14:09:52 2012 (r237481) +++ user/attilio/vmcontention/sys/cam/scsi/scsi_da.c Sat Jun 23 14:15:13 2012 (r237482) @@ -2254,7 +2254,6 @@ dadone(struct cam_periph *periph, union */ return; } else if (error != 0) { - struct scsi_sense_data *sense; int asc, ascq; int sense_key, error_code; int have_sense; @@ -2277,20 +2276,12 @@ dadone(struct cam_periph *periph, union cgd.ccb_h.func_code = XPT_GDEV_TYPE; xpt_action((union ccb *)&cgd); - if (((csio->ccb_h.flags & CAM_SENSE_PHYS) != 0) - || ((csio->ccb_h.flags & CAM_SENSE_PTR) != 0) - || ((status & CAM_AUTOSNS_VALID) == 0)) - have_sense = FALSE; - else + if (scsi_extract_sense_ccb(done_ccb, + &error_code, &sense_key, &asc, &ascq)) have_sense = TRUE; + else + have_sense = FALSE; - if (have_sense) { - sense = &csio->sense_data; - scsi_extract_sense_len(sense, - csio->sense_len - csio->sense_resid, - &error_code, &sense_key, &asc, - &ascq, /*show_errors*/ 1); - } /* * If we tried READ CAPACITY(16) and failed, * fallback to READ CAPACITY(10). @@ -2428,7 +2419,7 @@ daerror(union ccb *ccb, u_int32_t cam_fl { struct da_softc *softc; struct cam_periph *periph; - int error; + int error, error_code, sense_key, asc, ascq; periph = xpt_path_periph(ccb->ccb_h.path); softc = (struct da_softc *)periph->softc; @@ -2440,16 +2431,8 @@ daerror(union ccb *ccb, u_int32_t cam_fl error = 0; if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_INVALID) { error = cmd6workaround(ccb); - } else if (((ccb->ccb_h.status & CAM_STATUS_MASK) == - CAM_SCSI_STATUS_ERROR) - && (ccb->ccb_h.status & CAM_AUTOSNS_VALID) - && (ccb->csio.scsi_status == SCSI_STATUS_CHECK_COND) - && ((ccb->ccb_h.flags & CAM_SENSE_PHYS) == 0) - && ((ccb->ccb_h.flags & CAM_SENSE_PTR) == 0)) { - int sense_key, error_code, asc, ascq; - - scsi_extract_sense(&ccb->csio.sense_data, - &error_code, &sense_key, &asc, &ascq); + } else if (scsi_extract_sense_ccb(ccb, + &error_code, &sense_key, &asc, &ascq)) { if (sense_key == SSD_KEY_ILLEGAL_REQUEST) error = cmd6workaround(ccb); /* Modified: user/attilio/vmcontention/sys/conf/files ============================================================================== --- user/attilio/vmcontention/sys/conf/files Sat Jun 23 14:09:52 2012 (r237481) +++ user/attilio/vmcontention/sys/conf/files Sat Jun 23 14:15:13 2012 (r237482) @@ -2567,6 +2567,7 @@ kern/kern_rmlock.c standard kern/kern_rwlock.c standard kern/kern_sdt.c optional kdtrace_hooks kern/kern_sema.c standard +kern/kern_sharedpage.c standard kern/kern_shutdown.c standard kern/kern_sig.c standard kern/kern_switch.c standard Modified: user/attilio/vmcontention/sys/dev/adb/adb_kbd.c ============================================================================== --- user/attilio/vmcontention/sys/dev/adb/adb_kbd.c Sat Jun 23 14:09:52 2012 (r237481) +++ user/attilio/vmcontention/sys/dev/adb/adb_kbd.c Sat Jun 23 14:15:13 2012 (r237482) @@ -426,8 +426,10 @@ adb_kbd_receive_packet(device_t dev, u_c /* 0x7f is always the power button */ if (data[0] == 0x7f && devctl_process_running()) { devctl_notify("PMU", "Button", "pressed", NULL); + mtx_unlock(&sc->sc_mutex); return (0); } else if (data[0] == 0xff) { + mtx_unlock(&sc->sc_mutex); return (0); /* Ignore power button release. */ } if ((data[0] & 0x7f) == 57 && sc->buffers < 7) { Modified: user/attilio/vmcontention/sys/kern/kern_exec.c ============================================================================== --- user/attilio/vmcontention/sys/kern/kern_exec.c Sat Jun 23 14:09:52 2012 (r237481) +++ user/attilio/vmcontention/sys/kern/kern_exec.c Sat Jun 23 14:15:13 2012 (r237482) @@ -28,7 +28,6 @@ __FBSDID("$FreeBSD$"); #include "opt_capsicum.h" -#include "opt_compat.h" #include "opt_hwpmc_hooks.h" #include "opt_kdtrace.h" #include "opt_ktrace.h" @@ -65,7 +64,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #ifdef KTRACE @@ -1513,204 +1511,3 @@ exec_unregister(execsw_arg) execsw = newexecsw; return (0); } - -static struct sx shared_page_alloc_sx; -static vm_object_t shared_page_obj; -static int shared_page_free; - -struct sf_buf * -shared_page_write_start(int base) -{ - vm_page_t m; - struct sf_buf *s; - - VM_OBJECT_LOCK(shared_page_obj); - m = vm_page_grab(shared_page_obj, OFF_TO_IDX(base), VM_ALLOC_RETRY); - VM_OBJECT_UNLOCK(shared_page_obj); - s = sf_buf_alloc(m, SFB_DEFAULT); - return (s); -} - -void -shared_page_write_end(struct sf_buf *sf) -{ - vm_page_t m; - - m = sf_buf_page(sf); - sf_buf_free(sf); - VM_OBJECT_LOCK(shared_page_obj); - vm_page_wakeup(m); - VM_OBJECT_UNLOCK(shared_page_obj); -} - -void -shared_page_write(int base, int size, const void *data) -{ - struct sf_buf *sf; - vm_offset_t sk; - - sf = shared_page_write_start(base); - sk = sf_buf_kva(sf); - bcopy(data, (void *)(sk + (base & PAGE_MASK)), size); - shared_page_write_end(sf); -} - -static int -shared_page_alloc_locked(int size, int align) -{ - int res; - - res = roundup(shared_page_free, align); - if (res + size >= IDX_TO_OFF(shared_page_obj->size)) - res = -1; - else - shared_page_free = res + size; - return (res); -} - -int -shared_page_alloc(int size, int align) -{ - int res; - - sx_xlock(&shared_page_alloc_sx); - res = shared_page_alloc_locked(size, align); - sx_xunlock(&shared_page_alloc_sx); - return (res); -} - -int -shared_page_fill(int size, int align, const void *data) -{ - int res; - - sx_xlock(&shared_page_alloc_sx); - res = shared_page_alloc_locked(size, align); - if (res != -1) - shared_page_write(res, size, data); - sx_xunlock(&shared_page_alloc_sx); - return (res); -} - -static void -shared_page_init(void *dummy __unused) -{ - vm_page_t m; - - sx_init(&shared_page_alloc_sx, "shpsx"); - shared_page_obj = vm_pager_allocate(OBJT_PHYS, 0, PAGE_SIZE, - VM_PROT_DEFAULT, 0, NULL); - VM_OBJECT_LOCK(shared_page_obj); - m = vm_page_grab(shared_page_obj, 0, VM_ALLOC_RETRY | VM_ALLOC_NOBUSY | - VM_ALLOC_ZERO); - m->valid = VM_PAGE_BITS_ALL; - VM_OBJECT_UNLOCK(shared_page_obj); -} - -SYSINIT(shp, SI_SUB_EXEC, SI_ORDER_FIRST, (sysinit_cfunc_t)shared_page_init, - NULL); - -static void -timehands_update(void *arg) -{ - struct sysentvec *sv; - struct sf_buf *sf; - struct vdso_timehands th; - struct vdso_timekeep *tk; - uint32_t enabled, idx; - - sv = arg; - sx_xlock(&shared_page_alloc_sx); - enabled = tc_fill_vdso_timehands(&th); - sf = shared_page_write_start(sv->sv_timekeep_off); - tk = (void *)(sf_buf_kva(sf) + (sv->sv_timekeep_off & PAGE_MASK)); - idx = sv->sv_timekeep_curr; - atomic_store_rel_32(&tk->tk_th[idx].th_gen, 0); - if (++idx >= VDSO_TH_NUM) - idx = 0; - sv->sv_timekeep_curr = idx; - if (++sv->sv_timekeep_gen == 0) - sv->sv_timekeep_gen = 1; - th.th_gen = 0; - if (enabled) - tk->tk_th[idx] = th; - tk->tk_enabled = enabled; - atomic_store_rel_32(&tk->tk_th[idx].th_gen, sv->sv_timekeep_gen); - tk->tk_current = idx; - shared_page_write_end(sf); - sx_xunlock(&shared_page_alloc_sx); -} - -#ifdef COMPAT_FREEBSD32 -static void -timehands_update32(void *arg) -{ - struct sysentvec *sv; - struct sf_buf *sf; - struct vdso_timekeep32 *tk; - struct vdso_timehands32 th; - uint32_t enabled, idx; - - sv = arg; - sx_xlock(&shared_page_alloc_sx); - enabled = tc_fill_vdso_timehands32(&th); - sf = shared_page_write_start(sv->sv_timekeep_off); - tk = (void *)(sf_buf_kva(sf) + (sv->sv_timekeep_off & PAGE_MASK)); - idx = sv->sv_timekeep_curr; - atomic_store_rel_32(&tk->tk_th[idx].th_gen, 0); - if (++idx >= VDSO_TH_NUM) - idx = 0; - sv->sv_timekeep_curr = idx; - if (++sv->sv_timekeep_gen == 0) - sv->sv_timekeep_gen = 1; - th.th_gen = 0; - if (enabled) - tk->tk_th[idx] = th; - tk->tk_enabled = enabled; - atomic_store_rel_32(&tk->tk_th[idx].th_gen, sv->sv_timekeep_gen); - tk->tk_current = idx; - shared_page_write_end(sf); - sx_xunlock(&shared_page_alloc_sx); -} -#endif - -void -exec_sysvec_init(void *param) -{ - struct sysentvec *sv; - int tk_base; - uint32_t tk_ver; - - sv = (struct sysentvec *)param; - - if ((sv->sv_flags & SV_SHP) == 0) - return; - sv->sv_shared_page_obj = shared_page_obj; - sv->sv_sigcode_base = sv->sv_shared_page_base + - shared_page_fill(*(sv->sv_szsigcode), 16, sv->sv_sigcode); - tk_ver = VDSO_TK_VER_CURR; -#ifdef COMPAT_FREEBSD32 - if ((sv->sv_flags & SV_ILP32) != 0) { - tk_base = shared_page_alloc(sizeof(struct vdso_timekeep32) + - sizeof(struct vdso_timehands32) * VDSO_TH_NUM, 16); - KASSERT(tk_base != -1, ("tk_base -1 for 32bit")); - EVENTHANDLER_REGISTER(tc_windup, timehands_update32, sv, - EVENTHANDLER_PRI_ANY); - shared_page_write(tk_base + offsetof(struct vdso_timekeep32, - tk_ver), sizeof(uint32_t), &tk_ver); - } else { -#endif - tk_base = shared_page_alloc(sizeof(struct vdso_timekeep) + - sizeof(struct vdso_timehands) * VDSO_TH_NUM, 16); - KASSERT(tk_base != -1, ("tk_base -1 for native")); - EVENTHANDLER_REGISTER(tc_windup, timehands_update, sv, - EVENTHANDLER_PRI_ANY); - shared_page_write(tk_base + offsetof(struct vdso_timekeep, - tk_ver), sizeof(uint32_t), &tk_ver); -#ifdef COMPAT_FREEBSD32 - } -#endif - sv->sv_timekeep_base = sv->sv_shared_page_base + tk_base; - sv->sv_timekeep_off = tk_base; - EVENTHANDLER_INVOKE(tc_windup); -} Copied: user/attilio/vmcontention/sys/kern/kern_sharedpage.c (from r237481, head/sys/kern/kern_sharedpage.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/attilio/vmcontention/sys/kern/kern_sharedpage.c Sat Jun 23 14:15:13 2012 (r237482, copy of r237481, head/sys/kern/kern_sharedpage.c) @@ -0,0 +1,240 @@ +/*- + * Copyright (c) 2010, 2012 Konstantin Belousov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_compat.h" +#include "opt_vm.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static struct sx shared_page_alloc_sx; +static vm_object_t shared_page_obj; +static int shared_page_free; +char *shared_page_mapping; + +void +shared_page_write(int base, int size, const void *data) +{ + + bcopy(data, shared_page_mapping + base, size); +} + +static int +shared_page_alloc_locked(int size, int align) +{ + int res; + + res = roundup(shared_page_free, align); + if (res + size >= IDX_TO_OFF(shared_page_obj->size)) + res = -1; + else + shared_page_free = res + size; + return (res); +} + +int +shared_page_alloc(int size, int align) +{ + int res; + + sx_xlock(&shared_page_alloc_sx); + res = shared_page_alloc_locked(size, align); + sx_xunlock(&shared_page_alloc_sx); + return (res); +} + +int +shared_page_fill(int size, int align, const void *data) +{ + int res; + + sx_xlock(&shared_page_alloc_sx); + res = shared_page_alloc_locked(size, align); + if (res != -1) + shared_page_write(res, size, data); + sx_xunlock(&shared_page_alloc_sx); + return (res); +} + +static void +shared_page_init(void *dummy __unused) +{ + vm_page_t m; + vm_offset_t addr; + + sx_init(&shared_page_alloc_sx, "shpsx"); + shared_page_obj = vm_pager_allocate(OBJT_PHYS, 0, PAGE_SIZE, + VM_PROT_DEFAULT, 0, NULL); + VM_OBJECT_LOCK(shared_page_obj); + m = vm_page_grab(shared_page_obj, 0, VM_ALLOC_RETRY | VM_ALLOC_NOBUSY | + VM_ALLOC_ZERO); + m->valid = VM_PAGE_BITS_ALL; + VM_OBJECT_UNLOCK(shared_page_obj); + addr = kmem_alloc_nofault(kernel_map, PAGE_SIZE); + pmap_qenter(addr, &m, 1); + shared_page_mapping = (char *)addr; +} + +SYSINIT(shp, SI_SUB_EXEC, SI_ORDER_FIRST, (sysinit_cfunc_t)shared_page_init, + NULL); + +static void +timehands_update(struct sysentvec *sv) +{ + struct vdso_timehands th; + struct vdso_timekeep *tk; + uint32_t enabled, idx; + + enabled = tc_fill_vdso_timehands(&th); + tk = (struct vdso_timekeep *)(shared_page_mapping + + sv->sv_timekeep_off); + idx = sv->sv_timekeep_curr; + atomic_store_rel_32(&tk->tk_th[idx].th_gen, 0); + if (++idx >= VDSO_TH_NUM) + idx = 0; + sv->sv_timekeep_curr = idx; + if (++sv->sv_timekeep_gen == 0) + sv->sv_timekeep_gen = 1; + th.th_gen = 0; + if (enabled) + tk->tk_th[idx] = th; + tk->tk_enabled = enabled; + atomic_store_rel_32(&tk->tk_th[idx].th_gen, sv->sv_timekeep_gen); + tk->tk_current = idx; +} + +#ifdef COMPAT_FREEBSD32 +static void +timehands_update32(struct sysentvec *sv) +{ + struct vdso_timekeep32 *tk; + struct vdso_timehands32 th; + uint32_t enabled, idx; + + enabled = tc_fill_vdso_timehands32(&th); + tk = (struct vdso_timekeep32 *)(shared_page_mapping + + sv->sv_timekeep_off); + idx = sv->sv_timekeep_curr; + atomic_store_rel_32(&tk->tk_th[idx].th_gen, 0); + if (++idx >= VDSO_TH_NUM) + idx = 0; + sv->sv_timekeep_curr = idx; + if (++sv->sv_timekeep_gen == 0) + sv->sv_timekeep_gen = 1; + th.th_gen = 0; + if (enabled) + tk->tk_th[idx] = th; + tk->tk_enabled = enabled; + atomic_store_rel_32(&tk->tk_th[idx].th_gen, sv->sv_timekeep_gen); + tk->tk_current = idx; +} +#endif + +/* + * This is hackish, but easiest way to avoid creating list structures + * that needs to be iterated over from the hardclock interrupt + * context. + */ +static struct sysentvec *host_sysentvec; +#ifdef COMPAT_FREEBSD32 +static struct sysentvec *compat32_sysentvec; +#endif + +void +timekeep_push_vdso(void) +{ + + if (host_sysentvec != NULL && host_sysentvec->sv_timekeep_base != 0) + timehands_update(host_sysentvec); +#ifdef COMPAT_FREEBSD32 + if (compat32_sysentvec != NULL && + compat32_sysentvec->sv_timekeep_base != 0) + timehands_update32(compat32_sysentvec); +#endif +} + +void +exec_sysvec_init(void *param) +{ + struct sysentvec *sv; + int tk_base; + uint32_t tk_ver; + + sv = (struct sysentvec *)param; + + if ((sv->sv_flags & SV_SHP) == 0) + return; + sv->sv_shared_page_obj = shared_page_obj; + sv->sv_sigcode_base = sv->sv_shared_page_base + + shared_page_fill(*(sv->sv_szsigcode), 16, sv->sv_sigcode); + if ((sv->sv_flags & SV_ABI_MASK) != SV_ABI_FREEBSD) + return; + tk_ver = VDSO_TK_VER_CURR; +#ifdef COMPAT_FREEBSD32 + if ((sv->sv_flags & SV_ILP32) != 0) { + tk_base = shared_page_alloc(sizeof(struct vdso_timekeep32) + + sizeof(struct vdso_timehands32) * VDSO_TH_NUM, 16); + KASSERT(tk_base != -1, ("tk_base -1 for 32bit")); + shared_page_write(tk_base + offsetof(struct vdso_timekeep32, + tk_ver), sizeof(uint32_t), &tk_ver); + KASSERT(compat32_sysentvec == 0, + ("Native compat32 already registered")); + compat32_sysentvec = sv; + } else { +#endif + tk_base = shared_page_alloc(sizeof(struct vdso_timekeep) + + sizeof(struct vdso_timehands) * VDSO_TH_NUM, 16); + KASSERT(tk_base != -1, ("tk_base -1 for native")); + shared_page_write(tk_base + offsetof(struct vdso_timekeep, + tk_ver), sizeof(uint32_t), &tk_ver); + KASSERT(host_sysentvec == 0, ("Native already registered")); + host_sysentvec = sv; +#ifdef COMPAT_FREEBSD32 + } +#endif + sv->sv_timekeep_base = sv->sv_shared_page_base + tk_base; + sv->sv_timekeep_off = tk_base; + timekeep_push_vdso(); +} Modified: user/attilio/vmcontention/sys/kern/kern_tc.c ============================================================================== --- user/attilio/vmcontention/sys/kern/kern_tc.c Sat Jun 23 14:09:52 2012 (r237481) +++ user/attilio/vmcontention/sys/kern/kern_tc.c Sat Jun 23 14:15:13 2012 (r237482) @@ -31,7 +31,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -121,12 +120,8 @@ SYSCTL_INT(_kern_timecounter, OID_AUTO, ×tepwarnings, 0, "Log time steps"); static void tc_windup(void); -static void tc_windup_push_vdso(void *ctx, int pending); static void cpu_tick_calibrate(int); -static struct task tc_windup_push_vdso_task = TASK_INITIALIZER(0, - tc_windup_push_vdso, 0); - static int sysctl_kern_boottime(SYSCTL_HANDLER_ARGS) { @@ -1367,7 +1362,7 @@ tc_windup(void) #endif timehands = th; - taskqueue_enqueue_fast(taskqueue_fast, &tc_windup_push_vdso_task); + timekeep_push_vdso(); } /* Report or change the active timecounter hardware. */ @@ -1394,7 +1389,7 @@ sysctl_kern_timecounter_hardware(SYSCTL_ (void)newtc->tc_get_timecount(newtc); timecounter = newtc; - EVENTHANDLER_INVOKE(tc_windup); + timekeep_push_vdso(); return (0); } return (EINVAL); @@ -1865,7 +1860,7 @@ sysctl_fast_gettime(SYSCTL_HANDLER_ARGS) if (error != 0) return (error); vdso_th_enable = old_vdso_th_enable; - EVENTHANDLER_INVOKE(tc_windup); + timekeep_push_vdso(); return (0); } SYSCTL_PROC(_kern_timecounter, OID_AUTO, fast_gettime, @@ -1877,19 +1872,15 @@ tc_fill_vdso_timehands(struct vdso_timeh { struct timehands *th; uint32_t enabled; - int gen; - do { - th = timehands; - gen = th->th_generation; - vdso_th->th_algo = VDSO_TH_ALGO_1; - vdso_th->th_scale = th->th_scale; - vdso_th->th_offset_count = th->th_offset_count; - vdso_th->th_counter_mask = th->th_counter->tc_counter_mask; - vdso_th->th_offset = th->th_offset; - vdso_th->th_boottime = boottimebin; - enabled = cpu_fill_vdso_timehands(vdso_th); - } while (gen == 0 || timehands->th_generation != gen); + th = timehands; + vdso_th->th_algo = VDSO_TH_ALGO_1; + vdso_th->th_scale = th->th_scale; + vdso_th->th_offset_count = th->th_offset_count; + vdso_th->th_counter_mask = th->th_counter->tc_counter_mask; + vdso_th->th_offset = th->th_offset; + vdso_th->th_boottime = boottimebin; + enabled = cpu_fill_vdso_timehands(vdso_th); if (!vdso_th_enable) enabled = 0; return (enabled); @@ -1901,30 +1892,19 @@ tc_fill_vdso_timehands32(struct vdso_tim { struct timehands *th; uint32_t enabled; - int gen; - do { - th = timehands; - gen = th->th_generation; - vdso_th32->th_algo = VDSO_TH_ALGO_1; - *(uint64_t *)&vdso_th32->th_scale[0] = th->th_scale; - vdso_th32->th_offset_count = th->th_offset_count; - vdso_th32->th_counter_mask = th->th_counter->tc_counter_mask; - vdso_th32->th_offset.sec = th->th_offset.sec; - *(uint64_t *)&vdso_th32->th_offset.frac[0] = th->th_offset.frac; - vdso_th32->th_boottime.sec = boottimebin.sec; - *(uint64_t *)&vdso_th32->th_boottime.frac[0] = boottimebin.frac; - enabled = cpu_fill_vdso_timehands32(vdso_th32); - } while (gen == 0 || timehands->th_generation != gen); + th = timehands; + vdso_th32->th_algo = VDSO_TH_ALGO_1; + *(uint64_t *)&vdso_th32->th_scale[0] = th->th_scale; + vdso_th32->th_offset_count = th->th_offset_count; + vdso_th32->th_counter_mask = th->th_counter->tc_counter_mask; + vdso_th32->th_offset.sec = th->th_offset.sec; + *(uint64_t *)&vdso_th32->th_offset.frac[0] = th->th_offset.frac; + vdso_th32->th_boottime.sec = boottimebin.sec; + *(uint64_t *)&vdso_th32->th_boottime.frac[0] = boottimebin.frac; + enabled = cpu_fill_vdso_timehands32(vdso_th32); if (!vdso_th_enable) enabled = 0; return (enabled); } #endif - -static void -tc_windup_push_vdso(void *ctx, int pending) -{ - - EVENTHANDLER_INVOKE(tc_windup); -} Modified: user/attilio/vmcontention/sys/netinet/ipfw/ip_fw_table.c ============================================================================== --- user/attilio/vmcontention/sys/netinet/ipfw/ip_fw_table.c Sat Jun 23 14:09:52 2012 (r237481) +++ user/attilio/vmcontention/sys/netinet/ipfw/ip_fw_table.c Sat Jun 23 14:15:13 2012 (r237482) @@ -568,7 +568,8 @@ ipfw_lookup_table_extended(struct ip_fw_ break; case IPFW_TABLE_INTERFACE: - KEY_LEN(iface) = strlcpy(iface.ifname, (char *)paddr, IF_NAMESIZE); + KEY_LEN(iface) = KEY_LEN_IFACE + + strlcpy(iface.ifname, (char *)paddr, IF_NAMESIZE); /* Assume direct match */ /* FIXME: Add interface pattern matching */ xent = (struct table_xentry *)(rnh->rnh_lookup(&iface, NULL, rnh)); Modified: user/attilio/vmcontention/sys/sys/sysent.h ============================================================================== --- user/attilio/vmcontention/sys/sys/sysent.h Sat Jun 23 14:09:52 2012 (r237481) +++ user/attilio/vmcontention/sys/sys/sysent.h Sat Jun 23 14:15:13 2012 (r237482) @@ -260,13 +260,10 @@ int lkmressys(struct thread *, struct no int syscall_thread_enter(struct thread *td, struct sysent *se); void syscall_thread_exit(struct thread *td, struct sysent *se); -struct sf_buf; int shared_page_alloc(int size, int align); int shared_page_fill(int size, int align, const void *data); void shared_page_write(int base, int size, const void *data); void exec_sysvec_init(void *param); -struct sf_buf *shared_page_write_start(int base); -void shared_page_write_end(struct sf_buf *sf); #define INIT_SYSENTVEC(name, sv) \ SYSINIT(name, SI_SUB_EXEC, SI_ORDER_ANY, \ Modified: user/attilio/vmcontention/sys/sys/vdso.h ============================================================================== --- user/attilio/vmcontention/sys/sys/vdso.h Sat Jun 23 14:09:52 2012 (r237481) +++ user/attilio/vmcontention/sys/sys/vdso.h Sat Jun 23 14:15:13 2012 (r237482) @@ -29,7 +29,6 @@ #define _SYS_VDSO_H #include -#include #include struct vdso_timehands { @@ -74,6 +73,8 @@ u_int __vdso_gettc(const struct vdso_tim #ifdef _KERNEL +void timekeep_push_vdso(void); + uint32_t tc_fill_vdso_timehands(struct vdso_timehands *vdso_th); /* @@ -86,9 +87,6 @@ uint32_t tc_fill_vdso_timehands(struct v */ uint32_t cpu_fill_vdso_timehands(struct vdso_timehands *vdso_th); -typedef void (*tc_windup_fn)(void *); -EVENTHANDLER_DECLARE(tc_windup, tc_windup_fn); - #define VDSO_TH_NUM 4 #ifdef COMPAT_FREEBSD32 From owner-svn-src-user@FreeBSD.ORG Sat Jun 23 21:03:51 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3F5DF106564A; Sat, 23 Jun 2012 21:03:51 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 29D348FC08; Sat, 23 Jun 2012 21:03:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NL3p4T064621; Sat, 23 Jun 2012 21:03:51 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NL3oXr064618; Sat, 23 Jun 2012 21:03:50 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206232103.q5NL3oXr064618@svn.freebsd.org> From: Adrian Chadd Date: Sat, 23 Jun 2012 21:03:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237510 - user/adrian/ath_radar_stuff/src/qt-hpktlog X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 21:03:51 -0000 Author: adrian Date: Sat Jun 23 21:03:50 2012 New Revision: 237510 URL: http://svn.freebsd.org/changeset/base/237510 Log: Implement a very basic, hacky heat map. It's totally inefficient - I'm still plotting all the points even if all the samples are acutally at the same point. I'll fix this soon. Modified: user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.cpp user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.h Modified: user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.cpp ============================================================================== --- user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.cpp Sat Jun 23 20:44:45 2012 (r237509) +++ user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.cpp Sat Jun 23 21:03:50 2012 (r237510) @@ -14,6 +14,13 @@ MainApp::MainApp(QMainWindow *parent) { + // Blank the heat map + for (int i = 0; i < MAX_RSSI; i++) { + for (int j = 0; j < MAX_PULSEDUR; j++) { + heat_map[i][j] = 0; + } + } + // How many entries to keep in the FIFO num_entries = 128; @@ -73,22 +80,33 @@ MainApp::getRadarEntry(struct radar_entr q_dur.insert(q_dur.begin(), (float) re.re_dur); q_rssi.insert(q_rssi.begin(), (float) re.re_rssi); + + // Update the heat map for the current pixel, topping out at 65535 + // entries (ie, don't overflow.) + if (heat_map[re.re_rssi % MAX_RSSI][re.re_dur % MAX_PULSEDUR] < MAX_HEATCNT) + heat_map[re.re_rssi % MAX_RSSI][re.re_dur % MAX_PULSEDUR]++; + q_points.insert(q_points.begin(), QwtPoint3D( (float) re.re_dur, (float) re.re_rssi, - (float) re.re_rssi * 25.0)); + (float) heat_map[re.re_rssi % MAX_RSSI][re.re_dur % MAX_PULSEDUR] * 100.0)); // If we're too big, delete the first entry if (q_points.size() > num_entries) { + // Decrement the heat map entry! + uint8_t rssi, dur; + rssi = q_rssi[q_rssi.size() - 1]; + dur = q_dur[q_dur.size() - 1]; + if (heat_map[rssi % MAX_RSSI][dur % MAX_PULSEDUR] > 0) + heat_map[rssi % MAX_RSSI][dur % MAX_PULSEDUR]--; + + // Remove the tail entry q_dur.pop_back(); q_rssi.pop_back(); q_points.pop_back(); } - // Trim the head entries if the array is too big - // (maybe we should use a queue, not a vector?) - // Replot! RePlot(); } Modified: user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.h ============================================================================== --- user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.h Sat Jun 23 20:44:45 2012 (r237509) +++ user/adrian/ath_radar_stuff/src/qt-hpktlog/MainApp.h Sat Jun 23 21:03:50 2012 (r237510) @@ -4,6 +4,7 @@ #include #include +#include #include #include @@ -18,6 +19,10 @@ #include "libradarpkt/pkt.h" +#define MAX_RSSI 256 +#define MAX_PULSEDUR 256 +#define MAX_HEATCNT 254 + class MainApp : public QMainWindow { Q_OBJECT @@ -32,11 +37,17 @@ class MainApp : public QMainWindow // How many entries to keep in the histogram size_t num_entries; - // Our histogram data + // Our old-style histogram data std::vector q_dur; std::vector q_rssi; + + // and the new-style histogram data QVector q_points; + // Now, an array of items, for "heat" data + // XXX this really should be another class.. + uint8_t heat_map[MAX_RSSI][MAX_PULSEDUR]; + // TODO When rendering the screen, we only want to do it // every say, 3ms.