From owner-svn-src-head@FreeBSD.ORG Sun May 10 00:00:26 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5D250106564A; Sun, 10 May 2009 00:00:26 +0000 (UTC) (envelope-from kuriyama@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 48B2B8FC12; Sun, 10 May 2009 00:00:26 +0000 (UTC) (envelope-from kuriyama@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4A00Q4v037682; Sun, 10 May 2009 00:00:26 GMT (envelope-from kuriyama@svn.freebsd.org) Received: (from kuriyama@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4A00PPG037665; Sun, 10 May 2009 00:00:25 GMT (envelope-from kuriyama@svn.freebsd.org) Message-Id: <200905100000.n4A00PPG037665@svn.freebsd.org> From: Jun Kuriyama Date: Sun, 10 May 2009 00:00:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191954 - in head/sys: amd64/conf arm/conf conf i386/conf ia64/conf mips/conf pc98/conf powerpc/conf sparc64/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 May 2009 00:00:26 -0000 Author: kuriyama Date: Sun May 10 00:00:25 2009 New Revision: 191954 URL: http://svn.freebsd.org/changeset/base/191954 Log: - Use "device\t" and "options \t" for consistency. Modified: head/sys/amd64/conf/DEFAULTS head/sys/amd64/conf/GENERIC head/sys/amd64/conf/NOTES head/sys/amd64/conf/XENHVM head/sys/arm/conf/AVILA head/sys/arm/conf/BWCT head/sys/arm/conf/CAMBRIA head/sys/arm/conf/CRB head/sys/arm/conf/DB-78XXX head/sys/arm/conf/DB-88F5XXX head/sys/arm/conf/DB-88F6XXX head/sys/arm/conf/EP80219 head/sys/arm/conf/GUMSTIX head/sys/arm/conf/HL200 head/sys/arm/conf/IQ31244 head/sys/arm/conf/KB920X head/sys/arm/conf/NSLU head/sys/arm/conf/SIMICS head/sys/arm/conf/SKYEYE head/sys/conf/NOTES head/sys/i386/conf/DEFAULTS head/sys/i386/conf/GENERIC head/sys/i386/conf/NOTES head/sys/i386/conf/PAE head/sys/i386/conf/XBOX head/sys/i386/conf/XEN head/sys/ia64/conf/DEFAULTS head/sys/ia64/conf/NOTES head/sys/mips/conf/ADM5120 head/sys/mips/conf/IDT head/sys/mips/conf/MALTA head/sys/mips/conf/QEMU head/sys/mips/conf/SENTRY5 head/sys/pc98/conf/DEFAULTS head/sys/pc98/conf/NOTES head/sys/powerpc/conf/GENERIC head/sys/powerpc/conf/MPC85XX head/sys/powerpc/conf/NOTES head/sys/sparc64/conf/GENERIC Modified: head/sys/amd64/conf/DEFAULTS ============================================================================== --- head/sys/amd64/conf/DEFAULTS Sat May 9 20:18:20 2009 (r191953) +++ head/sys/amd64/conf/DEFAULTS Sun May 10 00:00:25 2009 (r191954) @@ -21,4 +21,4 @@ options GEOM_PART_EBR options GEOM_PART_EBR_COMPAT options GEOM_PART_MBR -options FLOWTABLE +options FLOWTABLE Modified: head/sys/amd64/conf/GENERIC ============================================================================== --- head/sys/amd64/conf/GENERIC Sat May 9 20:18:20 2009 (r191953) +++ head/sys/amd64/conf/GENERIC Sun May 10 00:00:25 2009 (r191954) @@ -68,7 +68,7 @@ options SYSVSEM # SYSV-style semaphor options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions options KBD_INSTALL_CDEV # install a CDEV entry in /dev options STOP_NMI # Stop CPUS using NMI instead of IPI -options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) +options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) options AUDIT # Security event auditing #options KDTRACE_FRAME # Ensure frames are compiled in #options KDTRACE_HOOKS # Kernel DTrace hooks @@ -114,7 +114,7 @@ options AHD_REG_PRETTY_PRINT # Print re device amd # AMD 53C974 (Tekram DC-390(T)) device hptiop # Highpoint RocketRaid 3xxx series device isp # Qlogic family -#device ispfw # Firmware for QLogic HBAs- normally a module +#device ispfw # Firmware for QLogic HBAs- normally a module device mpt # LSI-Logic MPT-Fusion #device ncr # NCR/Symbios Logic device sym # NCR/Symbios Logic (newer chipsets + those of `ncr') @@ -260,7 +260,7 @@ device wlan_amrr # AMRR transmit rate c device an # Aironet 4500/4800 802.11 wireless NICs. device ath # Atheros pci/cardbus NIC's device ath_hal # pci/cardbus chip support -options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors +options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors device ath_rate_sample # SampleRate tx rate control for ath device ral # Ralink Technology RT2500 wireless NICs. device wi # WaveLAN/Intersil/Symbol 802.11 wireless NICs. Modified: head/sys/amd64/conf/NOTES ============================================================================== --- head/sys/amd64/conf/NOTES Sat May 9 20:18:20 2009 (r191953) +++ head/sys/amd64/conf/NOTES Sun May 10 00:00:25 2009 (r191954) @@ -33,7 +33,7 @@ options MP_WATCHDOG # # Debugging options. # -options STOP_NMI # Stop CPUS using NMI instead of IPI +options STOP_NMI # Stop CPUS using NMI instead of IPI @@ -82,7 +82,7 @@ options DEVICE_POLLING # BPF_JITTER adds support for BPF just-in-time compiler. -options BPF_JITTER +options BPF_JITTER ##################################################################### @@ -153,7 +153,7 @@ device agp # # AGP debugging. # -options AGP_DEBUG +options AGP_DEBUG ##################################################################### @@ -288,7 +288,7 @@ device wpi device ath # Atheros pci/cardbus NIC's device ath_hal # pci/cardbus chip support -options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors +options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors device ath_rate_sample # SampleRate tx rate control for ath #device ath_rate_amrr # AMRR rate control for ath driver #device ath_rate_onoe # Onoe rate control for ath driver @@ -457,7 +457,7 @@ options LINPROCFS #Enable the linux-like sys filesystem support (requires COMPAT_LINUX32 # and PSEUDOFS) -options LINSYSFS +options LINSYSFS # # SysVR4 ABI emulation Modified: head/sys/amd64/conf/XENHVM ============================================================================== --- head/sys/amd64/conf/XENHVM Sat May 9 20:18:20 2009 (r191953) +++ head/sys/amd64/conf/XENHVM Sun May 10 00:00:25 2009 (r191954) @@ -69,12 +69,12 @@ options SYSVSEM # SYSV-style semaphor options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions options KBD_INSTALL_CDEV # install a CDEV entry in /dev options STOP_NMI # Stop CPUS using NMI instead of IPI -options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) +options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) options AUDIT # Security event auditing #options KDTRACE_FRAME # Ensure frames are compiled in #options KDTRACE_HOOKS # Kernel DTrace hooks -options NO_ADAPTIVE_MUTEXES -options NO_ADAPTIVE_RWLOCKS +options NO_ADAPTIVE_MUTEXES +options NO_ADAPTIVE_RWLOCKS # Debugging for use in -current options KDB # Enable kernel debugger support. @@ -99,7 +99,7 @@ device pci device fdc # Xen HVM support -options XENHVM +options XENHVM device xenpci # ATA and ATAPI devices Modified: head/sys/arm/conf/AVILA ============================================================================== --- head/sys/arm/conf/AVILA Sat May 9 20:18:20 2009 (r191953) +++ head/sys/arm/conf/AVILA Sun May 10 00:00:25 2009 (r191954) @@ -99,12 +99,12 @@ device loop device if_bridge device md -device random # Entropy device +device random # Entropy device # Wireless NIC cards device wlan # 802.11 support -options IEEE80211_DEBUG -options IEEE80211_SUPPORT_TDMA +options IEEE80211_DEBUG +options IEEE80211_SUPPORT_TDMA device wlan_wep # 802.11 WEP support device wlan_ccmp # 802.11 CCMP support device wlan_tkip # 802.11 TKIP support @@ -112,12 +112,12 @@ device wlan_xauth device ath # Atheros pci/cardbus NIC's options ATH_DEBUG -options ATH_DIAGAPI -#options ATH_TX99_DIAG +options ATH_DIAGAPI +#options ATH_TX99_DIAG device ath_rate_sample # SampleRate tx rate control for ath -#options AH_DEBUG -#options AH_ASSERT +#options AH_DEBUG +#options AH_ASSERT #device ath_ar5210 #device ath_ar5211 device ath_ar5212 @@ -129,7 +129,7 @@ device ath_rf5112 device ath_rf5413 # device ath_ar5416 -options AH_SUPPORT_AR5416 +options AH_SUPPORT_AR5416 device ath_ar9160 makeoptions WITH_LEGACY Modified: head/sys/arm/conf/BWCT ============================================================================== --- head/sys/arm/conf/BWCT Sat May 9 20:18:20 2009 (r191953) +++ head/sys/arm/conf/BWCT Sun May 10 00:00:25 2009 (r191954) @@ -19,9 +19,9 @@ ident BWCT -options VERBOSE_INIT_ARM +options VERBOSE_INIT_ARM -options AT91_BWCT +options AT91_BWCT include "../at91/std.bwct" #To statically compile in device wiring instead of /boot/device.hints @@ -30,8 +30,8 @@ hints "BWCT.hints" makeoptions MODULES_OVERRIDE="" #makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols -options DDB -options KDB +options DDB +options KDB options BREAK_TO_DEBUGGER options ALT_BREAK_TO_DEBUGGER @@ -43,15 +43,15 @@ options SOFTUPDATES #Enable FFS soft u #options UFS_ACL #Support for access control lists #options UFS_DIRHASH #Improve performance on big directories #options MD_ROOT #MD is a potential root device -#options MD_ROOT_SIZE=4096 # 3MB ram disk +#options MD_ROOT_SIZE=4096 # 3MB ram disk #options ROOTDEVNAME=\"ufs:md0\" #options ROOTDEVNAME=\"ufs:/dev/mmcsd0s1a\" options NFSCLIENT #Network Filesystem Client #options NFSSERVER #Network Filesystem Server #options NFSLOCKD #Network Lock Manager -options NFS_ROOT #NFS usable as /, requires NFSCLIENT -options BOOTP_NFSROOT -options BOOTP +options NFS_ROOT #NFS usable as /, requires NFSCLIENT +options BOOTP_NFSROOT +options BOOTP #options MSDOSFS #MSDOS Filesystem #options CD9660 #ISO 9660 Filesystem @@ -65,7 +65,7 @@ options SYSVSEM #SYSV-style semaphore options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions #options SYSCTL_OMIT_DESCR options MUTEX_NOINLINE -options RWLOCK_NOINLINE +options RWLOCK_NOINLINE options NO_FFS_SNAPSHOT options NO_SWAPPING device loop @@ -83,7 +83,7 @@ device rlswitch #options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS #options WITNESS #Enable checks to detect deadlocks and cycles #options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed -#options DIAGNOSTIC +#options DIAGNOSTIC device md device at91_twi # TWI: Two Wire Interface Modified: head/sys/arm/conf/CAMBRIA ============================================================================== --- head/sys/arm/conf/CAMBRIA Sat May 9 20:18:20 2009 (r191953) +++ head/sys/arm/conf/CAMBRIA Sun May 10 00:00:25 2009 (r191954) @@ -68,7 +68,7 @@ device uart device ixpwdog # watchdog timer -options IXP4XX_FLASH_SIZE=0x02000000 # stock 2358 comes w/ 32M +options IXP4XX_FLASH_SIZE=0x02000000 # stock 2358 comes w/ 32M device cfi # flash support device cfid # flash disk support device geom_redboot # redboot fis parser @@ -86,7 +86,7 @@ device cambria_fled # Font Panel LED on device cambria_led # 8-LED latch device ata -device atadisk # ATA disk drives +device atadisk # ATA disk drives device avila_ata # Gateworks CF/IDE support device npe # Network Processing Engine @@ -102,12 +102,12 @@ device loop device if_bridge device md -device random # Entropy device +device random # Entropy device # Wireless NIC cards device wlan # 802.11 support -options IEEE80211_DEBUG -options IEEE80211_SUPPORT_TDMA +options IEEE80211_DEBUG +options IEEE80211_SUPPORT_TDMA device wlan_wep # 802.11 WEP support device wlan_ccmp # 802.11 CCMP support device wlan_tkip # 802.11 TKIP support @@ -115,13 +115,13 @@ device wlan_xauth device ath # Atheros pci/cardbus NIC's options ATH_DEBUG -options ATH_DIAGAPI -#options ATH_TX99_DIAG +options ATH_DIAGAPI +#options ATH_TX99_DIAG device ath_rate_sample # SampleRate tx rate control for ath -options AH_DEBUG -#options AH_ASSERT -options AH_PRIVATE_DIAG +options AH_DEBUG +#options AH_ASSERT +options AH_PRIVATE_DIAG #device ath_ar5210 #device ath_ar5211 # @@ -133,7 +133,7 @@ device ath_rf5112 device ath_rf5413 # #device ath_ar5416 -#options AH_SUPPORT_AR5416 # NB: for 11n descriptor format +#options AH_SUPPORT_AR5416 # NB: for 11n descriptor format #device ath_rf2133 #device ath_ar9160 #device ath_ar9280 @@ -142,8 +142,8 @@ device ath_rf5413 # NB: 2 USB 2.0 ports standard device usb -options USB_EHCI_BIG_ENDIAN_DESC # handle big-endian byte order -#options USB_DEBUG +options USB_EHCI_BIG_ENDIAN_DESC # handle big-endian byte order +#options USB_DEBUG device ehci device umass device scbus # SCSI bus (required for SCSI) Modified: head/sys/arm/conf/CRB ============================================================================== --- head/sys/arm/conf/CRB Sat May 9 20:18:20 2009 (r191953) +++ head/sys/arm/conf/CRB Sun May 10 00:00:25 2009 (r191954) @@ -20,11 +20,11 @@ ident CRB options PHYSADDR=0x00000000 -options KERNPHYSADDR=0x00200000 -options KERNVIRTADDR=0xc0200000 # Used in ldscript.arm +options KERNPHYSADDR=0x00200000 +options KERNVIRTADDR=0xc0200000 # Used in ldscript.arm -options COUNTS_PER_SEC=400000000 -options STARTUP_PAGETABLE_ADDR=0x00000000 +options COUNTS_PER_SEC=400000000 +options STARTUP_PAGETABLE_ADDR=0x00000000 include "../xscale/i8134x/std.crb" #To statically compile in device wiring instead of /boot/device.hints #hints "GENERIC.hints" #Default places to look for devices. @@ -32,9 +32,9 @@ makeoptions MODULES_OVERRIDE="" #makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols makeoptions CONF_CFLAGS=-mcpu=xscale -options HZ=100 -options BREAK_TO_DEBUGGER -#options DEVICE_POLLING +options HZ=100 +options BREAK_TO_DEBUGGER +#options DEVICE_POLLING options SCHED_4BSD #4BSD scheduler options INET #InterNETworking @@ -53,18 +53,18 @@ options CD9660 #ISO 9660 Filesystem options PSEUDOFS #Pseudo-filesystem framework options SCSI_DELAY=5000 #Delay (in ms) before probing SCSI options KTRACE #ktrace(1) support -options INTR_FILTER +options INTR_FILTER options SYSVSHM #SYSV-style shared memory options SYSVMSG #SYSV-style message queues options SYSVSEM #SYSV-style semaphores options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions options KBD_INSTALL_CDEV # install a CDEV entry in /dev -options BOOTP -options BOOTP_NFSROOT -options BOOTP_NFSV3 -options BOOTP_WIRED_TO=em0 -options BOOTP_COMPAT -#options PREEMPTION +options BOOTP +options BOOTP_NFSROOT +options BOOTP_NFSV3 +options BOOTP_WIRED_TO=em0 +options BOOTP_COMPAT +#options PREEMPTION device loop device ether #device saarm @@ -75,12 +75,12 @@ device uart device pci device ata -device atadisk # ATA disk drives -device ataraid # ATA RAID drives -device atapicd # ATAPI CDROM drives -device atapifd # ATAPI floppy drives -device atapist # ATAPI tape drives -options ATA_STATIC_ID # Static device numbering +device atadisk # ATA disk drives +device ataraid # ATA RAID drives +device atapicd # ATAPI CDROM drives +device atapifd # ATAPI floppy drives +device atapist # ATAPI tape drives +options ATA_STATIC_ID # Static device numbering device "7seg" @@ -93,22 +93,22 @@ device pty # output. Adds ~215k to driver. # Debugging for use in -current -options KDB +options KDB options DDB #Enable the kernel debugger #options INVARIANTS #Enable calls of extra sanity checking #options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS #options WITNESS #Enable checks to detect deadlocks and cycles #options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed -#options DIAGNOSTIC +#options DIAGNOSTIC # To make an SMP kernel, the next two are needed #options SMP # Symmetric MultiProcessor Kernel #options APIC_IO # Symmetric (APIC) I/O -options XSCALE_CACHE_READ_WRITE_ALLOCATE -device md -device random # Entropy device +options XSCALE_CACHE_READ_WRITE_ALLOCATE +device md +device random # Entropy device device iopwdog -options ARM_USE_SMALL_ALLOC +options ARM_USE_SMALL_ALLOC # Floppy drives Modified: head/sys/arm/conf/DB-78XXX ============================================================================== --- head/sys/arm/conf/DB-78XXX Sat May 9 20:18:20 2009 (r191953) +++ head/sys/arm/conf/DB-78XXX Sun May 10 00:00:25 2009 (r191954) @@ -7,7 +7,7 @@ ident DB-88F78XX include "../mv/discovery/std.db78xxx" -options SOC_MV_DISCOVERY +options SOC_MV_DISCOVERY makeoptions MODULES_OVERRIDE="" #makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols @@ -18,34 +18,34 @@ options INET #InterNETworking options INET6 #IPv6 communications protocols options FFS #Berkeley Fast Filesystem options NFSCLIENT #Network Filesystem Client -options NFSLOCKD #Network Lock Manager +options NFSLOCKD #Network Lock Manager options NFS_ROOT #NFS usable as /, requires NFSCLIENT -options BOOTP -options BOOTP_NFSROOT -options BOOTP_NFSV3 -options BOOTP_WIRED_TO=mge0 +options BOOTP +options BOOTP_NFSROOT +options BOOTP_NFSV3 +options BOOTP_WIRED_TO=mge0 -#options ROOTDEVNAME=\"ufs:/dev/da0a\" +#options ROOTDEVNAME=\"ufs:/dev/da0a\" options SYSVSHM #SYSV-style shared memory options SYSVMSG #SYSV-style message queues options SYSVSEM #SYSV-style semaphores options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions options MUTEX_NOINLINE -options RWLOCK_NOINLINE +options RWLOCK_NOINLINE options NO_FFS_SNAPSHOT options NO_SWAPPING # Debugging -options ALT_BREAK_TO_DEBUGGER -options DDB -options DIAGNOSTIC +options ALT_BREAK_TO_DEBUGGER +options DDB +options DIAGNOSTIC #options INVARIANTS #Enable calls of extra sanity checking #options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS -options KDB +options KDB options WITNESS #Enable checks to detect deadlocks and cycles options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed -#options WITNESS_KDB +#options WITNESS_KDB device pci Modified: head/sys/arm/conf/DB-88F5XXX ============================================================================== --- head/sys/arm/conf/DB-88F5XXX Sat May 9 20:18:20 2009 (r191953) +++ head/sys/arm/conf/DB-88F5XXX Sun May 10 00:00:25 2009 (r191954) @@ -7,7 +7,7 @@ ident DB-88F5XXX include "../mv/orion/std.db88f5xxx" -options SOC_MV_ORION +options SOC_MV_ORION makeoptions MODULES_OVERRIDE="" #makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols @@ -18,34 +18,34 @@ options INET #InterNETworking options INET6 #IPv6 communications protocols options FFS #Berkeley Fast Filesystem options NFSCLIENT #Network Filesystem Client -options NFSLOCKD #Network Lock Manager +options NFSLOCKD #Network Lock Manager options NFS_ROOT #NFS usable as /, requires NFSCLIENT -options BOOTP -options BOOTP_NFSROOT -options BOOTP_NFSV3 -options BOOTP_WIRED_TO=mge0 +options BOOTP +options BOOTP_NFSROOT +options BOOTP_NFSV3 +options BOOTP_WIRED_TO=mge0 -#options ROOTDEVNAME=\"ufs:/dev/da0a\" +#options ROOTDEVNAME=\"ufs:/dev/da0a\" options SYSVSHM #SYSV-style shared memory options SYSVMSG #SYSV-style message queues options SYSVSEM #SYSV-style semaphores options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions options MUTEX_NOINLINE -options RWLOCK_NOINLINE +options RWLOCK_NOINLINE options NO_FFS_SNAPSHOT options NO_SWAPPING # Debugging -options ALT_BREAK_TO_DEBUGGER -options DDB -options DIAGNOSTIC +options ALT_BREAK_TO_DEBUGGER +options DDB +options DIAGNOSTIC #options INVARIANTS #Enable calls of extra sanity checking #options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS -options KDB +options KDB options WITNESS #Enable checks to detect deadlocks and cycles options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed -#options WITNESS_KDB +#options WITNESS_KDB device pci @@ -64,8 +64,8 @@ device mge # Marvell Gigabit Ethernet device mii device e1000phy device bpf -options DEVICE_POLLING -options HZ=1000 +options DEVICE_POLLING +options HZ=1000 # I2C (TWSI) device iic Modified: head/sys/arm/conf/DB-88F6XXX ============================================================================== --- head/sys/arm/conf/DB-88F6XXX Sat May 9 20:18:20 2009 (r191953) +++ head/sys/arm/conf/DB-88F6XXX Sun May 10 00:00:25 2009 (r191954) @@ -7,7 +7,7 @@ ident DB-88F6XXX include "../mv/kirkwood/std.db88f6xxx" -options SOC_MV_KIRKWOOD +options SOC_MV_KIRKWOOD makeoptions MODULES_OVERRIDE="" #makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols @@ -18,34 +18,34 @@ options INET #InterNETworking options INET6 #IPv6 communications protocols options FFS #Berkeley Fast Filesystem options NFSCLIENT #Network Filesystem Client -options NFSLOCKD #Network Lock Manager +options NFSLOCKD #Network Lock Manager options NFS_ROOT #NFS usable as /, requires NFSCLIENT -options BOOTP -options BOOTP_NFSROOT -options BOOTP_NFSV3 -options BOOTP_WIRED_TO=mge0 +options BOOTP +options BOOTP_NFSROOT +options BOOTP_NFSV3 +options BOOTP_WIRED_TO=mge0 -#options ROOTDEVNAME=\"ufs:/dev/da0a\" +#options ROOTDEVNAME=\"ufs:/dev/da0a\" options SYSVSHM #SYSV-style shared memory options SYSVMSG #SYSV-style message queues options SYSVSEM #SYSV-style semaphores options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions options MUTEX_NOINLINE -options RWLOCK_NOINLINE +options RWLOCK_NOINLINE options NO_FFS_SNAPSHOT options NO_SWAPPING # Debugging -options ALT_BREAK_TO_DEBUGGER -options DDB -options DIAGNOSTIC +options ALT_BREAK_TO_DEBUGGER +options DDB +options DIAGNOSTIC #options INVARIANTS #Enable calls of extra sanity checking #options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS -options KDB +options KDB options WITNESS #Enable checks to detect deadlocks and cycles options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed -#options WITNESS_KDB +#options WITNESS_KDB device pci Modified: head/sys/arm/conf/EP80219 ============================================================================== --- head/sys/arm/conf/EP80219 Sat May 9 20:18:20 2009 (r191953) +++ head/sys/arm/conf/EP80219 Sun May 10 00:00:25 2009 (r191954) @@ -20,11 +20,11 @@ ident EP80219 options PHYSADDR=0xa0000000 -options KERNPHYSADDR=0xa0200000 -options KERNVIRTADDR=0xc0200000 # Used in ldscript.arm +options KERNPHYSADDR=0xa0200000 +options KERNVIRTADDR=0xc0200000 # Used in ldscript.arm options STARTUP_PAGETABLE_ADDR=0xa0000000 -#options ARM32_NEW_VM_LAYOUT +#options ARM32_NEW_VM_LAYOUT include "../xscale/i80321/std.ep80219" #To statically compile in device wiring instead of /boot/device.hints #hints "GENERIC.hints" #Default places to look for devices. @@ -32,8 +32,8 @@ makeoptions MODULES_OVERRIDE="" makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols makeoptions CONF_CFLAGS=-mcpu=xscale -options HZ=100 -#options DEVICE_POLLING +options HZ=100 +#options DEVICE_POLLING options SCHED_4BSD #4BSD scheduler options INET #InterNETworking @@ -57,15 +57,15 @@ options SYSVMSG #SYSV-style message q options SYSVSEM #SYSV-style semaphores options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions options KBD_INSTALL_CDEV # install a CDEV entry in /dev -options GEOM_PART_GPT # GUID Partition Tables. -options GEOM_LABEL # Providers labelization. +options GEOM_PART_GPT # GUID Partition Tables. +options GEOM_LABEL # Providers labelization. -options BOOTP -options BOOTP_NFSROOT -options BOOTP_NFSV3 -options BOOTP_WIRED_TO=fxp0 -options BOOTP_COMPAT -#options PREEMPTION +options BOOTP +options BOOTP_NFSROOT +options BOOTP_NFSV3 +options BOOTP_WIRED_TO=fxp0 +options BOOTP_COMPAT +#options PREEMPTION device loop device ether #device saarm @@ -75,12 +75,12 @@ device uart device pci device ata -device atadisk # ATA disk drives -device ataraid # ATA RAID drives -device atapicd # ATAPI CDROM drives -device atapifd # ATAPI floppy drives -device atapist # ATAPI tape drives -options ATA_STATIC_ID # Static device numbering +device atadisk # ATA disk drives +device ataraid # ATA RAID drives +device atapicd # ATAPI CDROM drives +device atapifd # ATAPI floppy drives +device atapist # ATAPI tape drives +options ATA_STATIC_ID # Static device numbering # SCSI Controllers @@ -89,27 +89,27 @@ device iopwdog # I80321 Watchdog device dma # I80321 DMA Controller # Debugging for use in -current -options KDB +options KDB options DDB #Enable the kernel debugger #options INVARIANTS #Enable calls of extra sanity checking #options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS #options WITNESS #Enable checks to detect deadlocks and cycles #options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed -#options DIAGNOSTIC +#options DIAGNOSTIC # To make an SMP kernel, the next two are needed #options SMP # Symmetric MultiProcessor Kernel #options APIC_IO # Symmetric (APIC) I/O -options XSCALE_CACHE_READ_WRITE_ALLOCATE -device md +options XSCALE_CACHE_READ_WRITE_ALLOCATE +device md device random # Entropy device -options ARM_USE_SMALL_ALLOC +options ARM_USE_SMALL_ALLOC # Floppy drives -options INCLUDE_CONFIG_FILE # Include this file in kernel -#options VERBOSE_SYSINIT -options VERBOSE_INIT_ARM +options INCLUDE_CONFIG_FILE # Include this file in kernel +#options VERBOSE_SYSINIT +options VERBOSE_INIT_ARM -device bpf -#options ROOTDEVNAME=\"ufs:ad4s1a\" +device bpf +#options ROOTDEVNAME=\"ufs:ad4s1a\" Modified: head/sys/arm/conf/GUMSTIX ============================================================================== --- head/sys/arm/conf/GUMSTIX Sat May 9 20:18:20 2009 (r191953) +++ head/sys/arm/conf/GUMSTIX Sun May 10 00:00:25 2009 (r191954) @@ -27,18 +27,18 @@ cpu CPU_XSCALE_PXA2X0 hints "GUMSTIX.hints" options PHYSADDR=0xa0000000 -options KERNPHYSADDR=0xa0200000 -options KERNVIRTADDR=0xc0200000 # Used in ldscript.arm +options KERNPHYSADDR=0xa0200000 +options KERNVIRTADDR=0xc0200000 # Used in ldscript.arm -options STARTUP_PAGETABLE_ADDR=0xa0000000 +options STARTUP_PAGETABLE_ADDR=0xa0000000 include "../xscale/pxa/std.pxa" #To statically compile in device wiring instead of /boot/device.hints #hints "GENERIC.hints" #Default places to look for devices. makeoptions MODULES_OVERRIDE="" makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols -options HZ=100 -#options DEVICE_POLLING +options HZ=100 +#options DEVICE_POLLING options SCHED_4BSD #4BSD scheduler options INET #InterNETworking @@ -62,13 +62,13 @@ options SYSVMSG #SYSV-style message q options SYSVSEM #SYSV-style semaphores options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions options KBD_INSTALL_CDEV # install a CDEV entry in /dev -options BOOTP -options BOOTP_NFSROOT -options BOOTP_WIRED_TO=smc0 -options BOOTP_COMPAT -options BOOTP_NFSV3 -options BOOTP_BLOCKSIZE=4096 -options PREEMPTION +options BOOTP +options BOOTP_NFSROOT +options BOOTP_WIRED_TO=smc0 +options BOOTP_COMPAT +options BOOTP_NFSV3 +options BOOTP_BLOCKSIZE=4096 +options PREEMPTION device loop device ether device mii @@ -80,7 +80,7 @@ device uart_ns8250 device pty # Debugging for use in -current -options KDB +options KDB options DDB #Enable the kernel debugger #options INVARIANTS #Enable calls of extra sanity checking #options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS @@ -89,4 +89,4 @@ options DDB #Enable the kernel debugg #options DIAGNOSTIC device md -device random # Entropy device +device random # Entropy device Modified: head/sys/arm/conf/HL200 ============================================================================== --- head/sys/arm/conf/HL200 Sat May 9 20:18:20 2009 (r191953) +++ head/sys/arm/conf/HL200 Sun May 10 00:00:25 2009 (r191954) @@ -26,8 +26,8 @@ hints "KB920X.hints" makeoptions MODULES_OVERRIDE="" makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols -options DDB -options KDB +options DDB +options KDB options SCHED_4BSD #4BSD scheduler options INET #InterNETworking @@ -44,7 +44,7 @@ options NFSCLIENT #Network Filesystem #options NFSLOCKD #Network Lock Manager options NFS_ROOT #NFS usable as /, requires NFSCLIENT options BOOTP_NFSROOT -options BOOTP +options BOOTP options BOOTP_NFSV3 options BOOTP_WIRED_TO=ate0 options BOOTP_COMPAT @@ -61,7 +61,7 @@ options SYSVSEM #SYSV-style semaphore options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions #options SYSCTL_OMIT_DESCR options MUTEX_NOINLINE -options RWLOCK_NOINLINE +options RWLOCK_NOINLINE options NO_FFS_SNAPSHOT options NO_SWAPPING device random @@ -94,23 +94,23 @@ device icee device bpf # USB support -device ohci # OHCI localbus->USB interface -device usb # USB Bus (required) -#device udbp # USB Double Bulk Pipe devices -device uhid # "Human Interface Devices" -device ulpt # Printer -device umass # Disks/Mass storage - Requires scbus and da -device ural # Ralink Technology RT2500USB wireless NICs -device rum # Ralink Technology RT2501USB wireless NICs -device urio # Diamond Rio 500 MP3 player +device ohci # OHCI localbus->USB interface +device usb # USB Bus (required) +#device udbp # USB Double Bulk Pipe devices +device uhid # "Human Interface Devices" +device ulpt # Printer +device umass # Disks/Mass storage - Requires scbus and da +device ural # Ralink Technology RT2500USB wireless NICs +device rum # Ralink Technology RT2501USB wireless NICs +device urio # Diamond Rio 500 MP3 player # USB Ethernet, requires miibus device miibus -device aue # ADMtek USB Ethernet -device axe # ASIX Electronics USB Ethernet -device cdce # Generic USB over Ethernet -device cue # CATC USB Ethernet -device kue # Kawasaki LSI USB Ethernet -device rue # RealTek RTL8150 USB Ethernet +device aue # ADMtek USB Ethernet +device axe # ASIX Electronics USB Ethernet +device cdce # Generic USB over Ethernet +device cue # CATC USB Ethernet +device kue # Kawasaki LSI USB Ethernet +device rue # RealTek RTL8150 USB Ethernet device udav # usb serial device uark @@ -122,13 +122,13 @@ device uplcom device uvisor device uvscom # SCSI peripherals -device scbus # SCSI bus (required for SCSI) -device da # Direct Access (disks) -device cd # CD -device pass # Passthrough device (direct SCSI access) +device scbus # SCSI bus (required for SCSI) +device da # Direct Access (disks) +device cd # CD +device pass # Passthrough device (direct SCSI access) # Wireless NIC cards -device wlan # 802.11 support -device wlan_wep # 802.11 WEP support -device wlan_ccmp # 802.11 CCMP support -device wlan_tkip # 802.11 TKIP support -device wlan_amrr # AMRR transmit rate control algorithm +device wlan # 802.11 support +device wlan_wep # 802.11 WEP support +device wlan_ccmp # 802.11 CCMP support +device wlan_tkip # 802.11 TKIP support +device wlan_amrr # AMRR transmit rate control algorithm Modified: head/sys/arm/conf/IQ31244 ============================================================================== --- head/sys/arm/conf/IQ31244 Sat May 9 20:18:20 2009 (r191953) +++ head/sys/arm/conf/IQ31244 Sun May 10 00:00:25 2009 (r191954) @@ -20,10 +20,10 @@ ident IQ31244 options PHYSADDR=0xa0000000 -options KERNPHYSADDR=0xa0200000 -options KERNVIRTADDR=0xc0200000 # Used in ldscript.arm -options FLASHADDR=0xf0000000 -options LOADERRAMADDR=0x00000000 +options KERNPHYSADDR=0xa0200000 +options KERNVIRTADDR=0xc0200000 # Used in ldscript.arm +options FLASHADDR=0xf0000000 +options LOADERRAMADDR=0x00000000 options STARTUP_PAGETABLE_ADDR=0xa0000000 include "../xscale/i80321/std.iq31244" @@ -33,8 +33,8 @@ makeoptions MODULES_OVERRIDE="" #makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols makeoptions CONF_CFLAGS=-mcpu=xscale -options HZ=100 -#options DEVICE_POLLING +options HZ=100 +#options DEVICE_POLLING options SCHED_4BSD #4BSD scheduler options INET #InterNETworking @@ -58,12 +58,12 @@ options SYSVMSG #SYSV-style message q options SYSVSEM #SYSV-style semaphores options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions options KBD_INSTALL_CDEV # install a CDEV entry in /dev -options BOOTP -options BOOTP_NFSROOT -options BOOTP_NFSV3 -options BOOTP_WIRED_TO=em0 -options BOOTP_COMPAT -#options PREEMPTION +options BOOTP +options BOOTP_NFSROOT +options BOOTP_NFSV3 +options BOOTP_WIRED_TO=em0 +options BOOTP_COMPAT +#options PREEMPTION device loop device ether #device saarm @@ -74,12 +74,12 @@ device uart device pci device ata -device atadisk # ATA disk drives -device ataraid # ATA RAID drives -device atapicd # ATAPI CDROM drives -device atapifd # ATAPI floppy drives -device atapist # ATAPI tape drives -options ATA_STATIC_ID # Static device numbering +device atadisk # ATA disk drives +device ataraid # ATA RAID drives +device atapicd # ATAPI CDROM drives +device atapifd # ATAPI floppy drives +device atapist # ATAPI tape drives +options ATA_STATIC_ID # Static device numbering # SCSI Controllers @@ -94,21 +94,21 @@ device "iq31244_7seg" # IQ31244 7 seg # output. Adds ~215k to driver. # Debugging for use in -current -options KDB +options KDB options DDB #Enable the kernel debugger #options INVARIANTS #Enable calls of extra sanity checking #options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS #options WITNESS #Enable checks to detect deadlocks and cycles #options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed -#options DIAGNOSTIC +#options DIAGNOSTIC # To make an SMP kernel, the next two are needed #options SMP # Symmetric MultiProcessor Kernel #options APIC_IO # Symmetric (APIC) I/O -options XSCALE_CACHE_READ_WRITE_ALLOCATE -device md -device random # Entropy device +options XSCALE_CACHE_READ_WRITE_ALLOCATE +device md +device random # Entropy device -options ARM_USE_SMALL_ALLOC +options ARM_USE_SMALL_ALLOC # Floppy drives Modified: head/sys/arm/conf/KB920X ============================================================================== --- head/sys/arm/conf/KB920X Sat May 9 20:18:20 2009 (r191953) +++ head/sys/arm/conf/KB920X Sun May 10 00:00:25 2009 (r191954) @@ -95,40 +95,40 @@ device icee device bpf # USB support -device ohci # OHCI localbus->USB interface -device usb # USB Bus (required) -#device udbp # USB Double Bulk Pipe devices -device uhid # "Human Interface Devices" -device ulpt # Printer -device umass # Disks/Mass storage - Requires scbus and da -device ural # Ralink Technology RT2500USB wireless NICs -device rum # Ralink Technology RT2501USB wireless NICs -device urio # Diamond Rio 500 MP3 player +device ohci # OHCI localbus->USB interface +device usb # USB Bus (required) +#device udbp # USB Double Bulk Pipe devices +device uhid # "Human Interface Devices" +device ulpt # Printer +device umass # Disks/Mass storage - Requires scbus and da +device ural # Ralink Technology RT2500USB wireless NICs +device rum # Ralink Technology RT2501USB wireless NICs +device urio # Diamond Rio 500 MP3 player # USB Ethernet, requires miibus device miibus -device aue # ADMtek USB Ethernet -device axe # ASIX Electronics USB Ethernet -device cdce # Generic USB over Ethernet -device cue # CATC USB Ethernet -device kue # Kawasaki LSI USB Ethernet -device rue # RealTek RTL8150 USB Ethernet +device aue # ADMtek USB Ethernet +device axe # ASIX Electronics USB Ethernet +device cdce # Generic USB over Ethernet +device cue # CATC USB Ethernet +device kue # Kawasaki LSI USB Ethernet +device rue # RealTek RTL8150 USB Ethernet device udav # usb serial -device uark -device ubsa -device uftdi -device uipaq -device uplcom -device uvisor -device uvscom +device uark +device ubsa +device uftdi +device uipaq +device uplcom +device uvisor +device uvscom # SCSI peripherals -device scbus # SCSI bus (required for SCSI) -device da # Direct Access (disks) -device cd # CD -device pass # Passthrough device (direct SCSI access) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sun May 10 02:17:50 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9D9F11065672; Sun, 10 May 2009 02:17:50 +0000 (UTC) (envelope-from bms@incunabulum.net) Received: from out4.smtp.messagingengine.com (out4.smtp.messagingengine.com [66.111.4.28]) by mx1.freebsd.org (Postfix) with ESMTP id 5454C8FC20; Sun, 10 May 2009 02:17:50 +0000 (UTC) (envelope-from bms@incunabulum.net) Received: from compute1.internal (compute1.internal [10.202.2.41]) by out1.messagingengine.com (Postfix) with ESMTP id D7B74340A47; Sat, 9 May 2009 22:17:49 -0400 (EDT) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by compute1.internal (MEProxy); Sat, 09 May 2009 22:17:49 -0400 X-Sasl-enc: loVq9C1Crufb8Lsaaj8Lj9Nl2/snQYbH1W5IR0YGSz/B 1241921869 Received: from [192.168.123.18] (82-35-112-254.cable.ubr07.dals.blueyonder.co.uk [82.35.112.254]) by mail.messagingengine.com (Postfix) with ESMTPSA id 020E84C034; Sat, 9 May 2009 22:17:48 -0400 (EDT) Message-ID: <4A06394B.8050002@incunabulum.net> Date: Sun, 10 May 2009 03:17:47 +0100 From: Bruce Simpson User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: Warner Losh References: <200905091850.n49Io1vX031388@svn.freebsd.org> In-Reply-To: <200905091850.n49Io1vX031388@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191943 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 May 2009 02:17:51 -0000 Warner Losh wrote: > Author: imp > Date: Sat May 9 18:50:01 2009 > New Revision: 191943 > URL: http://svn.freebsd.org/changeset/base/191943 > > Log: > Remove bogus comment. > Thanks for tackling the BURN_BRIDGES cleanup. Some more general thoughts: Actually, in_multihead can probably get blown away now. It was used only by the IN_LOOKUP_MULTI() macro. It is no longer used in HEAD anywhere (and vice versa for the IPv6 equivalent); the code now uses the if_multiaddrs TAILQ in ifnet. I just didn't do that right away to avoid VIMAGE churn. I'm wondering if we should even be putting network layer addresses in ifnet at all, given the fun locking churn and LORs it can lead to. We've got a couple of peculiarities with IPv4 multicast and limited/network broadcast, which originated in 4.4BSD and have largely been perpetuated by other implementations ever since TCP/IP has pollinated everywhere. With an SSM capable stack, in_multi becomes a bigger structure with more state. What we might benefit from is from introducing a map of inpcb to in_multi 1:M instead (with bidirectional key lookup), which is a wholly separate idea. It would avoid the need for a walk of all inpcb in the system whenever a multicast (or broadcast!) datagram arrives on an interface. On a system with tens of thousands of sockets, that probably wouldn't scale, and the (since reclaimed) additional memory might be worth it. I believe Windows already does just this. In fact it's worth looking at their BSD sockets API in Vista/Longhorn -- there are a bunch of tricks in there to work around / fix some historical BSD lameness. That is pure irony, it has to be seen -- clients I've worked with in the past are rolling out their satellite multimedia systems using Windows as the client, but not strictly for these reasons; their timing problems would go away if they had POSIX realtime APIs, instead of having to hack around them the way the Geiss Winamp plugin guy did, or going straight to a kernel-mode driver; but by using Windows, they don't even run into issues like this with the network layer, they've already been fixed. (The real reason they stuck with Windows was probably more to do with the fact that commercial MPEG4 in RTP implementations were available there and then when they needed them in their business plan.) Right now we have the kludgy situation that we're carrying around a BSD-specific socket option, SO_REUSEPORT. It exists solely because laddr-bound inpcb's will not match the in_multi lookup, and it isn't actually used in other implementations. This is counter-intuitive because multicast group membership is scoped to particular links, yet if you bind() to an address configured on that link, you don't receive multicast traffic. Same with broadcast. We do need to preserve the SO_REUSEPORT behaviour for idempotence and backwards compatibility. Just something to chew on... cheers, BMS From owner-svn-src-head@FreeBSD.ORG Sun May 10 02:21:19 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ABC21106566C; Sun, 10 May 2009 02:21:19 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 99AA28FC0C; Sun, 10 May 2009 02:21:19 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4A2LJbH040526; Sun, 10 May 2009 02:21:19 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4A2LJkg040525; Sun, 10 May 2009 02:21:19 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200905100221.n4A2LJkg040525@svn.freebsd.org> From: Andrew Thompson Date: Sun, 10 May 2009 02:21:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191955 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 May 2009 02:21:20 -0000 Author: thompsa Date: Sun May 10 02:21:19 2009 New Revision: 191955 URL: http://svn.freebsd.org/changeset/base/191955 Log: Cancel the scan when going to INIT state. Should do this for other states here too as once the protocol newstate handler runs the scan has always ended. Modified: head/sys/net80211/ieee80211_proto.c Modified: head/sys/net80211/ieee80211_proto.c ============================================================================== --- head/sys/net80211/ieee80211_proto.c Sun May 10 00:00:25 2009 (r191954) +++ head/sys/net80211/ieee80211_proto.c Sun May 10 02:21:19 2009 (r191955) @@ -1834,6 +1834,8 @@ ieee80211_new_state_locked(struct ieee80 } break; case IEEE80211_S_INIT: + /* cancel any scan in progress */ + ieee80211_cancel_scan(vap); if (ostate == IEEE80211_S_INIT ) { /* XXX don't believe this */ /* INIT -> INIT. nothing to do */ From owner-svn-src-head@FreeBSD.ORG Sun May 10 02:44:20 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5021D106564A; Sun, 10 May 2009 02:44:20 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 332498FC0C; Sun, 10 May 2009 02:44:20 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4A2iJiD040978; Sun, 10 May 2009 02:44:19 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4A2iJXh040974; Sun, 10 May 2009 02:44:19 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200905100244.n4A2iJXh040974@svn.freebsd.org> From: Andrew Thompson Date: Sun, 10 May 2009 02:44:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191956 - in head/sys/dev: ipw iwi iwn wpi X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 May 2009 02:44:20 -0000 Author: thompsa Date: Sun May 10 02:44:19 2009 New Revision: 191956 URL: http://svn.freebsd.org/changeset/base/191956 Log: Abort any scan on a fatal firmware. ic_scan_curchan is overridden to perform the scan in firmware and this relies on the firmware to wake up the scan task on completion. Modified: head/sys/dev/ipw/if_ipw.c head/sys/dev/iwi/if_iwi.c head/sys/dev/iwn/if_iwn.c head/sys/dev/wpi/if_wpi.c Modified: head/sys/dev/ipw/if_ipw.c ============================================================================== --- head/sys/dev/ipw/if_ipw.c Sun May 10 02:21:19 2009 (r191955) +++ head/sys/dev/ipw/if_ipw.c Sun May 10 02:44:19 2009 (r191956) @@ -1384,8 +1384,11 @@ ipw_fatal_error_intr(struct ipw_softc *s { struct ifnet *ifp = sc->sc_ifp; struct ieee80211com *ic = ifp->if_l2com; + struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); device_printf(sc->sc_dev, "firmware error\n"); + if (vap != NULL) + ieee80211_cancel_scan(vap); ieee80211_runtask(ic, &sc->sc_init_task); } Modified: head/sys/dev/iwi/if_iwi.c ============================================================================== --- head/sys/dev/iwi/if_iwi.c Sun May 10 02:21:19 2009 (r191955) +++ head/sys/dev/iwi/if_iwi.c Sun May 10 02:44:19 2009 (r191956) @@ -1635,8 +1635,11 @@ iwi_fatal_error_intr(struct iwi_softc *s { struct ifnet *ifp = sc->sc_ifp; struct ieee80211com *ic = ifp->if_l2com; + struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); device_printf(sc->sc_dev, "firmware error\n"); + if (vap != NULL) + ieee80211_cancel_scan(vap); ieee80211_runtask(ic, &sc->sc_restarttask); sc->flags &= ~IWI_FLAG_BUSY; Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Sun May 10 02:21:19 2009 (r191955) +++ head/sys/dev/iwn/if_iwn.c Sun May 10 02:44:19 2009 (r191956) @@ -1789,11 +1789,14 @@ iwn_error_intr(struct iwn_softc *sc, uin { struct ifnet *ifp = sc->sc_ifp; struct ieee80211com *ic = ifp->if_l2com; + struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); IWN_LOCK_ASSERT(sc); device_printf(sc->sc_dev, "error, INTR=%b STATUS=0x%x\n", r1, IWN_INTR_BITS, r2); + if (vap != NULL) + ieee80211_cancel_scan(vap); ieee80211_runtask(ic, &sc->sc_reinit_task); } Modified: head/sys/dev/wpi/if_wpi.c ============================================================================== --- head/sys/dev/wpi/if_wpi.c Sun May 10 02:21:19 2009 (r191955) +++ head/sys/dev/wpi/if_wpi.c Sun May 10 02:44:19 2009 (r191956) @@ -1786,10 +1786,13 @@ wpi_intr(void *arg) if (r & (WPI_SW_ERROR | WPI_HW_ERROR)) { struct ifnet *ifp = sc->sc_ifp; struct ieee80211com *ic = ifp->if_l2com; + struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); device_printf(sc->sc_dev, "fatal firmware error\n"); DPRINTFN(6,("(%s)\n", (r & WPI_SW_ERROR) ? "(Software Error)" : "(Hardware Error)")); + if (vap != NULL) + ieee80211_cancel_scan(vap); ieee80211_runtask(ic, &sc->sc_restarttask); sc->flags &= ~WPI_FLAG_BUSY; WPI_UNLOCK(sc); From owner-svn-src-head@FreeBSD.ORG Sun May 10 05:44:40 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 71913106566B; Sun, 10 May 2009 05:44:40 +0000 (UTC) (envelope-from peterjeremy@optushome.com.au) Received: from mail34.syd.optusnet.com.au (mail34.syd.optusnet.com.au [211.29.133.218]) by mx1.freebsd.org (Postfix) with ESMTP id DAF8C8FC0C; Sun, 10 May 2009 05:44:39 +0000 (UTC) (envelope-from peterjeremy@optushome.com.au) Received: from server.vk2pj.dyndns.org (c122-106-216-167.belrs3.nsw.optusnet.com.au [122.106.216.167]) by mail34.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n4A5ibPi024556 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 10 May 2009 15:44:37 +1000 X-Bogosity: Ham, spamicity=0.000000 Received: from server.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1]) by server.vk2pj.dyndns.org (8.14.3/8.14.3) with ESMTP id n4A5iaRa099727; Sun, 10 May 2009 15:44:36 +1000 (EST) (envelope-from peter@server.vk2pj.dyndns.org) Received: (from peter@localhost) by server.vk2pj.dyndns.org (8.14.3/8.14.3/Submit) id n4A5iacb099726; Sun, 10 May 2009 15:44:36 +1000 (EST) (envelope-from peter) Date: Sun, 10 May 2009 15:44:36 +1000 From: Peter Jeremy To: Jeff Roberson Message-ID: <20090510054436.GA99673@server.vk2pj.dyndns.org> References: <200904290654.n3T6seLQ071937@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="5mCyUwZo2JvN/JJP" Content-Disposition: inline In-Reply-To: <200904290654.n3T6seLQ071937@svn.freebsd.org> X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc User-Agent: Mutt/1.5.19 (2009-01-05) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191648 - in head/sys: amd64/amd64 amd64/include i386/i386 i386/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 May 2009 05:44:40 -0000 --5mCyUwZo2JvN/JJP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2009-Apr-29 06:54:40 +0000, Jeff Roberson wrote: >+ * At the time of writing (May 12, 2005) the only hyperthreaded >+ * cpus are from Intel, and Intel's dual-core processors can be >+ * identified via the "deterministic cache parameters" cpuid >+ * calls. I realise this is pasted from elsewhere but it's now 4 years since it was written. Is that comment still true? --=20 Peter Jeremy --5mCyUwZo2JvN/JJP Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.11 (FreeBSD) iEYEARECAAYFAkoGacQACgkQ/opHv/APuIe+VQCfb4NXDdwVaDZcXUbJN2e+JqvW BiIAnjQlnxiwAZH9feEpVXxnjzeq44CK =W1gL -----END PGP SIGNATURE----- --5mCyUwZo2JvN/JJP-- From owner-svn-src-head@FreeBSD.ORG Sun May 10 08:54:10 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D6E371065673; Sun, 10 May 2009 08:54:10 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C5A678FC12; Sun, 10 May 2009 08:54:10 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4A8sA3h048369; Sun, 10 May 2009 08:54:10 GMT (envelope-from stas@svn.freebsd.org) Received: (from stas@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4A8sAPw048368; Sun, 10 May 2009 08:54:10 GMT (envelope-from stas@svn.freebsd.org) Message-Id: <200905100854.n4A8sAPw048368@svn.freebsd.org> From: Stanislav Sedov Date: Sun, 10 May 2009 08:54:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191959 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 May 2009 08:54:11 -0000 Author: stas Date: Sun May 10 08:54:10 2009 New Revision: 191959 URL: http://svn.freebsd.org/changeset/base/191959 Log: - Fix promisc/multicast/broadcast parameters setting by introducing the new ate_rxfilter function to set requested parameters. Use this function on parameters change rather than reinitializing the chip. Modified: head/sys/arm/at91/if_ate.c Modified: head/sys/arm/at91/if_ate.c ============================================================================== --- head/sys/arm/at91/if_ate.c Sun May 10 05:17:51 2009 (r191958) +++ head/sys/arm/at91/if_ate.c Sun May 10 08:54:10 2009 (r191959) @@ -76,6 +76,11 @@ __FBSDID("$FreeBSD$"); #define ATE_MAX_TX_BUFFERS 2 /* We have ping-pong tx buffers */ #define ATE_MAX_RX_BUFFERS 64 +/* + * Driver-specific flags. + */ +#define ATE_FLAG_DETACHING 0x01 + struct ate_softc { struct ifnet *ifp; /* ifnet pointer */ @@ -100,6 +105,8 @@ struct ate_softc eth_rx_desc_t *rx_descs; int use_rmii; struct ifmib_iso_8802_3 mibdata; /* stuff for network mgmt */ + int flags; + int if_flags; }; static inline uint32_t @@ -149,6 +156,7 @@ static int ate_ifmedia_upd(struct ifnet static void ate_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr); static int ate_get_mac(struct ate_softc *sc, u_char *eaddr); static void ate_set_mac(struct ate_softc *sc, u_char *eaddr); +static void ate_rxfilter(struct ate_softc *sc); /* * The AT91 family of products has the ethernet called EMAC. However, @@ -238,6 +246,7 @@ ate_attach(device_t dev) ifp->if_linkmib = &sc->mibdata; ifp->if_linkmiblen = sizeof(sc->mibdata); sc->mibdata.dot3Compliance = DOT3COMPLIANCE_COLLS; + sc->if_flags = ifp->if_flags; ether_ifattach(ifp, eaddr); @@ -763,13 +772,6 @@ ateinit_locked(void *xsc) else WR4(sc, ETH_CFG, RD4(sc, ETH_CFG) & ~ETH_CFG_RMII); - /* - * Turn on the multicast hash, and write 0's to it. - */ - WR4(sc, ETH_CFG, RD4(sc, ETH_CFG) | ETH_CFG_MTI); - WR4(sc, ETH_HSH, 0); - WR4(sc, ETH_HSL, 0); - WR4(sc, ETH_CTL, RD4(sc, ETH_CTL) | ETH_CTL_TE | ETH_CTL_RE); WR4(sc, ETH_IER, ETH_ISR_RCOM | ETH_ISR_TCOM | ETH_ISR_RBNA); @@ -780,6 +782,7 @@ ateinit_locked(void *xsc) * swapping to do. Again, if we need it (which I don't think we do). */ ate_setmcast(sc); + ate_rxfilter(sc); /* enable big packets */ WR4(sc, ETH_CFG, RD4(sc, ETH_CFG) | ETH_CFG_BIG); @@ -940,25 +943,63 @@ atestop(struct ate_softc *sc) */ } +static void +ate_rxfilter(struct ate_softc *sc) +{ + struct ifnet *ifp; + uint32_t reg; + + KASSERT(sc != NULL, ("[ate, %d]: sc is NULL!", __LINE__)); + ATE_ASSERT_LOCKED(sc); + ifp = sc->ifp; + + /* + * Wipe out old filter settings. + */ + reg = RD4(sc, ETH_CFG); + reg &= ~(ETH_CFG_CAF | ETH_CFG_MTI | ETH_CFG_UNI); + reg |= ETH_CFG_NBC; + + /* + * Set new parameters. + */ + if ((ifp->if_flags & IFF_BROADCAST) != 0) + reg &= ~ETH_CFG_NBC; + if ((ifp->if_flags & IFF_PROMISC) != 0) + reg |= ETH_CFG_CAF; + if ((ifp->if_flags & IFF_ALLMULTI) != 0) + reg |= ETH_CFG_MTI; + WR4(sc, ETH_CFG, reg); +} + static int ateioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct ate_softc *sc = ifp->if_softc; struct mii_data *mii; struct ifreq *ifr = (struct ifreq *)data; + int drv_flags, flags; int mask, error = 0; + flags = ifp->if_flags; + drv_flags = ifp->if_drv_flags; switch (cmd) { case SIOCSIFFLAGS: ATE_LOCK(sc); - if ((ifp->if_flags & IFF_UP) == 0 && - ifp->if_drv_flags & IFF_DRV_RUNNING) { + if ((flags & IFF_UP) != 0) { + if ((drv_flags & IFF_DRV_RUNNING) != 0) { + if (((flags ^ sc->if_flags) + & (IFF_PROMISC | IFF_ALLMULTI)) != 0) + ate_rxfilter(sc); + } else { + if ((sc->flags & ATE_FLAG_DETACHING) == 0) + ateinit_locked(sc); + } + } else if ((drv_flags & IFF_DRV_RUNNING) != 0) { ifp->if_drv_flags &= ~IFF_DRV_RUNNING; atestop(sc); - } else { - /* reinitialize card on any parameter change */ - ateinit_locked(sc); } + sc->if_flags = flags; ATE_UNLOCK(sc); break; From owner-svn-src-head@FreeBSD.ORG Sun May 10 10:32:29 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D8D341065673; Sun, 10 May 2009 10:32:29 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C72688FC08; Sun, 10 May 2009 10:32:29 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4AAWTXl050354; Sun, 10 May 2009 10:32:29 GMT (envelope-from stas@svn.freebsd.org) Received: (from stas@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4AAWT0x050353; Sun, 10 May 2009 10:32:29 GMT (envelope-from stas@svn.freebsd.org) Message-Id: <200905101032.n4AAWT0x050353@svn.freebsd.org> From: Stanislav Sedov Date: Sun, 10 May 2009 10:32:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191960 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 May 2009 10:32:30 -0000 Author: stas Date: Sun May 10 10:32:29 2009 New Revision: 191960 URL: http://svn.freebsd.org/changeset/base/191960 Log: - Fix multicast operation that I broke in previous commit. - Do not enable multicast hash lookup if no multicast addresses were configured or if promisc mode is enabled. Modified: head/sys/arm/at91/if_ate.c Modified: head/sys/arm/at91/if_ate.c ============================================================================== --- head/sys/arm/at91/if_ate.c Sun May 10 08:54:10 2009 (r191959) +++ head/sys/arm/at91/if_ate.c Sun May 10 10:32:29 2009 (r191960) @@ -80,6 +80,7 @@ __FBSDID("$FreeBSD$"); * Driver-specific flags. */ #define ATE_FLAG_DETACHING 0x01 +#define ATE_FLAG_MULTICAST 0x02 struct ate_softc { @@ -316,26 +317,39 @@ ate_load_rx_buf(void *arg, bus_dma_segme * of different MAC chips use this method (or the reverse the bits) * method. */ -static void +static int ate_setmcast(struct ate_softc *sc) { uint32_t index; uint32_t mcaf[2]; u_char *af = (u_char *) mcaf; struct ifmultiaddr *ifma; + struct ifnet *ifp; + + ifp = sc->ifp; + + if ((ifp->if_flags & IFF_PROMISC) != 0) + return (0); + if ((ifp->if_flags & IFF_ALLMULTI) != 0) { + WR4(sc, ETH_HSL, 0xffffffff); + WR4(sc, ETH_HSH, 0xffffffff); + return (1); + } + /* + * Compute the multicast hash. + */ mcaf[0] = 0; mcaf[1] = 0; - - IF_ADDR_LOCK(sc->ifp); - TAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) { + IF_ADDR_LOCK(ifp); + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; index = ether_crc32_be(LLADDR((struct sockaddr_dl *) ifma->ifma_addr), ETHER_ADDR_LEN) >> 26; af[index >> 3] |= 1 << (index & 7); } - IF_ADDR_UNLOCK(sc->ifp); + IF_ADDR_UNLOCK(ifp); /* * Write the hash to the hash register. This card can also @@ -346,6 +360,7 @@ ate_setmcast(struct ate_softc *sc) */ WR4(sc, ETH_HSL, mcaf[0]); WR4(sc, ETH_HSH, mcaf[1]); + return (mcaf[0] || mcaf[1]); } static int @@ -772,6 +787,11 @@ ateinit_locked(void *xsc) else WR4(sc, ETH_CFG, RD4(sc, ETH_CFG) & ~ETH_CFG_RMII); + ate_rxfilter(sc); + + /* + * Turn on MACs and interrupt processing. + */ WR4(sc, ETH_CTL, RD4(sc, ETH_CTL) | ETH_CTL_TE | ETH_CTL_RE); WR4(sc, ETH_IER, ETH_ISR_RCOM | ETH_ISR_TCOM | ETH_ISR_RBNA); @@ -781,8 +801,6 @@ ateinit_locked(void *xsc) * the byte order is big endian, not little endian, so we have some * swapping to do. Again, if we need it (which I don't think we do). */ - ate_setmcast(sc); - ate_rxfilter(sc); /* enable big packets */ WR4(sc, ETH_CFG, RD4(sc, ETH_CFG) | ETH_CFG_BIG); @@ -948,6 +966,7 @@ ate_rxfilter(struct ate_softc *sc) { struct ifnet *ifp; uint32_t reg; + int enabled; KASSERT(sc != NULL, ("[ate, %d]: sc is NULL!", __LINE__)); ATE_ASSERT_LOCKED(sc); @@ -959,16 +978,22 @@ ate_rxfilter(struct ate_softc *sc) reg = RD4(sc, ETH_CFG); reg &= ~(ETH_CFG_CAF | ETH_CFG_MTI | ETH_CFG_UNI); reg |= ETH_CFG_NBC; + sc->flags &= ~ATE_FLAG_MULTICAST; /* * Set new parameters. */ if ((ifp->if_flags & IFF_BROADCAST) != 0) reg &= ~ETH_CFG_NBC; - if ((ifp->if_flags & IFF_PROMISC) != 0) + if ((ifp->if_flags & IFF_PROMISC) != 0) { reg |= ETH_CFG_CAF; - if ((ifp->if_flags & IFF_ALLMULTI) != 0) - reg |= ETH_CFG_MTI; + } else { + enabled = ate_setmcast(sc); + if (enabled != 0) { + reg |= ETH_CFG_MTI; + sc->flags |= ATE_FLAG_MULTICAST; + } + } WR4(sc, ETH_CFG, reg); } @@ -979,8 +1004,9 @@ ateioctl(struct ifnet *ifp, u_long cmd, struct mii_data *mii; struct ifreq *ifr = (struct ifreq *)data; int drv_flags, flags; - int mask, error = 0; + int mask, error, enabled; + error = 0; flags = ifp->if_flags; drv_flags = ifp->if_drv_flags; switch (cmd) { @@ -1005,11 +1031,13 @@ ateioctl(struct ifnet *ifp, u_long cmd, case SIOCADDMULTI: case SIOCDELMULTI: - /* update multicast filter list. */ - ATE_LOCK(sc); - ate_setmcast(sc); - ATE_UNLOCK(sc); - error = 0; + if ((drv_flags & IFF_DRV_RUNNING) != 0) { + ATE_LOCK(sc); + enabled = ate_setmcast(sc); + if (enabled != (sc->flags & ATE_FLAG_MULTICAST)) + ate_rxfilter(sc); + ATE_UNLOCK(sc); + } break; case SIOCSIFMEDIA: From owner-svn-src-head@FreeBSD.ORG Sun May 10 11:05:22 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B2EE106566B; Sun, 10 May 2009 11:05:22 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 89B148FC27; Sun, 10 May 2009 11:05:22 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4AB5MKa055906; Sun, 10 May 2009 11:05:22 GMT (envelope-from stas@svn.freebsd.org) Received: (from stas@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4AB5M4K055905; Sun, 10 May 2009 11:05:22 GMT (envelope-from stas@svn.freebsd.org) Message-Id: <200905101105.n4AB5M4K055905@svn.freebsd.org> From: Stanislav Sedov Date: Sun, 10 May 2009 11:05:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191961 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 May 2009 11:05:23 -0000 Author: stas Date: Sun May 10 11:05:22 2009 New Revision: 191961 URL: http://svn.freebsd.org/changeset/base/191961 Log: - Fix build with INVARIANTS enabled. Modified: head/sys/arm/at91/at91_cfata.c Modified: head/sys/arm/at91/at91_cfata.c ============================================================================== --- head/sys/arm/at91/at91_cfata.c Sun May 10 10:32:29 2009 (r191960) +++ head/sys/arm/at91/at91_cfata.c Sun May 10 11:05:22 2009 (r191961) @@ -131,9 +131,9 @@ ata_at91_release_resource(device_t dev, struct resource *r) { - KASSERT(type == SYS_RES_IRQ && *rid == ATA_IRQ_RID, + KASSERT(type == SYS_RES_IRQ && rid == ATA_IRQ_RID, ("[at91_cfata, %d]: illegal resource request (type %u rid %u)", - __LINE__, type, *rid)); + __LINE__, type, rid)); return (0); } From owner-svn-src-head@FreeBSD.ORG Sun May 10 14:22:48 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AE78B106566C; Sun, 10 May 2009 14:22:48 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 56D628FC08; Sun, 10 May 2009 14:22:48 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id n4AEJquv083984; Sun, 10 May 2009 08:19:52 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Sun, 10 May 2009 08:19:53 -0600 (MDT) Message-Id: <20090510.081953.1169634800.imp@bsdimp.com> To: stas@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <200905100854.n4A8sAPw048368@svn.freebsd.org> References: <200905100854.n4A8sAPw048368@svn.freebsd.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r191959 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 May 2009 14:22:49 -0000 In message: <200905100854.n4A8sAPw048368@svn.freebsd.org> Stanislav Sedov writes: : +/* : + * Driver-specific flags. : + */ : +#define ATE_FLAG_DETACHING 0x01 ... : + if ((sc->flags & ATE_FLAG_DETACHING) == 0) : + ateinit_locked(sc); ... This flag is never set... Warner From owner-svn-src-head@FreeBSD.ORG Sun May 10 14:37:44 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 46272106564A for ; Sun, 10 May 2009 14:37:44 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from mx0.deglitch.com (backbone.deglitch.com [IPv6:2001:16d8:fffb:4::abba]) by mx1.freebsd.org (Postfix) with ESMTP id EB5098FC1A for ; Sun, 10 May 2009 14:37:43 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from DSPAM-Daemon (localhost [127.0.0.1]) by mx0.deglitch.com (Postfix) with SMTP id D2DD28FC52 for ; Sun, 10 May 2009 18:23:32 +0400 (MSD) Received: from orion.SpringDaemons.com (unknown [77.232.3.143]) by mx0.deglitch.com (Postfix) with ESMTPA id 155628FC18; Sun, 10 May 2009 18:23:30 +0400 (MSD) Received: from orion (localhost [127.0.0.1]) by orion.SpringDaemons.com (Postfix) with SMTP id 4F1443982B; Sun, 10 May 2009 18:23:52 +0400 (MSD) Date: Sun, 10 May 2009 18:23:52 +0400 From: Stanislav Sedov To: "M. Warner Losh" Message-Id: <20090510182352.f314be67.stas@FreeBSD.org> In-Reply-To: <20090510.081953.1169634800.imp@bsdimp.com> References: <200905100854.n4A8sAPw048368@svn.freebsd.org> <20090510.081953.1169634800.imp@bsdimp.com> Organization: The FreeBSD Project X-XMPP: ssedov@jabber.ru X-Voice: +7 916 849 20 23 X-PGP-Fingerprint: F21E D6CC 5626 9609 6CE2 A385 2BF5 5993 EB26 9581 X-Mailer: carrier-pigeon Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-DSPAM-Result: Innocent X-DSPAM-Processed: Sun May 10 18:23:32 2009 X-DSPAM-Confidence: 0.9899 X-DSPAM-Improbability: 1 in 9809 chance of being spam X-DSPAM-Probability: 0.0000 X-DSPAM-Signature: 4a06e364994291131326605 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r191959 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 May 2009 14:37:44 -0000 On Sun, 10 May 2009 08:19:53 -0600 (MDT) "M. Warner Losh" mentioned: > In message: <200905100854.n4A8sAPw048368@svn.freebsd.org> > Stanislav Sedov writes: > : +/* > : + * Driver-specific flags. > : + */ > : +#define ATE_FLAG_DETACHING 0x01 > ... > : + if ((sc->flags & ATE_FLAG_DETACHING) == 0) > : + ateinit_locked(sc); > ... > > This flag is never set... > Yeah, it's for future use in detach. -- Stanislav Sedov ST4096-RIPE !DSPAM:4a06e364994291131326605! From owner-svn-src-head@FreeBSD.ORG Sun May 10 16:00:41 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B89F7106564A; Sun, 10 May 2009 16:00:41 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A65648FC1A; Sun, 10 May 2009 16:00:41 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4AG0fw0061814; Sun, 10 May 2009 16:00:41 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4AG0ftd061813; Sun, 10 May 2009 16:00:41 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200905101600.n4AG0ftd061813@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 10 May 2009 16:00:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191963 - head/sys/modules/sound/sound X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 May 2009 16:00:42 -0000 Author: nwhitehorn Date: Sun May 10 16:00:41 2009 New Revision: 191963 URL: http://svn.freebsd.org/changeset/base/191963 Log: PowerPC does not, in general, have ISA sound devices or an ISA bus, so add PowerPC to list of platforms for which we don't want to depend on ISA. Modified: head/sys/modules/sound/sound/Makefile Modified: head/sys/modules/sound/sound/Makefile ============================================================================== --- head/sys/modules/sound/sound/Makefile Sun May 10 15:37:48 2009 (r191962) +++ head/sys/modules/sound/sound/Makefile Sun May 10 16:00:41 2009 (r191963) @@ -18,7 +18,7 @@ SRCS+= midi.c mpu401.c sequencer.c EXPORT_SYMS= YES # XXX evaluate -.if ${MACHINE_ARCH} == "sparc64" +.if ${MACHINE_ARCH} == "sparc64" || ${MACHINE_ARCH} == "powerpc" # Create an empty opt_isa.h in order to keep kmod.mk from linking in an # existing one from KERNBUILDDIR which possibly has DEV_ISA defined so # sound.ko is always built without isadma support. From owner-svn-src-head@FreeBSD.ORG Sun May 10 17:05:44 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F8BE106566C; Sun, 10 May 2009 17:05:44 +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 146EF8FC1C; Sun, 10 May 2009 17:05:44 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4AH5hSQ063139; Sun, 10 May 2009 17:05:43 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4AH5hE1063137; Sun, 10 May 2009 17:05:43 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200905101705.n4AH5hE1063137@svn.freebsd.org> From: Alan Cox Date: Sun, 10 May 2009 17:05:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191964 - in head/sys: fs/smbfs nfsclient X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 May 2009 17:05:44 -0000 Author: alc Date: Sun May 10 17:05:43 2009 New Revision: 191964 URL: http://svn.freebsd.org/changeset/base/191964 Log: Eliminate stale comments. Eliminate a case of unnecessary page queues locking. Modified: head/sys/fs/smbfs/smbfs_io.c head/sys/nfsclient/nfs_bio.c Modified: head/sys/fs/smbfs/smbfs_io.c ============================================================================== --- head/sys/fs/smbfs/smbfs_io.c Sun May 10 16:00:41 2009 (r191963) +++ head/sys/fs/smbfs/smbfs_io.c Sun May 10 17:05:43 2009 (r191964) @@ -456,8 +456,6 @@ smbfs_getpages(ap) VM_OBJECT_LOCK(object); if (m->valid != 0) { - /* handled by vm_fault now */ - /* vm_page_zero_invalid(m, TRUE); */ vm_page_lock_queues(); for (i = 0; i < npages; ++i) { if (i != reqpage) @@ -526,8 +524,6 @@ smbfs_getpages(ap) */ m->valid = 0; vm_page_set_validclean(m, 0, size - toff); - /* handled by vm_fault now */ - /* vm_page_zero_invalid(m, TRUE); */ } else { /* * Read operation was short. If no error occured Modified: head/sys/nfsclient/nfs_bio.c ============================================================================== --- head/sys/nfsclient/nfs_bio.c Sun May 10 16:00:41 2009 (r191963) +++ head/sys/nfsclient/nfs_bio.c Sun May 10 17:05:43 2009 (r191964) @@ -138,10 +138,8 @@ nfs_getpages(struct vop_getpages_args *a vm_page_t m = pages[ap->a_reqpage]; VM_OBJECT_LOCK(object); - vm_page_lock_queues(); if (m->valid != 0) { - /* handled by vm_fault now */ - /* vm_page_zero_invalid(m, TRUE); */ + vm_page_lock_queues(); for (i = 0; i < npages; ++i) { if (i != ap->a_reqpage) vm_page_free(pages[i]); @@ -150,7 +148,6 @@ nfs_getpages(struct vop_getpages_args *a VM_OBJECT_UNLOCK(object); return(0); } - vm_page_unlock_queues(); VM_OBJECT_UNLOCK(object); } @@ -219,8 +216,6 @@ nfs_getpages(struct vop_getpages_args *a */ m->valid = 0; vm_page_set_validclean(m, 0, size - toff); - /* handled by vm_fault now */ - /* vm_page_zero_invalid(m, TRUE); */ } else { /* * Read operation was short. If no error occured From owner-svn-src-head@FreeBSD.ORG Sun May 10 18:16:07 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EE71F1065672; Sun, 10 May 2009 18:16:07 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DBEBB8FC0A; Sun, 10 May 2009 18:16:07 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4AIG7OP064711; Sun, 10 May 2009 18:16:07 GMT (envelope-from dchagin@svn.freebsd.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4AIG7Ek064707; Sun, 10 May 2009 18:16:07 GMT (envelope-from dchagin@svn.freebsd.org) Message-Id: <200905101816.n4AIG7Ek064707@svn.freebsd.org> From: Dmitry Chagin Date: Sun, 10 May 2009 18:16:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191966 - in head/sys: amd64/linux32 compat/linux i386/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 May 2009 18:16:08 -0000 Author: dchagin Date: Sun May 10 18:16:07 2009 New Revision: 191966 URL: http://svn.freebsd.org/changeset/base/191966 Log: Rework r189362, r191883. The frequency of the statistics clock is given by stathz. Use stathz if it is available, otherwise use hz. Pointed out by: bde Approved by: kib (mentor) Modified: head/sys/amd64/linux32/linux32_sysvec.c head/sys/compat/linux/linux_misc.c head/sys/compat/linux/linux_misc.h head/sys/i386/linux/linux_sysvec.c Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Sun May 10 18:11:14 2009 (r191965) +++ head/sys/amd64/linux32/linux32_sysvec.c Sun May 10 18:16:07 2009 (r191966) @@ -261,7 +261,7 @@ elf_linux_fixup(register_t **stack_base, pos = base + (imgp->args->argc + imgp->args->envc + 2); AUXARGS_ENTRY_32(pos, LINUX_AT_HWCAP, cpu_feature); - AUXARGS_ENTRY_32(pos, LINUX_AT_CLKTCK, hz); + AUXARGS_ENTRY_32(pos, LINUX_AT_CLKTCK, stclohz); AUXARGS_ENTRY_32(pos, AT_PHDR, args->phdr); AUXARGS_ENTRY_32(pos, AT_PHENT, args->phent); AUXARGS_ENTRY_32(pos, AT_PHNUM, args->phnum); @@ -1125,6 +1125,7 @@ linux_elf_modevent(module_t mod, int typ linux_szplatform = roundup(strlen(linux_platform) + 1, sizeof(char *)); linux_osd_jail_register(); + stclohz = (stathz ? stathz : hz); if (bootverbose) printf("Linux ELF exec handler installed\n"); } else Modified: head/sys/compat/linux/linux_misc.c ============================================================================== --- head/sys/compat/linux/linux_misc.c Sun May 10 18:11:14 2009 (r191965) +++ head/sys/compat/linux/linux_misc.c Sun May 10 18:16:07 2009 (r191966) @@ -92,6 +92,8 @@ __FBSDID("$FreeBSD$"); #include #include +int stclohz; /* Statistics clock frequency */ + #define BSD_TO_LINUX_SIGNAL(sig) \ (((sig) <= LINUX_SIGTBLSZ) ? bsd_to_linux_signal[_SIG_IDX(sig)] : sig) @@ -659,7 +661,7 @@ struct l_times_argv { l_clock_t tms_cstime; }; -#define CONVTCK(r) (r.tv_sec * hz + r.tv_usec / (1000000 / hz)) +#define CONVTCK(r) (r.tv_sec * stclohz + r.tv_usec / (1000000 / stclohz)) int linux_times(struct thread *td, struct linux_times_args *args) Modified: head/sys/compat/linux/linux_misc.h ============================================================================== --- head/sys/compat/linux/linux_misc.h Sun May 10 18:11:14 2009 (r191965) +++ head/sys/compat/linux/linux_misc.h Sun May 10 18:16:07 2009 (r191966) @@ -65,4 +65,6 @@ extern const char *linux_platform; #define __LINUX_NPXCW__ 0x37f #endif +extern int stclohz; + #endif /* _LINUX_MISC_H_ */ Modified: head/sys/i386/linux/linux_sysvec.c ============================================================================== --- head/sys/i386/linux/linux_sysvec.c Sun May 10 18:11:14 2009 (r191965) +++ head/sys/i386/linux/linux_sysvec.c Sun May 10 18:16:07 2009 (r191966) @@ -255,7 +255,7 @@ elf_linux_fixup(register_t **stack_base, pos = *stack_base + (imgp->args->argc + imgp->args->envc + 2); AUXARGS_ENTRY(pos, LINUX_AT_HWCAP, cpu_feature); - AUXARGS_ENTRY(pos, LINUX_AT_CLKTCK, hz); + AUXARGS_ENTRY(pos, LINUX_AT_CLKTCK, stclohz); AUXARGS_ENTRY(pos, AT_PHDR, args->phdr); AUXARGS_ENTRY(pos, AT_PHENT, args->phent); AUXARGS_ENTRY(pos, AT_PHNUM, args->phnum); @@ -1092,6 +1092,7 @@ linux_elf_modevent(module_t mod, int typ linux_szplatform = roundup(strlen(linux_platform) + 1, sizeof(char *)); linux_osd_jail_register(); + stclohz = (stathz ? stathz : hz); if (bootverbose) printf("Linux ELF exec handler installed\n"); } else From owner-svn-src-head@FreeBSD.ORG Sun May 10 18:27:21 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07FC61065670; Sun, 10 May 2009 18:27:21 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DFA318FC08; Sun, 10 May 2009 18:27:20 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4AIRKHm065187; Sun, 10 May 2009 18:27:20 GMT (envelope-from dchagin@svn.freebsd.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4AIRKMH065185; Sun, 10 May 2009 18:27:20 GMT (envelope-from dchagin@svn.freebsd.org) Message-Id: <200905101827.n4AIRKMH065185@svn.freebsd.org> From: Dmitry Chagin Date: Sun, 10 May 2009 18:27:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191972 - head/sys/compat/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 May 2009 18:27:21 -0000 Author: dchagin Date: Sun May 10 18:27:20 2009 New Revision: 191972 URL: http://svn.freebsd.org/changeset/base/191972 Log: Introduce linux_kernver() interface which is intended for an exact designation of the emulated kernel version. linux_kernver() returns integer value formatted as 'VVVMMMIII' where VVV - version, MMM - major revision, III - minor revision. Approved by: kib (mentor) Modified: head/sys/compat/linux/linux_mib.c head/sys/compat/linux/linux_mib.h Modified: head/sys/compat/linux/linux_mib.c ============================================================================== --- head/sys/compat/linux/linux_mib.c Sun May 10 18:25:14 2009 (r191971) +++ head/sys/compat/linux/linux_mib.c Sun May 10 18:27:20 2009 (r191972) @@ -54,7 +54,7 @@ struct linux_prison { char pr_osname[LINUX_MAX_UTSNAME]; char pr_osrelease[LINUX_MAX_UTSNAME]; int pr_oss_version; - int pr_use_linux26; /* flag to determine whether to use 2.6 emulation */ + int pr_osrel; }; static unsigned linux_osd_jail_slot; @@ -87,7 +87,7 @@ SYSCTL_PROC(_compat_linux, OID_AUTO, osn "Linux kernel OS name"); static char linux_osrelease[LINUX_MAX_UTSNAME] = "2.6.16"; -static int linux_use_linux26 = 1; +static int linux_osrel = 2006016; static int linux_sysctl_osrelease(SYSCTL_HANDLER_ARGS) @@ -130,6 +130,37 @@ SYSCTL_PROC(_compat_linux, OID_AUTO, oss "Linux OSS version"); /* + * Map the osrelease into integer + */ +static int +linux_map_osrel(char *osrelease, int *osrel) +{ + char *sep, *eosrelease; + int len, v0, v1, v2, v; + + len = strlen(osrelease); + eosrelease = osrelease + len; + v0 = strtol(osrelease, &sep, 10); + if (osrelease == sep || sep + 1 >= eosrelease || *sep != '.') + return (EINVAL); + osrelease = sep + 1; + v1 = strtol(osrelease, &sep, 10); + if (osrelease == sep || sep + 1 >= eosrelease || *sep != '.') + return (EINVAL); + osrelease = sep + 1; + v2 = strtol(osrelease, &sep, 10); + if (osrelease == sep || sep != eosrelease) + return (EINVAL); + + v = v0 * 1000000 + v1 * 1000 + v2; + if (v < 1000000) + return (EINVAL); + + *osrel = v; + return (0); +} + +/* * Returns holding the prison mutex if return non-NULL. */ static struct linux_prison * @@ -187,7 +218,7 @@ linux_alloc_prison(struct prison *pr, st strncpy(lpr->pr_osname, linux_osname, LINUX_MAX_UTSNAME); strncpy(lpr->pr_osrelease, linux_osrelease, LINUX_MAX_UTSNAME); lpr->pr_oss_version = linux_oss_version; - lpr->pr_use_linux26 = linux_use_linux26; + lpr->pr_osrel = linux_osrel; mtx_unlock(&osname_lock); } done: @@ -297,14 +328,17 @@ linux_prison_set(void *obj, void *data) mtx_unlock(&pr->pr_mtx); return (error); } - if (osname) - strlcpy(lpr->pr_osname, osname, LINUX_MAX_UTSNAME); if (osrelease) { + error = linux_map_osrel(osrelease, &lpr->pr_osrel); + if (error) { + mtx_unlock(&pr->pr_mtx); + return (error); + } strlcpy(lpr->pr_osrelease, osrelease, LINUX_MAX_UTSNAME); - lpr->pr_use_linux26 = strlen(osrelease) >= 3 && - osrelease[2] == '6'; } + if (osname) + strlcpy(lpr->pr_osname, osname, LINUX_MAX_UTSNAME); if (gotversion) lpr->pr_oss_version = oss_version; mtx_unlock(&pr->pr_mtx); @@ -471,19 +505,19 @@ linux_get_osrelease(struct thread *td, c } int -linux_use26(struct thread *td) +linux_kernver(struct thread *td) { struct prison *pr; struct linux_prison *lpr; - int use26; + int osrel; lpr = linux_get_prison(td, &pr); if (lpr != NULL) { - use26 = lpr->pr_use_linux26; + osrel = lpr->pr_osrel; mtx_unlock(&pr->pr_mtx); } else - use26 = linux_use_linux26; - return (use26); + osrel = linux_osrel; + return (osrel); } int @@ -491,18 +525,25 @@ linux_set_osrelease(struct thread *td, c { struct prison *pr; struct linux_prison *lpr; + int error; lpr = linux_get_prison(td, &pr); if (lpr != NULL) { + error = linux_map_osrel(osrelease, &lpr->pr_osrel); + if (error) { + mtx_unlock(&pr->pr_mtx); + return (error); + } strlcpy(lpr->pr_osrelease, osrelease, LINUX_MAX_UTSNAME); - lpr->pr_use_linux26 = - strlen(osrelease) >= 3 && osrelease[2] == '6'; mtx_unlock(&pr->pr_mtx); } else { mtx_lock(&osname_lock); + error = linux_map_osrel(osrelease, &linux_osrel); + if (error) { + mtx_unlock(&osname_lock); + return (error); + } strcpy(linux_osrelease, osrelease); - linux_use_linux26 = - strlen(osrelease) >= 3 && osrelease[2] == '6'; mtx_unlock(&osname_lock); } Modified: head/sys/compat/linux/linux_mib.h ============================================================================== --- head/sys/compat/linux/linux_mib.h Sun May 10 18:25:14 2009 (r191971) +++ head/sys/compat/linux/linux_mib.h Sun May 10 18:27:20 2009 (r191972) @@ -43,6 +43,10 @@ int linux_set_osrelease(struct thread *t int linux_get_oss_version(struct thread *td); int linux_set_oss_version(struct thread *td, int oss_version); -int linux_use26(struct thread *td); +int linux_kernver(struct thread *td); + +#define LINUX_KERNVER_2006000 2006000 + +#define linux_use26(t) (linux_kernver(t) >= LINUX_KERNVER_2006000) #endif /* _LINUX_MIB_H_ */ From owner-svn-src-head@FreeBSD.ORG Sun May 10 18:43:44 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3887B106566B; Sun, 10 May 2009 18:43:44 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 25D638FC15; Sun, 10 May 2009 18:43:44 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4AIhilg065518; Sun, 10 May 2009 18:43:44 GMT (envelope-from dchagin@svn.freebsd.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4AIhh9K065514; Sun, 10 May 2009 18:43:43 GMT (envelope-from dchagin@svn.freebsd.org) Message-Id: <200905101843.n4AIhh9K065514@svn.freebsd.org> From: Dmitry Chagin Date: Sun, 10 May 2009 18:43:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191973 - in head/sys: amd64/linux32 compat/linux i386/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 May 2009 18:43:44 -0000 Author: dchagin Date: Sun May 10 18:43:43 2009 New Revision: 191973 URL: http://svn.freebsd.org/changeset/base/191973 Log: Do not export AT_CLKTCK when emulating Linux kernel prior to 2.4.0, as it has appeared in the 2.4.0-rc7 first time. Being exported, AT_CLKTCK is returned by sysconf(_SC_CLK_TCK), glibc falls back to the hard-coded CLK_TCK value when aux entry is not present. Glibc versions prior to 2.2.1 always use hard-coded CLK_TCK value. For older applications/libc's which depends on hard-coded CLK_TCK value user should set compat.linux.osrelease less than 2.4.0. Approved by: kib (mentor) Modified: head/sys/amd64/linux32/linux32_sysvec.c head/sys/compat/linux/linux_mib.h head/sys/compat/linux/linux_misc.c head/sys/i386/linux/linux_sysvec.c Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Sun May 10 18:27:20 2009 (r191972) +++ head/sys/amd64/linux32/linux32_sysvec.c Sun May 10 18:43:43 2009 (r191973) @@ -261,7 +261,17 @@ elf_linux_fixup(register_t **stack_base, pos = base + (imgp->args->argc + imgp->args->envc + 2); AUXARGS_ENTRY_32(pos, LINUX_AT_HWCAP, cpu_feature); - AUXARGS_ENTRY_32(pos, LINUX_AT_CLKTCK, stclohz); + + /* + * Do not export AT_CLKTCK when emulating Linux kernel prior to 2.4.0, + * as it has appeared in the 2.4.0-rc7 first time. + * Being exported, AT_CLKTCK is returned by sysconf(_SC_CLK_TCK), + * glibc falls back to the hard-coded CLK_TCK value when aux entry + * is not present. + * Also see linux_times() implementation. + */ + if (linux_kernver(curthread) >= LINUX_KERNVER_2004000) + AUXARGS_ENTRY_32(pos, LINUX_AT_CLKTCK, stclohz); AUXARGS_ENTRY_32(pos, AT_PHDR, args->phdr); AUXARGS_ENTRY_32(pos, AT_PHENT, args->phent); AUXARGS_ENTRY_32(pos, AT_PHNUM, args->phnum); Modified: head/sys/compat/linux/linux_mib.h ============================================================================== --- head/sys/compat/linux/linux_mib.h Sun May 10 18:27:20 2009 (r191972) +++ head/sys/compat/linux/linux_mib.h Sun May 10 18:43:43 2009 (r191973) @@ -45,6 +45,7 @@ int linux_set_oss_version(struct thread int linux_kernver(struct thread *td); +#define LINUX_KERNVER_2004000 2004000 #define LINUX_KERNVER_2006000 2006000 #define linux_use26(t) (linux_kernver(t) >= LINUX_KERNVER_2006000) Modified: head/sys/compat/linux/linux_misc.c ============================================================================== --- head/sys/compat/linux/linux_misc.c Sun May 10 18:27:20 2009 (r191972) +++ head/sys/compat/linux/linux_misc.c Sun May 10 18:43:43 2009 (r191973) @@ -661,7 +661,19 @@ struct l_times_argv { l_clock_t tms_cstime; }; -#define CONVTCK(r) (r.tv_sec * stclohz + r.tv_usec / (1000000 / stclohz)) + +/* + * Glibc versions prior to 2.2.1 always use hard-coded CLK_TCK value. + * Since 2.2.1 Glibc uses value exported from kernel via AT_CLKTCK + * auxiliary vector entry. + */ +#define CLK_TCK 100 + +#define CONVOTCK(r) (r.tv_sec * CLK_TCK + r.tv_usec / (1000000 / CLK_TCK)) +#define CONVNTCK(r) (r.tv_sec * stclohz + r.tv_usec / (1000000 / stclohz)) + +#define CONVTCK(r) (linux_kernver(td) >= LINUX_KERNVER_2004000 ? \ + CONVNTCK(r) : CONVOTCK(r)) int linux_times(struct thread *td, struct linux_times_args *args) Modified: head/sys/i386/linux/linux_sysvec.c ============================================================================== --- head/sys/i386/linux/linux_sysvec.c Sun May 10 18:27:20 2009 (r191972) +++ head/sys/i386/linux/linux_sysvec.c Sun May 10 18:43:43 2009 (r191973) @@ -255,7 +255,17 @@ elf_linux_fixup(register_t **stack_base, pos = *stack_base + (imgp->args->argc + imgp->args->envc + 2); AUXARGS_ENTRY(pos, LINUX_AT_HWCAP, cpu_feature); - AUXARGS_ENTRY(pos, LINUX_AT_CLKTCK, stclohz); + + /* + * Do not export AT_CLKTCK when emulating Linux kernel prior to 2.4.0, + * as it has appeared in the 2.4.0-rc7 first time. + * Being exported, AT_CLKTCK is returned by sysconf(_SC_CLK_TCK), + * glibc falls back to the hard-coded CLK_TCK value when aux entry + * is not present. + * Also see linux_times() implementation. + */ + if (linux_kernver(curthread) >= LINUX_KERNVER_2004000) + AUXARGS_ENTRY(pos, LINUX_AT_CLKTCK, stclohz); AUXARGS_ENTRY(pos, AT_PHDR, args->phdr); AUXARGS_ENTRY(pos, AT_PHENT, args->phent); AUXARGS_ENTRY(pos, AT_PHNUM, args->phnum); From owner-svn-src-head@FreeBSD.ORG Sun May 10 20:14:19 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA02D106564A; Sun, 10 May 2009 20:14:19 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B85518FC13; Sun, 10 May 2009 20:14:19 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4AKEJEE067742; Sun, 10 May 2009 20:14:19 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4AKEJmh067741; Sun, 10 May 2009 20:14:19 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200905102014.n4AKEJmh067741@svn.freebsd.org> From: Marius Strobl Date: Sun, 10 May 2009 20:14:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191979 - head/sys/dev/isp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 May 2009 20:14:20 -0000 Author: marius Date: Sun May 10 20:14:19 2009 New Revision: 191979 URL: http://svn.freebsd.org/changeset/base/191979 Log: Change uses of the struct ccb_hdr timeout_ch missed when isp(4) was adapted to MPSAFE cam(4) to a isp(4) specific callout structure. Thanks to Florian Smeets for providing access to a machine exhibiting this problem for debugging. Approved by: mjacob MFC after: 3 days Modified: head/sys/dev/isp/isp_freebsd.c Modified: head/sys/dev/isp/isp_freebsd.c ============================================================================== --- head/sys/dev/isp/isp_freebsd.c Sun May 10 19:50:24 2009 (r191978) +++ head/sys/dev/isp/isp_freebsd.c Sun May 10 20:14:19 2009 (r191979) @@ -1988,7 +1988,8 @@ isp_watchdog_work(ispsoftc_t *isp, XS_T isp_done(xs); } else { XS_CMD_C_WDOG(xs); - xs->ccb_h.timeout_ch = timeout(isp_watchdog, xs, hz); + callout_reset(&PISP_PCMD((union ccb *)xs)->wdog, hz, + isp_watchdog, xs); XS_CMD_S_GRACE(xs); isp->isp_sendmarker |= 1 << XS_CHANNEL(xs); } @@ -3004,7 +3005,7 @@ isp_done(struct ccb_scsiio *sccb) XS_CMD_S_DONE(sccb); if (XS_CMD_WDOG_P(sccb) == 0) { - untimeout(isp_watchdog, sccb, sccb->ccb_h.timeout_ch); + callout_stop(&PISP_PCMD(sccb)->wdog); if (XS_CMD_GRACE_P(sccb)) { isp_prt(isp, ISP_LOGDEBUG2, "finished command on borrowed time"); From owner-svn-src-head@FreeBSD.ORG Sun May 10 20:22:42 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2EFA4106566C; Sun, 10 May 2009 20:22:42 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 13E4E8FC1A; Sun, 10 May 2009 20:22:42 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4AKMfYh068017; Sun, 10 May 2009 20:22:41 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4AKMfpE068016; Sun, 10 May 2009 20:22:41 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200905102022.n4AKMfpE068016@svn.freebsd.org> From: Marius Strobl Date: Sun, 10 May 2009 20:22:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191980 - head/sys/sparc64/sparc64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 May 2009 20:22:42 -0000 Author: marius Date: Sun May 10 20:22:41 2009 New Revision: 191980 URL: http://svn.freebsd.org/changeset/base/191980 Log: - Fix style. - Use __FBSDID. Modified: head/sys/sparc64/sparc64/vm_machdep.c Modified: head/sys/sparc64/sparc64/vm_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/vm_machdep.c Sun May 10 20:14:19 2009 (r191979) +++ head/sys/sparc64/sparc64/vm_machdep.c Sun May 10 20:22:41 2009 (r191980) @@ -39,23 +39,26 @@ * * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ - * from: FreeBSD: src/sys/i386/i386/vm_machdep.c,v 1.167 2001/07/12 - * $FreeBSD$ + * from: FreeBSD: src/sys/i386/i386/vm_machdep.c,v 1.167 2001/07/12 */ +#include +__FBSDID("$FreeBSD$"); + #include "opt_pmap.h" #include #include -#include -#include #include #include #include #include +#include #include #include +#include #include +#include #include #include #include @@ -74,11 +77,10 @@ #include #include -#include #include #include -#include #include +#include #include #include #include @@ -94,7 +96,7 @@ static void sf_buf_init(void *arg); SYSINIT(sock_sf, SI_SUB_MBUF, SI_ORDER_ANY, sf_buf_init, NULL); /* - * Expanded sf_freelist head. Really an SLIST_HEAD() in disguise, with the + * Expanded sf_freelist head. Really an SLIST_HEAD() in disguise, with the * sf_freelist head with the sf_lock mutex. */ static struct { @@ -124,11 +126,13 @@ cpu_exit(struct thread *td) void cpu_thread_exit(struct thread *td) { + } void cpu_thread_clean(struct thread *td) { + } void @@ -146,16 +150,19 @@ cpu_thread_alloc(struct thread *td) void cpu_thread_free(struct thread *td) { + } - + void cpu_thread_swapin(struct thread *td) { + } void cpu_thread_swapout(struct thread *td) { + } void @@ -328,6 +335,7 @@ cpu_reset(void) 0, (cell_t)bspec }; + if ((chosen = OF_finddevice("/chosen")) != 0) { if (OF_getprop(chosen, "bootpath", bspec, sizeof(bspec)) == -1) bspec[0] = '\0'; @@ -392,7 +400,7 @@ sf_buf_init(void *arg) } /* - * Get an sf_buf from the freelist. Will block if none are available. + * Get an sf_buf from the freelist. Will block if none are available. */ struct sf_buf * sf_buf_alloc(struct vm_page *m, int flags) @@ -411,7 +419,7 @@ sf_buf_alloc(struct vm_page *m, int flag sf_buf_alloc_want--; /* - * If we got a signal, don't risk going back to sleep. + * If we got a signal, don't risk going back to sleep. */ if (error) break; From owner-svn-src-head@FreeBSD.ORG Sun May 10 20:41:53 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 295F21065673; Sun, 10 May 2009 20:41:53 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 17A0A8FC08; Sun, 10 May 2009 20:41:53 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4AKfqkn068446; Sun, 10 May 2009 20:41:52 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4AKfqRN068445; Sun, 10 May 2009 20:41:52 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200905102041.n4AKfqRN068445@svn.freebsd.org> From: Marius Strobl Date: Sun, 10 May 2009 20:41:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191981 - head/sys/sparc64/sparc64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 May 2009 20:41:54 -0000 Author: marius Date: Sun May 10 20:41:52 2009 New Revision: 191981 URL: http://svn.freebsd.org/changeset/base/191981 Log: Just like in cpu_halt(), use cpu_shutdown() rather than ofw_exit() directly in cpu_reset() in order to idle the APs before exiting the kernel and letting the BSP enter the firmware so that processes like init(8) which still might be running on an AP at that point don't cause a panic there when it crashes due to the fact it no longer can be supported by the kernel. MFC after: 3 days Modified: head/sys/sparc64/sparc64/vm_machdep.c Modified: head/sys/sparc64/sparc64/vm_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/vm_machdep.c Sun May 10 20:22:41 2009 (r191980) +++ head/sys/sparc64/sparc64/vm_machdep.c Sun May 10 20:41:52 2009 (r191981) @@ -342,7 +342,7 @@ cpu_reset(void) bspec[sizeof(bspec) - 1] = '\0'; } - ofw_exit(&args); + cpu_shutdown(&args); } /* From owner-svn-src-head@FreeBSD.ORG Mon May 11 01:30:32 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1CB4B106564A; Mon, 11 May 2009 01:30:32 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail04.syd.optusnet.com.au (mail04.syd.optusnet.com.au [211.29.132.185]) by mx1.freebsd.org (Postfix) with ESMTP id A93668FC08; Mon, 11 May 2009 01:30:31 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-106-172-38.carlnfd1.nsw.optusnet.com.au (c122-106-172-38.carlnfd1.nsw.optusnet.com.au [122.106.172.38]) by mail04.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n4B1UR6C004570 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 11 May 2009 11:30:28 +1000 Date: Mon, 11 May 2009 11:30:26 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Chagin Dmitry In-Reply-To: <20090509204559.GA4626@dchagin.static.corbina.ru> Message-ID: <20090511102521.W12504@delplex.bde.org> References: <200905071424.n47EOos1058369@svn.freebsd.org> <20090508111302.C1275@besplex.bde.org> <20090509204559.GA4626@dchagin.static.corbina.ru> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Bruce Evans Subject: Re: svn commit: r191883 - head/sys/compat/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 May 2009 01:30:32 -0000 On Sun, 10 May 2009, Chagin Dmitry wrote: > On Fri, May 08, 2009 at 11:45:16AM +1000, Bruce Evans wrote: >> On Thu, 7 May 2009, Dmitry Chagin wrote: >> >>> Log: >>> Linux exports HZ value to user space via AT_CLKTCK auxiliary vector entry, >>> which is available for Glibc as sysconf(_SC_CLK_TCK). If AT_CLKTCK entry is >>> not exported, Glibc uses 100. >> >> This cannot work for older applications/glibc's that have CLK_TCK hard-coded. > > yes, I know. Glibc versions prior to 2.2.1 uses hardcoded CLK_TCK value. >>> - >>> -#define CONVTCK(r) (r.tv_sec * CLK_TCK + r.tv_usec / (1000000 / CLK_TCK)) >>> +#define CONVTCK(r) (r.tv_sec * hz + r.tv_usec / (1000000 / hz)) >> >> hz has very little to do with statistics clock ticks. The frequency of the >> statistics clock in FreeBSD is given by stathz. stathz will normally only >> equal hz if the statistics clock is the same as the scheduling clock. >> stathz is a bogus value too since the clock most relevant for them is the >> cputicker and the statistics clock is only used to divide them up. >> > > Thank you! > >> Anyway, this patch is backwards. The bug was that the value exported to >> user space didn't match the value here. The value cannot be changed in > > hmm, r189362. hz exported to user space via AT_CLKTCK. Bug in r189362. Now larger. CLK_TCK = 100 should be exported to user space via AT_CLKTCK. >> either FreeBSD or Linux without breaking compatibility. It is even >> harder to change in emulators than in a full O/S distribution since the >> full distribution can more reasonably drop support for all old >> applications. A correct emulator would have to have an array of values >> for each "constant" sysconf() value with the arrays index by the O/S >> version and maybe the libc version being emulated :-(. > > I will try to make the hard-coded CLK_TCK support. It will depend > on value of compat.linux.osrelease (2.2 I guess). Er, it should be constant (= old CLK_TCK = 100). Old applications are unlikely to look at compat.linx.osrelease and change their behaviour depending on it, and anyway they cannot know what to do with an osrelease newer than themself. New applications won't care if AT_CLKTCK returns the old value of CLK_TCK, unless the value is increased significantly (say to 1 million) to give more accuracy. Linux itself does this, at least in 2.6.10: % ./arch/ia64/ia32/binfmt_elf32.c: % #undef CLOCKS_PER_SEC % #define CLOCKS_PER_SEC IA32_CLOCKS_PER_SEC % #define IA32_CLOCKS_PER_SEC 100 /* Cast in stone for IA32 Linux */ This ia32 value is used for Linux own emulation of compat32. It has to be cast in stone since previous mistakes cast it there. So does the native ia32 value, but that is not so well commented. The Linux native ia64 value might be variable because it doesn't have any mistakes to be compatible with. % ./fs/binfmt_elf.c: % NEW_AUX_ENT(AT_CLKTCK, CLOCKS_PER_SEC); This maps AT_CLKTCK to CLOCKS_PER_SEC. Related mistakes are responsible for mapping CLK_TCK to CLOCKS_PER_SEC. IIRC, POSIX.1-1988 narrowly escaped the bug of specifying CLK_TCK to be the same as CLOCKS_PER_SEC, It still has the bug of specifying CLK_TCK at all. This is partly fixed in POSIX.1-1990 by specifying CLK_TCK as obsolescent and saying that CLK_TCK may be #defined as (the variable) sysconf(_SC_CLK_TCK), and is fixed in POSIX.1-2001 by removing CLK_TCK. % ./include/asm-x86_64/param.h: % #ifdef __KERNEL__ % # define HZ 1000 /* Internal kernel timer frequency */ % # define USER_HZ 100 /* .. some user interfaces are in "ticks */ % #define CLOCKS_PER_SEC (USER_HZ) /* like times() */ % #endif Most arches distinguish between the kernel clock(s) and values returned to userland using HZ/USER_HZ like this, so that the latter can be kept constant. Apparently native x86_64 is too old to have not inherited the mistake. % ./include/asm-i386/param.h: % #ifdef __KERNEL__ % # define HZ 1000 /* Internal kernel timer frequency */ % # define USER_HZ 100 /* .. some user interfaces are in "ticks" */ % # define CLOCKS_PER_SEC (USER_HZ) /* like times() */ % #endif The mistake is oldest in i386. % ./include/asm-ia64/param.h: % #ifdef __KERNEL__ % # include /* mustn't include outside of #ifdef __KERNEL__ */ % # ifdef CONFIG_IA64_HP_SIM % /* % * Yeah, simulating stuff is slow, so let us catch some breath between % * timer interrupts... % */ % # define HZ 32 % # else % # define HZ 1024 % # endif % # define USER_HZ HZ % # define CLOCKS_PER_SEC HZ /* frequency at which times() counts */ % #else % /* % * Technically, this is wrong, but some old apps still refer to it. The proper way to % * get the HZ value is via sysconf(_SC_CLK_TCK). % */ % # define HZ 1024 % #endif ia64 (itanium?) is the main arch for which USER_HZ is the same as HZ. The only(?) others are m68knommu, alpha and h8300. According the the comment, broken apps have related problems for HZ. If linux-later-than-2.6.10 has fixed this, then it would have to have a new syscall for times() and for any other interface that uses "clock ticks" (mainly clock()), and the FreeBSD emulator would have to emulate these. Linux apparently doesn't have new interfaces, so emulators cannot have them and cannot fix the mistakes without making a larger mess. Bruce From owner-svn-src-head@FreeBSD.ORG Mon May 11 02:39:49 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6404D106574B; Mon, 11 May 2009 02:39:49 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5008F8FC0A; Mon, 11 May 2009 02:39:49 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4B2dnC0075287; Mon, 11 May 2009 02:39:49 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4B2dnSX075285; Mon, 11 May 2009 02:39:49 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <200905110239.n4B2dnSX075285@svn.freebsd.org> From: Weongyo Jeong Date: Mon, 11 May 2009 02:39:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191983 - in head/sys: dev/usb/wlan modules/usb/upgt X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 May 2009 02:39:50 -0000 Author: weongyo Date: Mon May 11 02:39:49 2009 New Revision: 191983 URL: http://svn.freebsd.org/changeset/base/191983 Log: ports upgt(4) driver for USB2. Added: head/sys/dev/usb/wlan/if_upgt.c (contents, props changed) head/sys/dev/usb/wlan/if_upgtvar.h (contents, props changed) head/sys/modules/usb/upgt/ head/sys/modules/usb/upgt/Makefile (contents, props changed) Added: head/sys/dev/usb/wlan/if_upgt.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/usb/wlan/if_upgt.c Mon May 11 02:39:49 2009 (r191983) @@ -0,0 +1,2404 @@ +/* $OpenBSD: if_upgt.c,v 1.35 2008/04/16 18:32:15 damien Exp $ */ +/* $FreeBSD$ */ + +/* + * Copyright (c) 2007 Marcus Glocker + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include "usbdevs.h" + +#include + +/* + * Driver for the USB PrismGT devices. + * + * For now just USB 2.0 devices with the GW3887 chipset are supported. + * The driver has been written based on the firmware version 2.13.1.0_LM87. + * + * TODO's: + * - MONITOR mode test. + * - Add HOSTAP mode. + * - Add IBSS mode. + * - Support the USB 1.0 devices (NET2280, ISL3880, ISL3886 chipsets). + * + * Parts of this driver has been influenced by reading the p54u driver + * written by Jean-Baptiste Note and + * Sebastien Bourdeauducq . + */ + +SYSCTL_NODE(_hw, OID_AUTO, upgt, CTLFLAG_RD, 0, + "USB PrismGT GW3887 driver parameters"); + +#ifdef UPGT_DEBUG +int upgt_debug = 0; +SYSCTL_INT(_hw_upgt, OID_AUTO, debug, CTLFLAG_RW, &upgt_debug, + 0, "control debugging printfs"); +TUNABLE_INT("hw.upgt.debug", &upgt_debug); +enum { + UPGT_DEBUG_XMIT = 0x00000001, /* basic xmit operation */ + UPGT_DEBUG_RECV = 0x00000002, /* basic recv operation */ + UPGT_DEBUG_RESET = 0x00000004, /* reset processing */ + UPGT_DEBUG_INTR = 0x00000008, /* INTR */ + UPGT_DEBUG_TX_PROC = 0x00000010, /* tx ISR proc */ + UPGT_DEBUG_RX_PROC = 0x00000020, /* rx ISR proc */ + UPGT_DEBUG_STATE = 0x00000040, /* 802.11 state transitions */ + UPGT_DEBUG_STAT = 0x00000080, /* statistic */ + UPGT_DEBUG_FW = 0x00000100, /* firmware */ + UPGT_DEBUG_ANY = 0xffffffff +}; +#define DPRINTF(sc, m, fmt, ...) do { \ + if (sc->sc_debug & (m)) \ + printf(fmt, __VA_ARGS__); \ +} while (0) +#else +#define DPRINTF(sc, m, fmt, ...) do { \ + (void) sc; \ +} while (0) +#endif + +/* + * Prototypes. + */ +static device_probe_t upgt_match; +static device_attach_t upgt_attach; +static device_detach_t upgt_detach; +static int upgt_alloc_tx(struct upgt_softc *); +static int upgt_alloc_rx(struct upgt_softc *); +static int upgt_device_reset(struct upgt_softc *); +static void upgt_bulk_tx(struct upgt_softc *, struct upgt_data *); +static int upgt_fw_verify(struct upgt_softc *); +static int upgt_mem_init(struct upgt_softc *); +static int upgt_fw_load(struct upgt_softc *); +static int upgt_fw_copy(const uint8_t *, char *, int); +static uint32_t upgt_crc32_le(const void *, size_t); +static struct mbuf * + upgt_rxeof(struct usb2_xfer *, struct upgt_data *, int *); +static struct mbuf * + upgt_rx(struct upgt_softc *, uint8_t *, int, int *); +static void upgt_txeof(struct usb2_xfer *, struct upgt_data *); +static int upgt_eeprom_read(struct upgt_softc *); +static int upgt_eeprom_parse(struct upgt_softc *); +static void upgt_eeprom_parse_hwrx(struct upgt_softc *, uint8_t *); +static void upgt_eeprom_parse_freq3(struct upgt_softc *, uint8_t *, int); +static void upgt_eeprom_parse_freq4(struct upgt_softc *, uint8_t *, int); +static void upgt_eeprom_parse_freq6(struct upgt_softc *, uint8_t *, int); +static uint32_t upgt_chksum_le(const uint32_t *, size_t); +static void upgt_tx_done(struct upgt_softc *, uint8_t *); +static void upgt_init(void *); +static void upgt_init_locked(struct upgt_softc *); +static int upgt_ioctl(struct ifnet *, u_long, caddr_t); +static void upgt_start(struct ifnet *); +static int upgt_raw_xmit(struct ieee80211_node *, struct mbuf *, + const struct ieee80211_bpf_params *); +static void upgt_scan_start(struct ieee80211com *); +static void upgt_scan_end(struct ieee80211com *); +static void upgt_set_channel(struct ieee80211com *); +static struct ieee80211vap *upgt_vap_create(struct ieee80211com *, + const char name[IFNAMSIZ], int unit, int opmode, + int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t mac[IEEE80211_ADDR_LEN]); +static void upgt_vap_delete(struct ieee80211vap *); +static void upgt_update_mcast(struct ifnet *); +static uint8_t upgt_rx_rate(struct upgt_softc *, const int); +static void upgt_set_multi(void *); +static void upgt_stop(struct upgt_softc *); +static void upgt_setup_rates(struct ieee80211vap *, struct ieee80211com *); +static int upgt_set_macfilter(struct upgt_softc *, uint8_t); +static int upgt_newstate(struct ieee80211vap *, enum ieee80211_state, int); +static void upgt_set_chan(struct upgt_softc *, struct ieee80211_channel *); +static void upgt_set_led(struct upgt_softc *, int); +static void upgt_set_led_blink(void *); +static void upgt_get_stats(struct upgt_softc *); +static void upgt_mem_free(struct upgt_softc *, uint32_t); +static uint32_t upgt_mem_alloc(struct upgt_softc *); +static void upgt_free_tx(struct upgt_softc *); +static void upgt_free_rx(struct upgt_softc *); +static void upgt_watchdog(void *); +static void upgt_abort_xfers(struct upgt_softc *); +static void upgt_abort_xfers_locked(struct upgt_softc *); +static void upgt_sysctl_node(struct upgt_softc *); +static struct upgt_data * + upgt_getbuf(struct upgt_softc *); +static struct upgt_data * + upgt_gettxbuf(struct upgt_softc *); +static int upgt_tx_start(struct upgt_softc *, struct mbuf *, + struct ieee80211_node *, struct upgt_data *); + +static const char *upgt_fwname = "upgt-gw3887"; + +static const struct usb2_device_id upgt_devs_2[] = { +#define UPGT_DEV(v,p) { USB_VP(USB_VENDOR_##v, USB_PRODUCT_##v##_##p) } + /* version 2 devices */ + UPGT_DEV(ACCTON, PRISM_GT), + UPGT_DEV(BELKIN, F5D7050), + UPGT_DEV(CISCOLINKSYS, WUSB54AG), + UPGT_DEV(CONCEPTRONIC, PRISM_GT), + UPGT_DEV(DELL, PRISM_GT_1), + UPGT_DEV(DELL, PRISM_GT_2), + UPGT_DEV(FSC, E5400), + UPGT_DEV(GLOBESPAN, PRISM_GT_1), + UPGT_DEV(GLOBESPAN, PRISM_GT_2), + UPGT_DEV(INTERSIL, PRISM_GT), + UPGT_DEV(SMC, 2862WG), + UPGT_DEV(WISTRONNEWEB, UR045G), + UPGT_DEV(XYRATEX, PRISM_GT_1), + UPGT_DEV(XYRATEX, PRISM_GT_2), + UPGT_DEV(ZCOM, XG703A), + UPGT_DEV(ZCOM, XM142) +}; + +static usb2_callback_t upgt_bulk_rx_callback; +static usb2_callback_t upgt_bulk_tx_callback; + +static const struct usb2_config upgt_config[UPGT_N_XFERS] = { + [UPGT_BULK_TX] = { + .type = UE_BULK, + .endpoint = UE_ADDR_ANY, + .direction = UE_DIR_OUT, + .bufsize = MCLBYTES, + .flags = { + .ext_buffer = 1, + .force_short_xfer = 1, + .pipe_bof = 1 + }, + .callback = upgt_bulk_tx_callback, + .timeout = UPGT_USB_TIMEOUT, /* ms */ + }, + [UPGT_BULK_RX] = { + .type = UE_BULK, + .endpoint = UE_ADDR_ANY, + .direction = UE_DIR_IN, + .bufsize = MCLBYTES, + .flags = { + .ext_buffer = 1, + .pipe_bof = 1, + .short_xfer_ok = 1 + }, + .callback = upgt_bulk_rx_callback, + }, +}; + +static int +upgt_match(device_t dev) +{ + struct usb2_attach_arg *uaa = device_get_ivars(dev); + + if (uaa->usb2_mode != USB_MODE_HOST) + return (ENXIO); + if (uaa->info.bConfigIndex != UPGT_CONFIG_INDEX) + return (ENXIO); + if (uaa->info.bIfaceIndex != UPGT_IFACE_INDEX) + return (ENXIO); + + return (usb2_lookup_id_by_uaa(upgt_devs_2, sizeof(upgt_devs_2), uaa)); +} + +static int +upgt_attach(device_t dev) +{ + int error; + struct ieee80211com *ic; + struct ifnet *ifp; + struct upgt_softc *sc = device_get_softc(dev); + struct usb2_attach_arg *uaa = device_get_ivars(dev); + uint8_t bands, iface_index = UPGT_IFACE_INDEX; + + sc->sc_dev = dev; + sc->sc_udev = uaa->device; +#ifdef UPGT_DEBUG + sc->sc_debug = upgt_debug; +#endif + + mtx_init(&sc->sc_mtx, device_get_nameunit(sc->sc_dev), MTX_NETWORK_LOCK, + MTX_DEF); + callout_init(&sc->sc_led_ch, 0); + callout_init(&sc->sc_watchdog_ch, 0); + + /* Allocate TX and RX xfers. */ + error = upgt_alloc_tx(sc); + if (error) + goto fail1; + error = upgt_alloc_rx(sc); + if (error) + goto fail2; + + error = usb2_transfer_setup(uaa->device, &iface_index, sc->sc_xfer, + upgt_config, UPGT_N_XFERS, sc, &sc->sc_mtx); + if (error) { + device_printf(dev, "could not allocate USB transfers, " + "err=%s\n", usb2_errstr(error)); + goto fail3; + } + + ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211); + if (ifp == NULL) { + device_printf(dev, "can not if_alloc()\n"); + goto fail4; + } + + /* Initialize the device. */ + error = upgt_device_reset(sc); + if (error) + goto fail5; + /* Verify the firmware. */ + error = upgt_fw_verify(sc); + if (error) + goto fail5; + /* Calculate device memory space. */ + if (sc->sc_memaddr_frame_start == 0 || sc->sc_memaddr_frame_end == 0) { + device_printf(dev, + "could not find memory space addresses on FW!\n"); + error = EIO; + goto fail5; + } + sc->sc_memaddr_frame_end -= UPGT_MEMSIZE_RX + 1; + sc->sc_memaddr_rx_start = sc->sc_memaddr_frame_end + 1; + + DPRINTF(sc, UPGT_DEBUG_FW, "memory address frame start=0x%08x\n", + sc->sc_memaddr_frame_start); + DPRINTF(sc, UPGT_DEBUG_FW, "memory address frame end=0x%08x\n", + sc->sc_memaddr_frame_end); + DPRINTF(sc, UPGT_DEBUG_FW, "memory address rx start=0x%08x\n", + sc->sc_memaddr_rx_start); + + upgt_mem_init(sc); + + /* Load the firmware. */ + error = upgt_fw_load(sc); + if (error) + goto fail5; + + /* Read the whole EEPROM content and parse it. */ + error = upgt_eeprom_read(sc); + if (error) + goto fail5; + error = upgt_eeprom_parse(sc); + if (error) + goto fail5; + + /* all works related with the device have done here. */ + upgt_abort_xfers(sc); + + /* Setup the 802.11 device. */ + ifp->if_softc = sc; + if_initname(ifp, "upgt", device_get_unit(sc->sc_dev)); + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + ifp->if_init = upgt_init; + ifp->if_ioctl = upgt_ioctl; + ifp->if_start = upgt_start; + IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); + IFQ_SET_READY(&ifp->if_snd); + + ic = ifp->if_l2com; + ic->ic_ifp = ifp; + ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */ + ic->ic_opmode = IEEE80211_M_STA; + /* set device capabilities */ + ic->ic_caps = + IEEE80211_C_STA /* station mode */ + | IEEE80211_C_MONITOR /* monitor mode */ + | IEEE80211_C_SHPREAMBLE /* short preamble supported */ + | IEEE80211_C_SHSLOT /* short slot time supported */ + | IEEE80211_C_BGSCAN /* capable of bg scanning */ + | IEEE80211_C_WPA /* 802.11i */ + ; + + bands = 0; + setbit(&bands, IEEE80211_MODE_11B); + setbit(&bands, IEEE80211_MODE_11G); + ieee80211_init_channels(ic, NULL, &bands); + + ieee80211_ifattach(ic, sc->sc_myaddr); + ic->ic_raw_xmit = upgt_raw_xmit; + ic->ic_scan_start = upgt_scan_start; + ic->ic_scan_end = upgt_scan_end; + ic->ic_set_channel = upgt_set_channel; + + ic->ic_vap_create = upgt_vap_create; + ic->ic_vap_delete = upgt_vap_delete; + ic->ic_update_mcast = upgt_update_mcast; + + bpfattach(ifp, DLT_IEEE802_11_RADIO, + sizeof(struct ieee80211_frame) + sizeof(sc->sc_txtap)); + sc->sc_rxtap_len = sizeof(sc->sc_rxtap); + sc->sc_rxtap.wr_ihdr.it_len = htole16(sc->sc_rxtap_len); + sc->sc_rxtap.wr_ihdr.it_present = htole32(UPGT_RX_RADIOTAP_PRESENT); + sc->sc_txtap_len = sizeof(sc->sc_txtap); + sc->sc_txtap.wt_ihdr.it_len = htole16(sc->sc_txtap_len); + sc->sc_txtap.wt_ihdr.it_present = htole32(UPGT_TX_RADIOTAP_PRESENT); + + upgt_sysctl_node(sc); + + if (bootverbose) + ieee80211_announce(ic); + + return (0); + +fail5: if_free(ifp); +fail4: usb2_transfer_unsetup(sc->sc_xfer, UPGT_N_XFERS); +fail3: upgt_free_rx(sc); +fail2: upgt_free_tx(sc); +fail1: mtx_destroy(&sc->sc_mtx); + + return (error); +} + +static void +upgt_txeof(struct usb2_xfer *xfer, struct upgt_data *data) +{ + struct upgt_softc *sc = xfer->priv_sc; + struct ifnet *ifp = sc->sc_ifp; + struct mbuf *m; + + UPGT_ASSERT_LOCKED(sc); + + /* + * Do any tx complete callback. Note this must be done before releasing + * the node reference. + */ + if (data->m) { + m = data->m; + if (m->m_flags & M_TXCB) { + /* XXX status? */ + ieee80211_process_callback(data->ni, m, 0); + } + m_freem(m); + data->m = NULL; + } + if (data->ni) { + ieee80211_free_node(data->ni); + data->ni = NULL; + } + ifp->if_opackets++; +} + +static void +upgt_get_stats(struct upgt_softc *sc) +{ + struct upgt_data *data_cmd; + struct upgt_lmac_mem *mem; + struct upgt_lmac_stats *stats; + + data_cmd = upgt_getbuf(sc); + if (data_cmd == NULL) { + device_printf(sc->sc_dev, "%s: out of buffer.\n", __func__); + return; + } + + /* + * Transmit the URB containing the CMD data. + */ + bzero(data_cmd->buf, MCLBYTES); + + mem = (struct upgt_lmac_mem *)data_cmd->buf; + mem->addr = htole32(sc->sc_memaddr_frame_start + + UPGT_MEMSIZE_FRAME_HEAD); + + stats = (struct upgt_lmac_stats *)(mem + 1); + + stats->header1.flags = 0; + stats->header1.type = UPGT_H1_TYPE_CTRL; + stats->header1.len = htole16( + sizeof(struct upgt_lmac_stats) - sizeof(struct upgt_lmac_header)); + + stats->header2.reqid = htole32(sc->sc_memaddr_frame_start); + stats->header2.type = htole16(UPGT_H2_TYPE_STATS); + stats->header2.flags = 0; + + data_cmd->buflen = sizeof(*mem) + sizeof(*stats); + + mem->chksum = upgt_chksum_le((uint32_t *)stats, + data_cmd->buflen - sizeof(*mem)); + + upgt_bulk_tx(sc, data_cmd); +} + +static int +upgt_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) +{ + struct upgt_softc *sc = ifp->if_softc; + struct ieee80211com *ic = ifp->if_l2com; + struct ifreq *ifr = (struct ifreq *) data; + int error = 0, startall = 0; + + switch (cmd) { + case SIOCSIFFLAGS: + mtx_lock(&Giant); + if (ifp->if_flags & IFF_UP) { + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + if ((ifp->if_flags ^ sc->sc_if_flags) & + (IFF_ALLMULTI | IFF_PROMISC)) + upgt_set_multi(sc); + } else { + upgt_init(sc); + startall = 1; + } + } else { + if (ifp->if_drv_flags & IFF_DRV_RUNNING) + upgt_stop(sc); + } + sc->sc_if_flags = ifp->if_flags; + if (startall) + ieee80211_start_all(ic); + mtx_unlock(&Giant); + break; + case SIOCGIFMEDIA: + error = ifmedia_ioctl(ifp, ifr, &ic->ic_media, cmd); + break; + case SIOCGIFADDR: + error = ether_ioctl(ifp, cmd, data); + break; + default: + error = EINVAL; + break; + } + return error; +} + +static void +upgt_stop_locked(struct upgt_softc *sc) +{ + struct ifnet *ifp = sc->sc_ifp; + + UPGT_ASSERT_LOCKED(sc); + + if (ifp->if_drv_flags & IFF_DRV_RUNNING) + upgt_set_macfilter(sc, IEEE80211_S_INIT); + upgt_abort_xfers_locked(sc); +} + +static void +upgt_stop(struct upgt_softc *sc) +{ + struct ifnet *ifp = sc->sc_ifp; + + UPGT_LOCK(sc); + upgt_stop_locked(sc); + UPGT_UNLOCK(sc); + + /* device down */ + sc->sc_tx_timer = 0; + ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); + sc->sc_flags &= ~UPGT_FLAG_INITDONE; +} + +static void +upgt_set_led(struct upgt_softc *sc, int action) +{ + struct upgt_data *data_cmd; + struct upgt_lmac_mem *mem; + struct upgt_lmac_led *led; + + data_cmd = upgt_getbuf(sc); + if (data_cmd == NULL) { + device_printf(sc->sc_dev, "%s: out of buffers.\n", __func__); + return; + } + + /* + * Transmit the URB containing the CMD data. + */ + bzero(data_cmd->buf, MCLBYTES); + + mem = (struct upgt_lmac_mem *)data_cmd->buf; + mem->addr = htole32(sc->sc_memaddr_frame_start + + UPGT_MEMSIZE_FRAME_HEAD); + + led = (struct upgt_lmac_led *)(mem + 1); + + led->header1.flags = UPGT_H1_FLAGS_TX_NO_CALLBACK; + led->header1.type = UPGT_H1_TYPE_CTRL; + led->header1.len = htole16( + sizeof(struct upgt_lmac_led) - + sizeof(struct upgt_lmac_header)); + + led->header2.reqid = htole32(sc->sc_memaddr_frame_start); + led->header2.type = htole16(UPGT_H2_TYPE_LED); + led->header2.flags = 0; + + switch (action) { + case UPGT_LED_OFF: + led->mode = htole16(UPGT_LED_MODE_SET); + led->action_fix = 0; + led->action_tmp = htole16(UPGT_LED_ACTION_OFF); + led->action_tmp_dur = 0; + break; + case UPGT_LED_ON: + led->mode = htole16(UPGT_LED_MODE_SET); + led->action_fix = 0; + led->action_tmp = htole16(UPGT_LED_ACTION_ON); + led->action_tmp_dur = 0; + break; + case UPGT_LED_BLINK: + if (sc->sc_state != IEEE80211_S_RUN) { + STAILQ_INSERT_TAIL(&sc->sc_tx_inactive, data_cmd, next); + return; + } + if (sc->sc_led_blink) { + /* previous blink was not finished */ + STAILQ_INSERT_TAIL(&sc->sc_tx_inactive, data_cmd, next); + return; + } + led->mode = htole16(UPGT_LED_MODE_SET); + led->action_fix = htole16(UPGT_LED_ACTION_OFF); + led->action_tmp = htole16(UPGT_LED_ACTION_ON); + led->action_tmp_dur = htole16(UPGT_LED_ACTION_TMP_DUR); + /* lock blink */ + sc->sc_led_blink = 1; + callout_reset(&sc->sc_led_ch, hz, upgt_set_led_blink, sc); + break; + default: + STAILQ_INSERT_TAIL(&sc->sc_tx_inactive, data_cmd, next); + return; + } + + data_cmd->buflen = sizeof(*mem) + sizeof(*led); + + mem->chksum = upgt_chksum_le((uint32_t *)led, + data_cmd->buflen - sizeof(*mem)); + + upgt_bulk_tx(sc, data_cmd); +} + +static void +upgt_set_led_blink(void *arg) +{ + struct upgt_softc *sc = arg; + + /* blink finished, we are ready for a next one */ + sc->sc_led_blink = 0; +} + +static void +upgt_init(void *priv) +{ + struct upgt_softc *sc = priv; + struct ifnet *ifp = sc->sc_ifp; + struct ieee80211com *ic = ifp->if_l2com; + + UPGT_LOCK(sc); + upgt_init_locked(sc); + UPGT_UNLOCK(sc); + + if (ifp->if_drv_flags & IFF_DRV_RUNNING) + ieee80211_start_all(ic); /* start all vap's */ +} + +static void +upgt_init_locked(struct upgt_softc *sc) +{ + struct ifnet *ifp = sc->sc_ifp; + + UPGT_ASSERT_LOCKED(sc); + + if (ifp->if_drv_flags & IFF_DRV_RUNNING) + upgt_stop_locked(sc); + + usb2_transfer_start(sc->sc_xfer[UPGT_BULK_RX]); + + (void)upgt_set_macfilter(sc, IEEE80211_S_SCAN); + + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + ifp->if_drv_flags |= IFF_DRV_RUNNING; + sc->sc_flags |= UPGT_FLAG_INITDONE; + + callout_reset(&sc->sc_watchdog_ch, hz, upgt_watchdog, sc); +} + +static int +upgt_set_macfilter(struct upgt_softc *sc, uint8_t state) +{ + struct ifnet *ifp = sc->sc_ifp; + struct ieee80211com *ic = ifp->if_l2com; + struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); + struct ieee80211_node *ni = vap->iv_bss; + struct upgt_data *data_cmd; + struct upgt_lmac_mem *mem; + struct upgt_lmac_filter *filter; + uint8_t broadcast[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; + + UPGT_ASSERT_LOCKED(sc); + + data_cmd = upgt_getbuf(sc); + if (data_cmd == NULL) { + device_printf(sc->sc_dev, "out of TX buffers.\n"); + return (ENOBUFS); + } + + /* + * Transmit the URB containing the CMD data. + */ + bzero(data_cmd->buf, MCLBYTES); + + mem = (struct upgt_lmac_mem *)data_cmd->buf; + mem->addr = htole32(sc->sc_memaddr_frame_start + + UPGT_MEMSIZE_FRAME_HEAD); + + filter = (struct upgt_lmac_filter *)(mem + 1); + + filter->header1.flags = UPGT_H1_FLAGS_TX_NO_CALLBACK; + filter->header1.type = UPGT_H1_TYPE_CTRL; + filter->header1.len = htole16( + sizeof(struct upgt_lmac_filter) - + sizeof(struct upgt_lmac_header)); + + filter->header2.reqid = htole32(sc->sc_memaddr_frame_start); + filter->header2.type = htole16(UPGT_H2_TYPE_MACFILTER); + filter->header2.flags = 0; + + switch (state) { + case IEEE80211_S_INIT: + DPRINTF(sc, UPGT_DEBUG_STATE, "%s: set MAC filter to INIT\n", + __func__); + filter->type = htole16(UPGT_FILTER_TYPE_RESET); + break; + case IEEE80211_S_SCAN: + DPRINTF(sc, UPGT_DEBUG_STATE, + "set MAC filter to SCAN (bssid %s)\n", + ether_sprintf(broadcast)); + filter->type = htole16(UPGT_FILTER_TYPE_NONE); + IEEE80211_ADDR_COPY(filter->dst, sc->sc_myaddr); + IEEE80211_ADDR_COPY(filter->src, broadcast); + filter->unknown1 = htole16(UPGT_FILTER_UNKNOWN1); + filter->rxaddr = htole32(sc->sc_memaddr_rx_start); + filter->unknown2 = htole16(UPGT_FILTER_UNKNOWN2); + filter->rxhw = htole32(sc->sc_eeprom_hwrx); + filter->unknown3 = htole16(UPGT_FILTER_UNKNOWN3); + break; + case IEEE80211_S_RUN: + /* XXX monitor mode isn't tested yet. */ + if (vap->iv_opmode == IEEE80211_M_MONITOR) { + filter->type = htole16(UPGT_FILTER_TYPE_MONITOR); + IEEE80211_ADDR_COPY(filter->dst, sc->sc_myaddr); + IEEE80211_ADDR_COPY(filter->src, ni->ni_bssid); + filter->unknown1 = htole16(UPGT_FILTER_MONITOR_UNKNOWN1); + filter->rxaddr = htole32(sc->sc_memaddr_rx_start); + filter->unknown2 = htole16(UPGT_FILTER_MONITOR_UNKNOWN2); + filter->rxhw = htole32(sc->sc_eeprom_hwrx); + filter->unknown3 = htole16(UPGT_FILTER_MONITOR_UNKNOWN3); + } else { + DPRINTF(sc, UPGT_DEBUG_STATE, + "set MAC filter to RUN (bssid %s)\n", + ether_sprintf(ni->ni_bssid)); + filter->type = htole16(UPGT_FILTER_TYPE_STA); + IEEE80211_ADDR_COPY(filter->dst, sc->sc_myaddr); + IEEE80211_ADDR_COPY(filter->src, ni->ni_bssid); + filter->unknown1 = htole16(UPGT_FILTER_UNKNOWN1); + filter->rxaddr = htole32(sc->sc_memaddr_rx_start); + filter->unknown2 = htole16(UPGT_FILTER_UNKNOWN2); + filter->rxhw = htole32(sc->sc_eeprom_hwrx); + filter->unknown3 = htole16(UPGT_FILTER_UNKNOWN3); + } + break; + default: + device_printf(sc->sc_dev, + "MAC filter does not know that state!\n"); + break; + } + + data_cmd->buflen = sizeof(*mem) + sizeof(*filter); + + mem->chksum = upgt_chksum_le((uint32_t *)filter, + data_cmd->buflen - sizeof(*mem)); + + upgt_bulk_tx(sc, data_cmd); + + return (0); +} + +static void +upgt_setup_rates(struct ieee80211vap *vap, struct ieee80211com *ic) +{ + struct ifnet *ifp = ic->ic_ifp; + struct upgt_softc *sc = ifp->if_softc; + const struct ieee80211_txparam *tp; + + /* + * 0x01 = OFMD6 0x10 = DS1 + * 0x04 = OFDM9 0x11 = DS2 + * 0x06 = OFDM12 0x12 = DS5 + * 0x07 = OFDM18 0x13 = DS11 + * 0x08 = OFDM24 + * 0x09 = OFDM36 + * 0x0a = OFDM48 + * 0x0b = OFDM54 + */ + const uint8_t rateset_auto_11b[] = + { 0x13, 0x13, 0x12, 0x11, 0x11, 0x10, 0x10, 0x10 }; + const uint8_t rateset_auto_11g[] = + { 0x0b, 0x0a, 0x09, 0x08, 0x07, 0x06, 0x04, 0x01 }; + const uint8_t rateset_fix_11bg[] = + { 0x10, 0x11, 0x12, 0x13, 0x01, 0x04, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b }; + + tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_curchan)]; + + /* XXX */ + if (tp->ucastrate == IEEE80211_FIXED_RATE_NONE) { + /* + * Automatic rate control is done by the device. + * We just pass the rateset from which the device + * will pickup a rate. + */ + if (ic->ic_curmode == IEEE80211_MODE_11B) + bcopy(rateset_auto_11b, sc->sc_cur_rateset, + sizeof(sc->sc_cur_rateset)); + if (ic->ic_curmode == IEEE80211_MODE_11G || + ic->ic_curmode == IEEE80211_MODE_AUTO) + bcopy(rateset_auto_11g, sc->sc_cur_rateset, + sizeof(sc->sc_cur_rateset)); + } else { + /* set a fixed rate */ + memset(sc->sc_cur_rateset, rateset_fix_11bg[tp->ucastrate], + sizeof(sc->sc_cur_rateset)); + } +} + +static void +upgt_set_multi(void *arg) +{ + struct upgt_softc *sc = arg; + struct ifnet *ifp = sc->sc_ifp; + + if (!(ifp->if_flags & IFF_UP)) + return; + + /* + * XXX don't know how to set a device. Lack of docs. Just try to set + * IFF_ALLMULTI flag here. + */ + IF_ADDR_LOCK(ifp); + ifp->if_flags |= IFF_ALLMULTI; + IF_ADDR_UNLOCK(ifp); +} + +static void +upgt_start(struct ifnet *ifp) +{ + struct upgt_softc *sc = ifp->if_softc; + struct upgt_data *data_tx; + struct ieee80211_node *ni; + struct mbuf *m; + + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + return; + + UPGT_LOCK(sc); + for (;;) { + IFQ_DRV_DEQUEUE(&ifp->if_snd, m); + if (m == NULL) + break; + + data_tx = upgt_gettxbuf(sc); + if (data_tx == NULL) { + IFQ_DRV_PREPEND(&ifp->if_snd, m); + break; + } + + ni = (struct ieee80211_node *)m->m_pkthdr.rcvif; + m->m_pkthdr.rcvif = NULL; + + if (upgt_tx_start(sc, m, ni, data_tx) != 0) { + STAILQ_INSERT_HEAD(&sc->sc_tx_inactive, data_tx, next); + UPGT_STAT_INC(sc, st_tx_inactive); + ieee80211_free_node(ni); + ifp->if_oerrors++; + continue; + } + sc->sc_tx_timer = 5; + } + UPGT_UNLOCK(sc); +} + +static int +upgt_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, + const struct ieee80211_bpf_params *params) +{ + struct ieee80211com *ic = ni->ni_ic; + struct ifnet *ifp = ic->ic_ifp; + struct upgt_softc *sc = ifp->if_softc; + struct upgt_data *data_tx = NULL; + + /* prevent management frames from being sent if we're not ready */ + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { + m_freem(m); + ieee80211_free_node(ni); + return ENETDOWN; + } + + UPGT_LOCK(sc); + data_tx = upgt_gettxbuf(sc); + if (data_tx == NULL) { + ieee80211_free_node(ni); + m_freem(m); + UPGT_UNLOCK(sc); + return (ENOBUFS); + } + + if (upgt_tx_start(sc, m, ni, data_tx) != 0) { + STAILQ_INSERT_HEAD(&sc->sc_tx_inactive, data_tx, next); + UPGT_STAT_INC(sc, st_tx_inactive); + ieee80211_free_node(ni); + ifp->if_oerrors++; + UPGT_UNLOCK(sc); + return (EIO); + } + UPGT_UNLOCK(sc); + + sc->sc_tx_timer = 5; + return (0); +} + +static void +upgt_watchdog(void *arg) +{ + struct upgt_softc *sc = arg; + struct ifnet *ifp = sc->sc_ifp; + + if (sc->sc_tx_timer > 0) { + if (--sc->sc_tx_timer == 0) { + device_printf(sc->sc_dev, "watchdog timeout\n"); + /* upgt_init(ifp); XXX needs a process context ? */ + ifp->if_oerrors++; + return; + } + callout_reset(&sc->sc_watchdog_ch, hz, upgt_watchdog, sc); + } +} + +static uint32_t +upgt_mem_alloc(struct upgt_softc *sc) +{ + int i; + + for (i = 0; i < sc->sc_memory.pages; i++) { + if (sc->sc_memory.page[i].used == 0) { + sc->sc_memory.page[i].used = 1; + return (sc->sc_memory.page[i].addr); + } + } + + return (0); +} + +static void +upgt_scan_start(struct ieee80211com *ic) +{ + /* do nothing. */ +} + +static void +upgt_scan_end(struct ieee80211com *ic) +{ + /* do nothing. */ +} + +static void +upgt_set_channel(struct ieee80211com *ic) +{ + struct upgt_softc *sc = ic->ic_ifp->if_softc; + + UPGT_LOCK(sc); + upgt_set_chan(sc, ic->ic_curchan); + UPGT_UNLOCK(sc); +} + +static void +upgt_set_chan(struct upgt_softc *sc, struct ieee80211_channel *c) +{ + struct ifnet *ifp = sc->sc_ifp; + struct ieee80211com *ic = ifp->if_l2com; + struct upgt_data *data_cmd; + struct upgt_lmac_mem *mem; + struct upgt_lmac_channel *chan; + int channel; + + UPGT_ASSERT_LOCKED(sc); + + channel = ieee80211_chan2ieee(ic, c); + if (channel == 0 || channel == IEEE80211_CHAN_ANY) { + /* XXX should NEVER happen */ + device_printf(sc->sc_dev, + "%s: invalid channel %x\n", __func__, channel); + return; + } + + DPRINTF(sc, UPGT_DEBUG_STATE, "%s: channel %d\n", __func__, channel); + + data_cmd = upgt_getbuf(sc); + if (data_cmd == NULL) { + device_printf(sc->sc_dev, "%s: out of buffers.\n", __func__); + return; + } + /* + * Transmit the URB containing the CMD data. + */ + bzero(data_cmd->buf, MCLBYTES); + + mem = (struct upgt_lmac_mem *)data_cmd->buf; + mem->addr = htole32(sc->sc_memaddr_frame_start + + UPGT_MEMSIZE_FRAME_HEAD); + + chan = (struct upgt_lmac_channel *)(mem + 1); + + chan->header1.flags = UPGT_H1_FLAGS_TX_NO_CALLBACK; + chan->header1.type = UPGT_H1_TYPE_CTRL; + chan->header1.len = htole16( + sizeof(struct upgt_lmac_channel) - sizeof(struct upgt_lmac_header)); + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Mon May 11 04:18:59 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 983B01065694; Mon, 11 May 2009 04:18:59 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8444A8FC14; Mon, 11 May 2009 04:18:59 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4B4IxU3077488; Mon, 11 May 2009 04:18:59 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4B4IxPC077484; Mon, 11 May 2009 04:18:59 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905110418.n4B4IxPC077484@svn.freebsd.org> From: Kip Macy Date: Mon, 11 May 2009 04:18:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191984 - in head/sys: cddl/contrib/opensolaris/uts/common/rpc modules/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 May 2009 04:19:00 -0000 Author: kmacy Date: Mon May 11 04:18:58 2009 New Revision: 191984 URL: http://svn.freebsd.org/changeset/base/191984 Log: rename xdr support files to avoid conflicts when linking in to the kernel Added: head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr.c (props changed) - copied unchanged from r191983, head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.c head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr_array.c (props changed) - copied unchanged from r191983, head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_array.c head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr_mem.c (props changed) - copied unchanged from r191983, head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_mem.c Deleted: head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.c head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_array.c head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_mem.c Modified: head/sys/modules/zfs/Makefile Copied: head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr.c (from r191983, head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr.c Mon May 11 04:18:58 2009 (r191984, copy of r191983, head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.c) @@ -0,0 +1,621 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * Portions of this source code were derived from Berkeley 4.3 BSD + * under license from the Regents of the University of California. + */ + +/* + * xdr.c, generic XDR routines implementation. + * These are the "generic" xdr routines used to serialize and de-serialize + * most common data items. See xdr.h for more info on the interface to + * xdr. + */ + +#include +#include +#include +#include + +#include +#include + +#pragma weak xdr_int32_t = xdr_int +#pragma weak xdr_uint32_t = xdr_u_int +#pragma weak xdr_int64_t = xdr_longlong_t +#pragma weak xdr_uint64_t = xdr_u_longlong_t + +#if defined(sun) +#if !defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN) +#error "Exactly one of _BIG_ENDIAN or _LITTLE_ENDIAN must be defined" +#elif defined(_BIG_ENDIAN) && defined(_LITTLE_ENDIAN) +#error "Only one of _BIG_ENDIAN or _LITTLE_ENDIAN may be defined" +#endif +#endif + +/* + * constants specific to the xdr "protocol" + */ +#define XDR_FALSE ((int32_t)0) +#define XDR_TRUE ((int32_t)1) +#define LASTUNSIGNED ((uint_t)0-1) + +/* + * for unit alignment + */ +static char xdr_zero[BYTES_PER_XDR_UNIT] = { 0, 0, 0, 0 }; + +/* + * Free a data structure using XDR + * Not a filter, but a convenient utility nonetheless + */ +void +xdr_free(xdrproc_t proc, char *objp) +{ + XDR x; + + x.x_op = XDR_FREE; + (*proc)(&x, objp); +} + +/* + * XDR nothing + */ +bool_t +xdr_void(void) +{ + return (TRUE); +} + +/* + * XDR integers + * + * PSARC 2003/523 Contract Private Interface + * xdr_int + * Changes must be reviewed by Solaris File Sharing + * Changes must be communicated to contract-2003-523@sun.com + */ +bool_t +xdr_int(XDR *xdrs, int *ip) +{ + if (xdrs->x_op == XDR_ENCODE) + return (XDR_PUTINT32(xdrs, ip)); + + if (xdrs->x_op == XDR_DECODE) + return (XDR_GETINT32(xdrs, ip)); + + if (xdrs->x_op == XDR_FREE) + return (TRUE); + + return (FALSE); +} + +/* + * XDR unsigned integers + * + * PSARC 2003/523 Contract Private Interface + * xdr_u_int + * Changes must be reviewed by Solaris File Sharing + * Changes must be communicated to contract-2003-523@sun.com + */ +bool_t +xdr_u_int(XDR *xdrs, uint_t *up) +{ + if (xdrs->x_op == XDR_ENCODE) + return (XDR_PUTINT32(xdrs, (int32_t *)up)); + + if (xdrs->x_op == XDR_DECODE) + return (XDR_GETINT32(xdrs, (int32_t *)up)); + + if (xdrs->x_op == XDR_FREE) + return (TRUE); + + return (FALSE); +} + + +#if defined(_ILP32) +/* + * xdr_long and xdr_u_long for binary compatability on ILP32 kernels. + * + * No prototypes since new code should not be using these interfaces. + */ +bool_t +xdr_long(XDR *xdrs, long *ip) +{ + return (xdr_int(xdrs, (int *)ip)); +} + +bool_t +xdr_u_long(XDR *xdrs, unsigned long *up) +{ + return (xdr_u_int(xdrs, (uint_t *)up)); +} +#endif /* _ILP32 */ + + +/* + * XDR long long integers + */ +bool_t +xdr_longlong_t(XDR *xdrs, longlong_t *hp) +{ + if (xdrs->x_op == XDR_ENCODE) { +#if BYTE_ORDER == _LITTLE_ENDIAN + if (XDR_PUTINT32(xdrs, (int32_t *)((char *)hp + + BYTES_PER_XDR_UNIT)) == TRUE) { + return (XDR_PUTINT32(xdrs, (int32_t *)hp)); + } +#else + if (XDR_PUTINT32(xdrs, (int32_t *)hp) == TRUE) { + return (XDR_PUTINT32(xdrs, (int32_t *)((char *)hp + + BYTES_PER_XDR_UNIT))); + } +#endif + return (FALSE); + + } + if (xdrs->x_op == XDR_DECODE) { +#if BYTE_ORDER == _LITTLE_ENDIAN + if (XDR_GETINT32(xdrs, (int32_t *)((char *)hp + + BYTES_PER_XDR_UNIT)) == TRUE) { + return (XDR_GETINT32(xdrs, (int32_t *)hp)); + } +#else + if (XDR_GETINT32(xdrs, (int32_t *)hp) == TRUE) { + return (XDR_GETINT32(xdrs, (int32_t *)((char *)hp + + BYTES_PER_XDR_UNIT))); + } +#endif + return (FALSE); + } + return (TRUE); +} + +/* + * XDR unsigned long long integers + */ +bool_t +xdr_u_longlong_t(XDR *xdrs, u_longlong_t *hp) +{ + + if (xdrs->x_op == XDR_ENCODE) { +#if BYTE_ORDER == _LITTLE_ENDIAN + if (XDR_PUTINT32(xdrs, (int32_t *)((char *)hp + + BYTES_PER_XDR_UNIT)) == TRUE) { + return (XDR_PUTINT32(xdrs, (int32_t *)hp)); + } +#else + if (XDR_PUTINT32(xdrs, (int32_t *)hp) == TRUE) { + return (XDR_PUTINT32(xdrs, (int32_t *)((char *)hp + + BYTES_PER_XDR_UNIT))); + } +#endif + return (FALSE); + + } + if (xdrs->x_op == XDR_DECODE) { +#if BYTE_ORDER == _LITTLE_ENDIAN + if (XDR_GETINT32(xdrs, (int32_t *)((char *)hp + + BYTES_PER_XDR_UNIT)) == TRUE) { + return (XDR_GETINT32(xdrs, (int32_t *)hp)); + } +#else + if (XDR_GETINT32(xdrs, (int32_t *)hp) == TRUE) { + return (XDR_GETINT32(xdrs, (int32_t *)((char *)hp + + BYTES_PER_XDR_UNIT))); + } +#endif + return (FALSE); + } + return (TRUE); +} + +/* + * XDR short integers + */ +bool_t +xdr_short(XDR *xdrs, short *sp) +{ + int32_t l; + + switch (xdrs->x_op) { + + case XDR_ENCODE: + l = (int32_t)*sp; + return (XDR_PUTINT32(xdrs, &l)); + + case XDR_DECODE: + if (!XDR_GETINT32(xdrs, &l)) + return (FALSE); + *sp = (short)l; + return (TRUE); + + case XDR_FREE: + return (TRUE); + } + return (FALSE); +} + +/* + * XDR unsigned short integers + */ +bool_t +xdr_u_short(XDR *xdrs, ushort_t *usp) +{ + uint32_t l; + + switch (xdrs->x_op) { + + case XDR_ENCODE: + l = (uint32_t)*usp; + return (XDR_PUTINT32(xdrs, (int32_t *)&l)); + + case XDR_DECODE: + if (!XDR_GETINT32(xdrs, (int32_t *)&l)) { + return (FALSE); + } + *usp = (ushort_t)l; + return (TRUE); + + case XDR_FREE: + return (TRUE); + } + return (FALSE); +} + + +/* + * XDR a char + */ +bool_t +xdr_char(XDR *xdrs, char *cp) +{ + int i; + + i = (*cp); + if (!xdr_int(xdrs, &i)) { + return (FALSE); + } + *cp = (char)i; + return (TRUE); +} + +/* + * XDR booleans + * + * PSARC 2003/523 Contract Private Interface + * xdr_bool + * Changes must be reviewed by Solaris File Sharing + * Changes must be communicated to contract-2003-523@sun.com + */ +bool_t +xdr_bool(XDR *xdrs, bool_t *bp) +{ + int32_t i32b; + + switch (xdrs->x_op) { + + case XDR_ENCODE: + i32b = *bp ? XDR_TRUE : XDR_FALSE; + return (XDR_PUTINT32(xdrs, &i32b)); + + case XDR_DECODE: + if (!XDR_GETINT32(xdrs, &i32b)) { + return (FALSE); + } + *bp = (i32b == XDR_FALSE) ? FALSE : TRUE; + return (TRUE); + + case XDR_FREE: + return (TRUE); + } + return (FALSE); +} + +/* + * XDR enumerations + * + * PSARC 2003/523 Contract Private Interface + * xdr_enum + * Changes must be reviewed by Solaris File Sharing + * Changes must be communicated to contract-2003-523@sun.com + */ +#ifndef lint +enum sizecheck { SIZEVAL } sizecheckvar; /* used to find the size of */ + /* an enum */ +#endif +bool_t +xdr_enum(XDR *xdrs, enum_t *ep) +{ +#ifndef lint + /* + * enums are treated as ints + */ + if (sizeof (sizecheckvar) == sizeof (int32_t)) { + return (xdr_int(xdrs, (int32_t *)ep)); + } else if (sizeof (sizecheckvar) == sizeof (short)) { + return (xdr_short(xdrs, (short *)ep)); + } else { + return (FALSE); + } +#else + (void) (xdr_short(xdrs, (short *)ep)); + return (xdr_int(xdrs, (int32_t *)ep)); +#endif +} + +/* + * XDR opaque data + * Allows the specification of a fixed size sequence of opaque bytes. + * cp points to the opaque object and cnt gives the byte length. + * + * PSARC 2003/523 Contract Private Interface + * xdr_opaque + * Changes must be reviewed by Solaris File Sharing + * Changes must be communicated to contract-2003-523@sun.com + */ +bool_t +xdr_opaque(XDR *xdrs, caddr_t cp, const uint_t cnt) +{ + uint_t rndup; + static char crud[BYTES_PER_XDR_UNIT]; + + /* + * if no data we are done + */ + if (cnt == 0) + return (TRUE); + + /* + * round byte count to full xdr units + */ + rndup = cnt % BYTES_PER_XDR_UNIT; + if (rndup != 0) + rndup = BYTES_PER_XDR_UNIT - rndup; + + if (xdrs->x_op == XDR_DECODE) { + if (!XDR_GETBYTES(xdrs, cp, cnt)) { + return (FALSE); + } + if (rndup == 0) + return (TRUE); + return (XDR_GETBYTES(xdrs, (caddr_t)crud, rndup)); + } + + if (xdrs->x_op == XDR_ENCODE) { + if (!XDR_PUTBYTES(xdrs, cp, cnt)) { + return (FALSE); + } + if (rndup == 0) + return (TRUE); + return (XDR_PUTBYTES(xdrs, xdr_zero, rndup)); + } + + if (xdrs->x_op == XDR_FREE) + return (TRUE); + + return (FALSE); +} + +/* + * XDR counted bytes + * *cpp is a pointer to the bytes, *sizep is the count. + * If *cpp is NULL maxsize bytes are allocated + * + * PSARC 2003/523 Contract Private Interface + * xdr_bytes + * Changes must be reviewed by Solaris File Sharing + * Changes must be communicated to contract-2003-523@sun.com + */ +bool_t +xdr_bytes(XDR *xdrs, char **cpp, uint_t *sizep, const uint_t maxsize) +{ + char *sp = *cpp; /* sp is the actual string pointer */ + uint_t nodesize; + + /* + * first deal with the length since xdr bytes are counted + */ + if (!xdr_u_int(xdrs, sizep)) { + return (FALSE); + } + nodesize = *sizep; + if ((nodesize > maxsize) && (xdrs->x_op != XDR_FREE)) { + return (FALSE); + } + + /* + * now deal with the actual bytes + */ + switch (xdrs->x_op) { + case XDR_DECODE: + if (nodesize == 0) + return (TRUE); + if (sp == NULL) + *cpp = sp = (char *)mem_alloc(nodesize); + /* FALLTHROUGH */ + + case XDR_ENCODE: + return (xdr_opaque(xdrs, sp, nodesize)); + + case XDR_FREE: + if (sp != NULL) { + mem_free(sp, nodesize); + *cpp = NULL; + } + return (TRUE); + } + return (FALSE); +} + +/* + * Implemented here due to commonality of the object. + */ +bool_t +xdr_netobj(XDR *xdrs, struct netobj *np) +{ + return (xdr_bytes(xdrs, &np->n_bytes, &np->n_len, MAX_NETOBJ_SZ)); +} + +/* + * XDR a descriminated union + * Support routine for discriminated unions. + * You create an array of xdrdiscrim structures, terminated with + * an entry with a null procedure pointer. The routine gets + * the discriminant value and then searches the array of xdrdiscrims + * looking for that value. It calls the procedure given in the xdrdiscrim + * to handle the discriminant. If there is no specific routine a default + * routine may be called. + * If there is no specific or default routine an error is returned. + */ +bool_t +xdr_union(XDR *xdrs, enum_t *dscmp, char *unp, + const struct xdr_discrim *choices, const xdrproc_t dfault) +{ + enum_t dscm; + + /* + * we deal with the discriminator; it's an enum + */ + if (!xdr_enum(xdrs, dscmp)) { + return (FALSE); + } + dscm = *dscmp; + + /* + * search choices for a value that matches the discriminator. + * if we find one, execute the xdr routine for that value. + */ + for (; choices->proc != NULL_xdrproc_t; choices++) { + if (choices->value == dscm) + return ((*(choices->proc))(xdrs, unp, LASTUNSIGNED)); + } + + /* + * no match - execute the default xdr routine if there is one + */ + return ((dfault == NULL_xdrproc_t) ? FALSE : + (*dfault)(xdrs, unp, LASTUNSIGNED)); +} + + +/* + * Non-portable xdr primitives. + * Care should be taken when moving these routines to new architectures. + */ + + +/* + * XDR null terminated ASCII strings + * xdr_string deals with "C strings" - arrays of bytes that are + * terminated by a NULL character. The parameter cpp references a + * pointer to storage; If the pointer is null, then the necessary + * storage is allocated. The last parameter is the max allowed length + * of the string as specified by a protocol. + */ +bool_t +xdr_string(XDR *xdrs, char **cpp, const uint_t maxsize) +{ + char *sp = *cpp; /* sp is the actual string pointer */ + uint_t size; + uint_t nodesize; + + /* + * first deal with the length since xdr strings are counted-strings + */ + switch (xdrs->x_op) { + case XDR_FREE: + if (sp == NULL) + return (TRUE); /* already free */ + /* FALLTHROUGH */ + case XDR_ENCODE: + size = (sp != NULL) ? (uint_t)strlen(sp) : 0; + break; + case XDR_DECODE: + break; + } + if (!xdr_u_int(xdrs, &size)) { + return (FALSE); + } + if (size > maxsize) { + return (FALSE); + } + nodesize = size + 1; + + /* + * now deal with the actual bytes + */ + switch (xdrs->x_op) { + case XDR_DECODE: + if (nodesize == 0) + return (TRUE); + if (sp == NULL) + sp = (char *)mem_alloc(nodesize); + sp[size] = 0; + if (!xdr_opaque(xdrs, sp, size)) { + /* + * free up memory if allocated here + */ + if (*cpp == NULL) { + mem_free(sp, nodesize); + } + return (FALSE); + } + if (strlen(sp) != size) { + if (*cpp == NULL) { + mem_free(sp, nodesize); + } + return (FALSE); + } + *cpp = sp; + return (TRUE); + + case XDR_ENCODE: + return (xdr_opaque(xdrs, sp, size)); + + case XDR_FREE: + mem_free(sp, nodesize); + *cpp = NULL; + return (TRUE); + } + return (FALSE); +} + +/* + * Wrapper for xdr_string that can be called directly from + * routines like clnt_call + */ +bool_t +xdr_wrapstring(XDR *xdrs, char **cpp) +{ + if (xdr_string(xdrs, cpp, LASTUNSIGNED)) + return (TRUE); + return (FALSE); +} Copied: head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr_array.c (from r191983, head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_array.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr_array.c Mon May 11 04:18:58 2009 (r191984, copy of r191983, head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_array.c) @@ -0,0 +1,114 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * Portions of this source code were derived from Berkeley 4.3 BSD + * under license from the Regents of the University of California. + */ + +/* + * xdr_array.c, Generic XDR routines impelmentation. + * These are the "non-trivial" xdr primitives used to serialize and de-serialize + * arrays. See xdr.h for more info on the interface to xdr. + */ + +#include +#include +#include +#include + +#include +#include + +#define LASTUNSIGNED ((uint_t)0-1) + +/* + * XDR an array of arbitrary elements + * *addrp is a pointer to the array, *sizep is the number of elements. + * If addrp is NULL (*sizep * elsize) bytes are allocated. + * elsize is the size (in bytes) of each element, and elproc is the + * xdr procedure to call to handle each element of the array. + */ +bool_t +xdr_array(XDR *xdrs, caddr_t *addrp, uint_t *sizep, const uint_t maxsize, + const uint_t elsize, const xdrproc_t elproc) +{ + uint_t i; + caddr_t target = *addrp; + uint_t c; /* the actual element count */ + bool_t stat = TRUE; + uint_t nodesize; + + /* like strings, arrays are really counted arrays */ + if (!xdr_u_int(xdrs, sizep)) { + return (FALSE); + } + c = *sizep; + if ((c > maxsize || LASTUNSIGNED / elsize < c) && + xdrs->x_op != XDR_FREE) { + return (FALSE); + } + nodesize = c * elsize; + + /* + * if we are deserializing, we may need to allocate an array. + * We also save time by checking for a null array if we are freeing. + */ + if (target == NULL) + switch (xdrs->x_op) { + case XDR_DECODE: + if (c == 0) + return (TRUE); + *addrp = target = (char *)mem_alloc(nodesize); + bzero(target, nodesize); + break; + + case XDR_FREE: + return (TRUE); + + case XDR_ENCODE: + break; + } + + /* + * now we xdr each element of array + */ + for (i = 0; (i < c) && stat; i++) { + stat = (*elproc)(xdrs, target, LASTUNSIGNED); + target += elsize; + } + + /* + * the array may need freeing + */ + if (xdrs->x_op == XDR_FREE) { + mem_free(*addrp, nodesize); + *addrp = NULL; + } + return (stat); +} Copied: head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr_mem.c (from r191983, head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_mem.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr_mem.c Mon May 11 04:18:58 2009 (r191984, copy of r191983, head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_mem.c) @@ -0,0 +1,209 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * Portions of this source code were derived from Berkeley 4.3 BSD + * under license from the Regents of the University of California. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * xdr_mem.c, XDR implementation using memory buffers. + * + * If you have some data to be interpreted as external data representation + * or to be converted to external data representation in a memory buffer, + * then this is the package for you. + */ + +#include +#include +#include + +#include +#include + +static struct xdr_ops *xdrmem_ops(void); + +/* + * The procedure xdrmem_create initializes a stream descriptor for a + * memory buffer. + */ +void +xdrmem_create(XDR *xdrs, caddr_t addr, uint_t size, enum xdr_op op) +{ + xdrs->x_op = op; + xdrs->x_ops = xdrmem_ops(); + xdrs->x_private = xdrs->x_base = addr; + xdrs->x_handy = size; + xdrs->x_public = NULL; +} + +/* ARGSUSED */ +static void +xdrmem_destroy(XDR *xdrs) +{ +} + +static bool_t +xdrmem_getint32(XDR *xdrs, int32_t *int32p) +{ + if ((xdrs->x_handy -= (int)sizeof (int32_t)) < 0) + return (FALSE); + /* LINTED pointer alignment */ + *int32p = (int32_t)ntohl((uint32_t)(*((int32_t *)(xdrs->x_private)))); + xdrs->x_private += sizeof (int32_t); + return (TRUE); +} + +static bool_t +xdrmem_putint32(XDR *xdrs, int32_t *int32p) +{ + if ((xdrs->x_handy -= (int)sizeof (int32_t)) < 0) + return (FALSE); + /* LINTED pointer alignment */ + *(int32_t *)xdrs->x_private = (int32_t)htonl((uint32_t)(*int32p)); + xdrs->x_private += sizeof (int32_t); + return (TRUE); +} + +static bool_t +xdrmem_getbytes(XDR *xdrs, caddr_t addr, int len) +{ + if ((xdrs->x_handy -= len) < 0) + return (FALSE); + bcopy(xdrs->x_private, addr, len); + xdrs->x_private += len; + return (TRUE); +} + +static bool_t +xdrmem_putbytes(XDR *xdrs, caddr_t addr, int len) +{ + if ((xdrs->x_handy -= len) < 0) + return (FALSE); + bcopy(addr, xdrs->x_private, len); + xdrs->x_private += len; + return (TRUE); +} + +static uint_t +xdrmem_getpos(XDR *xdrs) +{ + return ((uint_t)((uintptr_t)xdrs->x_private - (uintptr_t)xdrs->x_base)); +} + +static bool_t +xdrmem_setpos(XDR *xdrs, uint_t pos) +{ + caddr_t newaddr = xdrs->x_base + pos; + caddr_t lastaddr = xdrs->x_private + xdrs->x_handy; + ptrdiff_t diff; + + if (newaddr > lastaddr) + return (FALSE); + xdrs->x_private = newaddr; + diff = lastaddr - newaddr; + xdrs->x_handy = (int)diff; + return (TRUE); +} + +static rpc_inline_t * +xdrmem_inline(XDR *xdrs, int len) +{ + rpc_inline_t *buf = NULL; + + if (xdrs->x_handy >= len) { + xdrs->x_handy -= len; + /* LINTED pointer alignment */ + buf = (rpc_inline_t *)xdrs->x_private; + xdrs->x_private += len; + } + return (buf); +} + +static bool_t +xdrmem_control(XDR *xdrs, int request, void *info) +{ + xdr_bytesrec *xptr; + int32_t *int32p; + int len; + + switch (request) { + + case XDR_GET_BYTES_AVAIL: + xptr = (xdr_bytesrec *)info; + xptr->xc_is_last_record = TRUE; + xptr->xc_num_avail = xdrs->x_handy; + return (TRUE); + + case XDR_PEEK: + /* + * Return the next 4 byte unit in the XDR stream. + */ + if (xdrs->x_handy < sizeof (int32_t)) + return (FALSE); + int32p = (int32_t *)info; + *int32p = (int32_t)ntohl((uint32_t) + (*((int32_t *)(xdrs->x_private)))); + return (TRUE); + + case XDR_SKIPBYTES: + /* + * Skip the next N bytes in the XDR stream. + */ + int32p = (int32_t *)info; + len = RNDUP((int)(*int32p)); + if ((xdrs->x_handy -= len) < 0) + return (FALSE); + xdrs->x_private += len; + return (TRUE); + + } + return (FALSE); +} + +static struct xdr_ops * +xdrmem_ops(void) +{ + static struct xdr_ops ops; + + if (ops.x_getint32 == NULL) { + ops.x_getbytes = xdrmem_getbytes; + ops.x_putbytes = xdrmem_putbytes; + ops.x_getpostn = xdrmem_getpos; + ops.x_setpostn = xdrmem_setpos; + ops.x_inline = xdrmem_inline; + ops.x_destroy = xdrmem_destroy; + ops.x_control = xdrmem_control; + ops.x_getint32 = xdrmem_getint32; + ops.x_putint32 = xdrmem_putint32; + } + return (&ops); +} Modified: head/sys/modules/zfs/Makefile ============================================================================== --- head/sys/modules/zfs/Makefile Mon May 11 02:39:49 2009 (r191983) +++ head/sys/modules/zfs/Makefile Mon May 11 04:18:58 2009 (r191984) @@ -44,9 +44,9 @@ SRCS+= nvpair_alloc_system.c SRCS+= taskq.c .PATH: ${SUNW}/uts/common/rpc -SRCS+= xdr.c -SRCS+= xdr_array.c -SRCS+= xdr_mem.c +SRCS+= opensolaris_xdr.c +SRCS+= opensolaris_xdr_array.c +SRCS+= opensolaris_xdr_mem.c .PATH: ${SUNW}/uts/common/zmod SRCS+= adler32.c From owner-svn-src-head@FreeBSD.ORG Mon May 11 04:57:40 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BB657106568B; Mon, 11 May 2009 04:57:40 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AA0E88FC0C; Mon, 11 May 2009 04:57:40 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4B4vevT078204; Mon, 11 May 2009 04:57:40 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4B4veJe078203; Mon, 11 May 2009 04:57:40 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200905110457.n4B4veJe078203@svn.freebsd.org> From: Warner Losh Date: Mon, 11 May 2009 04:57:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191985 - head/sys/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 May 2009 04:57:41 -0000 Author: imp Date: Mon May 11 04:57:40 2009 New Revision: 191985 URL: http://svn.freebsd.org/changeset/base/191985 Log: Fix typo in bwi driver. Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon May 11 04:18:58 2009 (r191984) +++ head/sys/conf/files Mon May 11 04:57:40 2009 (r191985) @@ -712,9 +712,9 @@ dev/buslogic/bt_eisa.c optional bt eisa dev/buslogic/bt_isa.c optional bt isa dev/buslogic/bt_mca.c optional bt mca dev/buslogic/bt_pci.c optional bt pci -dev/bwi/bwiirf.c optional bwi dev/bwi/bwimac.c optional bwi dev/bwi/bwiphy.c optional bwi +dev/bwi/bwirf.c optional bwi dev/bwi/if_bwi.c optional bwi dev/bwi/if_bwi_pci.c optional bwi pci dev/cardbus/cardbus.c optional cardbus From owner-svn-src-head@FreeBSD.ORG Mon May 11 05:16:58 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 25F3B10656BC; Mon, 11 May 2009 05:16:58 +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 13F958FC2B; Mon, 11 May 2009 05:16:58 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4B5GvAE078609; Mon, 11 May 2009 05:16:57 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4B5Gv7O078608; Mon, 11 May 2009 05:16:57 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200905110516.n4B5Gv7O078608@svn.freebsd.org> From: Alan Cox Date: Mon, 11 May 2009 05:16:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191986 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 May 2009 05:16:59 -0000 Author: alc Date: Mon May 11 05:16:57 2009 New Revision: 191986 URL: http://svn.freebsd.org/changeset/base/191986 Log: Revert CVS revision 1.94 (svn r16840). Current pmap implementations don't suffer from the race condition that motivated revision 1.94. Consequently, the work-around that was implemented by revision 1.94 is no longer needed. Moreover, reverting this work-around eliminates the need for vfs_busy_pages() to acquire the page queues lock when preparing a buffer for read. Reviewed by: tegge Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Mon May 11 04:57:40 2009 (r191985) +++ head/sys/kern/vfs_bio.c Mon May 11 05:16:57 2009 (r191986) @@ -3519,7 +3519,8 @@ retry: goto retry; } bogus = 0; - vm_page_lock_queues(); + if (clear_modify) + vm_page_lock_queues(); for (i = 0; i < bp->b_npages; i++) { m = bp->b_pages[i]; @@ -3542,17 +3543,18 @@ retry: * It may not work properly with small-block devices. * We need to find a better way. */ - pmap_remove_all(m); - if (clear_modify) + if (clear_modify) { + pmap_remove_write(m); vfs_page_set_valid(bp, foff, m); - else if (m->valid == VM_PAGE_BITS_ALL && + } else if (m->valid == VM_PAGE_BITS_ALL && (bp->b_flags & B_CACHE) == 0) { bp->b_pages[i] = bogus_page; bogus++; } foff = (foff + PAGE_SIZE) & ~(off_t)PAGE_MASK; } - vm_page_unlock_queues(); + if (clear_modify) + vm_page_unlock_queues(); VM_OBJECT_UNLOCK(obj); if (bogus) pmap_qenter(trunc_page((vm_offset_t)bp->b_data), From owner-svn-src-head@FreeBSD.ORG Mon May 11 07:57:29 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B0CC1065673; Mon, 11 May 2009 07:57:29 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 885878FC2F; Mon, 11 May 2009 07:57:29 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4B7vTXk081894; Mon, 11 May 2009 07:57:29 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4B7vT3j081893; Mon, 11 May 2009 07:57:29 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200905110757.n4B7vT3j081893@svn.freebsd.org> From: Xin LI Date: Mon, 11 May 2009 07:57:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191987 - head/release/doc/en_US.ISO8859-1/relnotes X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 May 2009 07:57:30 -0000 Author: delphij Date: Mon May 11 07:57:29 2009 New Revision: 191987 URL: http://svn.freebsd.org/changeset/base/191987 Log: less has been updated to v429 Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.sgml Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.sgml ============================================================================== --- head/release/doc/en_US.ISO8859-1/relnotes/article.sgml Mon May 11 05:16:57 2009 (r191986) +++ head/release/doc/en_US.ISO8859-1/relnotes/article.sgml Mon May 11 07:57:29 2009 (r191987) @@ -450,7 +450,7 @@ 4.1.23 to 4.1.28. less has been updated from - v408 to v416. + v408 to v429. ncurses has been updated from 5.6-20061217 to 5.6-20080503. From owner-svn-src-head@FreeBSD.ORG Mon May 11 13:42:41 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 558261065670; Mon, 11 May 2009 13:42:41 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 437DA8FC14; Mon, 11 May 2009 13:42:41 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4BDgeRh092562; Mon, 11 May 2009 13:42:40 GMT (envelope-from dchagin@svn.freebsd.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4BDgeD9092561; Mon, 11 May 2009 13:42:40 GMT (envelope-from dchagin@svn.freebsd.org) Message-Id: <200905111342.n4BDgeD9092561@svn.freebsd.org> From: Dmitry Chagin Date: Mon, 11 May 2009 13:42:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191988 - head/sys/compat/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 May 2009 13:42:41 -0000 Author: dchagin Date: Mon May 11 13:42:40 2009 New Revision: 191988 URL: http://svn.freebsd.org/changeset/base/191988 Log: Add forgotten linux to bsd flags argument mapping into the linux_recv(). PR: kern/134276 Submitted by: Thomas Mueller Approved by: kib (mentor) MFC after: 2 weeks Modified: head/sys/compat/linux/linux_socket.c Modified: head/sys/compat/linux/linux_socket.c ============================================================================== --- head/sys/compat/linux/linux_socket.c Mon May 11 07:57:29 2009 (r191987) +++ head/sys/compat/linux/linux_socket.c Mon May 11 13:42:40 2009 (r191988) @@ -924,7 +924,7 @@ linux_recv(struct thread *td, struct lin bsd_args.s = args->s; bsd_args.buf = (caddr_t)PTRIN(args->msg); bsd_args.len = args->len; - bsd_args.flags = args->flags; + bsd_args.flags = linux_to_bsd_msg_flags(args->flags); bsd_args.from = NULL; bsd_args.fromlenaddr = 0; return (recvfrom(td, &bsd_args)); From owner-svn-src-head@FreeBSD.ORG Mon May 11 13:50:42 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9102010656E6; Mon, 11 May 2009 13:50:42 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 753098FC14; Mon, 11 May 2009 13:50:42 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4BDogeE092762; Mon, 11 May 2009 13:50:42 GMT (envelope-from dchagin@svn.freebsd.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4BDogTB092760; Mon, 11 May 2009 13:50:42 GMT (envelope-from dchagin@svn.freebsd.org) Message-Id: <200905111350.n4BDogTB092760@svn.freebsd.org> From: Dmitry Chagin Date: Mon, 11 May 2009 13:50:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191989 - in head/sys: amd64/linux32 compat/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 May 2009 13:50:43 -0000 Author: dchagin Date: Mon May 11 13:50:42 2009 New Revision: 191989 URL: http://svn.freebsd.org/changeset/base/191989 Log: Translate l_timeval arg to native struct timeval in linux_setsockopt()/linux_getsockopt() for SO_RCVTIMEO, SO_SNDTIMEO opts as l_timeval has MD members. Remove bogus __packed attribute from l_timeval struct on __amd64__. PR: kern/134276 Submitted by: Thomas Mueller Approved by: kib (mentor) MFC after: 2 weeks Modified: head/sys/amd64/linux32/linux.h head/sys/compat/linux/linux_socket.c Modified: head/sys/amd64/linux32/linux.h ============================================================================== --- head/sys/amd64/linux32/linux.h Mon May 11 13:42:40 2009 (r191988) +++ head/sys/amd64/linux32/linux.h Mon May 11 13:50:42 2009 (r191989) @@ -96,7 +96,7 @@ typedef struct { typedef struct { l_time_t tv_sec; l_suseconds_t tv_usec; -} __packed l_timeval; +} l_timeval; #define l_fd_set fd_set Modified: head/sys/compat/linux/linux_socket.c ============================================================================== --- head/sys/compat/linux/linux_socket.c Mon May 11 13:42:40 2009 (r191988) +++ head/sys/compat/linux/linux_socket.c Mon May 11 13:50:42 2009 (r191989) @@ -1278,6 +1278,8 @@ linux_setsockopt(struct thread *td, stru caddr_t val; int valsize; } */ bsd_args; + l_timeval linux_tv; + struct timeval tv; int error, name; bsd_args.s = args->s; @@ -1285,6 +1287,23 @@ linux_setsockopt(struct thread *td, stru switch (bsd_args.level) { case SOL_SOCKET: name = linux_to_bsd_so_sockopt(args->optname); + switch (name) { + case SO_RCVTIMEO: + /* FALLTHROUGH */ + case SO_SNDTIMEO: + error = copyin(PTRIN(args->optval), &linux_tv, + sizeof(linux_tv)); + if (error) + return (error); + tv.tv_sec = linux_tv.tv_sec; + tv.tv_usec = linux_tv.tv_usec; + return (kern_setsockopt(td, args->s, bsd_args.level, + name, &tv, UIO_SYSSPACE, sizeof(tv))); + /* NOTREACHED */ + break; + default: + break; + } break; case IPPROTO_IP: name = linux_to_bsd_ip_sockopt(args->optname); @@ -1333,6 +1352,9 @@ linux_getsockopt(struct thread *td, stru caddr_t val; int *avalsize; } */ bsd_args; + l_timeval linux_tv; + struct timeval tv; + socklen_t tv_len; int error, name; bsd_args.s = args->s; @@ -1340,6 +1362,24 @@ linux_getsockopt(struct thread *td, stru switch (bsd_args.level) { case SOL_SOCKET: name = linux_to_bsd_so_sockopt(args->optname); + switch (name) { + case SO_RCVTIMEO: + /* FALLTHROUGH */ + case SO_SNDTIMEO: + tv_len = sizeof(tv); + error = kern_getsockopt(td, args->s, bsd_args.level, + name, &tv, UIO_SYSSPACE, &tv_len); + if (error) + return (error); + linux_tv.tv_sec = tv.tv_sec; + linux_tv.tv_usec = tv.tv_usec; + return (copyout(&linux_tv, PTRIN(args->optval), + sizeof(linux_tv))); + /* NOTREACHED */ + break; + default: + break; + } break; case IPPROTO_IP: name = linux_to_bsd_ip_sockopt(args->optname); From owner-svn-src-head@FreeBSD.ORG Mon May 11 15:33:27 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 201981065670; Mon, 11 May 2009 15:33:27 +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 099C98FC08; Mon, 11 May 2009 15:33:27 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4BFXRIi095116; Mon, 11 May 2009 15:33:27 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4BFXQ7q095098; Mon, 11 May 2009 15:33:26 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <200905111533.n4BFXQ7q095098@svn.freebsd.org> From: Attilio Rao Date: Mon, 11 May 2009 15:33:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191990 - in head/sys: cddl/compat/opensolaris/kern cddl/contrib/opensolaris/uts/common/fs/zfs fs/cd9660 fs/coda fs/devfs fs/fdescfs fs/hpfs fs/msdosfs fs/nfs fs/nfsclient fs/nfsserver ... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 May 2009 15:33:27 -0000 Author: attilio Date: Mon May 11 15:33:26 2009 New Revision: 191990 URL: http://svn.freebsd.org/changeset/base/191990 Log: Remove the thread argument from the FSD (File-System Dependent) parts of the VFS. Now all the VFS_* functions and relating parts don't want the context as long as it always refers to curthread. In some points, in particular when dealing with VOPs and functions living in the same namespace (eg. vflush) which still need to be converted, pass curthread explicitly in order to retain the old behaviour. Such loose ends will be fixed ASAP. While here fix a bug: now, UFS_EXTATTR can be compiled alone without the UFS_EXTATTR_AUTOSTART option. VFS KPI is heavilly changed by this commit so thirdy parts modules needs to be recompiled. Bump __FreeBSD_version in order to signal such situation. Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c head/sys/fs/cd9660/cd9660_vfsops.c head/sys/fs/coda/coda_vfsops.c head/sys/fs/devfs/devfs.h head/sys/fs/devfs/devfs_vfsops.c head/sys/fs/devfs/devfs_vnops.c head/sys/fs/fdescfs/fdesc.h head/sys/fs/fdescfs/fdesc_vfsops.c head/sys/fs/fdescfs/fdesc_vnops.c head/sys/fs/hpfs/hpfs_vfsops.c head/sys/fs/msdosfs/msdosfs_vfsops.c head/sys/fs/nfs/nfs_commonsubs.c head/sys/fs/nfs/nfs_var.h head/sys/fs/nfsclient/nfs_clvfsops.c head/sys/fs/nfsserver/nfs_nfsdport.c head/sys/fs/nfsserver/nfs_nfsdserv.c head/sys/fs/ntfs/ntfs_vfsops.c head/sys/fs/nullfs/null_vfsops.c head/sys/fs/nwfs/nwfs_vfsops.c head/sys/fs/portalfs/portal_vfsops.c head/sys/fs/pseudofs/pseudofs.c head/sys/fs/pseudofs/pseudofs.h head/sys/fs/smbfs/smbfs_vfsops.c head/sys/fs/tmpfs/tmpfs.h head/sys/fs/tmpfs/tmpfs_subr.c head/sys/fs/tmpfs/tmpfs_vfsops.c head/sys/fs/tmpfs/tmpfs_vnops.c head/sys/fs/udf/udf_vfsops.c head/sys/fs/unionfs/union_vfsops.c head/sys/geom/journal/g_journal.c head/sys/gnu/fs/ext2fs/ext2_vfsops.c head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c head/sys/gnu/fs/xfs/FreeBSD/xfs_mountops.c head/sys/kern/kern_acct.c head/sys/kern/uipc_mqueue.c head/sys/kern/vfs_default.c head/sys/kern/vfs_export.c head/sys/kern/vfs_extattr.c head/sys/kern/vfs_lookup.c head/sys/kern/vfs_mount.c head/sys/kern/vfs_subr.c head/sys/kern/vfs_syscalls.c head/sys/kern/vfs_vnops.c head/sys/nfs4client/nfs4_vfsops.c head/sys/nfsclient/nfs.h head/sys/nfsclient/nfs_vfsops.c head/sys/nfsserver/nfs_serv.c head/sys/security/audit/audit_worker.c head/sys/sys/mount.h head/sys/sys/param.h head/sys/ufs/ffs/ffs_vfsops.c head/sys/ufs/ufs/extattr.h head/sys/ufs/ufs/ufs_extattr.c head/sys/ufs/ufs/ufs_vfsops.c Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c Mon May 11 13:50:42 2009 (r191989) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c Mon May 11 15:33:26 2009 (r191990) @@ -66,7 +66,6 @@ lookupnameat(char *dirname, enum uio_seg int traverse(vnode_t **cvpp, int lktype) { - kthread_t *td = curthread; vnode_t *cvp; vnode_t *tvp; vfs_t *vfsp; @@ -101,7 +100,7 @@ traverse(vnode_t **cvpp, int lktype) * The read lock must be held across the call to VFS_ROOT() to * prevent a concurrent unmount from destroying the vfs. */ - error = VFS_ROOT(vfsp, lktype, &tvp, td); + error = VFS_ROOT(vfsp, lktype, &tvp); if (error != 0) return (error); cvp = tvp; Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c Mon May 11 13:50:42 2009 (r191989) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c Mon May 11 15:33:26 2009 (r191990) @@ -160,14 +160,14 @@ domount(kthread_t *td, vnode_t *vp, cons */ cr = td->td_ucred; td->td_ucred = kcred; - error = VFS_MOUNT(mp, td); + error = VFS_MOUNT(mp); td->td_ucred = cr; if (!error) { if (mp->mnt_opt != NULL) vfs_freeopts(mp->mnt_opt); mp->mnt_opt = mp->mnt_optnew; - (void)VFS_STATFS(mp, &mp->mnt_stat, td); + (void)VFS_STATFS(mp, &mp->mnt_stat); } /* * Prevent external consumers of mount options from reading @@ -192,7 +192,7 @@ domount(kthread_t *td, vnode_t *vp, cons TAILQ_INSERT_TAIL(&mountlist, mp, mnt_list); mtx_unlock(&mountlist_mtx); vfs_event_signal(NULL, VQ_MOUNT, 0); - if (VFS_ROOT(mp, LK_EXCLUSIVE, &mvp, td)) + if (VFS_ROOT(mp, LK_EXCLUSIVE, &mvp)) panic("mount: lost mount"); mountcheckdirs(vp, mvp); vput(mvp); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Mon May 11 13:50:42 2009 (r191989) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Mon May 11 15:33:26 2009 (r191990) @@ -180,7 +180,7 @@ zfsctl_create(zfsvfs_t *zfsvfs) zcp = vp->v_data; zcp->zc_id = ZFSCTL_INO_ROOT; - VERIFY(VFS_ROOT(zfsvfs->z_vfs, LK_EXCLUSIVE, &rvp, curthread) == 0); + VERIFY(VFS_ROOT(zfsvfs->z_vfs, LK_EXCLUSIVE, &rvp) == 0); ZFS_TIME_DECODE(&zcp->zc_cmtime, VTOZ(rvp)->z_phys->zp_crtime); VN_URELE(rvp); @@ -415,7 +415,7 @@ zfsctl_root_lookup(vnode_t *dvp, char *n ZFS_ENTER(zfsvfs); if (strcmp(nm, "..") == 0) { - err = VFS_ROOT(dvp->v_vfsp, LK_EXCLUSIVE, vpp, curthread); + err = VFS_ROOT(dvp->v_vfsp, LK_EXCLUSIVE, vpp); if (err == 0) VOP_UNLOCK(*vpp, 0); } else { Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Mon May 11 13:50:42 2009 (r191989) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Mon May 11 15:33:26 2009 (r191990) @@ -91,12 +91,12 @@ static int zfs_version_zpl = ZPL_VERSION SYSCTL_INT(_vfs_zfs_version, OID_AUTO, zpl, CTLFLAG_RD, &zfs_version_zpl, 0, "ZPL_VERSION"); -static int zfs_mount(vfs_t *vfsp, kthread_t *td); -static int zfs_umount(vfs_t *vfsp, int fflag, kthread_t *td); -static int zfs_root(vfs_t *vfsp, int flags, vnode_t **vpp, kthread_t *td); -static int zfs_statfs(vfs_t *vfsp, struct statfs *statp, kthread_t *td); +static int zfs_mount(vfs_t *vfsp); +static int zfs_umount(vfs_t *vfsp, int fflag); +static int zfs_root(vfs_t *vfsp, int flags, vnode_t **vpp); +static int zfs_statfs(vfs_t *vfsp, struct statfs *statp); static int zfs_vget(vfs_t *vfsp, ino_t ino, int flags, vnode_t **vpp); -static int zfs_sync(vfs_t *vfsp, int waitfor, kthread_t *td); +static int zfs_sync(vfs_t *vfsp, int waitfor); static int zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, vnode_t **vpp); static void zfs_objset_close(zfsvfs_t *zfsvfs); static void zfs_freevfs(vfs_t *vfsp); @@ -122,7 +122,7 @@ static uint32_t zfs_active_fs_count = 0; /*ARGSUSED*/ static int -zfs_sync(vfs_t *vfsp, int waitfor, kthread_t *td) +zfs_sync(vfs_t *vfsp, int waitfor) { /* @@ -139,7 +139,7 @@ zfs_sync(vfs_t *vfsp, int waitfor, kthre zfsvfs_t *zfsvfs = vfsp->vfs_data; int error; - error = vfs_stdsync(vfsp, waitfor, td); + error = vfs_stdsync(vfsp, waitfor); if (error != 0) return (error); @@ -688,8 +688,9 @@ zfs_unregister_callbacks(zfsvfs_t *zfsvf /*ARGSUSED*/ static int -zfs_mount(vfs_t *vfsp, kthread_t *td) +zfs_mount(vfs_t *vfsp) { + kthread_t *td = curthread; vnode_t *mvp = vfsp->mnt_vnodecovered; cred_t *cr = td->td_ucred; char *osname; @@ -782,7 +783,7 @@ out: } static int -zfs_statfs(vfs_t *vfsp, struct statfs *statp, kthread_t *td) +zfs_statfs(vfs_t *vfsp, struct statfs *statp) { zfsvfs_t *zfsvfs = vfsp->vfs_data; uint64_t refdbytes, availbytes, usedobjs, availobjs; @@ -840,7 +841,7 @@ zfs_statfs(vfs_t *vfsp, struct statfs *s } static int -zfs_root(vfs_t *vfsp, int flags, vnode_t **vpp, kthread_t *td) +zfs_root(vfs_t *vfsp, int flags, vnode_t **vpp) { zfsvfs_t *zfsvfs = vfsp->vfs_data; znode_t *rootzp; @@ -957,11 +958,11 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolea /*ARGSUSED*/ static int -zfs_umount(vfs_t *vfsp, int fflag, kthread_t *td) +zfs_umount(vfs_t *vfsp, int fflag) { zfsvfs_t *zfsvfs = vfsp->vfs_data; objset_t *os; - cred_t *cr = td->td_ucred; + cred_t *cr = curthread->td_ucred; int ret; if (fflag & MS_FORCE) { @@ -992,7 +993,7 @@ zfs_umount(vfs_t *vfsp, int fflag, kthre if (zfsvfs->z_ctldir != NULL) { if ((ret = zfsctl_umount_snapshots(vfsp, fflag, cr)) != 0) return (ret); - ret = vflush(vfsp, 0, 0, td); + ret = vflush(vfsp, 0, 0, curthread); ASSERT(ret == EBUSY); if (!(fflag & MS_FORCE)) { if (zfsvfs->z_ctldir->v_count > 1) @@ -1006,7 +1007,7 @@ zfs_umount(vfs_t *vfsp, int fflag, kthre /* * Flush all the files. */ - ret = vflush(vfsp, 1, (fflag & MS_FORCE) ? FORCECLOSE : 0, td); + ret = vflush(vfsp, 1, (fflag & MS_FORCE) ? FORCECLOSE : 0, curthread); if (ret != 0) { if (!zfsvfs->z_issnap) { zfsctl_create(zfsvfs); Modified: head/sys/fs/cd9660/cd9660_vfsops.c ============================================================================== --- head/sys/fs/cd9660/cd9660_vfsops.c Mon May 11 13:50:42 2009 (r191989) +++ head/sys/fs/cd9660/cd9660_vfsops.c Mon May 11 15:33:26 2009 (r191990) @@ -95,7 +95,7 @@ static int iso_mountfs(struct vnode *dev */ static int -cd9660_cmount(struct mntarg *ma, void *data, int flags, struct thread *td) +cd9660_cmount(struct mntarg *ma, void *data, int flags) { struct iso_args args; int error; @@ -123,15 +123,18 @@ cd9660_cmount(struct mntarg *ma, void *d } static int -cd9660_mount(struct mount *mp, struct thread *td) +cd9660_mount(struct mount *mp) { struct vnode *devvp; + struct thread *td; char *fspec; int error; accmode_t accmode; struct nameidata ndp; struct iso_mnt *imp = 0; + td = curthread; + /* * Unconditionally mount as read-only. */ @@ -490,17 +493,16 @@ out: * unmount system call */ static int -cd9660_unmount(mp, mntflags, td) +cd9660_unmount(mp, mntflags) struct mount *mp; int mntflags; - struct thread *td; { struct iso_mnt *isomp; int error, flags = 0; if (mntflags & MNT_FORCE) flags |= FORCECLOSE; - if ((error = vflush(mp, 0, flags, td))) + if ((error = vflush(mp, 0, flags, curthread))) return (error); isomp = VFSTOISOFS(mp); @@ -530,11 +532,10 @@ cd9660_unmount(mp, mntflags, td) * Return root of a filesystem */ static int -cd9660_root(mp, flags, vpp, td) +cd9660_root(mp, flags, vpp) struct mount *mp; int flags; struct vnode **vpp; - struct thread *td; { struct iso_mnt *imp = VFSTOISOFS(mp); struct iso_directory_record *dp = @@ -553,10 +554,9 @@ cd9660_root(mp, flags, vpp, td) * Get filesystem statistics. */ static int -cd9660_statfs(mp, sbp, td) +cd9660_statfs(mp, sbp) struct mount *mp; struct statfs *sbp; - struct thread *td; { struct iso_mnt *isomp; Modified: head/sys/fs/coda/coda_vfsops.c ============================================================================== --- head/sys/fs/coda/coda_vfsops.c Mon May 11 13:50:42 2009 (r191989) +++ head/sys/fs/coda/coda_vfsops.c Mon May 11 15:33:26 2009 (r191990) @@ -106,7 +106,7 @@ static const char *coda_opts[] = { "from */ /*ARGSUSED*/ int -coda_mount(struct mount *vfsp, struct thread *td) +coda_mount(struct mount *vfsp) { struct vnode *dvp; struct cnode *cp; @@ -136,7 +136,7 @@ coda_mount(struct mount *vfsp, struct th /* * Validate mount device. Similar to getmdev(). */ - NDINIT(&ndp, LOOKUP, FOLLOW, UIO_SYSSPACE, from, td); + NDINIT(&ndp, LOOKUP, FOLLOW, UIO_SYSSPACE, from, curthread); error = namei(&ndp); dvp = ndp.ni_vp; if (error) { @@ -206,7 +206,7 @@ coda_mount(struct mount *vfsp, struct th } int -coda_unmount(struct mount *vfsp, int mntflags, struct thread *td) +coda_unmount(struct mount *vfsp, int mntflags) { struct coda_mntinfo *mi = vftomi(vfsp); int active, error = 0; @@ -232,7 +232,7 @@ coda_unmount(struct mount *vfsp, int mnt vrele(coda_ctlvp); coda_ctlvp = NULL; active = coda_kill(vfsp, NOT_DOWNCALL); - error = vflush(mi->mi_vfsp, 0, FORCECLOSE, td); + error = vflush(mi->mi_vfsp, 0, FORCECLOSE, curthread); #ifdef CODA_VERBOSE printf("coda_unmount: active = %d, vflush active %d\n", active, error); @@ -262,15 +262,17 @@ coda_unmount(struct mount *vfsp, int mnt * Find root of cfs. */ int -coda_root(struct mount *vfsp, int flags, struct vnode **vpp, - struct thread *td) +coda_root(struct mount *vfsp, int flags, struct vnode **vpp) { struct coda_mntinfo *mi = vftomi(vfsp); int error; - struct proc *p = td->td_proc; + struct proc *p; + struct thread *td; CodaFid VFid; static const CodaFid invalfid = INVAL_FID; + td = curthread; + p = td->td_proc; ENTRY; MARK_ENTRY(CODA_ROOT_STATS); if (vfsp == mi->mi_vfsp) { @@ -345,7 +347,7 @@ coda_root(struct mount *vfsp, int flags, * Get filesystem statistics. */ int -coda_statfs(struct mount *vfsp, struct statfs *sbp, struct thread *td) +coda_statfs(struct mount *vfsp, struct statfs *sbp) { ENTRY; @@ -377,7 +379,7 @@ coda_statfs(struct mount *vfsp, struct s * Flush any pending I/O. */ int -coda_sync(struct mount *vfsp, int waitfor, struct thread *td) +coda_sync(struct mount *vfsp, int waitfor) { ENTRY; Modified: head/sys/fs/devfs/devfs.h ============================================================================== --- head/sys/fs/devfs/devfs.h Mon May 11 13:50:42 2009 (r191989) +++ head/sys/fs/devfs/devfs.h Mon May 11 15:33:26 2009 (r191990) @@ -172,7 +172,8 @@ extern unsigned devfs_rule_depth; void devfs_rules_apply(struct devfs_mount *dm, struct devfs_dirent *de); void devfs_rules_cleanup (struct devfs_mount *dm); int devfs_rules_ioctl(struct devfs_mount *dm, u_long cmd, caddr_t data, struct thread *td); -int devfs_allocv (struct devfs_dirent *de, struct mount *mp, struct vnode **vpp, struct thread *td); +int devfs_allocv (struct devfs_dirent *de, struct mount *mp, + struct vnode **vpp); void devfs_delete(struct devfs_mount *dm, struct devfs_dirent *de, int vp_locked); void devfs_dirent_free(struct devfs_dirent *de); void devfs_populate (struct devfs_mount *dm); Modified: head/sys/fs/devfs/devfs_vfsops.c ============================================================================== --- head/sys/fs/devfs/devfs_vfsops.c Mon May 11 13:50:42 2009 (r191989) +++ head/sys/fs/devfs/devfs_vfsops.c Mon May 11 15:33:26 2009 (r191990) @@ -60,7 +60,7 @@ static vfs_statfs_t devfs_statfs; * Mount the filesystem */ static int -devfs_mount(struct mount *mp, struct thread *td) +devfs_mount(struct mount *mp) { int error; struct devfs_mount *fmp; @@ -92,7 +92,7 @@ devfs_mount(struct mount *mp, struct thr fmp->dm_rootdir = devfs_vmkdir(fmp, NULL, 0, NULL, DEVFS_ROOTINO); - error = devfs_root(mp, LK_EXCLUSIVE, &rvp, td); + error = devfs_root(mp, LK_EXCLUSIVE, &rvp); if (error) { sx_destroy(&fmp->dm_lock); free_unr(devfs_unr, fmp->dm_idx); @@ -115,7 +115,7 @@ devfs_unmount_final(struct devfs_mount * } static int -devfs_unmount(struct mount *mp, int mntflags, struct thread *td) +devfs_unmount(struct mount *mp, int mntflags) { int error; int flags = 0; @@ -127,7 +127,7 @@ devfs_unmount(struct mount *mp, int mntf KASSERT(fmp->dm_mount != NULL, ("devfs_unmount unmounted devfs_mount")); /* There is 1 extra root vnode reference from devfs_mount(). */ - error = vflush(mp, 1, flags, td); + error = vflush(mp, 1, flags, curthread); if (error) return (error); sx_xlock(&fmp->dm_lock); @@ -147,7 +147,7 @@ devfs_unmount(struct mount *mp, int mntf /* Return locked reference to root. */ static int -devfs_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td) +devfs_root(struct mount *mp, int flags, struct vnode **vpp) { int error; struct vnode *vp; @@ -155,7 +155,7 @@ devfs_root(struct mount *mp, int flags, dmp = VFSTODEVFS(mp); sx_xlock(&dmp->dm_lock); - error = devfs_allocv(dmp->dm_rootdir, mp, &vp, td); + error = devfs_allocv(dmp->dm_rootdir, mp, &vp); if (error) return (error); vp->v_vflag |= VV_ROOT; @@ -164,7 +164,7 @@ devfs_root(struct mount *mp, int flags, } static int -devfs_statfs(struct mount *mp, struct statfs *sbp, struct thread *td) +devfs_statfs(struct mount *mp, struct statfs *sbp) { sbp->f_flags = 0; Modified: head/sys/fs/devfs/devfs_vnops.c ============================================================================== --- head/sys/fs/devfs/devfs_vnops.c Mon May 11 13:50:42 2009 (r191989) +++ head/sys/fs/devfs/devfs_vnops.c Mon May 11 15:33:26 2009 (r191990) @@ -330,14 +330,13 @@ devfs_insmntque_dtr(struct vnode *vp, vo * it on return. */ int -devfs_allocv(struct devfs_dirent *de, struct mount *mp, struct vnode **vpp, struct thread *td) +devfs_allocv(struct devfs_dirent *de, struct mount *mp, struct vnode **vpp) { int error; struct vnode *vp; struct cdev *dev; struct devfs_mount *dmp; - KASSERT(td == curthread, ("devfs_allocv: td != curthread")); dmp = VFSTODEVFS(mp); if (de->de_flags & DE_DOOMED) { sx_xunlock(&dmp->dm_lock); @@ -351,7 +350,7 @@ devfs_allocv(struct devfs_dirent *de, st VI_LOCK(vp); mtx_unlock(&devfs_de_interlock); sx_xunlock(&dmp->dm_lock); - error = vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, td); + error = vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, curthread); sx_xlock(&dmp->dm_lock); if (devfs_allocv_drop_refs(0, dmp, de)) { if (error == 0) @@ -761,7 +760,7 @@ devfs_lookupx(struct vop_lookup_args *ap de = TAILQ_FIRST(&dd->de_dlist); /* "." */ de = TAILQ_NEXT(de, de_list); /* ".." */ de = de->de_dir; - error = devfs_allocv(de, dvp->v_mount, vpp, td); + error = devfs_allocv(de, dvp->v_mount, vpp); *dm_unlock = 0; vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY); return (error); @@ -844,7 +843,7 @@ devfs_lookupx(struct vop_lookup_args *ap return (0); } } - error = devfs_allocv(de, dvp->v_mount, vpp, td); + error = devfs_allocv(de, dvp->v_mount, vpp); *dm_unlock = 0; return (error); } @@ -870,7 +869,6 @@ devfs_mknod(struct vop_mknod_args *ap) { struct componentname *cnp; struct vnode *dvp, **vpp; - struct thread *td; struct devfs_dirent *dd, *de; struct devfs_mount *dmp; int error; @@ -886,7 +884,6 @@ devfs_mknod(struct vop_mknod_args *ap) cnp = ap->a_cnp; vpp = ap->a_vpp; - td = cnp->cn_thread; dd = dvp->v_data; error = ENOENT; @@ -904,7 +901,7 @@ devfs_mknod(struct vop_mknod_args *ap) if (de == NULL) goto notfound; de->de_flags &= ~DE_WHITEOUT; - error = devfs_allocv(de, dvp->v_mount, vpp, td); + error = devfs_allocv(de, dvp->v_mount, vpp); return (error); notfound: sx_xunlock(&dmp->dm_lock); @@ -1427,12 +1424,8 @@ devfs_symlink(struct vop_symlink_args *a struct devfs_dirent *dd; struct devfs_dirent *de; struct devfs_mount *dmp; - struct thread *td; - - td = ap->a_cnp->cn_thread; - KASSERT(td == curthread, ("devfs_symlink: td != curthread")); - error = priv_check(td, PRIV_DEVFS_SYMLINK); + error = priv_check(curthread, PRIV_DEVFS_SYMLINK); if (error) return(error); dmp = VFSTODEVFS(ap->a_dvp->v_mount); @@ -1451,7 +1444,7 @@ devfs_symlink(struct vop_symlink_args *a mac_devfs_create_symlink(ap->a_cnp->cn_cred, dmp->dm_mount, dd, de); #endif TAILQ_INSERT_TAIL(&dd->de_dlist, de, de_list); - return (devfs_allocv(de, ap->a_dvp->v_mount, ap->a_vpp, td)); + return (devfs_allocv(de, ap->a_dvp->v_mount, ap->a_vpp)); } static int Modified: head/sys/fs/fdescfs/fdesc.h ============================================================================== --- head/sys/fs/fdescfs/fdesc.h Mon May 11 13:50:42 2009 (r191989) +++ head/sys/fs/fdescfs/fdesc.h Mon May 11 15:33:26 2009 (r191990) @@ -65,5 +65,5 @@ extern struct mtx fdesc_hashmtx; extern vfs_init_t fdesc_init; extern vfs_uninit_t fdesc_uninit; extern int fdesc_allocvp(fdntype, unsigned, int, struct mount *, - struct vnode **, struct thread *); + struct vnode **); #endif /* _KERNEL */ Modified: head/sys/fs/fdescfs/fdesc_vfsops.c ============================================================================== --- head/sys/fs/fdescfs/fdesc_vfsops.c Mon May 11 13:50:42 2009 (r191989) +++ head/sys/fs/fdescfs/fdesc_vfsops.c Mon May 11 15:33:26 2009 (r191990) @@ -64,7 +64,7 @@ static vfs_root_t fdesc_root; * Compatibility shim for old mount(2) system call. */ int -fdesc_cmount(struct mntarg *ma, void *data, int flags, struct thread *td) +fdesc_cmount(struct mntarg *ma, void *data, int flags) { return kernel_mount(ma, flags); } @@ -73,7 +73,7 @@ fdesc_cmount(struct mntarg *ma, void *da * Mount the per-process file descriptors (/dev/fd) */ static int -fdesc_mount(struct mount *mp, struct thread *td) +fdesc_mount(struct mount *mp) { int error = 0; struct fdescmount *fmp; @@ -94,7 +94,7 @@ fdesc_mount(struct mount *mp, struct thr */ mp->mnt_data = (qaddr_t) fmp; fmp->flags = 0; - error = fdesc_allocvp(Froot, -1, FD_ROOT, mp, &rvp, td); + error = fdesc_allocvp(Froot, -1, FD_ROOT, mp, &rvp); if (error) { free(fmp, M_FDESCMNT); mp->mnt_data = 0; @@ -116,10 +116,9 @@ fdesc_mount(struct mount *mp, struct thr } static int -fdesc_unmount(mp, mntflags, td) +fdesc_unmount(mp, mntflags) struct mount *mp; int mntflags; - struct thread *td; { struct fdescmount *fmp; caddr_t data; @@ -143,7 +142,7 @@ fdesc_unmount(mp, mntflags, td) * There is 1 extra root vnode reference corresponding * to f_root. */ - if ((error = vflush(mp, 1, flags, td)) != 0) + if ((error = vflush(mp, 1, flags, curthread)) != 0) return (error); /* @@ -160,11 +159,10 @@ fdesc_unmount(mp, mntflags, td) } static int -fdesc_root(mp, flags, vpp, td) +fdesc_root(mp, flags, vpp) struct mount *mp; int flags; struct vnode **vpp; - struct thread *td; { struct vnode *vp; @@ -172,23 +170,25 @@ fdesc_root(mp, flags, vpp, td) * Return locked reference to root. */ vp = VFSTOFDESC(mp)->f_root; - vget(vp, LK_EXCLUSIVE | LK_RETRY, td); + vget(vp, LK_EXCLUSIVE | LK_RETRY, curthread); *vpp = vp; return (0); } static int -fdesc_statfs(mp, sbp, td) +fdesc_statfs(mp, sbp) struct mount *mp; struct statfs *sbp; - struct thread *td; { + struct thread *td; struct filedesc *fdp; int lim; int i; int last; int freefd; + td = curthread; + /* * Compute number of free file descriptors. * [ Strange results will ensue if the open file Modified: head/sys/fs/fdescfs/fdesc_vnops.c ============================================================================== --- head/sys/fs/fdescfs/fdesc_vnops.c Mon May 11 13:50:42 2009 (r191989) +++ head/sys/fs/fdescfs/fdesc_vnops.c Mon May 11 15:33:26 2009 (r191990) @@ -145,20 +145,21 @@ fdesc_remove_entry(struct fdescnode *fd) } int -fdesc_allocvp(ftype, fd_fd, ix, mp, vpp, td) +fdesc_allocvp(ftype, fd_fd, ix, mp, vpp) fdntype ftype; unsigned fd_fd; int ix; struct mount *mp; struct vnode **vpp; - struct thread *td; { struct fdescmount *fmp; struct fdhashhead *fc; struct fdescnode *fd, *fd2; struct vnode *vp, *vp2; + struct thread *td; int error = 0; + td = curthread; fc = FD_NHASH(ix); loop: mtx_lock(&fdesc_hashmtx); @@ -328,7 +329,7 @@ fdesc_lookup(ap) vhold(dvp); VOP_UNLOCK(dvp, 0); error = fdesc_allocvp(Fdesc, fd, FD_DESC + fd, dvp->v_mount, - &fvp, td); + &fvp); fdrop(fp, td); /* * The root vnode must be locked last to prevent deadlock condition. Modified: head/sys/fs/hpfs/hpfs_vfsops.c ============================================================================== --- head/sys/fs/hpfs/hpfs_vfsops.c Mon May 11 13:50:42 2009 (r191989) +++ head/sys/fs/hpfs/hpfs_vfsops.c Mon May 11 15:33:26 2009 (r191990) @@ -73,8 +73,7 @@ static int hpfs_cmount ( struct mntarg *ma, void *data, - int flags, - struct thread *td ) + int flags) { struct hpfs_args args; int error; @@ -103,16 +102,16 @@ static const char *hpfs_opts[] = { }; static int -hpfs_mount ( - struct mount *mp, - struct thread *td ) +hpfs_mount (struct mount *mp) { int err = 0, error; struct vnode *devvp; + struct thread *td; struct nameidata ndp; struct export_args export; char *from; + td = curthread; dprintf(("hpfs_omount():\n")); /* *** @@ -299,7 +298,7 @@ hpfs_mountfs(devvp, mp, td) goto failed; } - error = hpfs_root(mp, LK_EXCLUSIVE, &vp, td); + error = hpfs_root(mp, LK_EXCLUSIVE, &vp); if (error) { hpfs_cpdeinit(hpmp); hpfs_bmdeinit(hpmp); @@ -331,8 +330,7 @@ failed: static int hpfs_unmount( struct mount *mp, - int mntflags, - struct thread *td) + int mntflags) { int error, flags; register struct hpfsmount *hpmp = VFSTOHPFS(mp); @@ -345,7 +343,7 @@ hpfs_unmount( dprintf(("hpfs_unmount: vflushing...\n")); - error = vflush(mp, 0, flags, td); + error = vflush(mp, 0, flags, curthread); if (error) { printf("hpfs_unmount: vflush failed: %d\n",error); return (error); @@ -375,8 +373,7 @@ static int hpfs_root( struct mount *mp, int flags, - struct vnode **vpp, - struct thread *td ) + struct vnode **vpp) { int error = 0; struct hpfsmount *hpmp = VFSTOHPFS(mp); @@ -394,8 +391,7 @@ hpfs_root( static int hpfs_statfs( struct mount *mp, - struct statfs *sbp, - struct thread *td) + struct statfs *sbp) { struct hpfsmount *hpmp = VFSTOHPFS(mp); Modified: head/sys/fs/msdosfs/msdosfs_vfsops.c ============================================================================== --- head/sys/fs/msdosfs/msdosfs_vfsops.c Mon May 11 13:50:42 2009 (r191989) +++ head/sys/fs/msdosfs/msdosfs_vfsops.c Mon May 11 15:33:26 2009 (r191990) @@ -184,7 +184,7 @@ update_mp(struct mount *mp, struct threa pmp->pm_flags |= MSDOSFSMNT_LONGNAME; else { if ((error = - msdosfs_root(mp, LK_EXCLUSIVE, &rootvp, td)) != 0) + msdosfs_root(mp, LK_EXCLUSIVE, &rootvp)) != 0) return error; pmp->pm_flags |= findwin95(VTODE(rootvp)) ? MSDOSFSMNT_LONGNAME : MSDOSFSMNT_SHORTNAME; @@ -195,7 +195,7 @@ update_mp(struct mount *mp, struct threa } static int -msdosfs_cmount(struct mntarg *ma, void *data, int flags, struct thread *td) +msdosfs_cmount(struct mntarg *ma, void *data, int flags) { struct msdosfs_args args; int error; @@ -233,9 +233,10 @@ msdosfs_cmount(struct mntarg *ma, void * * special file to treat as a filesystem. */ static int -msdosfs_mount(struct mount *mp, struct thread *td) +msdosfs_mount(struct mount *mp) { struct vnode *devvp; /* vnode for blk device to mount */ + struct thread *td; /* msdosfs specific mount control block */ struct msdosfsmount *pmp = NULL; struct nameidata ndp; @@ -243,6 +244,7 @@ msdosfs_mount(struct mount *mp, struct t accmode_t accmode; char *from; + td = curthread; if (vfs_filteropt(mp->mnt_optnew, msdosfs_opts)) return (EINVAL); @@ -265,7 +267,7 @@ msdosfs_mount(struct mount *mp, struct t } if (!(pmp->pm_flags & MSDOSFSMNT_RONLY) && vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0)) { - error = VFS_SYNC(mp, MNT_WAIT, td); + error = VFS_SYNC(mp, MNT_WAIT); if (error) return (error); flags = WRITECLOSE; @@ -392,7 +394,7 @@ msdosfs_mount(struct mount *mp, struct t error = update_mp(mp, td); if (error) { if ((mp->mnt_flag & MNT_UPDATE) == 0) - msdosfs_unmount(mp, MNT_FORCE, td); + msdosfs_unmount(mp, MNT_FORCE); return error; } @@ -774,7 +776,7 @@ error_exit: * Unmount the filesystem described by mp. */ static int -msdosfs_unmount(struct mount *mp, int mntflags, struct thread *td) +msdosfs_unmount(struct mount *mp, int mntflags) { struct msdosfsmount *pmp; int error, flags; @@ -782,7 +784,7 @@ msdosfs_unmount(struct mount *mp, int mn flags = 0; if (mntflags & MNT_FORCE) flags |= FORCECLOSE; - error = vflush(mp, 0, flags, td); + error = vflush(mp, 0, flags, curthread); if (error && error != ENXIO) return error; pmp = VFSTOMSDOSFS(mp); @@ -844,7 +846,7 @@ msdosfs_unmount(struct mount *mp, int mn } static int -msdosfs_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td) +msdosfs_root(struct mount *mp, int flags, struct vnode **vpp) { struct msdosfsmount *pmp = VFSTOMSDOSFS(mp); struct denode *ndep; @@ -861,7 +863,7 @@ msdosfs_root(struct mount *mp, int flags } static int -msdosfs_statfs(struct mount *mp, struct statfs *sbp, struct thread *td) +msdosfs_statfs(struct mount *mp, struct statfs *sbp) { struct msdosfsmount *pmp; @@ -877,13 +879,16 @@ msdosfs_statfs(struct mount *mp, struct } static int -msdosfs_sync(struct mount *mp, int waitfor, struct thread *td) +msdosfs_sync(struct mount *mp, int waitfor) { struct vnode *vp, *nvp; + struct thread *td; struct denode *dep; struct msdosfsmount *pmp = VFSTOMSDOSFS(mp); int error, allerror = 0; + td = curthread; + /* * If we ever switch to not updating all of the fats all the time, * this would be the place to update them from the first one. Modified: head/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- head/sys/fs/nfs/nfs_commonsubs.c Mon May 11 13:50:42 2009 (r191989) +++ head/sys/fs/nfs/nfs_commonsubs.c Mon May 11 15:33:26 2009 (r191990) @@ -1446,7 +1446,7 @@ nfsv4_loadattr(struct nfsrv_descript *nd savuid = p->p_cred->p_ruid; p->p_cred->p_ruid = cred->cr_uid; if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA, - USRQUOTA), cred->cr_uid, (caddr_t)&dqb, p)) + USRQUOTA), cred->cr_uid, (caddr_t)&dqb)) freenum = min(dqb.dqb_bhardlimit, freenum); p->p_cred->p_ruid = savuid; #endif /* QUOTA */ @@ -1475,7 +1475,7 @@ nfsv4_loadattr(struct nfsrv_descript *nd savuid = p->p_cred->p_ruid; p->p_cred->p_ruid = cred->cr_uid; if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA, - USRQUOTA), cred->cr_uid, (caddr_t)&dqb, p)) + USRQUOTA), cred->cr_uid, (caddr_t)&dqb)) freenum = min(dqb.dqb_bsoftlimit, freenum); p->p_cred->p_ruid = savuid; #endif /* QUOTA */ @@ -1501,7 +1501,7 @@ nfsv4_loadattr(struct nfsrv_descript *nd savuid = p->p_cred->p_ruid; p->p_cred->p_ruid = cred->cr_uid; if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA, - USRQUOTA), cred->cr_uid, (caddr_t)&dqb, p)) + USRQUOTA), cred->cr_uid, (caddr_t)&dqb)) freenum = dqb.dqb_curblocks; p->p_cred->p_ruid = savuid; #endif /* QUOTA */ @@ -1943,7 +1943,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd * Get the VFS_STATFS(), since some attributes need them. */ if (NFSISSETSTATFS_ATTRBIT(retbitp)) { - error = VFS_STATFS(vnode_mount(vp), &fs, p); + error = VFS_STATFS(vnode_mount(vp), &fs); if (error != 0) { if (reterr) { nd->nd_repstat = NFSERR_ACCES; @@ -2138,7 +2138,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd savuid = p->p_cred->p_ruid; p->p_cred->p_ruid = cred->cr_uid; if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA,USRQUOTA), - cred->cr_uid, (caddr_t)&dqb, p)) + cred->cr_uid, (caddr_t)&dqb)) freenum = min(dqb.dqb_isoftlimit-dqb.dqb_curinodes, freenum); p->p_cred->p_ruid = savuid; @@ -2245,7 +2245,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd savuid = p->p_cred->p_ruid; p->p_cred->p_ruid = cred->cr_uid; if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA,USRQUOTA), - cred->cr_uid, (caddr_t)&dqb, p)) + cred->cr_uid, (caddr_t)&dqb)) freenum = min(dqb.dqb_bhardlimit, freenum); p->p_cred->p_ruid = savuid; #endif /* QUOTA */ @@ -2269,7 +2269,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd savuid = p->p_cred->p_ruid; p->p_cred->p_ruid = cred->cr_uid; if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA,USRQUOTA), - cred->cr_uid, (caddr_t)&dqb, p)) + cred->cr_uid, (caddr_t)&dqb)) freenum = min(dqb.dqb_bsoftlimit, freenum); p->p_cred->p_ruid = savuid; #endif /* QUOTA */ @@ -2290,7 +2290,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd savuid = p->p_cred->p_ruid; p->p_cred->p_ruid = cred->cr_uid; if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA,USRQUOTA), - cred->cr_uid, (caddr_t)&dqb, p)) + cred->cr_uid, (caddr_t)&dqb)) freenum = dqb.dqb_curblocks; p->p_cred->p_ruid = savuid; #endif /* QUOTA */ Modified: head/sys/fs/nfs/nfs_var.h ============================================================================== --- head/sys/fs/nfs/nfs_var.h Mon May 11 13:50:42 2009 (r191989) +++ head/sys/fs/nfs/nfs_var.h Mon May 11 15:33:26 2009 (r191990) @@ -558,7 +558,7 @@ int nfsvno_rename(struct nameidata *, st int nfsvno_link(struct nameidata *, vnode_t, struct ucred *, NFSPROC_T *, struct nfsexstuff *); int nfsvno_fsync(vnode_t, u_int64_t, int, struct ucred *, NFSPROC_T *); -int nfsvno_statfs(vnode_t, struct statfs *, struct ucred *, NFSPROC_T *); +int nfsvno_statfs(vnode_t, struct statfs *); void nfsvno_getfs(struct nfsfsinfo *, int); void nfsvno_open(struct nfsrv_descript *, struct nameidata *, nfsquad_t, nfsv4stateid_t *, struct nfsstate *, int *, struct nfsvattr *, u_char *, Modified: head/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvfsops.c Mon May 11 13:50:42 2009 (r191989) +++ head/sys/fs/nfsclient/nfs_clvfsops.c Mon May 11 15:33:26 2009 (r191990) @@ -244,9 +244,10 @@ nfs_convert_diskless(void) * nfs statfs call */ static int -nfs_statfs(struct mount *mp, struct statfs *sbp, struct thread *td) +nfs_statfs(struct mount *mp, struct statfs *sbp) { struct vnode *vp; + struct thread *td; struct nfsmount *nmp = VFSTONFS(mp); struct nfsvattr nfsva; struct nfsfsinfo fs; @@ -254,6 +255,8 @@ nfs_statfs(struct mount *mp, struct stat int error = 0, attrflag, gotfsinfo = 0, ret; struct nfsnode *np; + td = curthread; + error = vfs_busy(mp, MBF_NOWAIT); if (error) return (error); @@ -659,7 +662,7 @@ static const char *nfs_opts[] = { "from" */ /* ARGSUSED */ static int -nfs_mount(struct mount *mp, struct thread *td) +nfs_mount(struct mount *mp) { struct nfs_args args = { .version = NFS_ARGSVERSION, @@ -689,6 +692,7 @@ nfs_mount(struct mount *mp, struct threa int error; struct sockaddr *nam; struct vnode *vp; + struct thread *td; char hst[MNAMELEN]; size_t len; u_char nfh[NFSX_FHMAX], krbname[100], dirpath[100], srvkrbname[100]; @@ -698,6 +702,7 @@ nfs_mount(struct mount *mp, struct threa goto out; } + td = curthread; if ((mp->mnt_flag & (MNT_ROOTFS | MNT_UPDATE)) == MNT_ROOTFS) { error = ncl_mountroot(mp, td); goto out; @@ -835,7 +840,7 @@ out: */ /* ARGSUSED */ static int -nfs_cmount(struct mntarg *ma, void *data, int flags, struct thread *td) +nfs_cmount(struct mntarg *ma, void *data, int flags) { int error; struct nfs_args args; @@ -1069,11 +1074,14 @@ bad: * unmount system call */ static int -nfs_unmount(struct mount *mp, int mntflags, struct thread *td) +nfs_unmount(struct mount *mp, int mntflags) { + struct thread *td; struct nfsmount *nmp; int error, flags = 0, trycnt = 0; + td = curthread; + if (mntflags & MNT_FORCE) flags |= FORCECLOSE; nmp = VFSTONFS(mp); @@ -1120,7 +1128,7 @@ out: * Return root of a filesystem */ static int -nfs_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td) +nfs_root(struct mount *mp, int flags, struct vnode **vpp) { struct vnode *vp; struct nfsmount *nmp; @@ -1153,11 +1161,14 @@ nfs_root(struct mount *mp, int flags, st */ /* ARGSUSED */ static int -nfs_sync(struct mount *mp, int waitfor, struct thread *td) +nfs_sync(struct mount *mp, int waitfor) { struct vnode *vp, *mvp; + struct thread *td; int error, allerror = 0; + td = curthread; + /* * Force stale buffer cache information to be flushed. */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Mon May 11 16:32:59 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 03D7C106566C; Mon, 11 May 2009 16:32:59 +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 E60408FC19; Mon, 11 May 2009 16:32:58 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4BGWwBa096291; Mon, 11 May 2009 16:32:58 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4BGWwCx096290; Mon, 11 May 2009 16:32:58 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <200905111632.n4BGWwCx096290@svn.freebsd.org> From: Attilio Rao Date: Mon, 11 May 2009 16:32:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191991 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 May 2009 16:32:59 -0000 Author: attilio Date: Mon May 11 16:32:58 2009 New Revision: 191991 URL: http://svn.freebsd.org/changeset/base/191991 Log: Fix a kernel compilation error, introduced after r191990, by defining thread with curthread in the AUDIT case. Reported by: dchagin Modified: head/sys/kern/vfs_lookup.c Modified: head/sys/kern/vfs_lookup.c ============================================================================== --- head/sys/kern/vfs_lookup.c Mon May 11 15:33:26 2009 (r191990) +++ head/sys/kern/vfs_lookup.c Mon May 11 16:32:58 2009 (r191991) @@ -457,6 +457,9 @@ lookup(struct nameidata *ndp) int dvfslocked; /* VFS Giant state for parent */ int tvfslocked; int lkflags_save; +#ifdef AUDIT + struct thread *td = curthread; +#endif /* * Setup: break out flag bits into variables. From owner-svn-src-head@FreeBSD.ORG Mon May 11 16:36:19 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 617EA10656D7; Mon, 11 May 2009 16:36:19 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-bw0-f213.google.com (mail-bw0-f213.google.com [209.85.218.213]) by mx1.freebsd.org (Postfix) with ESMTP id A341C8FC3C; Mon, 11 May 2009 16:36:15 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: by bwz9 with SMTP id 9so2808484bwz.43 for ; Mon, 11 May 2009 09:36:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to :content-type:content-transfer-encoding; bh=/3o3TKM8xsdHeqVkFQbSwTrv1FQlvlFpi1unw1f64iY=; b=KHK5NvJnVyrcPEp95/UwNkQyAfV58EGF8yElDTF+eawGunkiMGwankZEDc0QOVJPYc ZQXZiBjB5hgFTrLISzRKxDfdS2bysjQnb3eNeeV/PbVbnnuYSQ3YK3wjVFRHa4IjhJP+ 0XfUTtyFRKNx55wNOmmImVpidNpHcp1amwb7o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=d2SqRYjyHCQkA+dxdvN3pbwrKiP09woclwEQCSDdawsuiSQfLEEqO6m9UnVinaLeLK mhARtTvASWR2DgjTEbOMx3zqUscX3+bckka4qdywHMXFGr5UC/H68pSL1/vurNbpaXFr /ZLMLljP68+sjgbVLUwVu7Nj3bd+S4lyaDIXs= MIME-Version: 1.0 Sender: asmrookie@gmail.com Received: by 10.223.117.14 with SMTP id o14mr3317562faq.21.1242059774174; Mon, 11 May 2009 09:36:14 -0700 (PDT) In-Reply-To: <200905111632.n4BGWwCx096290@svn.freebsd.org> References: <200905111632.n4BGWwCx096290@svn.freebsd.org> Date: Mon, 11 May 2009 18:36:14 +0200 X-Google-Sender-Auth: d55123fe86d1a67a Message-ID: <3bbf2fe10905110936g5e47e21ahc633c8ff61cac991@mail.gmail.com> From: Attilio Rao To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Subject: Re: svn commit: r191991 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 May 2009 16:36:29 -0000 2009/5/11, Attilio Rao : > Author: attilio > Date: Mon May 11 16:32:58 2009 > New Revision: 191991 > URL: http://svn.freebsd.org/changeset/base/191991 > > Log: > Fix a kernel compilation error, introduced after r191990, by defining > thread with curthread in the AUDIT case. The r191990 revision introduced a large KPI breakage. I compiled LINT and tried several combinations of key flags that let me identify several stubs to be introduced, but other can spring as the upside, so please be patienceful until all of them are reported and fixed. Thanks, Attilio -- Peace can only be achieved by understanding - A. Einstein From owner-svn-src-head@FreeBSD.ORG Mon May 11 16:45:53 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9D15D1065675; Mon, 11 May 2009 16:45:53 +0000 (UTC) (envelope-from green@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8B0238FC1C; Mon, 11 May 2009 16:45:53 +0000 (UTC) (envelope-from green@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4BGjrQP096615; Mon, 11 May 2009 16:45:53 GMT (envelope-from green@svn.freebsd.org) Received: (from green@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4BGjrX0096614; Mon, 11 May 2009 16:45:53 GMT (envelope-from green@svn.freebsd.org) Message-Id: <200905111645.n4BGjrX0096614@svn.freebsd.org> From: Brian Feldman Date: Mon, 11 May 2009 16:45:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191993 - head/lib/libthr/thread X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 May 2009 16:45:54 -0000 Author: green Date: Mon May 11 16:45:53 2009 New Revision: 191993 URL: http://svn.freebsd.org/changeset/base/191993 Log: These are some cosmetic changes to improve the clarity of libthr's fork implementation. Modified: head/lib/libthr/thread/thr_fork.c Modified: head/lib/libthr/thread/thr_fork.c ============================================================================== --- head/lib/libthr/thread/thr_fork.c Mon May 11 16:37:31 2009 (r191992) +++ head/lib/libthr/thread/thr_fork.c Mon May 11 16:45:53 2009 (r191993) @@ -105,7 +105,7 @@ _fork(void) struct pthread_atfork *af; pid_t ret; int errsave; - int unlock_malloc; + int was_threaded; int rtld_locks[MAX_RTLD_LOCKS]; if (!_thr_is_inited()) @@ -122,16 +122,16 @@ _fork(void) } /* - * Try our best to protect memory from being corrupted in - * child process because another thread in malloc code will - * simply be kill by fork(). + * All bets are off as to what should happen soon if the parent + * process was not so kindly as to set up pthread fork hooks to + * relinquish all running threads. */ if (_thr_isthreaded() != 0) { - unlock_malloc = 1; + was_threaded = 1; _malloc_prefork(); _rtld_atfork_pre(rtld_locks); } else { - unlock_malloc = 0; + was_threaded = 0; } /* @@ -159,7 +159,7 @@ _fork(void) _thr_umutex_init(&curthread->lock); _thr_umutex_init(&_thr_atfork_lock); - if (unlock_malloc) + if (was_threaded) _rtld_atfork_post(rtld_locks); _thr_setthreaded(0); @@ -173,7 +173,7 @@ _fork(void) /* Ready to continue, unblock signals. */ _thr_signal_unblock(curthread); - if (unlock_malloc) { + if (was_threaded) { __isthreaded = 1; _malloc_postfork(); __isthreaded = 0; @@ -191,7 +191,7 @@ _fork(void) /* Ready to continue, unblock signals. */ _thr_signal_unblock(curthread); - if (unlock_malloc) { + if (was_threaded) { _rtld_atfork_post(rtld_locks); _malloc_postfork(); } From owner-svn-src-head@FreeBSD.ORG Mon May 11 17:05:42 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 27325106567A; Mon, 11 May 2009 17:05:42 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 15DB78FC14; Mon, 11 May 2009 17:05:42 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4BH5fa1097023; Mon, 11 May 2009 17:05:41 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4BH5fFH097022; Mon, 11 May 2009 17:05:41 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200905111705.n4BH5fFH097022@svn.freebsd.org> From: Warner Losh Date: Mon, 11 May 2009 17:05:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191994 - head/share/man/man5 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 May 2009 17:05:42 -0000 Author: imp Date: Mon May 11 17:05:41 2009 New Revision: 191994 URL: http://svn.freebsd.org/changeset/base/191994 Log: LFS cannot be loaded, compiled, torn, spindled or mutilated in FreeBSD: it was deleted around FreeBSD 3.x... Modified: head/share/man/man5/fstab.5 Modified: head/share/man/man5/fstab.5 ============================================================================== --- head/share/man/man5/fstab.5 Mon May 11 16:45:53 2009 (r191993) +++ head/share/man/man5/fstab.5 Mon May 11 17:05:41 2009 (r191994) @@ -80,8 +80,7 @@ Only the root, /usr, and /tmp file syste compiled into the kernel; everything else will be automatically loaded at mount time. -(Exception: the UFS family - FFS and LFS cannot -currently be demand-loaded.) +(Exception: the FFS cannot currently be demand-loaded.) Some people still prefer to statically compile other file systems as well. .Pp From owner-svn-src-head@FreeBSD.ORG Mon May 11 17:13:52 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 82CB81065673; Mon, 11 May 2009 17:13:52 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 712998FC08; Mon, 11 May 2009 17:13:52 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4BHDqh3097216; Mon, 11 May 2009 17:13:52 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4BHDqmN097215; Mon, 11 May 2009 17:13:52 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200905111713.n4BHDqmN097215@svn.freebsd.org> From: Warner Losh Date: Mon, 11 May 2009 17:13:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191995 - head/sys/dev/bwi X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 May 2009 17:13:53 -0000 Author: imp Date: Mon May 11 17:13:52 2009 New Revision: 191995 URL: http://svn.freebsd.org/changeset/base/191995 Log: Update a few XXX comments Submitted by: ddk ddk ddkprog at yahoo dot com Modified: head/sys/dev/bwi/bwimac.c Modified: head/sys/dev/bwi/bwimac.c ============================================================================== --- head/sys/dev/bwi/bwimac.c Mon May 11 17:05:41 2009 (r191994) +++ head/sys/dev/bwi/bwimac.c Mon May 11 17:13:52 2009 (r191995) @@ -300,7 +300,7 @@ bwi_mac_init(struct bwi_mac *mac) if (error) return error; - /* XXX work around for hardware bugs? */ + /* do timeout fixup */ if (sc->sc_bus_regwin.rw_rev <= 5 && sc->sc_bus_regwin.rw_type != BWI_REGWIN_T_BUSPCIE) { CSR_SETBITS_4(sc, BWI_CONF_LO, @@ -364,7 +364,7 @@ bwi_mac_init(struct bwi_mac *mac) */ bwi_mac_opmode_init(mac); - /* XXX what's these */ + /* set up Beacon interval */ if (mac->mac_rev < 3) { CSR_WRITE_2(sc, 0x60e, 0); CSR_WRITE_2(sc, 0x610, 0x8000); @@ -389,7 +389,7 @@ bwi_mac_init(struct bwi_mac *mac) CSR_WRITE_4(sc, BWI_TXRX_INTR_MASK(i), intrs); } - /* XXX what's this */ + /* allow the MAC to control the PHY clock (dynamic on/off) */ CSR_SETBITS_4(sc, BWI_STATE_LO, 0x100000); /* Setup MAC power up delay */ @@ -441,7 +441,7 @@ bwi_mac_init(struct bwi_mac *mac) } } - /* XXX what's these */ + /* update PRETBTT */ CSR_WRITE_2(sc, 0x612, 0x50); /* Force Pre-TBTT to 80? */ MOBJ_WRITE_2(mac, BWI_COMM_MOBJ, 0x416, 0x50); MOBJ_WRITE_2(mac, BWI_COMM_MOBJ, 0x414, 0x1f4); From owner-svn-src-head@FreeBSD.ORG Mon May 11 17:29:11 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F5AE106564A; Mon, 11 May 2009 17:29:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4E0928FC12; Mon, 11 May 2009 17:29:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4BHTBQc097558; Mon, 11 May 2009 17:29:11 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4BHTBRx097557; Mon, 11 May 2009 17:29:11 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200905111729.n4BHTBRx097557@svn.freebsd.org> From: John Baldwin Date: Mon, 11 May 2009 17:29:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191996 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 May 2009 17:29:11 -0000 Author: jhb Date: Mon May 11 17:29:11 2009 New Revision: 191996 URL: http://svn.freebsd.org/changeset/base/191996 Log: Always use __null to define NULL for GCC 4+. Use '0' rather than '(void *)0' for NULL for C++ compilers compiling kernel code. Together this makes it easier to build kernel modules using C++. Reviewed by: imp MFC after: 3 days Modified: head/sys/sys/_null.h Modified: head/sys/sys/_null.h ============================================================================== --- head/sys/sys/_null.h Mon May 11 17:13:52 2009 (r191995) +++ head/sys/sys/_null.h Mon May 11 17:29:11 2009 (r191996) @@ -28,18 +28,18 @@ #ifndef NULL -#if defined(_KERNEL) || !defined(__cplusplus) -#define NULL ((void *)0) -#else #if defined(__GNUG__) && defined(__GNUC__) && __GNUC__ >= 4 #define NULL __null #else +#if defined(_KERNEL) && !defined(__cplusplus) +#define NULL ((void *)0) +#else #if defined(__LP64__) #define NULL (0L) #else #define NULL 0 #endif /* __LP64__ */ +#endif /* _KERNEL && !__cplusplus */ #endif /* __GNUG__ */ -#endif /* _KERNEL || !__cplusplus */ #endif From owner-svn-src-head@FreeBSD.ORG Mon May 11 18:40:26 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 091391065675; Mon, 11 May 2009 18:40:26 +0000 (UTC) (envelope-from dfr@rabson.org) Received: from itchy.rabson.org (router.rabson.org [80.177.232.241]) by mx1.freebsd.org (Postfix) with ESMTP id ADA298FC17; Mon, 11 May 2009 18:40:24 +0000 (UTC) (envelope-from dfr@rabson.org) Received: from [IPv6:2001:470:909f:1:225:ff:feed:9426] (unknown [IPv6:2001:470:909f:1:225:ff:feed:9426]) by itchy.rabson.org (Postfix) with ESMTP id ED8785CF3; Mon, 11 May 2009 19:22:05 +0100 (BST) Message-Id: <0E48393C-F519-42A1-AD3C-3EC31EE2AE06@rabson.org> From: Doug Rabson To: Kip Macy In-Reply-To: <200905110418.n4B4IxPC077484@svn.freebsd.org> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.4) Date: Mon, 11 May 2009 19:21:29 +0100 References: <200905110418.n4B4IxPC077484@svn.freebsd.org> X-Mailer: Apple Mail (2.930.4) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191984 - in head/sys: cddl/contrib/opensolaris/uts/common/rpc modules/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 May 2009 18:40:26 -0000 The XDR support code that is in the main kernel should have a very similar API to the opensolaris bits, possibly identical. Perhaps the opensolaris compat could use the main kernel's XDR implementation? On 11 May 2009, at 05:18, Kip Macy wrote: > Author: kmacy > Date: Mon May 11 04:18:58 2009 > New Revision: 191984 > URL: http://svn.freebsd.org/changeset/base/191984 > > Log: > rename xdr support files to avoid conflicts when linking in to the > kernel > > Added: > head/sys/cddl/contrib/opensolaris/uts/common/rpc/ > opensolaris_xdr.c (props changed) > - copied unchanged from r191983, head/sys/cddl/contrib/ > opensolaris/uts/common/rpc/xdr.c > head/sys/cddl/contrib/opensolaris/uts/common/rpc/ > opensolaris_xdr_array.c (props changed) > - copied unchanged from r191983, head/sys/cddl/contrib/ > opensolaris/uts/common/rpc/xdr_array.c > head/sys/cddl/contrib/opensolaris/uts/common/rpc/ > opensolaris_xdr_mem.c (props changed) > - copied unchanged from r191983, head/sys/cddl/contrib/ > opensolaris/uts/common/rpc/xdr_mem.c > Deleted: > head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.c > head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_array.c > head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_mem.c > Modified: > head/sys/modules/zfs/Makefile > > Copied: head/sys/cddl/contrib/opensolaris/uts/common/rpc/ > opensolaris_xdr.c (from r191983, head/sys/cddl/contrib/opensolaris/ > uts/common/rpc/xdr.c) > = > = > = > = > = > = > = > = > ====================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/cddl/contrib/opensolaris/uts/common/rpc/ > opensolaris_xdr.c Mon May 11 04:18:58 2009 (r191984, copy of > r191983, head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.c) > @@ -0,0 +1,621 @@ > +/* > + * CDDL HEADER START > + * > + * The contents of this file are subject to the terms of the > + * Common Development and Distribution License (the "License"). > + * You may not use this file except in compliance with the License. > + * > + * You can obtain a copy of the license at usr/src/ > OPENSOLARIS.LICENSE > + * or http://www.opensolaris.org/os/licensing. > + * See the License for the specific language governing permissions > + * and limitations under the License. > + * > + * When distributing Covered Code, include this CDDL HEADER in each > + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. > + * If applicable, add the following below this CDDL HEADER, with the > + * fields enclosed by brackets "[]" replaced with your own > identifying > + * information: Portions Copyright [yyyy] [name of copyright owner] > + * > + * CDDL HEADER END > + */ > +/* > + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. > + * Use is subject to license terms. > + */ > + > +/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ > +/* All Rights Reserved */ > + > +/* > + * Portions of this source code were derived from Berkeley 4.3 BSD > + * under license from the Regents of the University of California. > + */ > + > +/* > + * xdr.c, generic XDR routines implementation. > + * These are the "generic" xdr routines used to serialize and de- > serialize > + * most common data items. See xdr.h for more info on the > interface to > + * xdr. > + */ > + > +#include > +#include > +#include > +#include > + > +#include > +#include > + > +#pragma weak xdr_int32_t = xdr_int > +#pragma weak xdr_uint32_t = xdr_u_int > +#pragma weak xdr_int64_t = xdr_longlong_t > +#pragma weak xdr_uint64_t = xdr_u_longlong_t > + > +#if defined(sun) > +#if !defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN) > +#error "Exactly one of _BIG_ENDIAN or _LITTLE_ENDIAN must be defined" > +#elif defined(_BIG_ENDIAN) && defined(_LITTLE_ENDIAN) > +#error "Only one of _BIG_ENDIAN or _LITTLE_ENDIAN may be defined" > +#endif > +#endif > + > +/* > + * constants specific to the xdr "protocol" > + */ > +#define XDR_FALSE ((int32_t)0) > +#define XDR_TRUE ((int32_t)1) > +#define LASTUNSIGNED ((uint_t)0-1) > + > +/* > + * for unit alignment > + */ > +static char xdr_zero[BYTES_PER_XDR_UNIT] = { 0, 0, 0, 0 }; > + > +/* > + * Free a data structure using XDR > + * Not a filter, but a convenient utility nonetheless > + */ > +void > +xdr_free(xdrproc_t proc, char *objp) > +{ > + XDR x; > + > + x.x_op = XDR_FREE; > + (*proc)(&x, objp); > +} > + > +/* > + * XDR nothing > + */ > +bool_t > +xdr_void(void) > +{ > + return (TRUE); > +} > + > +/* > + * XDR integers > + * > + * PSARC 2003/523 Contract Private Interface > + * xdr_int > + * Changes must be reviewed by Solaris File Sharing > + * Changes must be communicated to contract-2003-523@sun.com > + */ > +bool_t > +xdr_int(XDR *xdrs, int *ip) > +{ > + if (xdrs->x_op == XDR_ENCODE) > + return (XDR_PUTINT32(xdrs, ip)); > + > + if (xdrs->x_op == XDR_DECODE) > + return (XDR_GETINT32(xdrs, ip)); > + > + if (xdrs->x_op == XDR_FREE) > + return (TRUE); > + > + return (FALSE); > +} > + > +/* > + * XDR unsigned integers > + * > + * PSARC 2003/523 Contract Private Interface > + * xdr_u_int > + * Changes must be reviewed by Solaris File Sharing > + * Changes must be communicated to contract-2003-523@sun.com > + */ > +bool_t > +xdr_u_int(XDR *xdrs, uint_t *up) > +{ > + if (xdrs->x_op == XDR_ENCODE) > + return (XDR_PUTINT32(xdrs, (int32_t *)up)); > + > + if (xdrs->x_op == XDR_DECODE) > + return (XDR_GETINT32(xdrs, (int32_t *)up)); > + > + if (xdrs->x_op == XDR_FREE) > + return (TRUE); > + > + return (FALSE); > +} > + > + > +#if defined(_ILP32) > +/* > + * xdr_long and xdr_u_long for binary compatability on ILP32 kernels. > + * > + * No prototypes since new code should not be using these interfaces. > + */ > +bool_t > +xdr_long(XDR *xdrs, long *ip) > +{ > + return (xdr_int(xdrs, (int *)ip)); > +} > + > +bool_t > +xdr_u_long(XDR *xdrs, unsigned long *up) > +{ > + return (xdr_u_int(xdrs, (uint_t *)up)); > +} > +#endif /* _ILP32 */ > + > + > +/* > + * XDR long long integers > + */ > +bool_t > +xdr_longlong_t(XDR *xdrs, longlong_t *hp) > +{ > + if (xdrs->x_op == XDR_ENCODE) { > +#if BYTE_ORDER == _LITTLE_ENDIAN > + if (XDR_PUTINT32(xdrs, (int32_t *)((char *)hp + > + BYTES_PER_XDR_UNIT)) == TRUE) { > + return (XDR_PUTINT32(xdrs, (int32_t *)hp)); > + } > +#else > + if (XDR_PUTINT32(xdrs, (int32_t *)hp) == TRUE) { > + return (XDR_PUTINT32(xdrs, (int32_t *)((char *)hp + > + BYTES_PER_XDR_UNIT))); > + } > +#endif > + return (FALSE); > + > + } > + if (xdrs->x_op == XDR_DECODE) { > +#if BYTE_ORDER == _LITTLE_ENDIAN > + if (XDR_GETINT32(xdrs, (int32_t *)((char *)hp + > + BYTES_PER_XDR_UNIT)) == TRUE) { > + return (XDR_GETINT32(xdrs, (int32_t *)hp)); > + } > +#else > + if (XDR_GETINT32(xdrs, (int32_t *)hp) == TRUE) { > + return (XDR_GETINT32(xdrs, (int32_t *)((char *)hp + > + BYTES_PER_XDR_UNIT))); > + } > +#endif > + return (FALSE); > + } > + return (TRUE); > +} > + > +/* > + * XDR unsigned long long integers > + */ > +bool_t > +xdr_u_longlong_t(XDR *xdrs, u_longlong_t *hp) > +{ > + > + if (xdrs->x_op == XDR_ENCODE) { > +#if BYTE_ORDER == _LITTLE_ENDIAN > + if (XDR_PUTINT32(xdrs, (int32_t *)((char *)hp + > + BYTES_PER_XDR_UNIT)) == TRUE) { > + return (XDR_PUTINT32(xdrs, (int32_t *)hp)); > + } > +#else > + if (XDR_PUTINT32(xdrs, (int32_t *)hp) == TRUE) { > + return (XDR_PUTINT32(xdrs, (int32_t *)((char *)hp + > + BYTES_PER_XDR_UNIT))); > + } > +#endif > + return (FALSE); > + > + } > + if (xdrs->x_op == XDR_DECODE) { > +#if BYTE_ORDER == _LITTLE_ENDIAN > + if (XDR_GETINT32(xdrs, (int32_t *)((char *)hp + > + BYTES_PER_XDR_UNIT)) == TRUE) { > + return (XDR_GETINT32(xdrs, (int32_t *)hp)); > + } > +#else > + if (XDR_GETINT32(xdrs, (int32_t *)hp) == TRUE) { > + return (XDR_GETINT32(xdrs, (int32_t *)((char *)hp + > + BYTES_PER_XDR_UNIT))); > + } > +#endif > + return (FALSE); > + } > + return (TRUE); > +} > + > +/* > + * XDR short integers > + */ > +bool_t > +xdr_short(XDR *xdrs, short *sp) > +{ > + int32_t l; > + > + switch (xdrs->x_op) { > + > + case XDR_ENCODE: > + l = (int32_t)*sp; > + return (XDR_PUTINT32(xdrs, &l)); > + > + case XDR_DECODE: > + if (!XDR_GETINT32(xdrs, &l)) > + return (FALSE); > + *sp = (short)l; > + return (TRUE); > + > + case XDR_FREE: > + return (TRUE); > + } > + return (FALSE); > +} > + > +/* > + * XDR unsigned short integers > + */ > +bool_t > +xdr_u_short(XDR *xdrs, ushort_t *usp) > +{ > + uint32_t l; > + > + switch (xdrs->x_op) { > + > + case XDR_ENCODE: > + l = (uint32_t)*usp; > + return (XDR_PUTINT32(xdrs, (int32_t *)&l)); > + > + case XDR_DECODE: > + if (!XDR_GETINT32(xdrs, (int32_t *)&l)) { > + return (FALSE); > + } > + *usp = (ushort_t)l; > + return (TRUE); > + > + case XDR_FREE: > + return (TRUE); > + } > + return (FALSE); > +} > + > + > +/* > + * XDR a char > + */ > +bool_t > +xdr_char(XDR *xdrs, char *cp) > +{ > + int i; > + > + i = (*cp); > + if (!xdr_int(xdrs, &i)) { > + return (FALSE); > + } > + *cp = (char)i; > + return (TRUE); > +} > + > +/* > + * XDR booleans > + * > + * PSARC 2003/523 Contract Private Interface > + * xdr_bool > + * Changes must be reviewed by Solaris File Sharing > + * Changes must be communicated to contract-2003-523@sun.com > + */ > +bool_t > +xdr_bool(XDR *xdrs, bool_t *bp) > +{ > + int32_t i32b; > + > + switch (xdrs->x_op) { > + > + case XDR_ENCODE: > + i32b = *bp ? XDR_TRUE : XDR_FALSE; > + return (XDR_PUTINT32(xdrs, &i32b)); > + > + case XDR_DECODE: > + if (!XDR_GETINT32(xdrs, &i32b)) { > + return (FALSE); > + } > + *bp = (i32b == XDR_FALSE) ? FALSE : TRUE; > + return (TRUE); > + > + case XDR_FREE: > + return (TRUE); > + } > + return (FALSE); > +} > + > +/* > + * XDR enumerations > + * > + * PSARC 2003/523 Contract Private Interface > + * xdr_enum > + * Changes must be reviewed by Solaris File Sharing > + * Changes must be communicated to contract-2003-523@sun.com > + */ > +#ifndef lint > +enum sizecheck { SIZEVAL } sizecheckvar; /* used to find the size > of */ > + /* an enum */ > +#endif > +bool_t > +xdr_enum(XDR *xdrs, enum_t *ep) > +{ > +#ifndef lint > + /* > + * enums are treated as ints > + */ > + if (sizeof (sizecheckvar) == sizeof (int32_t)) { > + return (xdr_int(xdrs, (int32_t *)ep)); > + } else if (sizeof (sizecheckvar) == sizeof (short)) { > + return (xdr_short(xdrs, (short *)ep)); > + } else { > + return (FALSE); > + } > +#else > + (void) (xdr_short(xdrs, (short *)ep)); > + return (xdr_int(xdrs, (int32_t *)ep)); > +#endif > +} > + > +/* > + * XDR opaque data > + * Allows the specification of a fixed size sequence of opaque bytes. > + * cp points to the opaque object and cnt gives the byte length. > + * > + * PSARC 2003/523 Contract Private Interface > + * xdr_opaque > + * Changes must be reviewed by Solaris File Sharing > + * Changes must be communicated to contract-2003-523@sun.com > + */ > +bool_t > +xdr_opaque(XDR *xdrs, caddr_t cp, const uint_t cnt) > +{ > + uint_t rndup; > + static char crud[BYTES_PER_XDR_UNIT]; > + > + /* > + * if no data we are done > + */ > + if (cnt == 0) > + return (TRUE); > + > + /* > + * round byte count to full xdr units > + */ > + rndup = cnt % BYTES_PER_XDR_UNIT; > + if (rndup != 0) > + rndup = BYTES_PER_XDR_UNIT - rndup; > + > + if (xdrs->x_op == XDR_DECODE) { > + if (!XDR_GETBYTES(xdrs, cp, cnt)) { > + return (FALSE); > + } > + if (rndup == 0) > + return (TRUE); > + return (XDR_GETBYTES(xdrs, (caddr_t)crud, rndup)); > + } > + > + if (xdrs->x_op == XDR_ENCODE) { > + if (!XDR_PUTBYTES(xdrs, cp, cnt)) { > + return (FALSE); > + } > + if (rndup == 0) > + return (TRUE); > + return (XDR_PUTBYTES(xdrs, xdr_zero, rndup)); > + } > + > + if (xdrs->x_op == XDR_FREE) > + return (TRUE); > + > + return (FALSE); > +} > + > +/* > + * XDR counted bytes > + * *cpp is a pointer to the bytes, *sizep is the count. > + * If *cpp is NULL maxsize bytes are allocated > + * > + * PSARC 2003/523 Contract Private Interface > + * xdr_bytes > + * Changes must be reviewed by Solaris File Sharing > + * Changes must be communicated to contract-2003-523@sun.com > + */ > +bool_t > +xdr_bytes(XDR *xdrs, char **cpp, uint_t *sizep, const uint_t maxsize) > +{ > + char *sp = *cpp; /* sp is the actual string pointer */ > + uint_t nodesize; > + > + /* > + * first deal with the length since xdr bytes are counted > + */ > + if (!xdr_u_int(xdrs, sizep)) { > + return (FALSE); > + } > + nodesize = *sizep; > + if ((nodesize > maxsize) && (xdrs->x_op != XDR_FREE)) { > + return (FALSE); > + } > + > + /* > + * now deal with the actual bytes > + */ > + switch (xdrs->x_op) { > + case XDR_DECODE: > + if (nodesize == 0) > + return (TRUE); > + if (sp == NULL) > + *cpp = sp = (char *)mem_alloc(nodesize); > + /* FALLTHROUGH */ > + > + case XDR_ENCODE: > + return (xdr_opaque(xdrs, sp, nodesize)); > + > + case XDR_FREE: > + if (sp != NULL) { > + mem_free(sp, nodesize); > + *cpp = NULL; > + } > + return (TRUE); > + } > + return (FALSE); > +} > + > +/* > + * Implemented here due to commonality of the object. > + */ > +bool_t > +xdr_netobj(XDR *xdrs, struct netobj *np) > +{ > + return (xdr_bytes(xdrs, &np->n_bytes, &np->n_len, MAX_NETOBJ_SZ)); > +} > + > +/* > + * XDR a descriminated union > + * Support routine for discriminated unions. > + * You create an array of xdrdiscrim structures, terminated with > + * an entry with a null procedure pointer. The routine gets > + * the discriminant value and then searches the array of xdrdiscrims > + * looking for that value. It calls the procedure given in the > xdrdiscrim > + * to handle the discriminant. If there is no specific routine a > default > + * routine may be called. > + * If there is no specific or default routine an error is returned. > + */ > +bool_t > +xdr_union(XDR *xdrs, enum_t *dscmp, char *unp, > + const struct xdr_discrim *choices, const xdrproc_t dfault) > +{ > + enum_t dscm; > + > + /* > + * we deal with the discriminator; it's an enum > + */ > + if (!xdr_enum(xdrs, dscmp)) { > + return (FALSE); > + } > + dscm = *dscmp; > + > + /* > + * search choices for a value that matches the discriminator. > + * if we find one, execute the xdr routine for that value. > + */ > + for (; choices->proc != NULL_xdrproc_t; choices++) { > + if (choices->value == dscm) > + return ((*(choices->proc))(xdrs, unp, LASTUNSIGNED)); > + } > + > + /* > + * no match - execute the default xdr routine if there is one > + */ > + return ((dfault == NULL_xdrproc_t) ? FALSE : > + (*dfault)(xdrs, unp, LASTUNSIGNED)); > +} > + > + > +/* > + * Non-portable xdr primitives. > + * Care should be taken when moving these routines to new > architectures. > + */ > + > + > +/* > + * XDR null terminated ASCII strings > + * xdr_string deals with "C strings" - arrays of bytes that are > + * terminated by a NULL character. The parameter cpp references a > + * pointer to storage; If the pointer is null, then the necessary > + * storage is allocated. The last parameter is the max allowed > length > + * of the string as specified by a protocol. > + */ > +bool_t > +xdr_string(XDR *xdrs, char **cpp, const uint_t maxsize) > +{ > + char *sp = *cpp; /* sp is the actual string pointer */ > + uint_t size; > + uint_t nodesize; > + > + /* > + * first deal with the length since xdr strings are counted-strings > + */ > + switch (xdrs->x_op) { > + case XDR_FREE: > + if (sp == NULL) > + return (TRUE); /* already free */ > + /* FALLTHROUGH */ > + case XDR_ENCODE: > + size = (sp != NULL) ? (uint_t)strlen(sp) : 0; > + break; > + case XDR_DECODE: > + break; > + } > + if (!xdr_u_int(xdrs, &size)) { > + return (FALSE); > + } > + if (size > maxsize) { > + return (FALSE); > + } > + nodesize = size + 1; > + > + /* > + * now deal with the actual bytes > + */ > + switch (xdrs->x_op) { > + case XDR_DECODE: > + if (nodesize == 0) > + return (TRUE); > + if (sp == NULL) > + sp = (char *)mem_alloc(nodesize); > + sp[size] = 0; > + if (!xdr_opaque(xdrs, sp, size)) { > + /* > + * free up memory if allocated here > + */ > + if (*cpp == NULL) { > + mem_free(sp, nodesize); > + } > + return (FALSE); > + } > + if (strlen(sp) != size) { > + if (*cpp == NULL) { > + mem_free(sp, nodesize); > + } > + return (FALSE); > + } > + *cpp = sp; > + return (TRUE); > + > + case XDR_ENCODE: > + return (xdr_opaque(xdrs, sp, size)); > + > + case XDR_FREE: > + mem_free(sp, nodesize); > + *cpp = NULL; > + return (TRUE); > + } > + return (FALSE); > +} > + > +/* > + * Wrapper for xdr_string that can be called directly from > + * routines like clnt_call > + */ > +bool_t > +xdr_wrapstring(XDR *xdrs, char **cpp) > +{ > + if (xdr_string(xdrs, cpp, LASTUNSIGNED)) > + return (TRUE); > + return (FALSE); > +} > > Copied: head/sys/cddl/contrib/opensolaris/uts/common/rpc/ > opensolaris_xdr_array.c (from r191983, head/sys/cddl/contrib/ > opensolaris/uts/common/rpc/xdr_array.c) > = > = > = > = > = > = > = > = > ====================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/cddl/contrib/opensolaris/uts/common/rpc/ > opensolaris_xdr_array.c Mon May 11 04:18:58 2009 (r191984, copy of > r191983, head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_array.c) > @@ -0,0 +1,114 @@ > +/* > + * CDDL HEADER START > + * > + * The contents of this file are subject to the terms of the > + * Common Development and Distribution License (the "License"). > + * You may not use this file except in compliance with the License. > + * > + * You can obtain a copy of the license at usr/src/ > OPENSOLARIS.LICENSE > + * or http://www.opensolaris.org/os/licensing. > + * See the License for the specific language governing permissions > + * and limitations under the License. > + * > + * When distributing Covered Code, include this CDDL HEADER in each > + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. > + * If applicable, add the following below this CDDL HEADER, with the > + * fields enclosed by brackets "[]" replaced with your own > identifying > + * information: Portions Copyright [yyyy] [name of copyright owner] > + * > + * CDDL HEADER END > + */ > +/* > + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. > + * Use is subject to license terms. > + */ > + > +/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ > +/* All Rights Reserved */ > + > +/* > + * Portions of this source code were derived from Berkeley 4.3 BSD > + * under license from the Regents of the University of California. > + */ > + > +/* > + * xdr_array.c, Generic XDR routines impelmentation. > + * These are the "non-trivial" xdr primitives used to serialize and > de-serialize > + * arrays. See xdr.h for more info on the interface to xdr. > + */ > + > +#include > +#include > +#include > +#include > + > +#include > +#include > + > +#define LASTUNSIGNED ((uint_t)0-1) > + > +/* > + * XDR an array of arbitrary elements > + * *addrp is a pointer to the array, *sizep is the number of > elements. > + * If addrp is NULL (*sizep * elsize) bytes are allocated. > + * elsize is the size (in bytes) of each element, and elproc is the > + * xdr procedure to call to handle each element of the array. > + */ > +bool_t > +xdr_array(XDR *xdrs, caddr_t *addrp, uint_t *sizep, const uint_t > maxsize, > + const uint_t elsize, const xdrproc_t elproc) > +{ > + uint_t i; > + caddr_t target = *addrp; > + uint_t c; /* the actual element count */ > + bool_t stat = TRUE; > + uint_t nodesize; > + > + /* like strings, arrays are really counted arrays */ > + if (!xdr_u_int(xdrs, sizep)) { > + return (FALSE); > + } > + c = *sizep; > + if ((c > maxsize || LASTUNSIGNED / elsize < c) && > + xdrs->x_op != XDR_FREE) { > + return (FALSE); > + } > + nodesize = c * elsize; > + > + /* > + * if we are deserializing, we may need to allocate an array. > + * We also save time by checking for a null array if we are freeing. > + */ > + if (target == NULL) > + switch (xdrs->x_op) { > + case XDR_DECODE: > + if (c == 0) > + return (TRUE); > + *addrp = target = (char *)mem_alloc(nodesize); > + bzero(target, nodesize); > + break; > + > + case XDR_FREE: > + return (TRUE); > + > + case XDR_ENCODE: > + break; > + } > + > + /* > + * now we xdr each element of array > + */ > + for (i = 0; (i < c) && stat; i++) { > + stat = (*elproc)(xdrs, target, LASTUNSIGNED); > + target += elsize; > + } > + > + /* > + * the array may need freeing > + */ > + if (xdrs->x_op == XDR_FREE) { > + mem_free(*addrp, nodesize); > + *addrp = NULL; > + } > + return (stat); > +} > > Copied: head/sys/cddl/contrib/opensolaris/uts/common/rpc/ > opensolaris_xdr_mem.c (from r191983, head/sys/cddl/contrib/ > opensolaris/uts/common/rpc/xdr_mem.c) > = > = > = > = > = > = > = > = > ====================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/cddl/contrib/opensolaris/uts/common/rpc/ > opensolaris_xdr_mem.c Mon May 11 04:18:58 2009 (r191984, copy of > r191983, head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_mem.c) > @@ -0,0 +1,209 @@ > +/* > + * CDDL HEADER START > + * > + * The contents of this file are subject to the terms of the > + * Common Development and Distribution License, Version 1.0 only > + * (the "License"). You may not use this file except in compliance > + * with the License. > + * > + * You can obtain a copy of the license at usr/src/ > OPENSOLARIS.LICENSE > + * or http://www.opensolaris.org/os/licensing. > + * See the License for the specific language governing permissions > + * and limitations under the License. > + * > + * When distributing Covered Code, include this CDDL HEADER in each > + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. > + * If applicable, add the following below this CDDL HEADER, with the > + * fields enclosed by brackets "[]" replaced with your own > identifying > + * information: Portions Copyright [yyyy] [name of copyright owner] > + * > + * CDDL HEADER END > + */ > +/* > + * Copyright 2005 Sun Microsystems, Inc. All rights reserved. > + * Use is subject to license terms. > + */ > + > +/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ > +/* All Rights Reserved */ > + > +/* > + * Portions of this source code were derived from Berkeley 4.3 BSD > + * under license from the Regents of the University of California. > + */ > + > +#pragma ident "%Z%%M% %I% %E% SMI" > + > +/* > + * xdr_mem.c, XDR implementation using memory buffers. > + * > + * If you have some data to be interpreted as external data > representation > + * or to be converted to external data representation in a memory > buffer, > + * then this is the package for you. > + */ > + > +#include > +#include > +#include > + > +#include > +#include > + > +static struct xdr_ops *xdrmem_ops(void); > + > +/* > + * The procedure xdrmem_create initializes a stream descriptor for a > + * memory buffer. > + */ > +void > +xdrmem_create(XDR *xdrs, caddr_t addr, uint_t size, enum xdr_op op) > +{ > + xdrs->x_op = op; > + xdrs->x_ops = xdrmem_ops(); > + xdrs->x_private = xdrs->x_base = addr; > + xdrs->x_handy = size; > + xdrs->x_public = NULL; > +} > + > +/* ARGSUSED */ > +static void > +xdrmem_destroy(XDR *xdrs) > +{ > +} > + > +static bool_t > +xdrmem_getint32(XDR *xdrs, int32_t *int32p) > +{ > + if ((xdrs->x_handy -= (int)sizeof (int32_t)) < 0) > + return (FALSE); > + /* LINTED pointer alignment */ > + *int32p = (int32_t)ntohl((uint32_t)(*((int32_t *)(xdrs- > >x_private)))); > + xdrs->x_private += sizeof (int32_t); > + return (TRUE); > +} > + > +static bool_t > +xdrmem_putint32(XDR *xdrs, int32_t *int32p) > +{ > + if ((xdrs->x_handy -= (int)sizeof (int32_t)) < 0) > + return (FALSE); > + /* LINTED pointer alignment */ > + *(int32_t *)xdrs->x_private = (int32_t)htonl((uint32_t)(*int32p)); > + xdrs->x_private += sizeof (int32_t); > + return (TRUE); > +} > + > +static bool_t > +xdrmem_getbytes(XDR *xdrs, caddr_t addr, int len) > +{ > + if ((xdrs->x_handy -= len) < 0) > + return (FALSE); > + bcopy(xdrs->x_private, addr, len); > + xdrs->x_private += len; > + return (TRUE); > +} > + > +static bool_t > +xdrmem_putbytes(XDR *xdrs, caddr_t addr, int len) > +{ > + if ((xdrs->x_handy -= len) < 0) > + return (FALSE); > + bcopy(addr, xdrs->x_private, len); > + xdrs->x_private += len; > + return (TRUE); > +} > + > +static uint_t > +xdrmem_getpos(XDR *xdrs) > +{ > + return ((uint_t)((uintptr_t)xdrs->x_private - (uintptr_t)xdrs- > >x_base)); > +} > + > +static bool_t > +xdrmem_setpos(XDR *xdrs, uint_t pos) > +{ > + caddr_t newaddr = xdrs->x_base + pos; > + caddr_t lastaddr = xdrs->x_private + xdrs->x_handy; > + ptrdiff_t diff; > + > + if (newaddr > lastaddr) > + return (FALSE); > + xdrs->x_private = newaddr; > + diff = lastaddr - newaddr; > + xdrs->x_handy = (int)diff; > + return (TRUE); > +} > + > +static rpc_inline_t * > +xdrmem_inline(XDR *xdrs, int len) > +{ > + rpc_inline_t *buf = NULL; > + > + if (xdrs->x_handy >= len) { > + xdrs->x_handy -= len; > + /* LINTED pointer alignment */ > + buf = (rpc_inline_t *)xdrs->x_private; > + xdrs->x_private += len; > + } > + return (buf); > +} > + > +static bool_t > +xdrmem_control(XDR *xdrs, int request, void *info) > +{ > + xdr_bytesrec *xptr; > + int32_t *int32p; > + int len; > + > + switch (request) { > + > + case XDR_GET_BYTES_AVAIL: > + xptr = (xdr_bytesrec *)info; > + xptr->xc_is_last_record = TRUE; > + xptr->xc_num_avail = xdrs->x_handy; > + return (TRUE); > + > + case XDR_PEEK: > + /* > + * Return the next 4 byte unit in the XDR stream. > + */ > + if (xdrs->x_handy < sizeof (int32_t)) > + return (FALSE); > + int32p = (int32_t *)info; > + *int32p = (int32_t)ntohl((uint32_t) > + (*((int32_t *)(xdrs->x_private)))); > + return (TRUE); > + > + case XDR_SKIPBYTES: > + /* > + * Skip the next N bytes in the XDR stream. > + */ > + int32p = (int32_t *)info; > + len = RNDUP((int)(*int32p)); > + if ((xdrs->x_handy -= len) < 0) > + return (FALSE); > + xdrs->x_private += len; > + return (TRUE); > + > + } > + return (FALSE); > +} > + > +static struct xdr_ops * > +xdrmem_ops(void) > +{ > + static struct xdr_ops ops; > + > + if (ops.x_getint32 == NULL) { > + ops.x_getbytes = xdrmem_getbytes; > + ops.x_putbytes = xdrmem_putbytes; > + ops.x_getpostn = xdrmem_getpos; > + ops.x_setpostn = xdrmem_setpos; > + ops.x_inline = xdrmem_inline; > + ops.x_destroy = xdrmem_destroy; > + ops.x_control = xdrmem_control; > + ops.x_getint32 = xdrmem_getint32; > + ops.x_putint32 = xdrmem_putint32; > + } > + return (&ops); > +} > > Modified: head/sys/modules/zfs/Makefile > = > = > = > = > = > = > = > = > ====================================================================== > --- head/sys/modules/zfs/Makefile Mon May 11 02:39:49 2009 (r191983) > +++ head/sys/modules/zfs/Makefile Mon May 11 04:18:58 2009 (r191984) > @@ -44,9 +44,9 @@ SRCS+= nvpair_alloc_system.c > SRCS+= taskq.c > > .PATH: ${SUNW}/uts/common/rpc > -SRCS+= xdr.c > -SRCS+= xdr_array.c > -SRCS+= xdr_mem.c > +SRCS+= opensolaris_xdr.c > +SRCS+= opensolaris_xdr_array.c > +SRCS+= opensolaris_xdr_mem.c > > .PATH: ${SUNW}/uts/common/zmod > SRCS+= adler32.c From owner-svn-src-head@FreeBSD.ORG Mon May 11 18:45:04 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C9300106566C; Mon, 11 May 2009 18:45:04 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B743A8FC12; Mon, 11 May 2009 18:45:04 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4BIj4JN099123; Mon, 11 May 2009 18:45:04 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4BIj4gV099122; Mon, 11 May 2009 18:45:04 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200905111845.n4BIj4gV099122@svn.freebsd.org> From: Rick Macklem Date: Mon, 11 May 2009 18:45:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191998 - head/sys/fs/nfsserver X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 May 2009 18:45:05 -0000 Author: rmacklem Date: Mon May 11 18:45:04 2009 New Revision: 191998 URL: http://svn.freebsd.org/changeset/base/191998 Log: Modify nfsvno_fhtovp() to ensure that it always sets the credp argument. Returning without credp set could result in a caller doing crfree() on garbage. Reviewed by: kan Approved by: kib (mentor) Modified: head/sys/fs/nfsserver/nfs_nfsdport.c Modified: head/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdport.c Mon May 11 18:20:34 2009 (r191997) +++ head/sys/fs/nfsserver/nfs_nfsdport.c Mon May 11 18:45:04 2009 (r191998) @@ -2422,6 +2422,7 @@ nfsvno_fhtovp(struct mount *mp, fhandle_ int error; int numsecflavor, *secflavors; + *credp = NULL; error = VFS_FHTOVP(mp, &fhp->fh_fid, vpp); if (nam && !error) { error = VFS_CHECKEXP(mp, nam, &exp->nes_exflag, credp, From owner-svn-src-head@FreeBSD.ORG Mon May 11 18:52:46 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A5F56106566C; Mon, 11 May 2009 18:52:46 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9468C8FC17; Mon, 11 May 2009 18:52:46 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4BIqku0099293; Mon, 11 May 2009 18:52:46 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4BIqkMd099292; Mon, 11 May 2009 18:52:46 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200905111852.n4BIqkMd099292@svn.freebsd.org> From: Ed Schouten Date: Mon, 11 May 2009 18:52:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191999 - head/sys/dev/snp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 May 2009 18:52:47 -0000 Author: ed Date: Mon May 11 18:52:46 2009 New Revision: 191999 URL: http://svn.freebsd.org/changeset/base/191999 Log: Add macros around the sx operations in snp(4). As an experiment, I changed snp(4) to use a mutex instead of an sx lock. We can't enable this right now, because Syscons still picks up Giant. It's nice to already have the framework there. Modified: head/sys/dev/snp/snp.c Modified: head/sys/dev/snp/snp.c ============================================================================== --- head/sys/dev/snp/snp.c Mon May 11 18:45:04 2009 (r191998) +++ head/sys/dev/snp/snp.c Mon May 11 18:52:46 2009 (r191999) @@ -43,11 +43,22 @@ __FBSDID("$FreeBSD$"); #include static struct cdev *snp_dev; +static MALLOC_DEFINE(M_SNP, "snp", "tty snoop device"); + /* XXX: should be mtx, but TTY can be locked by Giant. */ +#if 0 +static struct mtx snp_register_lock; +MTX_SYSINIT(snp_register_lock, &snp_register_lock, + "tty snoop registration", MTX_DEF); +#define SNP_LOCK() mtx_lock(&snp_register_lock) +#define SNP_UNLOCK() mtx_unlock(&snp_register_lock) +#else static struct sx snp_register_lock; SX_SYSINIT(snp_register_lock, &snp_register_lock, "tty snoop registration"); -static MALLOC_DEFINE(M_SNP, "snp", "tty snoop device"); +#define SNP_LOCK() sx_xlock(&snp_register_lock) +#define SNP_UNLOCK() sx_xunlock(&snp_register_lock) +#endif /* * There is no need to have a big input buffer. In most typical setups, @@ -241,14 +252,14 @@ snp_ioctl(struct cdev *dev, u_long cmd, switch (cmd) { case SNPSTTY: /* Bind TTY to snoop instance. */ - sx_xlock(&snp_register_lock); + SNP_LOCK(); if (ss->snp_tty != NULL) { - sx_xunlock(&snp_register_lock); + SNP_UNLOCK(); return (EBUSY); } error = ttyhook_register(&ss->snp_tty, td->td_proc, *(int *)data, &snp_hook, ss); - sx_xunlock(&snp_register_lock); + SNP_UNLOCK(); if (error != 0) return (error); From owner-svn-src-head@FreeBSD.ORG Mon May 11 19:23:40 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F3E3E106566B; Mon, 11 May 2009 19:23:39 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: from yx-out-2324.google.com (yx-out-2324.google.com [74.125.44.30]) by mx1.freebsd.org (Postfix) with ESMTP id 56A258FC13; Mon, 11 May 2009 19:23:39 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: by yx-out-2324.google.com with SMTP id 8so1780992yxb.13 for ; Mon, 11 May 2009 12:23:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=UGOMD+hGQBkc6SOOj76UaCMGoX2p1snN4WOZooMHkvU=; b=t101Hvb1HBaoSA0coS5bEkIIjNPYJ8uEllSYP5jFOaHwS/ssZbQrOvyZccVYL4ftua +K824rsXcUZltnxUvcAeTXU6wTTtD8puEK7kN7/lHNqkCmvdLeiWqZG+1PkadefQIcku 8ofBitP6bEiANvF/a10wP40aQwOklduLJX0gE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=fp8ngmz5oYjns7TKXc0htTxaLQHNaJBVJ6iE8mdiI1VBD5YY1EWj+sa061mr4b/mIR J2JB22MCISMVq8NwrOkw2O7+X3CLPSvqyMOhDDIV0rCSXSGT6RL1iN2lHwPcNw2SSMAr 3WBvPE1YJdW6nWp+wGHUQ3jeZ6OlyCRHur250= MIME-Version: 1.0 Sender: mat.macy@gmail.com Received: by 10.100.142.19 with SMTP id p19mr16253218and.13.1242069818452; Mon, 11 May 2009 12:23:38 -0700 (PDT) In-Reply-To: <0E48393C-F519-42A1-AD3C-3EC31EE2AE06@rabson.org> References: <200905110418.n4B4IxPC077484@svn.freebsd.org> <0E48393C-F519-42A1-AD3C-3EC31EE2AE06@rabson.org> Date: Mon, 11 May 2009 12:23:38 -0700 X-Google-Sender-Auth: 7ee2184eba6a3554 Message-ID: <3c1674c90905111223u74ec12ch9f40772940a42396@mail.gmail.com> From: Kip Macy To: Doug Rabson Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191984 - in head/sys: cddl/contrib/opensolaris/uts/common/rpc modules/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 May 2009 19:23:40 -0000 On Mon, May 11, 2009 at 11:21 AM, Doug Rabson wrote: > The XDR support code that is in the main kernel should have a very simila= r > API to the opensolaris bits, possibly identical. Perhaps the opensolaris > compat could use the main kernel's XDR implementation? I tried that. The label reads end up failing when ZFS uses the libkern implementation. Somewhere in there, there is a behavioral difference between the two implementations. At some point I'll track down the offending function. -Kip > > On 11 May 2009, at 05:18, Kip Macy wrote: > >> Author: kmacy >> Date: Mon May 11 04:18:58 2009 >> New Revision: 191984 >> URL: http://svn.freebsd.org/changeset/base/191984 >> >> Log: >> =A0rename xdr support files to avoid conflicts when linking in to the ke= rnel >> >> Added: >> =A0head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr.c >> (props changed) >> =A0 =A0- copied unchanged from r191983, >> head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.c >> =A0head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr_arra= y.c >> =A0 (props changed) >> =A0 =A0- copied unchanged from r191983, >> head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_array.c >> =A0head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr_mem.= c >> (props changed) >> =A0 =A0- copied unchanged from r191983, >> head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_mem.c >> Deleted: >> =A0head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.c >> =A0head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_array.c >> =A0head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_mem.c >> Modified: >> =A0head/sys/modules/zfs/Makefile >> >> Copied: head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr= .c >> (from r191983, head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.c) >> >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- /dev/null =A0 00:00:00 1970 =A0 (empty, because file is newly added) >> +++ head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr.c >> =A0 Mon May 11 04:18:58 2009 =A0 =A0 =A0 =A0(r191984, copy of r191983, >> head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.c) >> @@ -0,0 +1,621 @@ >> +/* >> + * CDDL HEADER START >> + * >> + * The contents of this file are subject to the terms of the >> + * Common Development and Distribution License (the "License"). >> + * You may not use this file except in compliance with the License. >> + * >> + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE >> + * or http://www.opensolaris.org/os/licensing. >> + * See the License for the specific language governing permissions >> + * and limitations under the License. >> + * >> + * When distributing Covered Code, include this CDDL HEADER in each >> + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. >> + * If applicable, add the following below this CDDL HEADER, with the >> + * fields enclosed by brackets "[]" replaced with your own identifying >> + * information: Portions Copyright [yyyy] [name of copyright owner] >> + * >> + * CDDL HEADER END >> + */ >> +/* >> + * Copyright 2008 Sun Microsystems, Inc. =A0All rights reserved. >> + * Use is subject to license terms. >> + */ >> + >> +/* =A0 =A0 Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T = =A0 =A0 */ >> +/* =A0 =A0 =A0 All Rights Reserved =A0 */ >> + >> +/* >> + * Portions of this source code were derived from Berkeley 4.3 BSD >> + * under license from the Regents of the University of California. >> + */ >> + >> +/* >> + * xdr.c, generic XDR routines implementation. >> + * These are the "generic" xdr routines used to serialize and >> de-serialize >> + * most common data items. =A0See xdr.h for more info on the interface = to >> + * xdr. >> + */ >> + >> +#include >> +#include >> +#include >> +#include >> + >> +#include >> +#include >> + >> +#pragma weak xdr_int32_t =3D xdr_int >> +#pragma weak xdr_uint32_t =3D xdr_u_int >> +#pragma weak xdr_int64_t =3D xdr_longlong_t >> +#pragma weak xdr_uint64_t =3D xdr_u_longlong_t >> + >> +#if defined(sun) >> +#if !defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN) >> +#error "Exactly one of _BIG_ENDIAN or _LITTLE_ENDIAN must be defined" >> +#elif defined(_BIG_ENDIAN) && defined(_LITTLE_ENDIAN) >> +#error "Only one of _BIG_ENDIAN or _LITTLE_ENDIAN may be defined" >> +#endif >> +#endif >> + >> +/* >> + * constants specific to the xdr "protocol" >> + */ >> +#define =A0 =A0 =A0 =A0XDR_FALSE =A0 =A0 =A0 ((int32_t)0) >> +#define =A0 =A0 =A0 =A0XDR_TRUE =A0 =A0 =A0 =A0((int32_t)1) >> +#define =A0 =A0 =A0 =A0LASTUNSIGNED =A0 =A0((uint_t)0-1) >> + >> +/* >> + * for unit alignment >> + */ >> +static char xdr_zero[BYTES_PER_XDR_UNIT] =3D { 0, 0, 0, 0 }; >> + >> +/* >> + * Free a data structure using XDR >> + * Not a filter, but a convenient utility nonetheless >> + */ >> +void >> +xdr_free(xdrproc_t proc, char *objp) >> +{ >> + =A0 =A0 =A0 XDR x; >> + >> + =A0 =A0 =A0 x.x_op =3D XDR_FREE; >> + =A0 =A0 =A0 (*proc)(&x, objp); >> +} >> + >> +/* >> + * XDR nothing >> + */ >> +bool_t >> +xdr_void(void) >> +{ >> + =A0 =A0 =A0 return (TRUE); >> +} >> + >> +/* >> + * XDR integers >> + * >> + * PSARC 2003/523 Contract Private Interface >> + * xdr_int >> + * Changes must be reviewed by Solaris File Sharing >> + * Changes must be communicated to contract-2003-523@sun.com >> + */ >> +bool_t >> +xdr_int(XDR *xdrs, int *ip) >> +{ >> + =A0 =A0 =A0 if (xdrs->x_op =3D=3D XDR_ENCODE) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (XDR_PUTINT32(xdrs, ip)); >> + >> + =A0 =A0 =A0 if (xdrs->x_op =3D=3D XDR_DECODE) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (XDR_GETINT32(xdrs, ip)); >> + >> + =A0 =A0 =A0 if (xdrs->x_op =3D=3D XDR_FREE) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >> + >> + =A0 =A0 =A0 return (FALSE); >> +} >> + >> +/* >> + * XDR unsigned integers >> + * >> + * PSARC 2003/523 Contract Private Interface >> + * xdr_u_int >> + * Changes must be reviewed by Solaris File Sharing >> + * Changes must be communicated to contract-2003-523@sun.com >> + */ >> +bool_t >> +xdr_u_int(XDR *xdrs, uint_t *up) >> +{ >> + =A0 =A0 =A0 if (xdrs->x_op =3D=3D XDR_ENCODE) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (XDR_PUTINT32(xdrs, (int32_t *)up))= ; >> + >> + =A0 =A0 =A0 if (xdrs->x_op =3D=3D XDR_DECODE) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (XDR_GETINT32(xdrs, (int32_t *)up))= ; >> + >> + =A0 =A0 =A0 if (xdrs->x_op =3D=3D XDR_FREE) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >> + >> + =A0 =A0 =A0 return (FALSE); >> +} >> + >> + >> +#if defined(_ILP32) >> +/* >> + * xdr_long and xdr_u_long for binary compatability on ILP32 kernels. >> + * >> + * No prototypes since new code should not be using these interfaces. >> + */ >> +bool_t >> +xdr_long(XDR *xdrs, long *ip) >> +{ >> + =A0 =A0 =A0 return (xdr_int(xdrs, (int *)ip)); >> +} >> + >> +bool_t >> +xdr_u_long(XDR *xdrs, unsigned long *up) >> +{ >> + =A0 =A0 =A0 return (xdr_u_int(xdrs, (uint_t *)up)); >> +} >> +#endif /* _ILP32 */ >> + >> + >> +/* >> + * XDR long long integers >> + */ >> +bool_t >> +xdr_longlong_t(XDR *xdrs, longlong_t *hp) >> +{ >> + =A0 =A0 =A0 if (xdrs->x_op =3D=3D XDR_ENCODE) { >> +#if BYTE_ORDER =3D=3D _LITTLE_ENDIAN >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (XDR_PUTINT32(xdrs, (int32_t *)((char *= )hp + >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 BYTES_PER_XDR_UNIT)) =3D=3D TRUE) = { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (XDR_PUTINT32(xdrs,= (int32_t *)hp)); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >> +#else >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (XDR_PUTINT32(xdrs, (int32_t *)hp) =3D= =3D TRUE) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (XDR_PUTINT32(xdrs,= (int32_t *)((char *)hp >> + >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 BYTES_PER_XDR_UNIT= ))); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >> +#endif >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >> + >> + =A0 =A0 =A0 } >> + =A0 =A0 =A0 if (xdrs->x_op =3D=3D XDR_DECODE) { >> +#if BYTE_ORDER =3D=3D _LITTLE_ENDIAN >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (XDR_GETINT32(xdrs, (int32_t *)((char *= )hp + >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 BYTES_PER_XDR_UNIT)) =3D=3D TRUE) = { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (XDR_GETINT32(xdrs,= (int32_t *)hp)); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >> +#else >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (XDR_GETINT32(xdrs, (int32_t *)hp) =3D= =3D TRUE) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (XDR_GETINT32(xdrs,= (int32_t *)((char *)hp >> + >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 BYTES_PER_XDR_UNIT= ))); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >> +#endif >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >> + =A0 =A0 =A0 } >> + =A0 =A0 =A0 return (TRUE); >> +} >> + >> +/* >> + * XDR unsigned long long integers >> + */ >> +bool_t >> +xdr_u_longlong_t(XDR *xdrs, u_longlong_t *hp) >> +{ >> + >> + =A0 =A0 =A0 if (xdrs->x_op =3D=3D XDR_ENCODE) { >> +#if BYTE_ORDER =3D=3D _LITTLE_ENDIAN >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (XDR_PUTINT32(xdrs, (int32_t *)((char *= )hp + >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 BYTES_PER_XDR_UNIT)) =3D=3D TRUE) = { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (XDR_PUTINT32(xdrs,= (int32_t *)hp)); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >> +#else >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (XDR_PUTINT32(xdrs, (int32_t *)hp) =3D= =3D TRUE) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (XDR_PUTINT32(xdrs,= (int32_t *)((char *)hp >> + >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 BYTES_PER_XDR_UNIT= ))); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >> +#endif >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >> + >> + =A0 =A0 =A0 } >> + =A0 =A0 =A0 if (xdrs->x_op =3D=3D XDR_DECODE) { >> +#if BYTE_ORDER =3D=3D _LITTLE_ENDIAN >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (XDR_GETINT32(xdrs, (int32_t *)((char *= )hp + >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 BYTES_PER_XDR_UNIT)) =3D=3D TRUE) = { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (XDR_GETINT32(xdrs,= (int32_t *)hp)); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >> +#else >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (XDR_GETINT32(xdrs, (int32_t *)hp) =3D= =3D TRUE) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (XDR_GETINT32(xdrs,= (int32_t *)((char *)hp >> + >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 BYTES_PER_XDR_UNIT= ))); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >> +#endif >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >> + =A0 =A0 =A0 } >> + =A0 =A0 =A0 return (TRUE); >> +} >> + >> +/* >> + * XDR short integers >> + */ >> +bool_t >> +xdr_short(XDR *xdrs, short *sp) >> +{ >> + =A0 =A0 =A0 int32_t l; >> + >> + =A0 =A0 =A0 switch (xdrs->x_op) { >> + >> + =A0 =A0 =A0 case XDR_ENCODE: >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 l =3D (int32_t)*sp; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (XDR_PUTINT32(xdrs, &l)); >> + >> + =A0 =A0 =A0 case XDR_DECODE: >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!XDR_GETINT32(xdrs, &l)) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 *sp =3D (short)l; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >> + >> + =A0 =A0 =A0 case XDR_FREE: >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >> + =A0 =A0 =A0 } >> + =A0 =A0 =A0 return (FALSE); >> +} >> + >> +/* >> + * XDR unsigned short integers >> + */ >> +bool_t >> +xdr_u_short(XDR *xdrs, ushort_t *usp) >> +{ >> + =A0 =A0 =A0 uint32_t l; >> + >> + =A0 =A0 =A0 switch (xdrs->x_op) { >> + >> + =A0 =A0 =A0 case XDR_ENCODE: >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 l =3D (uint32_t)*usp; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (XDR_PUTINT32(xdrs, (int32_t *)&l))= ; >> + >> + =A0 =A0 =A0 case XDR_DECODE: >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!XDR_GETINT32(xdrs, (int32_t *)&l)) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 *usp =3D (ushort_t)l; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >> + >> + =A0 =A0 =A0 case XDR_FREE: >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >> + =A0 =A0 =A0 } >> + =A0 =A0 =A0 return (FALSE); >> +} >> + >> + >> +/* >> + * XDR a char >> + */ >> +bool_t >> +xdr_char(XDR *xdrs, char *cp) >> +{ >> + =A0 =A0 =A0 int i; >> + >> + =A0 =A0 =A0 i =3D (*cp); >> + =A0 =A0 =A0 if (!xdr_int(xdrs, &i)) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >> + =A0 =A0 =A0 } >> + =A0 =A0 =A0 *cp =3D (char)i; >> + =A0 =A0 =A0 return (TRUE); >> +} >> + >> +/* >> + * XDR booleans >> + * >> + * PSARC 2003/523 Contract Private Interface >> + * xdr_bool >> + * Changes must be reviewed by Solaris File Sharing >> + * Changes must be communicated to contract-2003-523@sun.com >> + */ >> +bool_t >> +xdr_bool(XDR *xdrs, bool_t *bp) >> +{ >> + =A0 =A0 =A0 int32_t i32b; >> + >> + =A0 =A0 =A0 switch (xdrs->x_op) { >> + >> + =A0 =A0 =A0 case XDR_ENCODE: >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 i32b =3D *bp ? XDR_TRUE : XDR_FALSE; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (XDR_PUTINT32(xdrs, &i32b)); >> + >> + =A0 =A0 =A0 case XDR_DECODE: >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!XDR_GETINT32(xdrs, &i32b)) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 *bp =3D (i32b =3D=3D XDR_FALSE) ? FALSE : = TRUE; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >> + >> + =A0 =A0 =A0 case XDR_FREE: >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >> + =A0 =A0 =A0 } >> + =A0 =A0 =A0 return (FALSE); >> +} >> + >> +/* >> + * XDR enumerations >> + * >> + * PSARC 2003/523 Contract Private Interface >> + * xdr_enum >> + * Changes must be reviewed by Solaris File Sharing >> + * Changes must be communicated to contract-2003-523@sun.com >> + */ >> +#ifndef lint >> +enum sizecheck { SIZEVAL } sizecheckvar; =A0 =A0 =A0 /* used to find th= e size >> of */ >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 /* an enum */ >> +#endif >> +bool_t >> +xdr_enum(XDR *xdrs, enum_t *ep) >> +{ >> +#ifndef lint >> + =A0 =A0 =A0 /* >> + =A0 =A0 =A0 =A0* enums are treated as ints >> + =A0 =A0 =A0 =A0*/ >> + =A0 =A0 =A0 if (sizeof (sizecheckvar) =3D=3D sizeof (int32_t)) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (xdr_int(xdrs, (int32_t *)ep)); >> + =A0 =A0 =A0 } else if (sizeof (sizecheckvar) =3D=3D sizeof (short)) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (xdr_short(xdrs, (short *)ep)); >> + =A0 =A0 =A0 } else { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >> + =A0 =A0 =A0 } >> +#else >> + =A0 =A0 =A0 (void) (xdr_short(xdrs, (short *)ep)); >> + =A0 =A0 =A0 return (xdr_int(xdrs, (int32_t *)ep)); >> +#endif >> +} >> + >> +/* >> + * XDR opaque data >> + * Allows the specification of a fixed size sequence of opaque bytes. >> + * cp points to the opaque object and cnt gives the byte length. >> + * >> + * PSARC 2003/523 Contract Private Interface >> + * xdr_opaque >> + * Changes must be reviewed by Solaris File Sharing >> + * Changes must be communicated to contract-2003-523@sun.com >> + */ >> +bool_t >> +xdr_opaque(XDR *xdrs, caddr_t cp, const uint_t cnt) >> +{ >> + =A0 =A0 =A0 uint_t rndup; >> + =A0 =A0 =A0 static char crud[BYTES_PER_XDR_UNIT]; >> + >> + =A0 =A0 =A0 /* >> + =A0 =A0 =A0 =A0* if no data we are done >> + =A0 =A0 =A0 =A0*/ >> + =A0 =A0 =A0 if (cnt =3D=3D 0) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >> + >> + =A0 =A0 =A0 /* >> + =A0 =A0 =A0 =A0* round byte count to full xdr units >> + =A0 =A0 =A0 =A0*/ >> + =A0 =A0 =A0 rndup =3D cnt % BYTES_PER_XDR_UNIT; >> + =A0 =A0 =A0 if (rndup !=3D 0) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 rndup =3D BYTES_PER_XDR_UNIT - rndup; >> + >> + =A0 =A0 =A0 if (xdrs->x_op =3D=3D XDR_DECODE) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!XDR_GETBYTES(xdrs, cp, cnt)) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (rndup =3D=3D 0) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (XDR_GETBYTES(xdrs, (caddr_t)crud, = rndup)); >> + =A0 =A0 =A0 } >> + >> + =A0 =A0 =A0 if (xdrs->x_op =3D=3D XDR_ENCODE) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!XDR_PUTBYTES(xdrs, cp, cnt)) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (rndup =3D=3D 0) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (XDR_PUTBYTES(xdrs, xdr_zero, rndup= )); >> + =A0 =A0 =A0 } >> + >> + =A0 =A0 =A0 if (xdrs->x_op =3D=3D XDR_FREE) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >> + >> + =A0 =A0 =A0 return (FALSE); >> +} >> + >> +/* >> + * XDR counted bytes >> + * *cpp is a pointer to the bytes, *sizep is the count. >> + * If *cpp is NULL maxsize bytes are allocated >> + * >> + * PSARC 2003/523 Contract Private Interface >> + * xdr_bytes >> + * Changes must be reviewed by Solaris File Sharing >> + * Changes must be communicated to contract-2003-523@sun.com >> + */ >> +bool_t >> +xdr_bytes(XDR *xdrs, char **cpp, uint_t *sizep, const uint_t maxsize) >> +{ >> + =A0 =A0 =A0 char *sp =3D *cpp; =A0/* sp is the actual string pointer *= / >> + =A0 =A0 =A0 uint_t nodesize; >> + >> + =A0 =A0 =A0 /* >> + =A0 =A0 =A0 =A0* first deal with the length since xdr bytes are counte= d >> + =A0 =A0 =A0 =A0*/ >> + =A0 =A0 =A0 if (!xdr_u_int(xdrs, sizep)) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >> + =A0 =A0 =A0 } >> + =A0 =A0 =A0 nodesize =3D *sizep; >> + =A0 =A0 =A0 if ((nodesize > maxsize) && (xdrs->x_op !=3D XDR_FREE)) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >> + =A0 =A0 =A0 } >> + >> + =A0 =A0 =A0 /* >> + =A0 =A0 =A0 =A0* now deal with the actual bytes >> + =A0 =A0 =A0 =A0*/ >> + =A0 =A0 =A0 switch (xdrs->x_op) { >> + =A0 =A0 =A0 case XDR_DECODE: >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (nodesize =3D=3D 0) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (sp =3D=3D NULL) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 *cpp =3D sp =3D (char *)me= m_alloc(nodesize); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* FALLTHROUGH */ >> + >> + =A0 =A0 =A0 case XDR_ENCODE: >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (xdr_opaque(xdrs, sp, nodesize)); >> + >> + =A0 =A0 =A0 case XDR_FREE: >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (sp !=3D NULL) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 mem_free(sp, nodesize); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 *cpp =3D NULL; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >> + =A0 =A0 =A0 } >> + =A0 =A0 =A0 return (FALSE); >> +} >> + >> +/* >> + * Implemented here due to commonality of the object. >> + */ >> +bool_t >> +xdr_netobj(XDR *xdrs, struct netobj *np) >> +{ >> + =A0 =A0 =A0 return (xdr_bytes(xdrs, &np->n_bytes, &np->n_len, MAX_NETO= BJ_SZ)); >> +} >> + >> +/* >> + * XDR a descriminated union >> + * Support routine for discriminated unions. >> + * You create an array of xdrdiscrim structures, terminated with >> + * an entry with a null procedure pointer. =A0The routine gets >> + * the discriminant value and then searches the array of xdrdiscrims >> + * looking for that value. =A0It calls the procedure given in the >> xdrdiscrim >> + * to handle the discriminant. =A0If there is no specific routine a def= ault >> + * routine may be called. >> + * If there is no specific or default routine an error is returned. >> + */ >> +bool_t >> +xdr_union(XDR *xdrs, enum_t *dscmp, char *unp, >> + =A0 =A0 =A0 const struct xdr_discrim *choices, const xdrproc_t dfault) >> +{ >> + =A0 =A0 =A0 enum_t dscm; >> + >> + =A0 =A0 =A0 /* >> + =A0 =A0 =A0 =A0* we deal with the discriminator; =A0it's an enum >> + =A0 =A0 =A0 =A0*/ >> + =A0 =A0 =A0 if (!xdr_enum(xdrs, dscmp)) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >> + =A0 =A0 =A0 } >> + =A0 =A0 =A0 dscm =3D *dscmp; >> + >> + =A0 =A0 =A0 /* >> + =A0 =A0 =A0 =A0* search choices for a value that matches the discrimin= ator. >> + =A0 =A0 =A0 =A0* if we find one, execute the xdr routine for that valu= e. >> + =A0 =A0 =A0 =A0*/ >> + =A0 =A0 =A0 for (; choices->proc !=3D NULL_xdrproc_t; choices++) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (choices->value =3D=3D dscm) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return ((*(choices->proc))= (xdrs, unp, >> LASTUNSIGNED)); >> + =A0 =A0 =A0 } >> + >> + =A0 =A0 =A0 /* >> + =A0 =A0 =A0 =A0* no match - execute the default xdr routine if there i= s one >> + =A0 =A0 =A0 =A0*/ >> + =A0 =A0 =A0 return ((dfault =3D=3D NULL_xdrproc_t) ? FALSE : >> + =A0 =A0 =A0 =A0 =A0 (*dfault)(xdrs, unp, LASTUNSIGNED)); >> +} >> + >> + >> +/* >> + * Non-portable xdr primitives. >> + * Care should be taken when moving these routines to new architectures= . >> + */ >> + >> + >> +/* >> + * XDR null terminated ASCII strings >> + * xdr_string deals with "C strings" - arrays of bytes that are >> + * terminated by a NULL character. =A0The parameter cpp references a >> + * pointer to storage; If the pointer is null, then the necessary >> + * storage is allocated. =A0The last parameter is the max allowed lengt= h >> + * of the string as specified by a protocol. >> + */ >> +bool_t >> +xdr_string(XDR *xdrs, char **cpp, const uint_t maxsize) >> +{ >> + =A0 =A0 =A0 char *sp =3D *cpp; =A0/* sp is the actual string pointer *= / >> + =A0 =A0 =A0 uint_t size; >> + =A0 =A0 =A0 uint_t nodesize; >> + >> + =A0 =A0 =A0 /* >> + =A0 =A0 =A0 =A0* first deal with the length since xdr strings are >> counted-strings >> + =A0 =A0 =A0 =A0*/ >> + =A0 =A0 =A0 switch (xdrs->x_op) { >> + =A0 =A0 =A0 case XDR_FREE: >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (sp =3D=3D NULL) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); =A0/* alrea= dy free */ >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* FALLTHROUGH */ >> + =A0 =A0 =A0 case XDR_ENCODE: >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 size =3D (sp !=3D NULL) ? (uint_t)strlen(s= p) : 0; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 break; >> + =A0 =A0 =A0 case XDR_DECODE: >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 break; >> + =A0 =A0 =A0 } >> + =A0 =A0 =A0 if (!xdr_u_int(xdrs, &size)) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >> + =A0 =A0 =A0 } >> + =A0 =A0 =A0 if (size > maxsize) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >> + =A0 =A0 =A0 } >> + =A0 =A0 =A0 nodesize =3D size + 1; >> + >> + =A0 =A0 =A0 /* >> + =A0 =A0 =A0 =A0* now deal with the actual bytes >> + =A0 =A0 =A0 =A0*/ >> + =A0 =A0 =A0 switch (xdrs->x_op) { >> + =A0 =A0 =A0 case XDR_DECODE: >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (nodesize =3D=3D 0) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (sp =3D=3D NULL) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 sp =3D (char *)mem_alloc(n= odesize); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 sp[size] =3D 0; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!xdr_opaque(xdrs, sp, size)) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* free up memory if all= ocated here >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*/ >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (*cpp =3D=3D NULL) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 mem_free(s= p, nodesize); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (strlen(sp) !=3D size) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (*cpp =3D=3D NULL) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 mem_free(s= p, nodesize); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 *cpp =3D sp; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >> + >> + =A0 =A0 =A0 case XDR_ENCODE: >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (xdr_opaque(xdrs, sp, size)); >> + >> + =A0 =A0 =A0 case XDR_FREE: >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 mem_free(sp, nodesize); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 *cpp =3D NULL; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >> + =A0 =A0 =A0 } >> + =A0 =A0 =A0 return (FALSE); >> +} >> + >> +/* >> + * Wrapper for xdr_string that can be called directly from >> + * routines like clnt_call >> + */ >> +bool_t >> +xdr_wrapstring(XDR *xdrs, char **cpp) >> +{ >> + =A0 =A0 =A0 if (xdr_string(xdrs, cpp, LASTUNSIGNED)) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >> + =A0 =A0 =A0 return (FALSE); >> +} >> >> Copied: >> head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr_array.c >> (from r191983, head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_arra= y.c) >> >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- /dev/null =A0 00:00:00 1970 =A0 (empty, because file is newly added) >> +++ >> head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr_array.c= Mon >> May 11 04:18:58 2009 =A0 =A0 =A0 =A0(r191984, copy of r191983, >> head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_array.c) >> @@ -0,0 +1,114 @@ >> +/* >> + * CDDL HEADER START >> + * >> + * The contents of this file are subject to the terms of the >> + * Common Development and Distribution License (the "License"). >> + * You may not use this file except in compliance with the License. >> + * >> + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE >> + * or http://www.opensolaris.org/os/licensing. >> + * See the License for the specific language governing permissions >> + * and limitations under the License. >> + * >> + * When distributing Covered Code, include this CDDL HEADER in each >> + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. >> + * If applicable, add the following below this CDDL HEADER, with the >> + * fields enclosed by brackets "[]" replaced with your own identifying >> + * information: Portions Copyright [yyyy] [name of copyright owner] >> + * >> + * CDDL HEADER END >> + */ >> +/* >> + * Copyright 2008 Sun Microsystems, Inc. =A0All rights reserved. >> + * Use is subject to license terms. >> + */ >> + >> +/* =A0 =A0 Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T = =A0 =A0 */ >> +/* =A0 =A0 =A0 All Rights Reserved =A0 */ >> + >> +/* >> + * Portions of this source code were derived from Berkeley 4.3 BSD >> + * under license from the Regents of the University of California. >> + */ >> + >> +/* >> + * xdr_array.c, Generic XDR routines impelmentation. >> + * These are the "non-trivial" xdr primitives used to serialize and >> de-serialize >> + * arrays. =A0See xdr.h for more info on the interface to xdr. >> + */ >> + >> +#include >> +#include >> +#include >> +#include >> + >> +#include >> +#include >> + >> +#define =A0 =A0 =A0 =A0LASTUNSIGNED =A0 =A0((uint_t)0-1) >> + >> +/* >> + * XDR an array of arbitrary elements >> + * *addrp is a pointer to the array, *sizep is the number of elements. >> + * If addrp is NULL (*sizep * elsize) bytes are allocated. >> + * elsize is the size (in bytes) of each element, and elproc is the >> + * xdr procedure to call to handle each element of the array. >> + */ >> +bool_t >> +xdr_array(XDR *xdrs, caddr_t *addrp, uint_t *sizep, const uint_t maxsiz= e, >> + =A0 =A0 =A0 const uint_t elsize, const xdrproc_t elproc) >> +{ >> + =A0 =A0 =A0 uint_t i; >> + =A0 =A0 =A0 caddr_t target =3D *addrp; >> + =A0 =A0 =A0 uint_t c; =A0/* the actual element count */ >> + =A0 =A0 =A0 bool_t stat =3D TRUE; >> + =A0 =A0 =A0 uint_t nodesize; >> + >> + =A0 =A0 =A0 /* like strings, arrays are really counted arrays */ >> + =A0 =A0 =A0 if (!xdr_u_int(xdrs, sizep)) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >> + =A0 =A0 =A0 } >> + =A0 =A0 =A0 c =3D *sizep; >> + =A0 =A0 =A0 if ((c > maxsize || LASTUNSIGNED / elsize < c) && >> + =A0 =A0 =A0 =A0 =A0 xdrs->x_op !=3D XDR_FREE) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >> + =A0 =A0 =A0 } >> + =A0 =A0 =A0 nodesize =3D c * elsize; >> + >> + =A0 =A0 =A0 /* >> + =A0 =A0 =A0 =A0* if we are deserializing, we may need to allocate an a= rray. >> + =A0 =A0 =A0 =A0* We also save time by checking for a null array if we = are >> freeing. >> + =A0 =A0 =A0 =A0*/ >> + =A0 =A0 =A0 if (target =3D=3D NULL) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 switch (xdrs->x_op) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 case XDR_DECODE: >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (c =3D=3D 0) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TR= UE); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 *addrp =3D target =3D (cha= r *)mem_alloc(nodesize); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 bzero(target, nodesize); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break; >> + >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 case XDR_FREE: >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >> + >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 case XDR_ENCODE: >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >> + >> + =A0 =A0 =A0 /* >> + =A0 =A0 =A0 =A0* now we xdr each element of array >> + =A0 =A0 =A0 =A0*/ >> + =A0 =A0 =A0 for (i =3D 0; (i < c) && stat; i++) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 stat =3D (*elproc)(xdrs, target, LASTUNSIG= NED); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 target +=3D elsize; >> + =A0 =A0 =A0 } >> + >> + =A0 =A0 =A0 /* >> + =A0 =A0 =A0 =A0* the array may need freeing >> + =A0 =A0 =A0 =A0*/ >> + =A0 =A0 =A0 if (xdrs->x_op =3D=3D XDR_FREE) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 mem_free(*addrp, nodesize); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 *addrp =3D NULL; >> + =A0 =A0 =A0 } >> + =A0 =A0 =A0 return (stat); >> +} >> >> Copied: >> head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr_mem.c (= from >> r191983, head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_mem.c) >> >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- /dev/null =A0 00:00:00 1970 =A0 (empty, because file is newly added) >> +++ head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr_mem= .c >> =A0 Mon May 11 04:18:58 2009 =A0 =A0 =A0 =A0(r191984, copy of r191983, >> head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_mem.c) >> @@ -0,0 +1,209 @@ >> +/* >> + * CDDL HEADER START >> + * >> + * The contents of this file are subject to the terms of the >> + * Common Development and Distribution License, Version 1.0 only >> + * (the "License"). =A0You may not use this file except in compliance >> + * with the License. >> + * >> + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE >> + * or http://www.opensolaris.org/os/licensing. >> + * See the License for the specific language governing permissions >> + * and limitations under the License. >> + * >> + * When distributing Covered Code, include this CDDL HEADER in each >> + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. >> + * If applicable, add the following below this CDDL HEADER, with the >> + * fields enclosed by brackets "[]" replaced with your own identifying >> + * information: Portions Copyright [yyyy] [name of copyright owner] >> + * >> + * CDDL HEADER END >> + */ >> +/* >> + * Copyright 2005 Sun Microsystems, Inc. =A0All rights reserved. >> + * Use is subject to license terms. >> + */ >> + >> +/* =A0 =A0 Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T = =A0 =A0 */ >> +/* =A0 =A0 =A0 All Rights Reserved =A0 */ >> + >> +/* >> + * Portions of this source code were derived from Berkeley 4.3 BSD >> + * under license from the Regents of the University of California. >> + */ >> + >> +#pragma ident =A0"%Z%%M% %I% =A0 =A0 %E% SMI" >> + >> +/* >> + * xdr_mem.c, XDR implementation using memory buffers. >> + * >> + * If you have some data to be interpreted as external data >> representation >> + * or to be converted to external data representation in a memory buffe= r, >> + * then this is the package for you. >> + */ >> + >> +#include >> +#include >> +#include >> + >> +#include >> +#include >> + >> +static struct xdr_ops *xdrmem_ops(void); >> + >> +/* >> + * The procedure xdrmem_create initializes a stream descriptor for a >> + * memory buffer. >> + */ >> +void >> +xdrmem_create(XDR *xdrs, caddr_t addr, uint_t size, enum xdr_op op) >> +{ >> + =A0 =A0 =A0 xdrs->x_op =3D op; >> + =A0 =A0 =A0 xdrs->x_ops =3D xdrmem_ops(); >> + =A0 =A0 =A0 xdrs->x_private =3D xdrs->x_base =3D addr; >> + =A0 =A0 =A0 xdrs->x_handy =3D size; >> + =A0 =A0 =A0 xdrs->x_public =3D NULL; >> +} >> + >> +/* ARGSUSED */ >> +static void >> +xdrmem_destroy(XDR *xdrs) >> +{ >> +} >> + >> +static bool_t >> +xdrmem_getint32(XDR *xdrs, int32_t *int32p) >> +{ >> + =A0 =A0 =A0 if ((xdrs->x_handy -=3D (int)sizeof (int32_t)) < 0) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >> + =A0 =A0 =A0 /* LINTED pointer alignment */ >> + =A0 =A0 =A0 *int32p =3D (int32_t)ntohl((uint32_t)(*((int32_t >> *)(xdrs->x_private)))); >> + =A0 =A0 =A0 xdrs->x_private +=3D sizeof (int32_t); >> + =A0 =A0 =A0 return (TRUE); >> +} >> + >> +static bool_t >> +xdrmem_putint32(XDR *xdrs, int32_t *int32p) >> +{ >> + =A0 =A0 =A0 if ((xdrs->x_handy -=3D (int)sizeof (int32_t)) < 0) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >> + =A0 =A0 =A0 /* LINTED pointer alignment */ >> + =A0 =A0 =A0 *(int32_t *)xdrs->x_private =3D (int32_t)htonl((uint32_t)(= *int32p)); >> + =A0 =A0 =A0 xdrs->x_private +=3D sizeof (int32_t); >> + =A0 =A0 =A0 return (TRUE); >> +} >> + >> +static bool_t >> +xdrmem_getbytes(XDR *xdrs, caddr_t addr, int len) >> +{ >> + =A0 =A0 =A0 if ((xdrs->x_handy -=3D len) < 0) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >> + =A0 =A0 =A0 bcopy(xdrs->x_private, addr, len); >> + =A0 =A0 =A0 xdrs->x_private +=3D len; >> + =A0 =A0 =A0 return (TRUE); >> +} >> + >> +static bool_t >> +xdrmem_putbytes(XDR *xdrs, caddr_t addr, int len) >> +{ >> + =A0 =A0 =A0 if ((xdrs->x_handy -=3D len) < 0) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >> + =A0 =A0 =A0 bcopy(addr, xdrs->x_private, len); >> + =A0 =A0 =A0 xdrs->x_private +=3D len; >> + =A0 =A0 =A0 return (TRUE); >> +} >> + >> +static uint_t >> +xdrmem_getpos(XDR *xdrs) >> +{ >> + =A0 =A0 =A0 return ((uint_t)((uintptr_t)xdrs->x_private - >> (uintptr_t)xdrs->x_base)); >> +} >> + >> +static bool_t >> +xdrmem_setpos(XDR *xdrs, uint_t pos) >> +{ >> + =A0 =A0 =A0 caddr_t newaddr =3D xdrs->x_base + pos; >> + =A0 =A0 =A0 caddr_t lastaddr =3D xdrs->x_private + xdrs->x_handy; >> + =A0 =A0 =A0 ptrdiff_t diff; >> + >> + =A0 =A0 =A0 if (newaddr > lastaddr) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >> + =A0 =A0 =A0 xdrs->x_private =3D newaddr; >> + =A0 =A0 =A0 diff =3D lastaddr - newaddr; >> + =A0 =A0 =A0 xdrs->x_handy =3D (int)diff; >> + =A0 =A0 =A0 return (TRUE); >> +} >> + >> +static rpc_inline_t * >> +xdrmem_inline(XDR *xdrs, int len) >> +{ >> + =A0 =A0 =A0 rpc_inline_t *buf =3D NULL; >> + >> + =A0 =A0 =A0 if (xdrs->x_handy >=3D len) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 xdrs->x_handy -=3D len; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* LINTED pointer alignment */ >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 buf =3D (rpc_inline_t *)xdrs->x_private; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 xdrs->x_private +=3D len; >> + =A0 =A0 =A0 } >> + =A0 =A0 =A0 return (buf); >> +} >> + >> +static bool_t >> +xdrmem_control(XDR *xdrs, int request, void *info) >> +{ >> + =A0 =A0 =A0 xdr_bytesrec *xptr; >> + =A0 =A0 =A0 int32_t *int32p; >> + =A0 =A0 =A0 int len; >> + >> + =A0 =A0 =A0 switch (request) { >> + >> + =A0 =A0 =A0 case XDR_GET_BYTES_AVAIL: >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 xptr =3D (xdr_bytesrec *)info; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 xptr->xc_is_last_record =3D TRUE; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 xptr->xc_num_avail =3D xdrs->x_handy; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >> + >> + =A0 =A0 =A0 case XDR_PEEK: >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* Return the next 4 byte unit in the XD= R stream. >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*/ >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (xdrs->x_handy < sizeof (int32_t)) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 int32p =3D (int32_t *)info; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 *int32p =3D (int32_t)ntohl((uint32_t) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (*((int32_t *)(xdrs->x_private))))= ; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >> + >> + =A0 =A0 =A0 case XDR_SKIPBYTES: >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* Skip the next N bytes in the XDR stre= am. >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*/ >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 int32p =3D (int32_t *)info; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 len =3D RNDUP((int)(*int32p)); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((xdrs->x_handy -=3D len) < 0) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 xdrs->x_private +=3D len; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >> + >> + =A0 =A0 =A0 } >> + =A0 =A0 =A0 return (FALSE); >> +} >> + >> +static struct xdr_ops * >> +xdrmem_ops(void) >> +{ >> + =A0 =A0 =A0 static struct xdr_ops ops; >> + >> + =A0 =A0 =A0 if (ops.x_getint32 =3D=3D NULL) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ops.x_getbytes =3D xdrmem_getbytes; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ops.x_putbytes =3D xdrmem_putbytes; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ops.x_getpostn =3D xdrmem_getpos; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ops.x_setpostn =3D xdrmem_setpos; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ops.x_inline =3D xdrmem_inline; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ops.x_destroy =3D xdrmem_destroy; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ops.x_control =3D xdrmem_control; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ops.x_getint32 =3D xdrmem_getint32; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ops.x_putint32 =3D xdrmem_putint32; >> + =A0 =A0 =A0 } >> + =A0 =A0 =A0 return (&ops); >> +} >> >> Modified: head/sys/modules/zfs/Makefile >> >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/sys/modules/zfs/Makefile =A0 =A0 =A0 Mon May 11 02:39:49 2009 >> =A0(r191983) >> +++ head/sys/modules/zfs/Makefile =A0 =A0 =A0 Mon May 11 04:18:58 2009 >> =A0(r191984) >> @@ -44,9 +44,9 @@ SRCS+=3D =A0 =A0 =A0 =A0nvpair_alloc_system.c >> SRCS+=3D =A0taskq.c >> >> .PATH: =A0${SUNW}/uts/common/rpc >> -SRCS+=3D xdr.c >> -SRCS+=3D xdr_array.c >> -SRCS+=3D xdr_mem.c >> +SRCS+=3D opensolaris_xdr.c >> +SRCS+=3D opensolaris_xdr_array.c >> +SRCS+=3D opensolaris_xdr_mem.c >> >> .PATH: =A0${SUNW}/uts/common/zmod >> SRCS+=3D =A0adler32.c > > --=20 When bad men combine, the good must associate; else they will fall one by one, an unpitied sacrifice in a contemptible struggle. Edmund Burke From owner-svn-src-head@FreeBSD.ORG Mon May 11 19:37:09 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 69B5810656FD; Mon, 11 May 2009 19:37:09 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0F41A8FC1A; Mon, 11 May 2009 19:37:06 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4BJb5Qk000330; Mon, 11 May 2009 19:37:05 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4BJb5Ox000328; Mon, 11 May 2009 19:37:05 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200905111937.n4BJb5Ox000328@svn.freebsd.org> From: Rick Macklem Date: Mon, 11 May 2009 19:37:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192000 - in head/sys/fs: nfs nfsserver X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 May 2009 19:37:15 -0000 Author: rmacklem Date: Mon May 11 19:37:05 2009 New Revision: 192000 URL: http://svn.freebsd.org/changeset/base/192000 Log: Change the name of the nfs server addsock structure from nfsd_args to nfsd_addsock_args, so that it is consistent with the one in sys/nfsserver/nfs.h. Approved by: kib (mentor) Modified: head/sys/fs/nfs/nfs.h head/sys/fs/nfsserver/nfs_nfsdport.c Modified: head/sys/fs/nfs/nfs.h ============================================================================== --- head/sys/fs/nfs/nfs.h Mon May 11 18:52:46 2009 (r191999) +++ head/sys/fs/nfs/nfs.h Mon May 11 19:37:05 2009 (r192000) @@ -157,7 +157,7 @@ * Structures for the nfssvc(2) syscall. Not that anyone but nfsd, mount_nfs * and nfsloaduser should ever try and use it. */ -struct nfsd_args { +struct nfsd_addsock_args { int sock; /* Socket to serve */ caddr_t name; /* Client addr for connection based sockets */ int namelen; /* Length of name */ Modified: head/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdport.c Mon May 11 18:52:46 2009 (r191999) +++ head/sys/fs/nfsserver/nfs_nfsdport.c Mon May 11 19:37:05 2009 (r192000) @@ -2866,7 +2866,7 @@ static int nfssvc_nfsd(struct thread *td, struct nfssvc_args *uap) { struct file *fp; - struct nfsd_args nfsdarg; + struct nfsd_addsock_args nfsdarg; int error; if (uap->flag & NFSSVC_NFSDADDSOCK) { From owner-svn-src-head@FreeBSD.ORG Mon May 11 19:58:03 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D353410656E7; Mon, 11 May 2009 19:58:03 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BE3238FC19; Mon, 11 May 2009 19:58:03 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4BJw375000745; Mon, 11 May 2009 19:58:03 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4BJw34q000744; Mon, 11 May 2009 19:58:03 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200905111958.n4BJw34q000744@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 11 May 2009 19:58:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192001 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 May 2009 19:58:07 -0000 Author: kib Date: Mon May 11 19:58:03 2009 New Revision: 192001 URL: http://svn.freebsd.org/changeset/base/192001 Log: Prevent overflow of uio_resid. Noted by: jhb MFC after: 3 days Modified: head/sys/kern/vfs_syscalls.c Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Mon May 11 19:37:05 2009 (r192000) +++ head/sys/kern/vfs_syscalls.c Mon May 11 19:58:03 2009 (r192001) @@ -2596,6 +2596,9 @@ kern_readlinkat(struct thread *td, int f struct nameidata nd; int vfslocked; + if (count > INT_MAX) + return (EINVAL); + NDINIT_AT(&nd, LOOKUP, NOFOLLOW | LOCKSHARED | LOCKLEAF | MPSAFE | AUDITVNODE1, pathseg, path, fd, td); From owner-svn-src-head@FreeBSD.ORG Mon May 11 21:13:01 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3203E1065674; Mon, 11 May 2009 21:13:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2136C8FC17; Mon, 11 May 2009 21:13:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4BLD1Km002290; Mon, 11 May 2009 21:13:01 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4BLD1YW002289; Mon, 11 May 2009 21:13:01 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200905112113.n4BLD1YW002289@svn.freebsd.org> From: John Baldwin Date: Mon, 11 May 2009 21:13:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192002 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 May 2009 21:13:01 -0000 Author: jhb Date: Mon May 11 21:13:00 2009 New Revision: 192002 URL: http://svn.freebsd.org/changeset/base/192002 Log: *sigh*, while the kernel built, userland C did not. Revert the previous commit and fix it correctly by removing the _KERNEL check entirely. Now the kernel always sees the same value of NULL as userland meaning that it sees __null, 0, or 0L when compiled as C++, and '(void *)0' when compiled as C. Modified: head/sys/sys/_null.h Modified: head/sys/sys/_null.h ============================================================================== --- head/sys/sys/_null.h Mon May 11 19:58:03 2009 (r192001) +++ head/sys/sys/_null.h Mon May 11 21:13:00 2009 (r192002) @@ -28,18 +28,18 @@ #ifndef NULL +#if !defined(__cplusplus) +#define NULL ((void *)0) +#else #if defined(__GNUG__) && defined(__GNUC__) && __GNUC__ >= 4 #define NULL __null #else -#if defined(_KERNEL) && !defined(__cplusplus) -#define NULL ((void *)0) -#else #if defined(__LP64__) #define NULL (0L) #else #define NULL 0 #endif /* __LP64__ */ -#endif /* _KERNEL && !__cplusplus */ #endif /* __GNUG__ */ +#endif /* !__cplusplus */ #endif From owner-svn-src-head@FreeBSD.ORG Mon May 11 22:55:50 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B6D7106574A; Mon, 11 May 2009 22:55:50 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 490708FC1F; Mon, 11 May 2009 22:55:50 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4BMtoM7004365; Mon, 11 May 2009 22:55:50 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4BMtorH004362; Mon, 11 May 2009 22:55:50 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905112255.n4BMtorH004362@svn.freebsd.org> From: Kip Macy Date: Mon, 11 May 2009 22:55:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192003 - head/sys/dev/xen/console X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 May 2009 22:55:51 -0000 Author: kmacy Date: Mon May 11 22:55:49 2009 New Revision: 192003 URL: http://svn.freebsd.org/changeset/base/192003 Log: xen console lock needs to be a spin lock in case it is acquired from an interrupt context Modified: head/sys/dev/xen/console/console.c head/sys/dev/xen/console/xencons_ring.c head/sys/dev/xen/console/xencons_ring.h Modified: head/sys/dev/xen/console/console.c ============================================================================== --- head/sys/dev/xen/console/console.c Mon May 11 21:13:00 2009 (r192002) +++ head/sys/dev/xen/console/console.c Mon May 11 22:55:49 2009 (r192003) @@ -76,17 +76,17 @@ static unsigned int wc, wp; /* write_con #define XCUNIT(x) (dev2unit(x)) #define ISTTYOPEN(tp) ((tp) && ((tp)->t_state & TS_ISOPEN)) #define CN_LOCK_INIT(x, _name) \ - mtx_init(&x, _name, NULL, MTX_DEF|MTX_RECURSE) + mtx_init(&x, _name, NULL, MTX_SPIN|MTX_RECURSE) #define CN_LOCK(l) \ do { \ if (panicstr == NULL) \ - mtx_lock(&(l)); \ + mtx_lock_spin(&(l)); \ } while (0) #define CN_UNLOCK(l) \ do { \ if (panicstr == NULL) \ - mtx_unlock(&(l)); \ + mtx_unlock_spin(&(l)); \ } while (0) #define CN_LOCK_ASSERT(x) mtx_assert(&x, MA_OWNED) #define CN_LOCK_DESTROY(x) mtx_destroy(&x) Modified: head/sys/dev/xen/console/xencons_ring.c ============================================================================== --- head/sys/dev/xen/console/xencons_ring.c Mon May 11 21:13:00 2009 (r192002) +++ head/sys/dev/xen/console/xencons_ring.c Mon May 11 22:55:49 2009 (r192003) @@ -89,7 +89,7 @@ xencons_handle_input(void *unused) struct xencons_interface *intf; XENCONS_RING_IDX cons, prod; - mtx_lock(&cn_mtx); + CN_LOCK(cn_mtx); intf = xencons_interface(); cons = intf->in_cons; @@ -107,7 +107,7 @@ xencons_handle_input(void *unused) notify_remote_via_evtchn(xen_start_info->console_evtchn); xencons_tx(); - mtx_unlock(&cn_mtx); + CN_UNLOCK(cn_mtx); } void Modified: head/sys/dev/xen/console/xencons_ring.h ============================================================================== --- head/sys/dev/xen/console/xencons_ring.h Mon May 11 21:13:00 2009 (r192002) +++ head/sys/dev/xen/console/xencons_ring.h Mon May 11 22:55:49 2009 (r192003) @@ -5,6 +5,17 @@ #ifndef _XENCONS_RING_H #define _XENCONS_RING_H +#define CN_LOCK(l) \ + do { \ + if (panicstr == NULL) \ + mtx_lock_spin(&(l)); \ + } while (0) +#define CN_UNLOCK(l) \ + do { \ + if (panicstr == NULL) \ + mtx_unlock_spin(&(l)); \ + } while (0) + int xencons_ring_init(void); int xencons_ring_send(const char *data, unsigned len); void xencons_rx(char *buf, unsigned len); From owner-svn-src-head@FreeBSD.ORG Mon May 11 23:03:16 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 47BED106564A; Mon, 11 May 2009 23:03:16 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3648B8FC18; Mon, 11 May 2009 23:03:16 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4BN3FZt004545; Mon, 11 May 2009 23:03:15 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4BN3Fnp004543; Mon, 11 May 2009 23:03:15 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905112303.n4BN3Fnp004543@svn.freebsd.org> From: Kip Macy Date: Mon, 11 May 2009 23:03:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192004 - head/sys/dev/xen/console X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 May 2009 23:03:16 -0000 Author: kmacy Date: Mon May 11 23:03:15 2009 New Revision: 192004 URL: http://svn.freebsd.org/changeset/base/192004 Log: don't acquire tty lock with console lock held Modified: head/sys/dev/xen/console/console.c head/sys/dev/xen/console/xencons_ring.c Modified: head/sys/dev/xen/console/console.c ============================================================================== --- head/sys/dev/xen/console/console.c Mon May 11 22:55:49 2009 (r192003) +++ head/sys/dev/xen/console/console.c Mon May 11 23:03:15 2009 (r192004) @@ -287,8 +287,10 @@ xencons_rx(char *buf, unsigned len) ttydisc_rint_done(tp); tty_unlock(tp); } else { + CN_LOCK(cn_mtx); for (i = 0; i < len; i++) rbuf[RBUF_MASK(rp++)] = buf[i]; + CN_UNLOCK(cn_mtx); } } Modified: head/sys/dev/xen/console/xencons_ring.c ============================================================================== --- head/sys/dev/xen/console/xencons_ring.c Mon May 11 22:55:49 2009 (r192003) +++ head/sys/dev/xen/console/xencons_ring.c Mon May 11 23:03:15 2009 (r192004) @@ -94,7 +94,8 @@ xencons_handle_input(void *unused) cons = intf->in_cons; prod = intf->in_prod; - + CN_UNLOCK(cn_mtx); + /* XXX needs locking */ while (cons != prod) { xencons_rx(intf->in + MASK_XENCONS_IDX(cons, intf->in), 1); @@ -104,6 +105,7 @@ xencons_handle_input(void *unused) mb(); intf->in_cons = cons; + CN_LOCK(cn_mtx); notify_remote_via_evtchn(xen_start_info->console_evtchn); xencons_tx(); From owner-svn-src-head@FreeBSD.ORG Tue May 12 02:05:43 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48FD51065672; Tue, 12 May 2009 02:05:43 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 36D4E8FC13; Tue, 12 May 2009 02:05:43 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4C25hUt008018; Tue, 12 May 2009 02:05:43 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4C25hXh008017; Tue, 12 May 2009 02:05:43 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <200905120205.n4C25hXh008017@svn.freebsd.org> From: Weongyo Jeong Date: Tue, 12 May 2009 02:05:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192006 - head/sys/dev/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 02:05:43 -0000 Author: weongyo Date: Tue May 12 02:05:42 2009 New Revision: 192006 URL: http://svn.freebsd.org/changeset/base/192006 Log: Add WUSB54AG and XM142 entries for upgt(4) Modified: head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Tue May 12 01:00:30 2009 (r192005) +++ head/sys/dev/usb/usbdevs Tue May 12 02:05:42 2009 (r192006) @@ -1023,6 +1023,7 @@ product CHPRODUCTS FIGHTERSTICK 0x00f3 F product CHPRODUCTS FLIGHTYOKE 0x00ff Flight Sim Yoke /* Cisco-Linksys products */ +product CISCOLINKSYS WUSB54AG 0x000c WUSB54AG Wireless Adapter product CISCOLINKSYS WUSB54G 0x000d WUSB54G Wireless Adapter product CISCOLINKSYS WUSB54GP 0x0011 WUSB54GP Wireless Adapter product CISCOLINKSYS USB200MV2 0x0018 USB200M v2 @@ -2516,6 +2517,7 @@ product ZCOM XG703A 0x0008 PrismGT USB product ZCOM ZD1211 0x0011 ZD1211 product ZCOM AR5523 0x0012 AR5523 product ZCOM AR5523_NF 0x0013 AR5523 driver (no firmware) +product ZCOM XM142 0x0015 XM-142 product ZCOM ZD1211B 0x001a ZD1211B /* Zinwell products */ From owner-svn-src-head@FreeBSD.ORG Tue May 12 02:08:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1C34110656BB; Tue, 12 May 2009 02:08:57 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 09A4F8FC0C; Tue, 12 May 2009 02:08:57 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4C28uoA008170; Tue, 12 May 2009 02:08:56 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4C28uc1008169; Tue, 12 May 2009 02:08:56 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <200905120208.n4C28uc1008169@svn.freebsd.org> From: Weongyo Jeong Date: Tue, 12 May 2009 02:08:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192007 - head/sys/modules/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 02:08:57 -0000 Author: weongyo Date: Tue May 12 02:08:56 2009 New Revision: 192007 URL: http://svn.freebsd.org/changeset/base/192007 Log: connect upgt(4) to the build. It should work on all architectures. Modified: head/sys/modules/usb/Makefile Modified: head/sys/modules/usb/Makefile ============================================================================== --- head/sys/modules/usb/Makefile Tue May 12 02:05:42 2009 (r192006) +++ head/sys/modules/usb/Makefile Tue May 12 02:08:56 2009 (r192007) @@ -28,7 +28,7 @@ SUBDIR = usb #SUBDIR += ubt bluetooth_ng ubtfw SUBDIR += ehci musb ohci uhci uss820dci ${_at91dci} ${_atmegadci} -SUBDIR += rum uath ural zyd +SUBDIR += rum uath upgt ural zyd SUBDIR += uhid ukbd ums udbp ufm SUBDIR += ucom u3g uark ubsa ubser uchcom ucycom ufoma uftdi ugensa uipaq ulpt \ umct umodem umoscom uplcom uslcom uvisor uvscom From owner-svn-src-head@FreeBSD.ORG Tue May 12 03:30:25 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE83F106566C; Tue, 12 May 2009 03:30:25 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BCF4A8FC15; Tue, 12 May 2009 03:30:25 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4C3UPf7010018; Tue, 12 May 2009 03:30:25 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4C3UPhg010017; Tue, 12 May 2009 03:30:25 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905120330.n4C3UPhg010017@svn.freebsd.org> From: Kip Macy Date: Tue, 12 May 2009 03:30:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192009 - head/sys/dev/cxgb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 03:30:26 -0000 Author: kmacy Date: Tue May 12 03:30:25 2009 New Revision: 192009 URL: http://svn.freebsd.org/changeset/base/192009 Log: fix bug introduced by last change Submitted by: Navdeep Parhar Modified: head/sys/dev/cxgb/cxgb_multiq.c Modified: head/sys/dev/cxgb/cxgb_multiq.c ============================================================================== --- head/sys/dev/cxgb/cxgb_multiq.c Tue May 12 02:17:25 2009 (r192008) +++ head/sys/dev/cxgb/cxgb_multiq.c Tue May 12 03:30:25 2009 (r192009) @@ -296,7 +296,7 @@ cxgb_pcpu_start_(struct sge_qset *qs, st } stopped = isset(&qs->txq_stopped, TXQ_ETH); - flush = ((drbr_empty(pi->ifp, txq->txq_mr) + flush = ((!drbr_empty(pi->ifp, txq->txq_mr) && !stopped) || txq->immpkt); max_desc = tx_flush ? TX_ETH_Q_SIZE : TX_START_MAX_DESC; From owner-svn-src-head@FreeBSD.ORG Tue May 12 05:03:50 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 32F361065670; Tue, 12 May 2009 05:03:50 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: from yw-out-2324.google.com (yw-out-2324.google.com [74.125.46.31]) by mx1.freebsd.org (Postfix) with ESMTP id 8E1518FC1B; Tue, 12 May 2009 05:03:49 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: by yw-out-2324.google.com with SMTP id 9so1941274ywe.13 for ; Mon, 11 May 2009 22:03:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=87V9v2c7NMG4HeD9rH4t3b5VXHe9xJkstq8lV6IAjKU=; b=t5AQCjj1VE0cQ9tyiOy0Xu9E0RstmYEnzE8h8oW8wUwuqwZYQ+I1hT2qQAgxVfXzAQ q3glac9Kr3TnO0JNTgjAqo/O4WEqpxbGpj5v8ufdHwjwZQuF79tHsVl5wtY6Ks7BGaUz A3rA6ukBR8+VDZooE8635V8Ou02qHy4DJ/W7A= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=Mn4Fa4Ec46M4gLftHpZlYYU9+fJfdg1SSZM8Yn8mWzwhGkcoyFaoAr9+nwne83ovxz Lx2+QY0sXBYfRdlnJJhBJlfD8tviVs5Z1BiDDBbgwMtRhs0CSq+OQrbbPIkgnB59Gm5a NpVryo1uHxQvl4d8GcVUDJo2YFEpCMUHGmV9Q= MIME-Version: 1.0 Sender: mat.macy@gmail.com Received: by 10.100.144.14 with SMTP id r14mr15897094and.65.1242104613364; Mon, 11 May 2009 22:03:33 -0700 (PDT) In-Reply-To: <3c1674c90905111223u74ec12ch9f40772940a42396@mail.gmail.com> References: <200905110418.n4B4IxPC077484@svn.freebsd.org> <0E48393C-F519-42A1-AD3C-3EC31EE2AE06@rabson.org> <3c1674c90905111223u74ec12ch9f40772940a42396@mail.gmail.com> Date: Mon, 11 May 2009 22:03:33 -0700 X-Google-Sender-Auth: 7ab5f84024744580 Message-ID: <3c1674c90905112203p363d3dfdoa0511d8b5c00f74b@mail.gmail.com> From: Kip Macy To: Doug Rabson Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191984 - in head/sys: cddl/contrib/opensolaris/uts/common/rpc modules/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 05:03:50 -0000 Here is the problem, FreeBSD is sloppy about 32-bit vs. 64-bit for xdr whereas in the kernel, Solaris is not. Solaris: bool_t xdr_int(XDR *xdrs, int *ip) { if (xdrs->x_op =3D=3D XDR_ENCODE) return (XDR_PUTINT32(xdrs, ip)); if (xdrs->x_op =3D=3D XDR_DECODE) return (XDR_GETINT32(xdrs, ip)); if (xdrs->x_op =3D=3D XDR_FREE) return (TRUE); return (FALSE); } #if !defined(_LP64) && !defined(_KERNEL) /* * For binary compatability on ILP32 we do not change the shape * of the XDR structure and the GET/PUTINT32 functions just use * the get/putlong vectors which operate on identically-sized * units of data. */ #define XDR_GETINT32(xdrs, int32p) \ (*(xdrs)->x_ops->x_getlong)(xdrs, (long *)int32p) #define xdr_getint32(xdrs, int32p) \ (*(xdrs)->x_ops->x_getlong)(xdrs, (long *)int32p) #define XDR_PUTINT32(xdrs, int32p) \ (*(xdrs)->x_ops->x_putlong)(xdrs, (long *)int32p) #define xdr_putint32(xdrs, int32p) \ (*(xdrs)->x_ops->x_putlong)(xdrs, (long *)int32p) #else /* !_LP64 && !_KERNEL */ #define XDR_GETINT32(xdrs, int32p) \ (*(xdrs)->x_ops->x_getint32)(xdrs, int32p) #define xdr_getint32(xdrs, int32p) \ (*(xdrs)->x_ops->x_getint32)(xdrs, int32p) #define XDR_PUTINT32(xdrs, int32p) \ (*(xdrs)->x_ops->x_putint32)(xdrs, int32p) #define xdr_putint32(xdrs, int32p) \ (*(xdrs)->x_ops->x_putint32)(xdrs, int32p) #endif /* !_LP64 && !_KERNEL */ FreeBSD: bool_t xdr_int(XDR *xdrs, int *ip) { long l; switch (xdrs->x_op) { case XDR_ENCODE: l =3D (long) *ip; return (XDR_PUTLONG(xdrs, &l)); case XDR_DECODE: if (!XDR_GETLONG(xdrs, &l)) { return (FALSE); } *ip =3D (int) l; return (TRUE); case XDR_FREE: return (TRUE); } /* NOTREACHED */ return (FALSE); } On Mon, May 11, 2009 at 12:23 PM, Kip Macy wrote: > On Mon, May 11, 2009 at 11:21 AM, Doug Rabson wrote: >> The XDR support code that is in the main kernel should have a very simil= ar >> API to the opensolaris bits, possibly identical. Perhaps the opensolaris >> compat could use the main kernel's XDR implementation? > > I tried that. The label reads end up failing when ZFS uses the libkern > implementation. Somewhere in there, there is a behavioral difference > between the two implementations. > > > At some point I'll track down the offending function. > > -Kip > > >> >> On 11 May 2009, at 05:18, Kip Macy wrote: >> >>> Author: kmacy >>> Date: Mon May 11 04:18:58 2009 >>> New Revision: 191984 >>> URL: http://svn.freebsd.org/changeset/base/191984 >>> >>> Log: >>> =A0rename xdr support files to avoid conflicts when linking in to the k= ernel >>> >>> Added: >>> =A0head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr.c >>> (props changed) >>> =A0 =A0- copied unchanged from r191983, >>> head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.c >>> =A0head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr_arr= ay.c >>> =A0 (props changed) >>> =A0 =A0- copied unchanged from r191983, >>> head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_array.c >>> =A0head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr_mem= .c >>> (props changed) >>> =A0 =A0- copied unchanged from r191983, >>> head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_mem.c >>> Deleted: >>> =A0head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.c >>> =A0head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_array.c >>> =A0head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_mem.c >>> Modified: >>> =A0head/sys/modules/zfs/Makefile >>> >>> Copied: head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xd= r.c >>> (from r191983, head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.c) >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- /dev/null =A0 00:00:00 1970 =A0 (empty, because file is newly added= ) >>> +++ head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr.c >>> =A0 Mon May 11 04:18:58 2009 =A0 =A0 =A0 =A0(r191984, copy of r191983, >>> head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.c) >>> @@ -0,0 +1,621 @@ >>> +/* >>> + * CDDL HEADER START >>> + * >>> + * The contents of this file are subject to the terms of the >>> + * Common Development and Distribution License (the "License"). >>> + * You may not use this file except in compliance with the License. >>> + * >>> + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE >>> + * or http://www.opensolaris.org/os/licensing. >>> + * See the License for the specific language governing permissions >>> + * and limitations under the License. >>> + * >>> + * When distributing Covered Code, include this CDDL HEADER in each >>> + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. >>> + * If applicable, add the following below this CDDL HEADER, with the >>> + * fields enclosed by brackets "[]" replaced with your own identifying >>> + * information: Portions Copyright [yyyy] [name of copyright owner] >>> + * >>> + * CDDL HEADER END >>> + */ >>> +/* >>> + * Copyright 2008 Sun Microsystems, Inc. =A0All rights reserved. >>> + * Use is subject to license terms. >>> + */ >>> + >>> +/* =A0 =A0 Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T= =A0 =A0 */ >>> +/* =A0 =A0 =A0 All Rights Reserved =A0 */ >>> + >>> +/* >>> + * Portions of this source code were derived from Berkeley 4.3 BSD >>> + * under license from the Regents of the University of California. >>> + */ >>> + >>> +/* >>> + * xdr.c, generic XDR routines implementation. >>> + * These are the "generic" xdr routines used to serialize and >>> de-serialize >>> + * most common data items. =A0See xdr.h for more info on the interface= to >>> + * xdr. >>> + */ >>> + >>> +#include >>> +#include >>> +#include >>> +#include >>> + >>> +#include >>> +#include >>> + >>> +#pragma weak xdr_int32_t =3D xdr_int >>> +#pragma weak xdr_uint32_t =3D xdr_u_int >>> +#pragma weak xdr_int64_t =3D xdr_longlong_t >>> +#pragma weak xdr_uint64_t =3D xdr_u_longlong_t >>> + >>> +#if defined(sun) >>> +#if !defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN) >>> +#error "Exactly one of _BIG_ENDIAN or _LITTLE_ENDIAN must be defined" >>> +#elif defined(_BIG_ENDIAN) && defined(_LITTLE_ENDIAN) >>> +#error "Only one of _BIG_ENDIAN or _LITTLE_ENDIAN may be defined" >>> +#endif >>> +#endif >>> + >>> +/* >>> + * constants specific to the xdr "protocol" >>> + */ >>> +#define =A0 =A0 =A0 =A0XDR_FALSE =A0 =A0 =A0 ((int32_t)0) >>> +#define =A0 =A0 =A0 =A0XDR_TRUE =A0 =A0 =A0 =A0((int32_t)1) >>> +#define =A0 =A0 =A0 =A0LASTUNSIGNED =A0 =A0((uint_t)0-1) >>> + >>> +/* >>> + * for unit alignment >>> + */ >>> +static char xdr_zero[BYTES_PER_XDR_UNIT] =3D { 0, 0, 0, 0 }; >>> + >>> +/* >>> + * Free a data structure using XDR >>> + * Not a filter, but a convenient utility nonetheless >>> + */ >>> +void >>> +xdr_free(xdrproc_t proc, char *objp) >>> +{ >>> + =A0 =A0 =A0 XDR x; >>> + >>> + =A0 =A0 =A0 x.x_op =3D XDR_FREE; >>> + =A0 =A0 =A0 (*proc)(&x, objp); >>> +} >>> + >>> +/* >>> + * XDR nothing >>> + */ >>> +bool_t >>> +xdr_void(void) >>> +{ >>> + =A0 =A0 =A0 return (TRUE); >>> +} >>> + >>> +/* >>> + * XDR integers >>> + * >>> + * PSARC 2003/523 Contract Private Interface >>> + * xdr_int >>> + * Changes must be reviewed by Solaris File Sharing >>> + * Changes must be communicated to contract-2003-523@sun.com >>> + */ >>> +bool_t >>> +xdr_int(XDR *xdrs, int *ip) >>> +{ >>> + =A0 =A0 =A0 if (xdrs->x_op =3D=3D XDR_ENCODE) >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (XDR_PUTINT32(xdrs, ip)); >>> + >>> + =A0 =A0 =A0 if (xdrs->x_op =3D=3D XDR_DECODE) >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (XDR_GETINT32(xdrs, ip)); >>> + >>> + =A0 =A0 =A0 if (xdrs->x_op =3D=3D XDR_FREE) >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >>> + >>> + =A0 =A0 =A0 return (FALSE); >>> +} >>> + >>> +/* >>> + * XDR unsigned integers >>> + * >>> + * PSARC 2003/523 Contract Private Interface >>> + * xdr_u_int >>> + * Changes must be reviewed by Solaris File Sharing >>> + * Changes must be communicated to contract-2003-523@sun.com >>> + */ >>> +bool_t >>> +xdr_u_int(XDR *xdrs, uint_t *up) >>> +{ >>> + =A0 =A0 =A0 if (xdrs->x_op =3D=3D XDR_ENCODE) >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (XDR_PUTINT32(xdrs, (int32_t *)up)= ); >>> + >>> + =A0 =A0 =A0 if (xdrs->x_op =3D=3D XDR_DECODE) >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (XDR_GETINT32(xdrs, (int32_t *)up)= ); >>> + >>> + =A0 =A0 =A0 if (xdrs->x_op =3D=3D XDR_FREE) >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >>> + >>> + =A0 =A0 =A0 return (FALSE); >>> +} >>> + >>> + >>> +#if defined(_ILP32) >>> +/* >>> + * xdr_long and xdr_u_long for binary compatability on ILP32 kernels. >>> + * >>> + * No prototypes since new code should not be using these interfaces. >>> + */ >>> +bool_t >>> +xdr_long(XDR *xdrs, long *ip) >>> +{ >>> + =A0 =A0 =A0 return (xdr_int(xdrs, (int *)ip)); >>> +} >>> + >>> +bool_t >>> +xdr_u_long(XDR *xdrs, unsigned long *up) >>> +{ >>> + =A0 =A0 =A0 return (xdr_u_int(xdrs, (uint_t *)up)); >>> +} >>> +#endif /* _ILP32 */ >>> + >>> + >>> +/* >>> + * XDR long long integers >>> + */ >>> +bool_t >>> +xdr_longlong_t(XDR *xdrs, longlong_t *hp) >>> +{ >>> + =A0 =A0 =A0 if (xdrs->x_op =3D=3D XDR_ENCODE) { >>> +#if BYTE_ORDER =3D=3D _LITTLE_ENDIAN >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (XDR_PUTINT32(xdrs, (int32_t *)((char = *)hp + >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 BYTES_PER_XDR_UNIT)) =3D=3D TRUE)= { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (XDR_PUTINT32(xdrs= , (int32_t *)hp)); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >>> +#else >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (XDR_PUTINT32(xdrs, (int32_t *)hp) =3D= =3D TRUE) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (XDR_PUTINT32(xdrs= , (int32_t *)((char *)hp >>> + >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 BYTES_PER_XDR_UNI= T))); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >>> +#endif >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >>> + >>> + =A0 =A0 =A0 } >>> + =A0 =A0 =A0 if (xdrs->x_op =3D=3D XDR_DECODE) { >>> +#if BYTE_ORDER =3D=3D _LITTLE_ENDIAN >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (XDR_GETINT32(xdrs, (int32_t *)((char = *)hp + >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 BYTES_PER_XDR_UNIT)) =3D=3D TRUE)= { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (XDR_GETINT32(xdrs= , (int32_t *)hp)); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >>> +#else >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (XDR_GETINT32(xdrs, (int32_t *)hp) =3D= =3D TRUE) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (XDR_GETINT32(xdrs= , (int32_t *)((char *)hp >>> + >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 BYTES_PER_XDR_UNI= T))); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >>> +#endif >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >>> + =A0 =A0 =A0 } >>> + =A0 =A0 =A0 return (TRUE); >>> +} >>> + >>> +/* >>> + * XDR unsigned long long integers >>> + */ >>> +bool_t >>> +xdr_u_longlong_t(XDR *xdrs, u_longlong_t *hp) >>> +{ >>> + >>> + =A0 =A0 =A0 if (xdrs->x_op =3D=3D XDR_ENCODE) { >>> +#if BYTE_ORDER =3D=3D _LITTLE_ENDIAN >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (XDR_PUTINT32(xdrs, (int32_t *)((char = *)hp + >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 BYTES_PER_XDR_UNIT)) =3D=3D TRUE)= { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (XDR_PUTINT32(xdrs= , (int32_t *)hp)); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >>> +#else >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (XDR_PUTINT32(xdrs, (int32_t *)hp) =3D= =3D TRUE) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (XDR_PUTINT32(xdrs= , (int32_t *)((char *)hp >>> + >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 BYTES_PER_XDR_UNI= T))); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >>> +#endif >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >>> + >>> + =A0 =A0 =A0 } >>> + =A0 =A0 =A0 if (xdrs->x_op =3D=3D XDR_DECODE) { >>> +#if BYTE_ORDER =3D=3D _LITTLE_ENDIAN >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (XDR_GETINT32(xdrs, (int32_t *)((char = *)hp + >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 BYTES_PER_XDR_UNIT)) =3D=3D TRUE)= { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (XDR_GETINT32(xdrs= , (int32_t *)hp)); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >>> +#else >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (XDR_GETINT32(xdrs, (int32_t *)hp) =3D= =3D TRUE) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (XDR_GETINT32(xdrs= , (int32_t *)((char *)hp >>> + >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 BYTES_PER_XDR_UNI= T))); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >>> +#endif >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >>> + =A0 =A0 =A0 } >>> + =A0 =A0 =A0 return (TRUE); >>> +} >>> + >>> +/* >>> + * XDR short integers >>> + */ >>> +bool_t >>> +xdr_short(XDR *xdrs, short *sp) >>> +{ >>> + =A0 =A0 =A0 int32_t l; >>> + >>> + =A0 =A0 =A0 switch (xdrs->x_op) { >>> + >>> + =A0 =A0 =A0 case XDR_ENCODE: >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 l =3D (int32_t)*sp; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (XDR_PUTINT32(xdrs, &l)); >>> + >>> + =A0 =A0 =A0 case XDR_DECODE: >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!XDR_GETINT32(xdrs, &l)) >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 *sp =3D (short)l; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >>> + >>> + =A0 =A0 =A0 case XDR_FREE: >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >>> + =A0 =A0 =A0 } >>> + =A0 =A0 =A0 return (FALSE); >>> +} >>> + >>> +/* >>> + * XDR unsigned short integers >>> + */ >>> +bool_t >>> +xdr_u_short(XDR *xdrs, ushort_t *usp) >>> +{ >>> + =A0 =A0 =A0 uint32_t l; >>> + >>> + =A0 =A0 =A0 switch (xdrs->x_op) { >>> + >>> + =A0 =A0 =A0 case XDR_ENCODE: >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 l =3D (uint32_t)*usp; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (XDR_PUTINT32(xdrs, (int32_t *)&l)= ); >>> + >>> + =A0 =A0 =A0 case XDR_DECODE: >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!XDR_GETINT32(xdrs, (int32_t *)&l)) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 *usp =3D (ushort_t)l; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >>> + >>> + =A0 =A0 =A0 case XDR_FREE: >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >>> + =A0 =A0 =A0 } >>> + =A0 =A0 =A0 return (FALSE); >>> +} >>> + >>> + >>> +/* >>> + * XDR a char >>> + */ >>> +bool_t >>> +xdr_char(XDR *xdrs, char *cp) >>> +{ >>> + =A0 =A0 =A0 int i; >>> + >>> + =A0 =A0 =A0 i =3D (*cp); >>> + =A0 =A0 =A0 if (!xdr_int(xdrs, &i)) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >>> + =A0 =A0 =A0 } >>> + =A0 =A0 =A0 *cp =3D (char)i; >>> + =A0 =A0 =A0 return (TRUE); >>> +} >>> + >>> +/* >>> + * XDR booleans >>> + * >>> + * PSARC 2003/523 Contract Private Interface >>> + * xdr_bool >>> + * Changes must be reviewed by Solaris File Sharing >>> + * Changes must be communicated to contract-2003-523@sun.com >>> + */ >>> +bool_t >>> +xdr_bool(XDR *xdrs, bool_t *bp) >>> +{ >>> + =A0 =A0 =A0 int32_t i32b; >>> + >>> + =A0 =A0 =A0 switch (xdrs->x_op) { >>> + >>> + =A0 =A0 =A0 case XDR_ENCODE: >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 i32b =3D *bp ? XDR_TRUE : XDR_FALSE; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (XDR_PUTINT32(xdrs, &i32b)); >>> + >>> + =A0 =A0 =A0 case XDR_DECODE: >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!XDR_GETINT32(xdrs, &i32b)) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 *bp =3D (i32b =3D=3D XDR_FALSE) ? FALSE := TRUE; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >>> + >>> + =A0 =A0 =A0 case XDR_FREE: >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >>> + =A0 =A0 =A0 } >>> + =A0 =A0 =A0 return (FALSE); >>> +} >>> + >>> +/* >>> + * XDR enumerations >>> + * >>> + * PSARC 2003/523 Contract Private Interface >>> + * xdr_enum >>> + * Changes must be reviewed by Solaris File Sharing >>> + * Changes must be communicated to contract-2003-523@sun.com >>> + */ >>> +#ifndef lint >>> +enum sizecheck { SIZEVAL } sizecheckvar; =A0 =A0 =A0 /* used to find t= he size >>> of */ >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 /* an enum */ >>> +#endif >>> +bool_t >>> +xdr_enum(XDR *xdrs, enum_t *ep) >>> +{ >>> +#ifndef lint >>> + =A0 =A0 =A0 /* >>> + =A0 =A0 =A0 =A0* enums are treated as ints >>> + =A0 =A0 =A0 =A0*/ >>> + =A0 =A0 =A0 if (sizeof (sizecheckvar) =3D=3D sizeof (int32_t)) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (xdr_int(xdrs, (int32_t *)ep)); >>> + =A0 =A0 =A0 } else if (sizeof (sizecheckvar) =3D=3D sizeof (short)) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (xdr_short(xdrs, (short *)ep)); >>> + =A0 =A0 =A0 } else { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >>> + =A0 =A0 =A0 } >>> +#else >>> + =A0 =A0 =A0 (void) (xdr_short(xdrs, (short *)ep)); >>> + =A0 =A0 =A0 return (xdr_int(xdrs, (int32_t *)ep)); >>> +#endif >>> +} >>> + >>> +/* >>> + * XDR opaque data >>> + * Allows the specification of a fixed size sequence of opaque bytes. >>> + * cp points to the opaque object and cnt gives the byte length. >>> + * >>> + * PSARC 2003/523 Contract Private Interface >>> + * xdr_opaque >>> + * Changes must be reviewed by Solaris File Sharing >>> + * Changes must be communicated to contract-2003-523@sun.com >>> + */ >>> +bool_t >>> +xdr_opaque(XDR *xdrs, caddr_t cp, const uint_t cnt) >>> +{ >>> + =A0 =A0 =A0 uint_t rndup; >>> + =A0 =A0 =A0 static char crud[BYTES_PER_XDR_UNIT]; >>> + >>> + =A0 =A0 =A0 /* >>> + =A0 =A0 =A0 =A0* if no data we are done >>> + =A0 =A0 =A0 =A0*/ >>> + =A0 =A0 =A0 if (cnt =3D=3D 0) >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >>> + >>> + =A0 =A0 =A0 /* >>> + =A0 =A0 =A0 =A0* round byte count to full xdr units >>> + =A0 =A0 =A0 =A0*/ >>> + =A0 =A0 =A0 rndup =3D cnt % BYTES_PER_XDR_UNIT; >>> + =A0 =A0 =A0 if (rndup !=3D 0) >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 rndup =3D BYTES_PER_XDR_UNIT - rndup; >>> + >>> + =A0 =A0 =A0 if (xdrs->x_op =3D=3D XDR_DECODE) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!XDR_GETBYTES(xdrs, cp, cnt)) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (rndup =3D=3D 0) >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (XDR_GETBYTES(xdrs, (caddr_t)crud,= rndup)); >>> + =A0 =A0 =A0 } >>> + >>> + =A0 =A0 =A0 if (xdrs->x_op =3D=3D XDR_ENCODE) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!XDR_PUTBYTES(xdrs, cp, cnt)) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (rndup =3D=3D 0) >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (XDR_PUTBYTES(xdrs, xdr_zero, rndu= p)); >>> + =A0 =A0 =A0 } >>> + >>> + =A0 =A0 =A0 if (xdrs->x_op =3D=3D XDR_FREE) >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >>> + >>> + =A0 =A0 =A0 return (FALSE); >>> +} >>> + >>> +/* >>> + * XDR counted bytes >>> + * *cpp is a pointer to the bytes, *sizep is the count. >>> + * If *cpp is NULL maxsize bytes are allocated >>> + * >>> + * PSARC 2003/523 Contract Private Interface >>> + * xdr_bytes >>> + * Changes must be reviewed by Solaris File Sharing >>> + * Changes must be communicated to contract-2003-523@sun.com >>> + */ >>> +bool_t >>> +xdr_bytes(XDR *xdrs, char **cpp, uint_t *sizep, const uint_t maxsize) >>> +{ >>> + =A0 =A0 =A0 char *sp =3D *cpp; =A0/* sp is the actual string pointer = */ >>> + =A0 =A0 =A0 uint_t nodesize; >>> + >>> + =A0 =A0 =A0 /* >>> + =A0 =A0 =A0 =A0* first deal with the length since xdr bytes are count= ed >>> + =A0 =A0 =A0 =A0*/ >>> + =A0 =A0 =A0 if (!xdr_u_int(xdrs, sizep)) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >>> + =A0 =A0 =A0 } >>> + =A0 =A0 =A0 nodesize =3D *sizep; >>> + =A0 =A0 =A0 if ((nodesize > maxsize) && (xdrs->x_op !=3D XDR_FREE)) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >>> + =A0 =A0 =A0 } >>> + >>> + =A0 =A0 =A0 /* >>> + =A0 =A0 =A0 =A0* now deal with the actual bytes >>> + =A0 =A0 =A0 =A0*/ >>> + =A0 =A0 =A0 switch (xdrs->x_op) { >>> + =A0 =A0 =A0 case XDR_DECODE: >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (nodesize =3D=3D 0) >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (sp =3D=3D NULL) >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 *cpp =3D sp =3D (char *)m= em_alloc(nodesize); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* FALLTHROUGH */ >>> + >>> + =A0 =A0 =A0 case XDR_ENCODE: >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (xdr_opaque(xdrs, sp, nodesize)); >>> + >>> + =A0 =A0 =A0 case XDR_FREE: >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (sp !=3D NULL) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 mem_free(sp, nodesize); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 *cpp =3D NULL; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >>> + =A0 =A0 =A0 } >>> + =A0 =A0 =A0 return (FALSE); >>> +} >>> + >>> +/* >>> + * Implemented here due to commonality of the object. >>> + */ >>> +bool_t >>> +xdr_netobj(XDR *xdrs, struct netobj *np) >>> +{ >>> + =A0 =A0 =A0 return (xdr_bytes(xdrs, &np->n_bytes, &np->n_len, MAX_NET= OBJ_SZ)); >>> +} >>> + >>> +/* >>> + * XDR a descriminated union >>> + * Support routine for discriminated unions. >>> + * You create an array of xdrdiscrim structures, terminated with >>> + * an entry with a null procedure pointer. =A0The routine gets >>> + * the discriminant value and then searches the array of xdrdiscrims >>> + * looking for that value. =A0It calls the procedure given in the >>> xdrdiscrim >>> + * to handle the discriminant. =A0If there is no specific routine a de= fault >>> + * routine may be called. >>> + * If there is no specific or default routine an error is returned. >>> + */ >>> +bool_t >>> +xdr_union(XDR *xdrs, enum_t *dscmp, char *unp, >>> + =A0 =A0 =A0 const struct xdr_discrim *choices, const xdrproc_t dfault= ) >>> +{ >>> + =A0 =A0 =A0 enum_t dscm; >>> + >>> + =A0 =A0 =A0 /* >>> + =A0 =A0 =A0 =A0* we deal with the discriminator; =A0it's an enum >>> + =A0 =A0 =A0 =A0*/ >>> + =A0 =A0 =A0 if (!xdr_enum(xdrs, dscmp)) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >>> + =A0 =A0 =A0 } >>> + =A0 =A0 =A0 dscm =3D *dscmp; >>> + >>> + =A0 =A0 =A0 /* >>> + =A0 =A0 =A0 =A0* search choices for a value that matches the discrimi= nator. >>> + =A0 =A0 =A0 =A0* if we find one, execute the xdr routine for that val= ue. >>> + =A0 =A0 =A0 =A0*/ >>> + =A0 =A0 =A0 for (; choices->proc !=3D NULL_xdrproc_t; choices++) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (choices->value =3D=3D dscm) >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return ((*(choices->proc)= )(xdrs, unp, >>> LASTUNSIGNED)); >>> + =A0 =A0 =A0 } >>> + >>> + =A0 =A0 =A0 /* >>> + =A0 =A0 =A0 =A0* no match - execute the default xdr routine if there = is one >>> + =A0 =A0 =A0 =A0*/ >>> + =A0 =A0 =A0 return ((dfault =3D=3D NULL_xdrproc_t) ? FALSE : >>> + =A0 =A0 =A0 =A0 =A0 (*dfault)(xdrs, unp, LASTUNSIGNED)); >>> +} >>> + >>> + >>> +/* >>> + * Non-portable xdr primitives. >>> + * Care should be taken when moving these routines to new architecture= s. >>> + */ >>> + >>> + >>> +/* >>> + * XDR null terminated ASCII strings >>> + * xdr_string deals with "C strings" - arrays of bytes that are >>> + * terminated by a NULL character. =A0The parameter cpp references a >>> + * pointer to storage; If the pointer is null, then the necessary >>> + * storage is allocated. =A0The last parameter is the max allowed leng= th >>> + * of the string as specified by a protocol. >>> + */ >>> +bool_t >>> +xdr_string(XDR *xdrs, char **cpp, const uint_t maxsize) >>> +{ >>> + =A0 =A0 =A0 char *sp =3D *cpp; =A0/* sp is the actual string pointer = */ >>> + =A0 =A0 =A0 uint_t size; >>> + =A0 =A0 =A0 uint_t nodesize; >>> + >>> + =A0 =A0 =A0 /* >>> + =A0 =A0 =A0 =A0* first deal with the length since xdr strings are >>> counted-strings >>> + =A0 =A0 =A0 =A0*/ >>> + =A0 =A0 =A0 switch (xdrs->x_op) { >>> + =A0 =A0 =A0 case XDR_FREE: >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (sp =3D=3D NULL) >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); =A0/* alre= ady free */ >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* FALLTHROUGH */ >>> + =A0 =A0 =A0 case XDR_ENCODE: >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 size =3D (sp !=3D NULL) ? (uint_t)strlen(= sp) : 0; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 break; >>> + =A0 =A0 =A0 case XDR_DECODE: >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 break; >>> + =A0 =A0 =A0 } >>> + =A0 =A0 =A0 if (!xdr_u_int(xdrs, &size)) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >>> + =A0 =A0 =A0 } >>> + =A0 =A0 =A0 if (size > maxsize) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >>> + =A0 =A0 =A0 } >>> + =A0 =A0 =A0 nodesize =3D size + 1; >>> + >>> + =A0 =A0 =A0 /* >>> + =A0 =A0 =A0 =A0* now deal with the actual bytes >>> + =A0 =A0 =A0 =A0*/ >>> + =A0 =A0 =A0 switch (xdrs->x_op) { >>> + =A0 =A0 =A0 case XDR_DECODE: >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (nodesize =3D=3D 0) >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (sp =3D=3D NULL) >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 sp =3D (char *)mem_alloc(= nodesize); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 sp[size] =3D 0; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!xdr_opaque(xdrs, sp, size)) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* free up memory if al= located here >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*/ >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (*cpp =3D=3D NULL) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 mem_free(= sp, nodesize); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (strlen(sp) !=3D size) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (*cpp =3D=3D NULL) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 mem_free(= sp, nodesize); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 *cpp =3D sp; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >>> + >>> + =A0 =A0 =A0 case XDR_ENCODE: >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (xdr_opaque(xdrs, sp, size)); >>> + >>> + =A0 =A0 =A0 case XDR_FREE: >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 mem_free(sp, nodesize); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 *cpp =3D NULL; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >>> + =A0 =A0 =A0 } >>> + =A0 =A0 =A0 return (FALSE); >>> +} >>> + >>> +/* >>> + * Wrapper for xdr_string that can be called directly from >>> + * routines like clnt_call >>> + */ >>> +bool_t >>> +xdr_wrapstring(XDR *xdrs, char **cpp) >>> +{ >>> + =A0 =A0 =A0 if (xdr_string(xdrs, cpp, LASTUNSIGNED)) >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >>> + =A0 =A0 =A0 return (FALSE); >>> +} >>> >>> Copied: >>> head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr_array.= c >>> (from r191983, head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_arr= ay.c) >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- /dev/null =A0 00:00:00 1970 =A0 (empty, because file is newly added= ) >>> +++ >>> head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr_array.= c Mon >>> May 11 04:18:58 2009 =A0 =A0 =A0 =A0(r191984, copy of r191983, >>> head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_array.c) >>> @@ -0,0 +1,114 @@ >>> +/* >>> + * CDDL HEADER START >>> + * >>> + * The contents of this file are subject to the terms of the >>> + * Common Development and Distribution License (the "License"). >>> + * You may not use this file except in compliance with the License. >>> + * >>> + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE >>> + * or http://www.opensolaris.org/os/licensing. >>> + * See the License for the specific language governing permissions >>> + * and limitations under the License. >>> + * >>> + * When distributing Covered Code, include this CDDL HEADER in each >>> + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. >>> + * If applicable, add the following below this CDDL HEADER, with the >>> + * fields enclosed by brackets "[]" replaced with your own identifying >>> + * information: Portions Copyright [yyyy] [name of copyright owner] >>> + * >>> + * CDDL HEADER END >>> + */ >>> +/* >>> + * Copyright 2008 Sun Microsystems, Inc. =A0All rights reserved. >>> + * Use is subject to license terms. >>> + */ >>> + >>> +/* =A0 =A0 Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T= =A0 =A0 */ >>> +/* =A0 =A0 =A0 All Rights Reserved =A0 */ >>> + >>> +/* >>> + * Portions of this source code were derived from Berkeley 4.3 BSD >>> + * under license from the Regents of the University of California. >>> + */ >>> + >>> +/* >>> + * xdr_array.c, Generic XDR routines impelmentation. >>> + * These are the "non-trivial" xdr primitives used to serialize and >>> de-serialize >>> + * arrays. =A0See xdr.h for more info on the interface to xdr. >>> + */ >>> + >>> +#include >>> +#include >>> +#include >>> +#include >>> + >>> +#include >>> +#include >>> + >>> +#define =A0 =A0 =A0 =A0LASTUNSIGNED =A0 =A0((uint_t)0-1) >>> + >>> +/* >>> + * XDR an array of arbitrary elements >>> + * *addrp is a pointer to the array, *sizep is the number of elements. >>> + * If addrp is NULL (*sizep * elsize) bytes are allocated. >>> + * elsize is the size (in bytes) of each element, and elproc is the >>> + * xdr procedure to call to handle each element of the array. >>> + */ >>> +bool_t >>> +xdr_array(XDR *xdrs, caddr_t *addrp, uint_t *sizep, const uint_t maxsi= ze, >>> + =A0 =A0 =A0 const uint_t elsize, const xdrproc_t elproc) >>> +{ >>> + =A0 =A0 =A0 uint_t i; >>> + =A0 =A0 =A0 caddr_t target =3D *addrp; >>> + =A0 =A0 =A0 uint_t c; =A0/* the actual element count */ >>> + =A0 =A0 =A0 bool_t stat =3D TRUE; >>> + =A0 =A0 =A0 uint_t nodesize; >>> + >>> + =A0 =A0 =A0 /* like strings, arrays are really counted arrays */ >>> + =A0 =A0 =A0 if (!xdr_u_int(xdrs, sizep)) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >>> + =A0 =A0 =A0 } >>> + =A0 =A0 =A0 c =3D *sizep; >>> + =A0 =A0 =A0 if ((c > maxsize || LASTUNSIGNED / elsize < c) && >>> + =A0 =A0 =A0 =A0 =A0 xdrs->x_op !=3D XDR_FREE) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >>> + =A0 =A0 =A0 } >>> + =A0 =A0 =A0 nodesize =3D c * elsize; >>> + >>> + =A0 =A0 =A0 /* >>> + =A0 =A0 =A0 =A0* if we are deserializing, we may need to allocate an = array. >>> + =A0 =A0 =A0 =A0* We also save time by checking for a null array if we= are >>> freeing. >>> + =A0 =A0 =A0 =A0*/ >>> + =A0 =A0 =A0 if (target =3D=3D NULL) >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 switch (xdrs->x_op) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 case XDR_DECODE: >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (c =3D=3D 0) >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (T= RUE); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 *addrp =3D target =3D (ch= ar *)mem_alloc(nodesize); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 bzero(target, nodesize); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break; >>> + >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 case XDR_FREE: >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >>> + >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 case XDR_ENCODE: >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >>> + >>> + =A0 =A0 =A0 /* >>> + =A0 =A0 =A0 =A0* now we xdr each element of array >>> + =A0 =A0 =A0 =A0*/ >>> + =A0 =A0 =A0 for (i =3D 0; (i < c) && stat; i++) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 stat =3D (*elproc)(xdrs, target, LASTUNSI= GNED); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 target +=3D elsize; >>> + =A0 =A0 =A0 } >>> + >>> + =A0 =A0 =A0 /* >>> + =A0 =A0 =A0 =A0* the array may need freeing >>> + =A0 =A0 =A0 =A0*/ >>> + =A0 =A0 =A0 if (xdrs->x_op =3D=3D XDR_FREE) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 mem_free(*addrp, nodesize); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 *addrp =3D NULL; >>> + =A0 =A0 =A0 } >>> + =A0 =A0 =A0 return (stat); >>> +} >>> >>> Copied: >>> head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr_mem.c = (from >>> r191983, head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_mem.c) >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- /dev/null =A0 00:00:00 1970 =A0 (empty, because file is newly added= ) >>> +++ head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr_me= m.c >>> =A0 Mon May 11 04:18:58 2009 =A0 =A0 =A0 =A0(r191984, copy of r191983, >>> head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_mem.c) >>> @@ -0,0 +1,209 @@ >>> +/* >>> + * CDDL HEADER START >>> + * >>> + * The contents of this file are subject to the terms of the >>> + * Common Development and Distribution License, Version 1.0 only >>> + * (the "License"). =A0You may not use this file except in compliance >>> + * with the License. >>> + * >>> + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE >>> + * or http://www.opensolaris.org/os/licensing. >>> + * See the License for the specific language governing permissions >>> + * and limitations under the License. >>> + * >>> + * When distributing Covered Code, include this CDDL HEADER in each >>> + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. >>> + * If applicable, add the following below this CDDL HEADER, with the >>> + * fields enclosed by brackets "[]" replaced with your own identifying >>> + * information: Portions Copyright [yyyy] [name of copyright owner] >>> + * >>> + * CDDL HEADER END >>> + */ >>> +/* >>> + * Copyright 2005 Sun Microsystems, Inc. =A0All rights reserved. >>> + * Use is subject to license terms. >>> + */ >>> + >>> +/* =A0 =A0 Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T= =A0 =A0 */ >>> +/* =A0 =A0 =A0 All Rights Reserved =A0 */ >>> + >>> +/* >>> + * Portions of this source code were derived from Berkeley 4.3 BSD >>> + * under license from the Regents of the University of California. >>> + */ >>> + >>> +#pragma ident =A0"%Z%%M% %I% =A0 =A0 %E% SMI" >>> + >>> +/* >>> + * xdr_mem.c, XDR implementation using memory buffers. >>> + * >>> + * If you have some data to be interpreted as external data >>> representation >>> + * or to be converted to external data representation in a memory buff= er, >>> + * then this is the package for you. >>> + */ >>> + >>> +#include >>> +#include >>> +#include >>> + >>> +#include >>> +#include >>> + >>> +static struct xdr_ops *xdrmem_ops(void); >>> + >>> +/* >>> + * The procedure xdrmem_create initializes a stream descriptor for a >>> + * memory buffer. >>> + */ >>> +void >>> +xdrmem_create(XDR *xdrs, caddr_t addr, uint_t size, enum xdr_op op) >>> +{ >>> + =A0 =A0 =A0 xdrs->x_op =3D op; >>> + =A0 =A0 =A0 xdrs->x_ops =3D xdrmem_ops(); >>> + =A0 =A0 =A0 xdrs->x_private =3D xdrs->x_base =3D addr; >>> + =A0 =A0 =A0 xdrs->x_handy =3D size; >>> + =A0 =A0 =A0 xdrs->x_public =3D NULL; >>> +} >>> + >>> +/* ARGSUSED */ >>> +static void >>> +xdrmem_destroy(XDR *xdrs) >>> +{ >>> +} >>> + >>> +static bool_t >>> +xdrmem_getint32(XDR *xdrs, int32_t *int32p) >>> +{ >>> + =A0 =A0 =A0 if ((xdrs->x_handy -=3D (int)sizeof (int32_t)) < 0) >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >>> + =A0 =A0 =A0 /* LINTED pointer alignment */ >>> + =A0 =A0 =A0 *int32p =3D (int32_t)ntohl((uint32_t)(*((int32_t >>> *)(xdrs->x_private)))); >>> + =A0 =A0 =A0 xdrs->x_private +=3D sizeof (int32_t); >>> + =A0 =A0 =A0 return (TRUE); >>> +} >>> + >>> +static bool_t >>> +xdrmem_putint32(XDR *xdrs, int32_t *int32p) >>> +{ >>> + =A0 =A0 =A0 if ((xdrs->x_handy -=3D (int)sizeof (int32_t)) < 0) >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >>> + =A0 =A0 =A0 /* LINTED pointer alignment */ >>> + =A0 =A0 =A0 *(int32_t *)xdrs->x_private =3D (int32_t)htonl((uint32_t)= (*int32p)); >>> + =A0 =A0 =A0 xdrs->x_private +=3D sizeof (int32_t); >>> + =A0 =A0 =A0 return (TRUE); >>> +} >>> + >>> +static bool_t >>> +xdrmem_getbytes(XDR *xdrs, caddr_t addr, int len) >>> +{ >>> + =A0 =A0 =A0 if ((xdrs->x_handy -=3D len) < 0) >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >>> + =A0 =A0 =A0 bcopy(xdrs->x_private, addr, len); >>> + =A0 =A0 =A0 xdrs->x_private +=3D len; >>> + =A0 =A0 =A0 return (TRUE); >>> +} >>> + >>> +static bool_t >>> +xdrmem_putbytes(XDR *xdrs, caddr_t addr, int len) >>> +{ >>> + =A0 =A0 =A0 if ((xdrs->x_handy -=3D len) < 0) >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >>> + =A0 =A0 =A0 bcopy(addr, xdrs->x_private, len); >>> + =A0 =A0 =A0 xdrs->x_private +=3D len; >>> + =A0 =A0 =A0 return (TRUE); >>> +} >>> + >>> +static uint_t >>> +xdrmem_getpos(XDR *xdrs) >>> +{ >>> + =A0 =A0 =A0 return ((uint_t)((uintptr_t)xdrs->x_private - >>> (uintptr_t)xdrs->x_base)); >>> +} >>> + >>> +static bool_t >>> +xdrmem_setpos(XDR *xdrs, uint_t pos) >>> +{ >>> + =A0 =A0 =A0 caddr_t newaddr =3D xdrs->x_base + pos; >>> + =A0 =A0 =A0 caddr_t lastaddr =3D xdrs->x_private + xdrs->x_handy; >>> + =A0 =A0 =A0 ptrdiff_t diff; >>> + >>> + =A0 =A0 =A0 if (newaddr > lastaddr) >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >>> + =A0 =A0 =A0 xdrs->x_private =3D newaddr; >>> + =A0 =A0 =A0 diff =3D lastaddr - newaddr; >>> + =A0 =A0 =A0 xdrs->x_handy =3D (int)diff; >>> + =A0 =A0 =A0 return (TRUE); >>> +} >>> + >>> +static rpc_inline_t * >>> +xdrmem_inline(XDR *xdrs, int len) >>> +{ >>> + =A0 =A0 =A0 rpc_inline_t *buf =3D NULL; >>> + >>> + =A0 =A0 =A0 if (xdrs->x_handy >=3D len) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 xdrs->x_handy -=3D len; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* LINTED pointer alignment */ >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 buf =3D (rpc_inline_t *)xdrs->x_private; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 xdrs->x_private +=3D len; >>> + =A0 =A0 =A0 } >>> + =A0 =A0 =A0 return (buf); >>> +} >>> + >>> +static bool_t >>> +xdrmem_control(XDR *xdrs, int request, void *info) >>> +{ >>> + =A0 =A0 =A0 xdr_bytesrec *xptr; >>> + =A0 =A0 =A0 int32_t *int32p; >>> + =A0 =A0 =A0 int len; >>> + >>> + =A0 =A0 =A0 switch (request) { >>> + >>> + =A0 =A0 =A0 case XDR_GET_BYTES_AVAIL: >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 xptr =3D (xdr_bytesrec *)info; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 xptr->xc_is_last_record =3D TRUE; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 xptr->xc_num_avail =3D xdrs->x_handy; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >>> + >>> + =A0 =A0 =A0 case XDR_PEEK: >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* Return the next 4 byte unit in the X= DR stream. >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*/ >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (xdrs->x_handy < sizeof (int32_t)) >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 int32p =3D (int32_t *)info; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 *int32p =3D (int32_t)ntohl((uint32_t) >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (*((int32_t *)(xdrs->x_private)))= ); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >>> + >>> + =A0 =A0 =A0 case XDR_SKIPBYTES: >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* Skip the next N bytes in the XDR str= eam. >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*/ >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 int32p =3D (int32_t *)info; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 len =3D RNDUP((int)(*int32p)); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((xdrs->x_handy -=3D len) < 0) >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (FALSE); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 xdrs->x_private +=3D len; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (TRUE); >>> + >>> + =A0 =A0 =A0 } >>> + =A0 =A0 =A0 return (FALSE); >>> +} >>> + >>> +static struct xdr_ops * >>> +xdrmem_ops(void) >>> +{ >>> + =A0 =A0 =A0 static struct xdr_ops ops; >>> + >>> + =A0 =A0 =A0 if (ops.x_getint32 =3D=3D NULL) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ops.x_getbytes =3D xdrmem_getbytes; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ops.x_putbytes =3D xdrmem_putbytes; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ops.x_getpostn =3D xdrmem_getpos; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ops.x_setpostn =3D xdrmem_setpos; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ops.x_inline =3D xdrmem_inline; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ops.x_destroy =3D xdrmem_destroy; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ops.x_control =3D xdrmem_control; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ops.x_getint32 =3D xdrmem_getint32; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ops.x_putint32 =3D xdrmem_putint32; >>> + =A0 =A0 =A0 } >>> + =A0 =A0 =A0 return (&ops); >>> +} >>> >>> Modified: head/sys/modules/zfs/Makefile >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- head/sys/modules/zfs/Makefile =A0 =A0 =A0 Mon May 11 02:39:49 2009 >>> =A0(r191983) >>> +++ head/sys/modules/zfs/Makefile =A0 =A0 =A0 Mon May 11 04:18:58 2009 >>> =A0(r191984) >>> @@ -44,9 +44,9 @@ SRCS+=3D =A0 =A0 =A0 =A0nvpair_alloc_system.c >>> SRCS+=3D =A0taskq.c >>> >>> .PATH: =A0${SUNW}/uts/common/rpc >>> -SRCS+=3D xdr.c >>> -SRCS+=3D xdr_array.c >>> -SRCS+=3D xdr_mem.c >>> +SRCS+=3D opensolaris_xdr.c >>> +SRCS+=3D opensolaris_xdr_array.c >>> +SRCS+=3D opensolaris_xdr_mem.c >>> >>> .PATH: =A0${SUNW}/uts/common/zmod >>> SRCS+=3D =A0adler32.c >> >> > > > > -- > When bad men combine, the good must associate; else they will fall one > by one, an unpitied sacrifice in a contemptible struggle. > > =A0 =A0Edmund Burke > --=20 When bad men combine, the good must associate; else they will fall one by one, an unpitied sacrifice in a contemptible struggle. Edmund Burke From owner-svn-src-head@FreeBSD.ORG Tue May 12 05:49:02 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E60410656B2; Tue, 12 May 2009 05:49:02 +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 62FCE8FC16; Tue, 12 May 2009 05:49:02 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4C5n2KU012611; Tue, 12 May 2009 05:49:02 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4C5n2Cj012608; Tue, 12 May 2009 05:49:02 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200905120549.n4C5n2Cj012608@svn.freebsd.org> From: Alan Cox Date: Tue, 12 May 2009 05:49:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192010 - in head/sys: fs/smbfs nfsclient vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 05:49:03 -0000 Author: alc Date: Tue May 12 05:49:02 2009 New Revision: 192010 URL: http://svn.freebsd.org/changeset/base/192010 Log: Eliminate gratuitous clearing of the page's dirty mask. Modified: head/sys/fs/smbfs/smbfs_io.c head/sys/nfsclient/nfs_bio.c head/sys/vm/vnode_pager.c Modified: head/sys/fs/smbfs/smbfs_io.c ============================================================================== --- head/sys/fs/smbfs/smbfs_io.c Tue May 12 03:30:25 2009 (r192009) +++ head/sys/fs/smbfs/smbfs_io.c Tue May 12 05:49:02 2009 (r192010) @@ -517,7 +517,8 @@ smbfs_getpages(ap) * Read operation filled an entire page */ m->valid = VM_PAGE_BITS_ALL; - vm_page_undirty(m); + KASSERT(m->dirty == 0, + ("smbfs_getpages: page %p is dirty", m)); } else if (size > toff) { /* * Read operation filled a partial page. Modified: head/sys/nfsclient/nfs_bio.c ============================================================================== --- head/sys/nfsclient/nfs_bio.c Tue May 12 03:30:25 2009 (r192009) +++ head/sys/nfsclient/nfs_bio.c Tue May 12 05:49:02 2009 (r192010) @@ -209,7 +209,8 @@ nfs_getpages(struct vop_getpages_args *a * Read operation filled an entire page */ m->valid = VM_PAGE_BITS_ALL; - vm_page_undirty(m); + KASSERT(m->dirty == 0, + ("nfs_getpages: page %p is dirty", m)); } else if (size > toff) { /* * Read operation filled a partial page. Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Tue May 12 03:30:25 2009 (r192009) +++ head/sys/vm/vnode_pager.c Tue May 12 05:49:02 2009 (r192010) @@ -762,7 +762,8 @@ vnode_pager_generic_getpages(vp, m, byte return VM_PAGER_OK; } else if (reqblock == -1) { pmap_zero_page(m[reqpage]); - vm_page_undirty(m[reqpage]); + KASSERT(m[reqpage]->dirty == 0, + ("vnode_pager_generic_getpages: page %p is dirty", m)); m[reqpage]->valid = VM_PAGE_BITS_ALL; vm_page_lock_queues(); for (i = 0; i < count; i++) From owner-svn-src-head@FreeBSD.ORG Tue May 12 07:33:36 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E47B1065670; Tue, 12 May 2009 07:33:36 +0000 (UTC) (envelope-from dfr@rabson.org) Received: from itchy.rabson.org (router.rabson.org [80.177.232.241]) by mx1.freebsd.org (Postfix) with ESMTP id 55A5A8FC1A; Tue, 12 May 2009 07:33:36 +0000 (UTC) (envelope-from dfr@rabson.org) Received: from [IPv6:2001:470:909f:1:225:ff:feed:9426] (unknown [IPv6:2001:470:909f:1:225:ff:feed:9426]) by itchy.rabson.org (Postfix) with ESMTP id C5EEA5C9C; Tue, 12 May 2009 08:33:41 +0100 (BST) Message-Id: <56AB958E-2FF5-421C-9B72-1181EA265A35@rabson.org> From: Doug Rabson To: Kip Macy In-Reply-To: <3c1674c90905112203p363d3dfdoa0511d8b5c00f74b@mail.gmail.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.4) Date: Tue, 12 May 2009 08:33:03 +0100 References: <200905110418.n4B4IxPC077484@svn.freebsd.org> <0E48393C-F519-42A1-AD3C-3EC31EE2AE06@rabson.org> <3c1674c90905111223u74ec12ch9f40772940a42396@mail.gmail.com> <3c1674c90905112203p363d3dfdoa0511d8b5c00f74b@mail.gmail.com> X-Mailer: Apple Mail (2.930.4) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191984 - in head/sys: cddl/contrib/opensolaris/uts/common/rpc modules/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 07:33:37 -0000 On 12 May 2009, at 06:03, Kip Macy wrote: > Here is the problem, FreeBSD is sloppy about 32-bit vs. 64-bit for xdr > whereas in the kernel, Solaris is not. I thought that XDR 'long' types were 32 bit regardless of whether the platform was 32 or 64 bit. I'll have to read the code again. From owner-svn-src-head@FreeBSD.ORG Tue May 12 07:41:21 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 15ECB106564A; Tue, 12 May 2009 07:41:21 +0000 (UTC) (envelope-from qingli@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 03FF48FC0A; Tue, 12 May 2009 07:41:21 +0000 (UTC) (envelope-from qingli@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4C7fKIu014804; Tue, 12 May 2009 07:41:20 GMT (envelope-from qingli@svn.freebsd.org) Received: (from qingli@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4C7fK8o014803; Tue, 12 May 2009 07:41:20 GMT (envelope-from qingli@svn.freebsd.org) Message-Id: <200905120741.n4C7fK8o014803@svn.freebsd.org> From: Qing Li Date: Tue, 12 May 2009 07:41:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192011 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 07:41:21 -0000 Author: qingli Date: Tue May 12 07:41:20 2009 New Revision: 192011 URL: http://svn.freebsd.org/changeset/base/192011 Log: This patch adds a host route to an interface address (that is assigned to a non loopback/ppp link types) through the loopback interface. Prior to the new L2/L3 rewrite, this host route is implicitly added by the L2 code during RTM_RESOLVE of that interface address. This host route is deleted when that interface is removed. Reviewed by: kmacy Modified: head/sys/netinet/in.c Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Tue May 12 05:49:02 2009 (r192010) +++ head/sys/netinet/in.c Tue May 12 07:41:20 2009 (r192011) @@ -45,12 +45,15 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include #include #include #include +#include #include #include @@ -814,6 +817,9 @@ in_ifinit(struct ifnet *ifp, struct in_i INIT_VNET_INET(ifp->if_vnet); register u_long i = ntohl(sin->sin_addr.s_addr); struct sockaddr_in oldaddr; + struct rtentry *rt = NULL; + struct rt_addrinfo info; + static struct sockaddr_dl null_sdl = {sizeof(null_sdl), AF_LINK}; int s = splimp(), flags = RTF_UP, error = 0; oldaddr = ia->ia_addr; @@ -900,6 +906,29 @@ in_ifinit(struct ifnet *ifp, struct in_i if ((error = in_addprefix(ia, flags)) != 0) return (error); + /* + * add a loopback route to self + */ + if (!(ifp->if_flags & (IFF_LOOPBACK | IFF_POINTOPOINT))) { + bzero(&info, sizeof(info)); + info.rti_ifp = V_loif; + info.rti_flags = ia->ia_flags | RTF_HOST | RTF_STATIC; + info.rti_info[RTAX_DST] = (struct sockaddr *)&ia->ia_addr; + info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&null_sdl; + error = rtrequest1_fib(RTM_ADD, &info, &rt, 0); + + if (error == 0 && rt != NULL) { + RT_LOCK(rt); + ((struct sockaddr_dl *)rt->rt_gateway)->sdl_type = + rt->rt_ifp->if_type; + ((struct sockaddr_dl *)rt->rt_gateway)->sdl_index = + rt->rt_ifp->if_index; + RT_REMREF(rt); + RT_UNLOCK(rt); + } else if (error != 0) + log(LOG_INFO, "in_ifinit: insertion failed\n"); + } + return (error); } @@ -979,10 +1008,28 @@ in_scrubprefix(struct in_ifaddr *target) struct in_ifaddr *ia; struct in_addr prefix, mask, p; int error; + struct rt_addrinfo info; + struct sockaddr_dl null_sdl; if ((target->ia_flags & IFA_ROUTE) == 0) return (0); + if (!(target->ia_ifp->if_flags & (IFF_LOOPBACK | IFF_POINTOPOINT))) { + bzero(&null_sdl, sizeof(null_sdl)); + null_sdl.sdl_len = sizeof(null_sdl); + null_sdl.sdl_family = AF_LINK; + null_sdl.sdl_type = V_loif->if_type; + null_sdl.sdl_index = V_loif->if_index; + bzero(&info, sizeof(info)); + info.rti_flags = target->ia_flags | RTF_HOST | RTF_STATIC; + info.rti_info[RTAX_DST] = (struct sockaddr *)&target->ia_addr; + info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&null_sdl; + error = rtrequest1_fib(RTM_DELETE, &info, NULL, 0); + + if (error != 0) + log(LOG_INFO, "in_scrubprefix: deletion failed\n"); + } + if (rtinitflags(target)) prefix = target->ia_dstaddr.sin_addr; else { @@ -1136,7 +1183,6 @@ in_purgemaddrs(struct ifnet *ifp) IN_MULTI_UNLOCK(); } -#include #include #include From owner-svn-src-head@FreeBSD.ORG Tue May 12 08:16:34 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CC3F21065670; Tue, 12 May 2009 08:16:34 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: from yx-out-2324.google.com (yx-out-2324.google.com [74.125.44.28]) by mx1.freebsd.org (Postfix) with ESMTP id 5361D8FC0C; Tue, 12 May 2009 08:16:34 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: by yx-out-2324.google.com with SMTP id 8so1979355yxb.13 for ; Tue, 12 May 2009 01:16:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=9Spy3R2+r+n8D55FoJn+/uMun2V6c1W9hKo9ChAyqUE=; b=NafkwbatU3mCwf9jHwzuZCGQmj7AlU5FBPV8RwYohPU4UWWwIkiP+XEdEmtnCFVx+s h25uMRLPhOE9ZQ80o7wlNWm0OOCNSL5hihIqkmzdTgSju1GVNnqflU+DFjtyZTAsPZvK qzWW3WB7o3AMlNn1CVRX+VNnQwPiJxnNEV6Ac= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=DHTDxINyOTcp1J0Nm1Molg4VlLJ2h0PHpHNtaGPhPsI4GUGV1/Kk36TK9Ee7KCA7Oa tMpWa95O3oxd7GdPjHv1XbnWbOZmlwBe9DTtxEavQUzK9Pb4oxLrqrsOSRux9xV3olWn U+q46+aRK9iUmOYd+3mhWweemFrL0mHAalZiA= MIME-Version: 1.0 Sender: mat.macy@gmail.com Received: by 10.100.178.9 with SMTP id a9mr19639646anf.11.1242116194131; Tue, 12 May 2009 01:16:34 -0700 (PDT) In-Reply-To: <56AB958E-2FF5-421C-9B72-1181EA265A35@rabson.org> References: <200905110418.n4B4IxPC077484@svn.freebsd.org> <0E48393C-F519-42A1-AD3C-3EC31EE2AE06@rabson.org> <3c1674c90905111223u74ec12ch9f40772940a42396@mail.gmail.com> <3c1674c90905112203p363d3dfdoa0511d8b5c00f74b@mail.gmail.com> <56AB958E-2FF5-421C-9B72-1181EA265A35@rabson.org> Date: Tue, 12 May 2009 01:16:34 -0700 X-Google-Sender-Auth: de9789ac1722f889 Message-ID: <3c1674c90905120116l46d2fc84w789b3396419a9ede@mail.gmail.com> From: Kip Macy To: Doug Rabson Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191984 - in head/sys: cddl/contrib/opensolaris/uts/common/rpc modules/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 08:16:35 -0000 On Tue, May 12, 2009 at 12:33 AM, Doug Rabson wrote: > > On 12 May 2009, at 06:03, Kip Macy wrote: > >> Here is the problem, FreeBSD is sloppy about 32-bit vs. 64-bit for xdr >> whereas in the kernel, Solaris is not. > > I thought that XDR 'long' types were 32 bit regardless of whether the > platform was 32 or 64 bit. I'll have to read the code again. I'm not familiar with XDR, so I might be in error. If you could reconcile the differences between Solaris and FreeBSD so that ZFS can use FreeBSD's XDR implementation I would greatly appreciate it. Thanks, Kip -- When bad men combine, the good must associate; else they will fall one by one, an unpitied sacrifice in a contemptible struggle. Edmund Burke From owner-svn-src-head@FreeBSD.ORG Tue May 12 08:18:39 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1CDA11065694; Tue, 12 May 2009 08:18:39 +0000 (UTC) (envelope-from dfr@rabson.org) Received: from itchy.rabson.org (router.rabson.org [80.177.232.241]) by mx1.freebsd.org (Postfix) with ESMTP id 97AA48FC20; Tue, 12 May 2009 08:18:34 +0000 (UTC) (envelope-from dfr@rabson.org) Received: from [IPv6:2001:470:909f:1:225:ff:feed:9426] (unknown [IPv6:2001:470:909f:1:225:ff:feed:9426]) by itchy.rabson.org (Postfix) with ESMTP id 7FB695CF3; Tue, 12 May 2009 09:18:41 +0100 (BST) Message-Id: <6F0EE05A-45C0-410F-AFE4-7A6DD3CEF452@rabson.org> From: Doug Rabson To: Kip Macy In-Reply-To: <3c1674c90905120116l46d2fc84w789b3396419a9ede@mail.gmail.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.4) Date: Tue, 12 May 2009 09:18:02 +0100 References: <200905110418.n4B4IxPC077484@svn.freebsd.org> <0E48393C-F519-42A1-AD3C-3EC31EE2AE06@rabson.org> <3c1674c90905111223u74ec12ch9f40772940a42396@mail.gmail.com> <3c1674c90905112203p363d3dfdoa0511d8b5c00f74b@mail.gmail.com> <56AB958E-2FF5-421C-9B72-1181EA265A35@rabson.org> <3c1674c90905120116l46d2fc84w789b3396419a9ede@mail.gmail.com> X-Mailer: Apple Mail (2.930.4) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191984 - in head/sys: cddl/contrib/opensolaris/uts/common/rpc modules/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 08:18:39 -0000 On 12 May 2009, at 09:16, Kip Macy wrote: > On Tue, May 12, 2009 at 12:33 AM, Doug Rabson wrote: >> >> On 12 May 2009, at 06:03, Kip Macy wrote: >> >>> Here is the problem, FreeBSD is sloppy about 32-bit vs. 64-bit for >>> xdr >>> whereas in the kernel, Solaris is not. >> >> I thought that XDR 'long' types were 32 bit regardless of whether the >> platform was 32 or 64 bit. I'll have to read the code again. > > I'm not familiar with XDR, so I might be in error. If you could > reconcile the differences between Solaris and FreeBSD so that ZFS can > use FreeBSD's XDR implementation I would greatly appreciate it. I'll see what I can do. Thanks for taking the time to look at it. From owner-svn-src-head@FreeBSD.ORG Tue May 12 09:13:48 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 919FC1065673; Tue, 12 May 2009 09:13:48 +0000 (UTC) (envelope-from frank@ilse.behrens.de) Received: from post.behrens.de (post.behrens.de [IPv6:2a01:170:1023::1:2]) by mx1.freebsd.org (Postfix) with ESMTP id E107A8FC20; Tue, 12 May 2009 09:13:47 +0000 (UTC) (envelope-from frank@ilse.behrens.de) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=behrens.de; h=from:to:date:mime-version:subject:cc:in-reply-to:references:content-type:content-transfer-encoding:content-description; s=pinky1; t=1242119625; i=frank@ilse.behrens.de; bh=VVGXtJF1Uc8y0vBcojvueTaT6iVGI2RYq16p5lUjtZI=; b=KLhUwzo0q9dbNkvJVp+B70ADzl5yMSgyu9LiHHMajPqUVEKLRSME+LriyE3PFwX4xtoLAFz0FES60JrM70THkA== Received: from sun.behrens ([IPv6:2a01:170:1023:0:dc3:696e:f638:57c7]) by post.behrens.de (8.14.3/8.14.2) with ESMTP(MSA) id n4C9DOqw032522; Tue, 12 May 2009 11:13:24 +0200 (CEST) (envelope-from frank@ilse.behrens.de) Message-Id: <200905120913.n4C9DOqw032522@post.behrens.de> From: "Frank Behrens" To: Doug Rabson Date: Tue, 12 May 2009 11:13:24 +0200 MIME-Version: 1.0 Priority: normal In-reply-to: <3c1674c90905120116l46d2fc84w789b3396419a9ede@mail.gmail.com> References: <56AB958E-2FF5-421C-9B72-1181EA265A35@rabson.org> X-mailer: Pegasus Mail for Windows (4.31, DE v4.31 R1) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-Hashcash: 1:23:090512:src-committers@freebsd.org::nx8RRSqtmD8//mkd:00000000non+ X-Hashcash: 1:23:090512:svn-src-all@freebsd.org::o9xeuA/OOE7iHAb+:0000000000bmoj X-Hashcash: 1:23:090512:svn-src-head@freebsd.org::k+IlOQKgqBER1Xce:000000000VZU4 X-Hashcash: 1:23:090512:dfr@rabson.org::6ofMGYICGlKnxDnA:AN0M Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191984 - in head/sys: cddl/contrib/opensolaris/uts/common/rpc modules/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 09:13:49 -0000 On Tue, May 12, 2009 at 12:33 AM, Doug Rabson wrote: > > I thought that XDR 'long' types were 32 bit regardless of whether the > > platform was 32 or 64 bit. I'll have to read the code again. XDR is defined in RFC 4506. It should be independent from architecture. "An XDR {signed,unsigned} integer is a 32-bit datum..." "The standard also defines 64-bit (8-byte) numbers called hyper integers and unsigned hyper integers." -- Frank Behrens, Osterwieck, Germany PGP-key 0x5B7C47ED on public servers available. From owner-svn-src-head@FreeBSD.ORG Tue May 12 09:22:33 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C9E981065674; Tue, 12 May 2009 09:22:33 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B700E8FC17; Tue, 12 May 2009 09:22:33 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4C9MXv3016791; Tue, 12 May 2009 09:22:33 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4C9MXWv016790; Tue, 12 May 2009 09:22:33 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200905120922.n4C9MXWv016790@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 12 May 2009 09:22:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192012 - head/sys/fs/fdescfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 09:22:34 -0000 Author: kib Date: Tue May 12 09:22:33 2009 New Revision: 192012 URL: http://svn.freebsd.org/changeset/base/192012 Log: Return controlled EINVAL when the fdescfs lookup routine is given string representing too large integer, instead of overflowing and possibly returning a random but valid vnode. Noted by: Jilles Tjoelker MFC after: 3 days Modified: head/sys/fs/fdescfs/fdesc_vnops.c Modified: head/sys/fs/fdescfs/fdesc_vnops.c ============================================================================== --- head/sys/fs/fdescfs/fdesc_vnops.c Tue May 12 07:41:20 2009 (r192011) +++ head/sys/fs/fdescfs/fdesc_vnops.c Tue May 12 09:22:33 2009 (r192012) @@ -265,7 +265,7 @@ fdesc_lookup(ap) struct thread *td = cnp->cn_thread; struct file *fp; int nlen = cnp->cn_namelen; - u_int fd; + u_int fd, fd1; int error; struct vnode *fvp; @@ -297,7 +297,12 @@ fdesc_lookup(ap) error = ENOENT; goto bad; } - fd = 10 * fd + *pname++ - '0'; + fd1 = 10 * fd + *pname++ - '0'; + if (fd1 < fd) { + error = ENOENT; + goto bad; + } + fd = fd1; } if ((error = fget(td, fd, &fp)) != 0) From owner-svn-src-head@FreeBSD.ORG Tue May 12 09:28:46 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5AC78106566C; Tue, 12 May 2009 09:28:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3D6E48FC19; Tue, 12 May 2009 09:28:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4C9SkHx016938; Tue, 12 May 2009 09:28:46 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4C9SkX1016937; Tue, 12 May 2009 09:28:46 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200905120928.n4C9SkX1016937@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 12 May 2009 09:28:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192013 - head/sys/fs/fdescfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 09:28:46 -0000 Author: kib Date: Tue May 12 09:28:45 2009 New Revision: 192013 URL: http://svn.freebsd.org/changeset/base/192013 Log: Report all fdescfs vnodes as VCHR for stat(2). Fake the unique major/minor numbers of the devices. Pretending that the vnodes are character devices prevents file tree walkers from descending into the directories opened by current process. Also, not doing stat on the filedescriptors prevents the recursive entry into the VFS. Requested by: kientzle Discussed with: Jilles Tjoelker Modified: head/sys/fs/fdescfs/fdesc_vnops.c Modified: head/sys/fs/fdescfs/fdesc_vnops.c ============================================================================== --- head/sys/fs/fdescfs/fdesc_vnops.c Tue May 12 09:22:33 2009 (r192012) +++ head/sys/fs/fdescfs/fdesc_vnops.c Tue May 12 09:28:45 2009 (r192013) @@ -389,78 +389,34 @@ fdesc_getattr(ap) { struct vnode *vp = ap->a_vp; struct vattr *vap = ap->a_vap; - struct thread *td = curthread; - struct file *fp; - struct stat stb; - u_int fd; - int error = 0; + + vap->va_mode = S_IRUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH; + vap->va_fileid = VTOFDESC(vp)->fd_ix; + vap->va_uid = 0; + vap->va_gid = 0; + vap->va_blocksize = DEV_BSIZE; + vap->va_atime.tv_sec = boottime.tv_sec; + vap->va_atime.tv_nsec = 0; + vap->va_mtime = vap->va_atime; + vap->va_ctime = vap->va_mtime; + vap->va_gen = 0; + vap->va_flags = 0; + vap->va_bytes = 0; + vap->va_filerev = 0; switch (VTOFDESC(vp)->fd_type) { case Froot: - vap->va_mode = S_IRUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH; vap->va_type = VDIR; vap->va_nlink = 2; vap->va_size = DEV_BSIZE; - vap->va_fileid = VTOFDESC(vp)->fd_ix; - vap->va_uid = 0; - vap->va_gid = 0; - vap->va_blocksize = DEV_BSIZE; - vap->va_atime.tv_sec = boottime.tv_sec; - vap->va_atime.tv_nsec = 0; - vap->va_mtime = vap->va_atime; - vap->va_ctime = vap->va_mtime; - vap->va_gen = 0; - vap->va_flags = 0; vap->va_rdev = NODEV; - vap->va_bytes = 0; - vap->va_filerev = 0; break; case Fdesc: - fd = VTOFDESC(vp)->fd_fd; - - if ((error = fget(td, fd, &fp)) != 0) - return (error); - - bzero(&stb, sizeof(stb)); - error = fo_stat(fp, &stb, td->td_ucred, td); - fdrop(fp, td); - if (error == 0) { - vap->va_type = IFTOVT(stb.st_mode); - vap->va_mode = stb.st_mode; - if (vap->va_type == VDIR) - vap->va_mode &= ~(S_IRUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH); - vap->va_nlink = 1; - vap->va_flags = 0; - vap->va_bytes = stb.st_blocks * stb.st_blksize; - vap->va_fileid = VTOFDESC(vp)->fd_ix; - vap->va_size = stb.st_size; - vap->va_blocksize = stb.st_blksize; - vap->va_rdev = stb.st_rdev; - - /* - * If no time data is provided, use the current time. - */ - if (stb.st_atimespec.tv_sec == 0 && - stb.st_atimespec.tv_nsec == 0) - nanotime(&stb.st_atimespec); - - if (stb.st_ctimespec.tv_sec == 0 && - stb.st_ctimespec.tv_nsec == 0) - nanotime(&stb.st_ctimespec); - - if (stb.st_mtimespec.tv_sec == 0 && - stb.st_mtimespec.tv_nsec == 0) - nanotime(&stb.st_mtimespec); - - vap->va_atime = stb.st_atimespec; - vap->va_mtime = stb.st_mtimespec; - vap->va_ctime = stb.st_ctimespec; - vap->va_uid = stb.st_uid; - vap->va_gid = stb.st_gid; - vap->va_gen = 0; - vap->va_filerev = 0; - } + vap->va_type = VCHR; + vap->va_nlink = 1; + vap->va_size = 0; + vap->va_rdev = makedev(0, vap->va_fileid); break; default: @@ -468,9 +424,8 @@ fdesc_getattr(ap) break; } - if (error == 0) - vp->v_type = vap->va_type; - return (error); + vp->v_type = vap->va_type; + return (0); } static int From owner-svn-src-head@FreeBSD.ORG Tue May 12 15:03:48 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 45627106564A; Tue, 12 May 2009 15:03:48 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3580F8FC08; Tue, 12 May 2009 15:03:48 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4CF3mnF025520; Tue, 12 May 2009 15:03:48 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4CF3mOU025519; Tue, 12 May 2009 15:03:48 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200905121503.n4CF3mOU025519@svn.freebsd.org> From: Edward Tomasz Napierala Date: Tue, 12 May 2009 15:03:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192015 - head/sys/cam/scsi X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 15:03:48 -0000 Author: trasz Date: Tue May 12 15:03:47 2009 New Revision: 192015 URL: http://svn.freebsd.org/changeset/base/192015 Log: Add missing 'break' statements. Found with: Coverity Prevent(tm) CID: 3936, 3937 Reviewed by: scottl@ Modified: head/sys/cam/scsi/scsi_sg.c Modified: head/sys/cam/scsi/scsi_sg.c ============================================================================== --- head/sys/cam/scsi/scsi_sg.c Tue May 12 09:38:51 2009 (r192014) +++ head/sys/cam/scsi/scsi_sg.c Tue May 12 15:03:47 2009 (r192015) @@ -953,6 +953,7 @@ sg_scsiio_status(struct ccb_scsiio *csio case CAM_SCSI_STATUS_ERROR: *hoststat = DID_ERROR; *drvstat = 0; + break; case CAM_SCSI_BUS_RESET: *hoststat = DID_RESET; *drvstat = 0; @@ -964,6 +965,7 @@ sg_scsiio_status(struct ccb_scsiio *csio case CAM_SCSI_BUSY: *hoststat = DID_BUS_BUSY; *drvstat = 0; + break; default: *hoststat = DID_ERROR; *drvstat = DRIVER_ERROR; From owner-svn-src-head@FreeBSD.ORG Tue May 12 15:14:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 35086106564A; Tue, 12 May 2009 15:14:38 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 24D858FC18; Tue, 12 May 2009 15:14:38 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4CFEcgk025760; Tue, 12 May 2009 15:14:38 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4CFEcdb025759; Tue, 12 May 2009 15:14:38 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200905121514.n4CFEcdb025759@svn.freebsd.org> From: Edward Tomasz Napierala Date: Tue, 12 May 2009 15:14:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192016 - head/sys/cam X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 15:14:39 -0000 Author: trasz Date: Tue May 12 15:14:37 2009 New Revision: 192016 URL: http://svn.freebsd.org/changeset/base/192016 Log: Add missing free(9) in error case. Found with: Coverity Prevent(tm) CID: 4224 Modified: head/sys/cam/cam_periph.c Modified: head/sys/cam/cam_periph.c ============================================================================== --- head/sys/cam/cam_periph.c Tue May 12 15:03:47 2009 (r192015) +++ head/sys/cam/cam_periph.c Tue May 12 15:14:37 2009 (r192016) @@ -173,6 +173,7 @@ cam_periph_alloc(periph_ctor_t *periph_c xpt_unlock_buses(); if (*p_drv == NULL) { printf("cam_periph_alloc: invalid periph name '%s'\n", name); + free(periph, M_CAMPERIPH); return (CAM_REQ_INVALID); } From owner-svn-src-head@FreeBSD.ORG Tue May 12 16:04:52 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E883E106566C; Tue, 12 May 2009 16:04:51 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D777C8FC1A; Tue, 12 May 2009 16:04:51 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4CG4pB4026836; Tue, 12 May 2009 16:04:51 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4CG4p8D026834; Tue, 12 May 2009 16:04:51 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200905121604.n4CG4p8D026834@svn.freebsd.org> From: Rick Macklem Date: Tue, 12 May 2009 16:04:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192017 - head/sys/fs/nfsserver X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 16:04:52 -0000 Author: rmacklem Date: Tue May 12 16:04:51 2009 New Revision: 192017 URL: http://svn.freebsd.org/changeset/base/192017 Log: Modify the experimental nfs server to use the new nfsd_nfsd_args structure for nfsd. Includes a change that clarifies the use of an empty principal name string to indicate AUTH_SYS only. Approved by: kib (mentor) Modified: head/sys/fs/nfsserver/nfs_nfsdkrpc.c head/sys/fs/nfsserver/nfs_nfsdport.c Modified: head/sys/fs/nfsserver/nfs_nfsdkrpc.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdkrpc.c Tue May 12 15:14:37 2009 (r192016) +++ head/sys/fs/nfsserver/nfs_nfsdkrpc.c Tue May 12 16:04:51 2009 (r192017) @@ -350,20 +350,16 @@ int nfsrvd_nfsd(struct thread *td, struct nfsd_nfsd_args *args) { #ifdef KGSSAPI - char principal[128]; + char principal[MAXHOSTNAMELEN + 5]; int error; bool_t ret2, ret3, ret4; #endif #ifdef KGSSAPI - if (args != NULL) { - error = copyinstr(args->principal, principal, - sizeof(principal), NULL); - if (error) - return (error); - } else { - snprintf(principal, sizeof(principal), "nfs@%s", hostname); - } + error = copyinstr(args->principal, principal, sizeof (principal), + NULL); + if (error) + return (error); #endif /* @@ -380,40 +376,36 @@ nfsrvd_nfsd(struct thread *td, struct nf NFSD_UNLOCK(); #ifdef KGSSAPI - ret2 = rpc_gss_set_svc_name(principal, "kerberosv5", - GSS_C_INDEFINITE, NFS_PROG, NFS_VER2); - ret3 = rpc_gss_set_svc_name(principal, "kerberosv5", - GSS_C_INDEFINITE, NFS_PROG, NFS_VER3); - ret4 = rpc_gss_set_svc_name(principal, "kerberosv5", - GSS_C_INDEFINITE, NFS_PROG, NFS_VER4); - - /* - * If the principal name was specified, these should have - * succeeded. - */ - if (args != NULL && principal[0] != '\0' && - (!ret2 || !ret3 || !ret4)) { - NFSD_LOCK(); - newnfs_numnfsd--; - NFSD_UNLOCK(); - return (EAUTH); + /* An empty string implies AUTH_SYS only. */ + if (principal[0] != '\0') { + ret2 = rpc_gss_set_svc_name(principal, "kerberosv5", + GSS_C_INDEFINITE, NFS_PROG, NFS_VER2); + ret3 = rpc_gss_set_svc_name(principal, "kerberosv5", + GSS_C_INDEFINITE, NFS_PROG, NFS_VER3); + ret4 = rpc_gss_set_svc_name(principal, "kerberosv5", + GSS_C_INDEFINITE, NFS_PROG, NFS_VER4); + + if (!ret2 || !ret3 || !ret4) { + NFSD_LOCK(); + newnfs_numnfsd--; + nfsrvd_init(1); + NFSD_UNLOCK(); + return (EAUTH); + } } #endif - if (args != NULL) { - nfsrvd_pool->sp_minthreads = args->minthreads; - nfsrvd_pool->sp_maxthreads = args->maxthreads; - } else { - nfsrvd_pool->sp_minthreads = 4; - nfsrvd_pool->sp_maxthreads = 4; - } + nfsrvd_pool->sp_minthreads = args->minthreads; + nfsrvd_pool->sp_maxthreads = args->maxthreads; svc_run(nfsrvd_pool); #ifdef KGSSAPI - rpc_gss_clear_svc_name(NFS_PROG, NFS_VER2); - rpc_gss_clear_svc_name(NFS_PROG, NFS_VER3); - rpc_gss_clear_svc_name(NFS_PROG, NFS_VER4); + if (principal[0] != '\0') { + rpc_gss_clear_svc_name(NFS_PROG, NFS_VER2); + rpc_gss_clear_svc_name(NFS_PROG, NFS_VER3); + rpc_gss_clear_svc_name(NFS_PROG, NFS_VER4); + } #endif NFSD_LOCK(); Modified: head/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdport.c Tue May 12 15:14:37 2009 (r192016) +++ head/sys/fs/nfsserver/nfs_nfsdport.c Tue May 12 16:04:51 2009 (r192017) @@ -2866,14 +2866,15 @@ static int nfssvc_nfsd(struct thread *td, struct nfssvc_args *uap) { struct file *fp; - struct nfsd_addsock_args nfsdarg; + struct nfsd_addsock_args sockarg; + struct nfsd_nfsd_args nfsdarg; int error; if (uap->flag & NFSSVC_NFSDADDSOCK) { - error = copyin(uap->argp, (caddr_t)&nfsdarg, sizeof(nfsdarg)); + error = copyin(uap->argp, (caddr_t)&sockarg, sizeof (sockarg)); if (error) return (error); - if ((error = fget(td, nfsdarg.sock, &fp)) != 0) { + if ((error = fget(td, sockarg.sock, &fp)) != 0) { return (error); } if (fp->f_type != DTYPE_SOCKET) { @@ -2883,7 +2884,13 @@ nfssvc_nfsd(struct thread *td, struct nf error = nfsrvd_addsock(fp); fdrop(fp, td); } else if (uap->flag & NFSSVC_NFSDNFSD) { - error = nfsrvd_nfsd(td, NULL); + if (uap->argp == NULL) + return (EINVAL); + error = copyin(uap->argp, (caddr_t)&nfsdarg, + sizeof (nfsdarg)); + if (error) + return (error); + error = nfsrvd_nfsd(td, &nfsdarg); } else { error = nfssvc_srvcall(td, uap, td->td_ucred); } From owner-svn-src-head@FreeBSD.ORG Tue May 12 16:07:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 87CDB106566C; Tue, 12 May 2009 16:07:08 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 76C1B8FC1A; Tue, 12 May 2009 16:07:08 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4CG7880026916; Tue, 12 May 2009 16:07:08 GMT (envelope-from stas@svn.freebsd.org) Received: (from stas@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4CG78wX026915; Tue, 12 May 2009 16:07:08 GMT (envelope-from stas@svn.freebsd.org) Message-Id: <200905121607.n4CG78wX026915@svn.freebsd.org> From: Stanislav Sedov Date: Tue, 12 May 2009 16:07:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192018 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 16:07:08 -0000 Author: stas Date: Tue May 12 16:07:08 2009 New Revision: 192018 URL: http://svn.freebsd.org/changeset/base/192018 Log: - Implement detach path. - Release memory and DMA resources on stop. - Unload the associated DMA maps after transmit is complete. Modified: head/sys/arm/at91/if_ate.c Modified: head/sys/arm/at91/if_ate.c ============================================================================== --- head/sys/arm/at91/if_ate.c Tue May 12 16:04:51 2009 (r192017) +++ head/sys/arm/at91/if_ate.c Tue May 12 16:07:08 2009 (r192018) @@ -23,14 +23,10 @@ * SUCH DAMAGE. */ -/* TODO: (in no order) +/* TODO * - * 8) Need to sync busdma goo in atestop - * 9) atestop should maybe free the mbufs? - * - * 1) detach - * 2) Free dma setup - * 3) Turn on the clock in pmc? Turn off? + * 1) Turn on the clock in pmc? Turn off? + * 2) GPIO initializtion in board setup code. */ #include @@ -152,7 +148,7 @@ static void ate_intr(void *); /* helper routines */ static int ate_activate(device_t dev); -static void ate_deactivate(device_t dev); +static void ate_deactivate(struct ate_softc *sc); static int ate_ifmedia_upd(struct ifnet *ifp); static void ate_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr); static int ate_get_mac(struct ate_softc *sc, u_char *eaddr); @@ -179,11 +175,33 @@ ate_attach(device_t dev) struct ifnet *ifp = NULL; struct sysctl_ctx_list *sctx; struct sysctl_oid *soid; - int err; u_char eaddr[ETHER_ADDR_LEN]; uint32_t rnd; + int rid, err; sc->dev = dev; + ATE_LOCK_INIT(sc); + + /* + * Allocate resources. + */ + rid = 0; + sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->mem_res == NULL) { + device_printf(dev, "could not allocate memory resources.\n"); + err = ENOMEM; + goto out; + } + rid = 0; + sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_ACTIVE); + if (sc->irq_res == NULL) { + device_printf(dev, "could not allocate interrupt resources.\n"); + err = ENOMEM; + goto out; + } + err = ate_activate(dev); if (err) goto out; @@ -197,8 +215,9 @@ ate_attach(device_t dev) CTLFLAG_RD, &sc->use_rmii, 0, "rmii in use"); /* calling atestop before ifp is set is OK */ + ATE_LOCK(sc); atestop(sc); - ATE_LOCK_INIT(sc); + ATE_UNLOCK(sc); callout_init_mtx(&sc->tick_ch, &sc->sc_mtx, 0); if ((err = ate_get_mac(sc, eaddr)) != 0) { @@ -252,26 +271,65 @@ ate_attach(device_t dev) ether_ifattach(ifp, eaddr); /* - * Activate the interrupt + * Activate the interrupt. */ err = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE, NULL, ate_intr, sc, &sc->intrhand); if (err) { + device_printf(dev, "could not establish interrupt handler.\n"); ether_ifdetach(ifp); - ATE_LOCK_DESTROY(sc); + goto out; } -out:; + +out: if (err) - ate_deactivate(dev); - if (err && ifp) - if_free(ifp); + ate_detach(dev); return (err); } static int ate_detach(device_t dev) { - return EBUSY; /* XXX TODO(1) */ + struct ate_softc *sc; + struct ifnet *ifp; + + sc = device_get_softc(dev); + KASSERT(sc != NULL, ("[ate: %d]: sc is NULL", __LINE__)); + ifp = sc->ifp; + if (device_is_attached(dev)) { + ATE_LOCK(sc); + sc->flags |= ATE_FLAG_DETACHING; + atestop(sc); + ATE_UNLOCK(sc); + callout_drain(&sc->tick_ch); + ether_ifdetach(ifp); + } + if (sc->miibus != NULL) { + device_delete_child(dev, sc->miibus); + sc->miibus = NULL; + } + bus_generic_detach(sc->dev); + ate_deactivate(sc); + if (sc->intrhand != NULL) { + bus_teardown_intr(dev, sc->irq_res, sc->intrhand); + sc->intrhand = NULL; + } + if (ifp != NULL) { + if_free(ifp); + sc->ifp = NULL; + } + if (sc->mem_res != NULL) { + bus_release_resource(dev, SYS_RES_IOPORT, + rman_get_rid(sc->mem_res), sc->mem_res); + sc->mem_res = NULL; + } + if (sc->irq_res != NULL) { + bus_release_resource(dev, SYS_RES_IRQ, + rman_get_rid(sc->irq_res), sc->irq_res); + sc->irq_res = NULL; + } + ATE_LOCK_DESTROY(sc); + return (0); } static void @@ -367,20 +425,9 @@ static int ate_activate(device_t dev) { struct ate_softc *sc; - int rid, err, i; + int err, i; sc = device_get_softc(dev); - rid = 0; - sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, - RF_ACTIVE); - if (sc->mem_res == NULL) - goto errout; - rid = 0; - sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, - RF_ACTIVE); - if (sc->irq_res == NULL) - goto errout; - /* * Allocate DMA tags and maps */ @@ -423,7 +470,6 @@ ate_activate(device_t dev) sc->rx_descs, ATE_MAX_RX_BUFFERS * sizeof(eth_rx_desc_t), ate_getaddr, sc, 0) != 0) goto errout; - /* XXX TODO(5) Put this in ateinit_locked? */ for (i = 0; i < ATE_MAX_RX_BUFFERS; i++) { sc->rx_buf_ptr = i; if (bus_dmamem_alloc(sc->rxtag, (void **)&sc->rx_buf[i], @@ -439,65 +485,69 @@ ate_activate(device_t dev) /* Write the descriptor queue address. */ WR4(sc, ETH_RBQP, sc->rx_desc_phys); return (0); + errout: - ate_deactivate(dev); return (ENOMEM); } static void -ate_deactivate(device_t dev) +ate_deactivate(struct ate_softc *sc) { - struct ate_softc *sc; + int i; - sc = device_get_softc(dev); - /* XXX TODO(2) teardown busdma junk, below from fxp -- customize */ -#if 0 - if (sc->fxp_mtag) { - for (i = 0; i < FXP_NRFABUFS; i++) { - rxp = &sc->fxp_desc.rx_list[i]; - if (rxp->rx_mbuf != NULL) { - bus_dmamap_sync(sc->fxp_mtag, rxp->rx_map, - BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->fxp_mtag, rxp->rx_map); - m_freem(rxp->rx_mbuf); + KASSERT(sc != NULL, ("[ate, %d]: sc is NULL!", __LINE__)); + if (sc->mtag != NULL) { + for (i = 0; i < ATE_MAX_TX_BUFFERS; i++) { + if (sc->sent_mbuf[i] != NULL) { + bus_dmamap_sync(sc->mtag, sc->tx_map[i], + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sc->mtag, sc->tx_map[i]); + m_freem(sc->sent_mbuf[i]); } - bus_dmamap_destroy(sc->fxp_mtag, rxp->rx_map); + bus_dmamap_destroy(sc->mtag, sc->tx_map[i]); + sc->sent_mbuf[i] = NULL; + sc->tx_map[i] = NULL; } - bus_dmamap_destroy(sc->fxp_mtag, sc->spare_map); - for (i = 0; i < FXP_NTXCB; i++) { - txp = &sc->fxp_desc.tx_list[i]; - if (txp->tx_mbuf != NULL) { - bus_dmamap_sync(sc->fxp_mtag, txp->tx_map, - BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(sc->fxp_mtag, txp->tx_map); - m_freem(txp->tx_mbuf); + bus_dma_tag_destroy(sc->mtag); + } + if (sc->rx_desc_tag != NULL) { + if (sc->rx_descs != NULL) { + if (sc->rx_desc_phys != 0) { + bus_dmamap_sync(sc->rx_desc_tag, + sc->rx_desc_map, BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->rx_desc_tag, + sc->rx_desc_map); + sc->rx_desc_phys = 0; } - bus_dmamap_destroy(sc->fxp_mtag, txp->tx_map); } - bus_dma_tag_destroy(sc->fxp_mtag); } - if (sc->fxp_stag) - bus_dma_tag_destroy(sc->fxp_stag); - if (sc->cbl_tag) - bus_dma_tag_destroy(sc->cbl_tag); - if (sc->mcs_tag) - bus_dma_tag_destroy(sc->mcs_tag); -#endif - if (sc->intrhand) - bus_teardown_intr(dev, sc->irq_res, sc->intrhand); - sc->intrhand = 0; - bus_generic_detach(sc->dev); - if (sc->miibus) - device_delete_child(sc->dev, sc->miibus); - if (sc->mem_res) - bus_release_resource(dev, SYS_RES_IOPORT, - rman_get_rid(sc->mem_res), sc->mem_res); - sc->mem_res = 0; - if (sc->irq_res) - bus_release_resource(dev, SYS_RES_IRQ, - rman_get_rid(sc->irq_res), sc->irq_res); - sc->irq_res = 0; - return; + if (sc->rxtag != NULL) { + for (i = 0; i < ATE_MAX_RX_BUFFERS; i++) { + if (sc->rx_buf[i] != NULL) { + if (sc->rx_descs[i].addr != 0) { + bus_dmamap_sync(sc->rxtag, + sc->rx_map[i], + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->rxtag, + sc->rx_map[i]); + sc->rx_descs[i].addr = 0; + } + bus_dmamem_free(sc->rxtag, sc->rx_buf[i], + sc->rx_map[i]); + sc->rx_buf[i] = NULL; + sc->rx_map[i] = NULL; + } + } + bus_dma_tag_destroy(sc->rxtag); + } + if (sc->rx_desc_tag != NULL) { + if (sc->rx_descs != NULL) + bus_dmamem_free(sc->rx_desc_tag, sc->rx_descs, + sc->rx_desc_map); + bus_dma_tag_destroy(sc->rx_desc_tag); + sc->rx_descs = NULL; + sc->rx_desc_tag = NULL; + } } /* @@ -718,6 +768,7 @@ ate_intr(void *xsc) if (sc->sent_mbuf[0]) { bus_dmamap_sync(sc->mtag, sc->tx_map[0], BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sc->mtag, sc->tx_map[0]); m_freem(sc->sent_mbuf[0]); ifp->if_opackets++; sc->sent_mbuf[0] = NULL; @@ -726,6 +777,7 @@ ate_intr(void *xsc) if (RD4(sc, ETH_TSR) & ETH_TSR_IDLE) { bus_dmamap_sync(sc->mtag, sc->tx_map[1], BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sc->mtag, sc->tx_map[1]); m_freem(sc->sent_mbuf[1]); ifp->if_opackets++; sc->txcur = 0; @@ -911,8 +963,11 @@ atestart(struct ifnet *ifp) static void atestop(struct ate_softc *sc) { - struct ifnet *ifp = sc->ifp; + struct ifnet *ifp; + int i; + ATE_ASSERT_LOCKED(sc); + ifp = sc->ifp; if (ifp) { ifp->if_timer = 0; ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); @@ -948,11 +1003,17 @@ atestop(struct ate_softc *sc) WR4(sc, ETH_RSR, 0xffffffff); /* - * XXX TODO(8) - * need to worry about the busdma resources? Yes, I think we need - * to sync and unload them. We may also need to release the mbufs - * that are assocaited with RX and TX operations. + * Release TX resources. */ + for (i = 0; i < ATE_MAX_TX_BUFFERS; i++) { + if (sc->sent_mbuf[i] != NULL) { + bus_dmamap_sync(sc->mtag, sc->tx_map[i], + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sc->mtag, sc->tx_map[i]); + m_freem(sc->sent_mbuf[i]); + sc->sent_mbuf[i] = NULL; + } + } /* * XXX we should power down the EMAC if it isn't in use, after From owner-svn-src-head@FreeBSD.ORG Tue May 12 16:38:32 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D62BE106566B; Tue, 12 May 2009 16:38:32 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C5D138FC0C; Tue, 12 May 2009 16:38:32 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4CGcWsM027489; Tue, 12 May 2009 16:38:32 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4CGcWN7027488; Tue, 12 May 2009 16:38:32 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200905121638.n4CGcWN7027488@svn.freebsd.org> From: Edward Tomasz Napierala Date: Tue, 12 May 2009 16:38:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192019 - head/sys/cam/scsi X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 16:38:33 -0000 Author: trasz Date: Tue May 12 16:38:32 2009 New Revision: 192019 URL: http://svn.freebsd.org/changeset/base/192019 Log: Remove dead code. Found with: Coverity Prevent(tm) CID: 3667 Modified: head/sys/cam/scsi/scsi_pass.c Modified: head/sys/cam/scsi/scsi_pass.c ============================================================================== --- head/sys/cam/scsi/scsi_pass.c Tue May 12 16:07:08 2009 (r192018) +++ head/sys/cam/scsi/scsi_pass.c Tue May 12 16:38:32 2009 (r192019) @@ -179,7 +179,6 @@ passasync(void *callback_arg, u_int32_t struct cam_path *path, void *arg) { struct cam_periph *periph; - struct cam_sim *sim; periph = (struct cam_periph *)callback_arg; @@ -198,7 +197,6 @@ passasync(void *callback_arg, u_int32_t * this device and start the probe * process. */ - sim = xpt_path_sim(cgd->ccb_h.path); status = cam_periph_alloc(passregister, passoninvalidate, passcleanup, passstart, "pass", CAM_PERIPH_BIO, cgd->ccb_h.path, From owner-svn-src-head@FreeBSD.ORG Tue May 12 16:39:43 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7775C1065672; Tue, 12 May 2009 16:39:43 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 673558FC12; Tue, 12 May 2009 16:39:43 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4CGdhJi027546; Tue, 12 May 2009 16:39:43 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4CGdhGI027545; Tue, 12 May 2009 16:39:43 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200905121639.n4CGdhGI027545@svn.freebsd.org> From: Edward Tomasz Napierala Date: Tue, 12 May 2009 16:39:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192020 - head/sys/dev/ata X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 16:39:43 -0000 Author: trasz Date: Tue May 12 16:39:43 2009 New Revision: 192020 URL: http://svn.freebsd.org/changeset/base/192020 Log: Remove dead code. Found with: Coverity Prevent(tm) CID: 556 Modified: head/sys/dev/ata/atapi-cam.c Modified: head/sys/dev/ata/atapi-cam.c ============================================================================== --- head/sys/dev/ata/atapi-cam.c Tue May 12 16:38:32 2009 (r192019) +++ head/sys/dev/ata/atapi-cam.c Tue May 12 16:39:43 2009 (r192020) @@ -796,14 +796,10 @@ static void atapi_async(void *callback_arg, u_int32_t code, struct cam_path* path, void *arg) { - struct atapi_xpt_softc *softc; - struct cam_sim *sim; int targ; GIANT_REQUIRED; - sim = (struct cam_sim *) callback_arg; - softc = (struct atapi_xpt_softc *) cam_sim_softc(sim); switch (code) { case AC_LOST_DEVICE: targ = xpt_path_target_id(path); From owner-svn-src-head@FreeBSD.ORG Tue May 12 16:59:53 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 496ED1065672; Tue, 12 May 2009 16:59:53 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 38A8F8FC14; Tue, 12 May 2009 16:59:53 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4CGxrKH027968; Tue, 12 May 2009 16:59:53 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4CGxrMM027967; Tue, 12 May 2009 16:59:53 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200905121659.n4CGxrMM027967@svn.freebsd.org> From: Edward Tomasz Napierala Date: Tue, 12 May 2009 16:59:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192021 - head/sys/geom/concat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 16:59:53 -0000 Author: trasz Date: Tue May 12 16:59:50 2009 New Revision: 192021 URL: http://svn.freebsd.org/changeset/base/192021 Log: Check return value of gctl_get_asciiparam(). Found with: Coverity Prevent(tm) CID: 1118 Modified: head/sys/geom/concat/g_concat.c Modified: head/sys/geom/concat/g_concat.c ============================================================================== --- head/sys/geom/concat/g_concat.c Tue May 12 16:39:43 2009 (r192020) +++ head/sys/geom/concat/g_concat.c Tue May 12 16:59:50 2009 (r192021) @@ -753,6 +753,10 @@ g_concat_ctl_create(struct gctl_req *req for (attached = 0, no = 1; no < *nargs; no++) { snprintf(param, sizeof(param), "arg%u", no); name = gctl_get_asciiparam(req, param); + if (name == NULL) { + gctl_error(req, "No 'arg%d' argument.", no); + return; + } if (strncmp(name, "/dev/", strlen("/dev/")) == 0) name += strlen("/dev/"); pp = g_provider_by_name(name); From owner-svn-src-head@FreeBSD.ORG Tue May 12 17:05:41 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 09DC3106564A; Tue, 12 May 2009 17:05:41 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ED7D88FC12; Tue, 12 May 2009 17:05:40 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4CH5eGF028138; Tue, 12 May 2009 17:05:40 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4CH5eCY028137; Tue, 12 May 2009 17:05:40 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200905121705.n4CH5eCY028137@svn.freebsd.org> From: Edward Tomasz Napierala Date: Tue, 12 May 2009 17:05:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192022 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 17:05:41 -0000 Author: trasz Date: Tue May 12 17:05:40 2009 New Revision: 192022 URL: http://svn.freebsd.org/changeset/base/192022 Log: Add missing 'break' statement. Found with: Coverity Prevent(tm) CID: 3919 Modified: head/sys/kern/kern_lock.c Modified: head/sys/kern/kern_lock.c ============================================================================== --- head/sys/kern/kern_lock.c Tue May 12 16:59:50 2009 (r192021) +++ head/sys/kern/kern_lock.c Tue May 12 17:05:40 2009 (r192022) @@ -1067,6 +1067,7 @@ db_show_lockmgr(struct lock_object *lock switch (lk->lk_lock & LK_ALL_WAITERS) { case LK_SHARED_WAITERS: db_printf("shared\n"); + break; case LK_EXCLUSIVE_WAITERS: db_printf("exclusive\n"); break; From owner-svn-src-head@FreeBSD.ORG Tue May 12 17:44:28 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 840EA106566B; Tue, 12 May 2009 17:44:28 +0000 (UTC) (envelope-from dimitry@andric.com) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id 45FC38FC18; Tue, 12 May 2009 17:44:28 +0000 (UTC) (envelope-from dimitry@andric.com) Received: from [IPv6:2001:7b8:3a7:0:755a:47e8:c7ef:3a5e] (unknown [IPv6:2001:7b8:3a7:0:755a:47e8:c7ef:3a5e]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 2FABE5C43; Tue, 12 May 2009 19:44:27 +0200 (CEST) Message-ID: <4A09B57C.6050709@andric.com> Date: Tue, 12 May 2009 19:44:28 +0200 From: Dimitry Andric User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.1b5pre) Gecko/20090508 Shredder/3.0b3pre MIME-Version: 1.0 To: Qing Li References: <200905120741.n4C7fK8o014803@svn.freebsd.org> In-Reply-To: <200905120741.n4C7fK8o014803@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r192011 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 17:44:28 -0000 On 2009-05-12 09:41, Qing Li wrote: > Author: qingli > Date: Tue May 12 07:41:20 2009 > New Revision: 192011 > URL: http://svn.freebsd.org/changeset/base/192011 > > Log: > This patch adds a host route to an interface address (that is assigned > to a non loopback/ppp link types) through the loopback interface. Prior > to the new L2/L3 rewrite, this host route is implicitly added by the L2 > code during RTM_RESOLVE of that interface address. This host route is > deleted when that interface is removed. This commit breaks dhclient startup, I now get: [...] in_ifinit: insertion failed ifconfig: ioctl (SIOCAIFADDR): File exists em0: not found exiting. So it seems to hit this part: + } else if (error != 0) + log(LOG_INFO, "in_ifinit: insertion failed\n"); Reverting the commit makes dhclient work again. From owner-svn-src-head@FreeBSD.ORG Tue May 12 18:07:26 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1CF01065674; Tue, 12 May 2009 18:07:26 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: from mail-ew0-f159.google.com (mail-ew0-f159.google.com [209.85.219.159]) by mx1.freebsd.org (Postfix) with ESMTP id 2C7FA8FC13; Tue, 12 May 2009 18:07:25 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: by ewy3 with SMTP id 3so181116ewy.43 for ; Tue, 12 May 2009 11:07:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=Ppb/9Hc9l8plbdvL6wBXvtvITYzDOnecqLZt/cKwdhU=; b=X5XZJEyRqmDYVD8Y8TmVZ3YmvApKQswmJeYgCK+I0pnGg7z3bYAmf4gA+5ZPuybYw8 +q45bd6USHXtFyaPE9Utj4R1tzfe21VZlcHlstZevRdhWwaWbEAmdLgu0fxyvJriqaFs Mo3gb0H2YanEv45wY3seqapqCzbY0nesHfRQ4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=VELlDU+30DTBwP8DUZBW1rB7cHsj8cQzjehtxHku3rlAn1fjS1ySA2zqMeyxAQTBGc 9Y496re+5zWHDxec2K6qYcXyBdVpFlogHjK99+jVvTDkhw1WE8xlviKMV1fMwkuY2tfQ LjhrftAAxXij4gzsx76iuOhzMauPm5lNWMtaU= MIME-Version: 1.0 Sender: mat.macy@gmail.com Received: by 10.216.54.194 with SMTP id i44mr4168436wec.93.1242151645103; Tue, 12 May 2009 11:07:25 -0700 (PDT) In-Reply-To: <200905120913.n4C9DOqw032522@post.behrens.de> References: <56AB958E-2FF5-421C-9B72-1181EA265A35@rabson.org> <3c1674c90905120116l46d2fc84w789b3396419a9ede@mail.gmail.com> <200905120913.n4C9DOqw032522@post.behrens.de> Date: Tue, 12 May 2009 11:07:25 -0700 X-Google-Sender-Auth: 431a9b2614855f38 Message-ID: <3c1674c90905121107x2352dba1r39ae7ed9c404f78e@mail.gmail.com> From: Kip Macy To: Frank Behrens Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Doug Rabson , src-committers@freebsd.org Subject: Re: svn commit: r191984 - in head/sys: cddl/contrib/opensolaris/uts/common/rpc modules/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 18:07:27 -0000 On Tue, May 12, 2009 at 2:13 AM, Frank Behrens wrote: > On Tue, May 12, 2009 at 12:33 AM, Doug Rabson wrote: >> > I thought that XDR 'long' types were 32 bit regardless of whether the >> > platform was 32 or 64 bit. I'll have to read the code again. > > XDR is defined in RFC 4506. It should be independent from > architecture. > > "An XDR {signed,unsigned} integer is a 32-bit datum..." > "The standard also defines 64-bit (8-byte) numbers called hyper > integers and unsigned hyper integers." > That is the definition. The implementation may be something entirely different :-) -Kip From owner-svn-src-head@FreeBSD.ORG Tue May 12 18:26:48 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DA6E41065673; Tue, 12 May 2009 18:26:48 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id AC71D8FC1F; Tue, 12 May 2009 18:26:48 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 51EE946B49; Tue, 12 May 2009 14:26:48 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 307A38A025; Tue, 12 May 2009 14:26:47 -0400 (EDT) From: John Baldwin To: Stanislav Sedov Date: Tue, 12 May 2009 12:17:05 -0400 User-Agent: KMail/1.9.7 References: <200905121607.n4CG78wX026915@svn.freebsd.org> In-Reply-To: <200905121607.n4CG78wX026915@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200905121217.06048.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Tue, 12 May 2009 14:26:47 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r192018 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 18:26:50 -0000 On Tuesday 12 May 2009 12:07:08 pm Stanislav Sedov wrote: > Author: stas > Date: Tue May 12 16:07:08 2009 > New Revision: 192018 > URL: http://svn.freebsd.org/changeset/base/192018 > > Log: > - Implement detach path. > - Release memory and DMA resources on stop. > - Unload the associated DMA maps after transmit is complete. Most NIC drivers that I am familiar with do not destroy DMA resources (tags and maps) during stop() and then create them during if_init(). Instead, they create those during attach() and detach(). They do tend to populate the RX ring with buffers during if_init() and free all of the mbus during stop() though. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue May 12 18:41:52 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9CFB71065688 for ; Tue, 12 May 2009 18:41:52 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from mx0.deglitch.com (backbone.deglitch.com [IPv6:2001:16d8:fffb:4::abba]) by mx1.freebsd.org (Postfix) with ESMTP id 4DB5C8FC0C for ; Tue, 12 May 2009 18:41:52 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from DSPAM-Daemon (localhost [127.0.0.1]) by mx0.deglitch.com (Postfix) with SMTP id 204C38FC54 for ; Tue, 12 May 2009 22:41:51 +0400 (MSD) Received: from orion.SpringDaemons.com (unknown [77.232.3.143]) by mx0.deglitch.com (Postfix) with ESMTPA id 7CC768FC4E; Tue, 12 May 2009 22:41:47 +0400 (MSD) Received: from orion (localhost [127.0.0.1]) by orion.SpringDaemons.com (Postfix) with SMTP id 5F1B439828; Tue, 12 May 2009 22:42:13 +0400 (MSD) Date: Tue, 12 May 2009 22:42:13 +0400 From: Stanislav Sedov To: John Baldwin Message-Id: <20090512224213.f80f2fd3.stas@FreeBSD.org> In-Reply-To: <200905121217.06048.jhb@freebsd.org> References: <200905121607.n4CG78wX026915@svn.freebsd.org> <200905121217.06048.jhb@freebsd.org> Organization: The FreeBSD Project X-XMPP: ssedov@jabber.ru X-Voice: +7 916 849 20 23 X-PGP-Fingerprint: F21E D6CC 5626 9609 6CE2 A385 2BF5 5993 EB26 9581 X-Mailer: carrier-pigeon Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-DSPAM-Result: Whitelisted X-DSPAM-Processed: Tue May 12 22:41:50 2009 X-DSPAM-Confidence: 0.9899 X-DSPAM-Improbability: 1 in 9809 chance of being spam X-DSPAM-Probability: 0.0000 X-DSPAM-Signature: 4a09c2ee994291751821101 Cc: Stanislav Sedov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r192018 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 18:41:52 -0000 On Tue, 12 May 2009 12:17:05 -0400 John Baldwin mentioned: > On Tuesday 12 May 2009 12:07:08 pm Stanislav Sedov wrote: > > Author: stas > > Date: Tue May 12 16:07:08 2009 > > New Revision: 192018 > > URL: http://svn.freebsd.org/changeset/base/192018 > > > > Log: > > - Implement detach path. > > - Release memory and DMA resources on stop. > > - Unload the associated DMA maps after transmit is complete. > > Most NIC drivers that I am familiar with do not destroy DMA resources (tags > and maps) during stop() and then create them during if_init(). Instead, they > create those during attach() and detach(). They do tend to populate the RX > ring with buffers during if_init() and free all of the mbus during stop() > though. > Well, probably my commit message was slightly wrong. I do not destroy DMA maps and tags in the stop routine, instead I free all allocated mbufs and unload DMA maps associated with them. -- Stanislav Sedov ST4096-RIPE !DSPAM:4a09c2ee994291751821101! From owner-svn-src-head@FreeBSD.ORG Tue May 12 19:16:48 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by hub.freebsd.org (Postfix) with ESMTP id C7A5D106564A; Tue, 12 May 2009 19:16:44 +0000 (UTC) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: Doug Rabson Date: Tue, 12 May 2009 15:16:33 -0400 User-Agent: KMail/1.6.2 References: <200905110418.n4B4IxPC077484@svn.freebsd.org> <3c1674c90905120116l46d2fc84w789b3396419a9ede@mail.gmail.com> <6F0EE05A-45C0-410F-AFE4-7A6DD3CEF452@rabson.org> In-Reply-To: <6F0EE05A-45C0-410F-AFE4-7A6DD3CEF452@rabson.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200905121516.37434.jkim@FreeBSD.org> Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Kip Macy Subject: Re: svn commit: r191984 - in head/sys: cddl/contrib/opensolaris/uts/common/rpc modules/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 19:16:49 -0000 On Tuesday 12 May 2009 04:18 am, Doug Rabson wrote: > On 12 May 2009, at 09:16, Kip Macy wrote: > > On Tue, May 12, 2009 at 12:33 AM, Doug Rabson wrote: > >> On 12 May 2009, at 06:03, Kip Macy wrote: > >>> Here is the problem, FreeBSD is sloppy about 32-bit vs. 64-bit > >>> for xdr > >>> whereas in the kernel, Solaris is not. > >> > >> I thought that XDR 'long' types were 32 bit regardless of > >> whether the platform was 32 or 64 bit. I'll have to read the > >> code again. > > > > I'm not familiar with XDR, so I might be in error. If you could > > reconcile the differences between Solaris and FreeBSD so that ZFS > > can use FreeBSD's XDR implementation I would greatly appreciate > > it. > > I'll see what I can do. Thanks for taking the time to look at it. xdr in kernel is originally from Sun. So, we have two versions of xdr from Sun with different license terms now, one from ancient rpcsrc distribution and one from OpenSolaris. Interesting... Sorry, just thinking out loud... ;-) Jung-uk Kim From owner-svn-src-head@FreeBSD.ORG Tue May 12 19:21:19 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8BAF106564A; Tue, 12 May 2009 19:21:19 +0000 (UTC) (envelope-from dfr@rabson.org) Received: from itchy.rabson.org (router.rabson.org [80.177.232.241]) by mx1.freebsd.org (Postfix) with ESMTP id 9B2608FC1D; Tue, 12 May 2009 19:21:19 +0000 (UTC) (envelope-from dfr@rabson.org) Received: from [IPv6:2001:470:909f:1:225:ff:feed:9426] (unknown [IPv6:2001:470:909f:1:225:ff:feed:9426]) by itchy.rabson.org (Postfix) with ESMTP id AEE665CBF; Tue, 12 May 2009 20:21:27 +0100 (BST) Message-Id: <051DF298-5307-48BF-BB45-9A62D1931DF0@rabson.org> From: Doug Rabson To: Jung-uk Kim In-Reply-To: <200905121516.37434.jkim@FreeBSD.org> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.4) Date: Tue, 12 May 2009 20:20:48 +0100 References: <200905110418.n4B4IxPC077484@svn.freebsd.org> <3c1674c90905120116l46d2fc84w789b3396419a9ede@mail.gmail.com> <6F0EE05A-45C0-410F-AFE4-7A6DD3CEF452@rabson.org> <200905121516.37434.jkim@FreeBSD.org> X-Mailer: Apple Mail (2.930.4) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Kip Macy Subject: Re: svn commit: r191984 - in head/sys: cddl/contrib/opensolaris/uts/common/rpc modules/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 19:21:20 -0000 On 12 May 2009, at 20:16, Jung-uk Kim wrote: > On Tuesday 12 May 2009 04:18 am, Doug Rabson wrote: >> On 12 May 2009, at 09:16, Kip Macy wrote: >>> On Tue, May 12, 2009 at 12:33 AM, Doug Rabson > wrote: >>>> On 12 May 2009, at 06:03, Kip Macy wrote: >>>>> Here is the problem, FreeBSD is sloppy about 32-bit vs. 64-bit >>>>> for xdr >>>>> whereas in the kernel, Solaris is not. >>>> >>>> I thought that XDR 'long' types were 32 bit regardless of >>>> whether the platform was 32 or 64 bit. I'll have to read the >>>> code again. >>> >>> I'm not familiar with XDR, so I might be in error. If you could >>> reconcile the differences between Solaris and FreeBSD so that ZFS >>> can use FreeBSD's XDR implementation I would greatly appreciate >>> it. >> >> I'll see what I can do. Thanks for taking the time to look at it. > > xdr in kernel is originally from Sun. So, we have two versions of xdr > from Sun with different license terms now, one from ancient rpcsrc > distribution and one from OpenSolaris. Interesting... > > Sorry, just thinking out loud... ;-) Well hopefully we can end up with just from from ancient rpcsrc (and not CDDL). From owner-svn-src-head@FreeBSD.ORG Tue May 12 19:30:46 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E1B5B1065674; Tue, 12 May 2009 19:30:46 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CF99A8FC1E; Tue, 12 May 2009 19:30:46 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4CJUk2l031053; Tue, 12 May 2009 19:30:46 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4CJUkfW031052; Tue, 12 May 2009 19:30:46 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <200905121930.n4CJUkfW031052@svn.freebsd.org> From: Christian Brueffer Date: Tue, 12 May 2009 19:30:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192023 - head/sys/dev/vge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 19:30:47 -0000 Author: brueffer Date: Tue May 12 19:30:46 2009 New Revision: 192023 URL: http://svn.freebsd.org/changeset/base/192023 Log: Remove unused variable. Found with: Coverity Prevent(tm) CID: 550 Modified: head/sys/dev/vge/if_vge.c Modified: head/sys/dev/vge/if_vge.c ============================================================================== --- head/sys/dev/vge/if_vge.c Tue May 12 17:05:40 2009 (r192022) +++ head/sys/dev/vge/if_vge.c Tue May 12 19:30:46 2009 (r192023) @@ -651,10 +651,8 @@ vge_probe(dev) device_t dev; { struct vge_type *t; - struct vge_softc *sc; t = vge_devs; - sc = device_get_softc(dev); while (t->vge_name != NULL) { if ((pci_get_vendor(dev) == t->vge_vid) && From owner-svn-src-head@FreeBSD.ORG Tue May 12 19:33:36 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 74C231065680; Tue, 12 May 2009 19:33:36 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 621168FC1C; Tue, 12 May 2009 19:33:36 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4CJXaku031147; Tue, 12 May 2009 19:33:36 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4CJXaTG031146; Tue, 12 May 2009 19:33:36 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <200905121933.n4CJXaTG031146@svn.freebsd.org> From: Christian Brueffer Date: Tue, 12 May 2009 19:33:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192024 - head/sys/dev/lge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 19:33:37 -0000 Author: brueffer Date: Tue May 12 19:33:36 2009 New Revision: 192024 URL: http://svn.freebsd.org/changeset/base/192024 Log: Remove unused variable. Found with: Coverity Prevent(tm) CID: 549 Modified: head/sys/dev/lge/if_lge.c Modified: head/sys/dev/lge/if_lge.c ============================================================================== --- head/sys/dev/lge/if_lge.c Tue May 12 19:30:46 2009 (r192023) +++ head/sys/dev/lge/if_lge.c Tue May 12 19:33:36 2009 (r192024) @@ -1257,7 +1257,6 @@ lge_init_locked(sc) struct lge_softc *sc; { struct ifnet *ifp = sc->lge_ifp; - struct mii_data *mii; LGE_LOCK_ASSERT(sc); if (ifp->if_drv_flags & IFF_DRV_RUNNING) @@ -1269,8 +1268,6 @@ lge_init_locked(sc) lge_stop(sc); lge_reset(sc); - mii = device_get_softc(sc->lge_miibus); - /* Set MAC address */ CSR_WRITE_4(sc, LGE_PAR0, *(u_int32_t *)(&IF_LLADDR(sc->lge_ifp)[0])); CSR_WRITE_4(sc, LGE_PAR1, *(u_int32_t *)(&IF_LLADDR(sc->lge_ifp)[4])); From owner-svn-src-head@FreeBSD.ORG Tue May 12 20:42:13 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0400E1065674; Tue, 12 May 2009 20:42:13 +0000 (UTC) (envelope-from dds@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E42B38FC12; Tue, 12 May 2009 20:42:12 +0000 (UTC) (envelope-from dds@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4CKgCPD032478; Tue, 12 May 2009 20:42:12 GMT (envelope-from dds@svn.freebsd.org) Received: (from dds@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4CKgC8B032465; Tue, 12 May 2009 20:42:12 GMT (envelope-from dds@svn.freebsd.org) Message-Id: <200905122042.n4CKgC8B032465@svn.freebsd.org> From: Diomidis Spinellis Date: Tue, 12 May 2009 20:42:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192025 - head/usr.bin/truss X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 20:42:13 -0000 Author: dds Date: Tue May 12 20:42:12 2009 New Revision: 192025 URL: http://svn.freebsd.org/changeset/base/192025 Log: Add -c option to summarize number of calls, errors, and system time. Reviewed by: alfred Modified: head/usr.bin/truss/amd64-fbsd.c head/usr.bin/truss/amd64-fbsd32.c head/usr.bin/truss/amd64-linux32.c head/usr.bin/truss/i386-fbsd.c head/usr.bin/truss/i386-linux.c head/usr.bin/truss/ia64-fbsd.c head/usr.bin/truss/main.c head/usr.bin/truss/powerpc-fbsd.c head/usr.bin/truss/sparc64-fbsd.c head/usr.bin/truss/syscall.h head/usr.bin/truss/syscalls.c head/usr.bin/truss/truss.1 head/usr.bin/truss/truss.h Modified: head/usr.bin/truss/amd64-fbsd.c ============================================================================== --- head/usr.bin/truss/amd64-fbsd.c Tue May 12 19:33:36 2009 (r192024) +++ head/usr.bin/truss/amd64-fbsd.c Tue May 12 20:42:12 2009 (r192025) @@ -323,7 +323,8 @@ amd64_syscall_exit(struct trussinfo *tru * but that complicates things considerably. */ - print_syscall_ret(trussinfo, fsc.name, fsc.nargs, fsc.s_args, errorp, retval); + print_syscall_ret(trussinfo, fsc.name, fsc.nargs, fsc.s_args, errorp, + retval, fsc.sc); clear_fsc(); return (retval); Modified: head/usr.bin/truss/amd64-fbsd32.c ============================================================================== --- head/usr.bin/truss/amd64-fbsd32.c Tue May 12 19:33:36 2009 (r192024) +++ head/usr.bin/truss/amd64-fbsd32.c Tue May 12 20:42:12 2009 (r192025) @@ -339,7 +339,8 @@ amd64_fbsd32_syscall_exit(struct trussin * but that complicates things considerably. */ - print_syscall_ret(trussinfo, fsc.name, fsc.nargs, fsc.s_args, errorp, retval); + print_syscall_ret(trussinfo, fsc.name, fsc.nargs, fsc.s_args, errorp, + retval, fsc.sc); clear_fsc(); return (retval); Modified: head/usr.bin/truss/amd64-linux32.c ============================================================================== --- head/usr.bin/truss/amd64-linux32.c Tue May 12 19:33:36 2009 (r192024) +++ head/usr.bin/truss/amd64-linux32.c Tue May 12 20:42:12 2009 (r192025) @@ -309,7 +309,7 @@ amd64_linux32_syscall_exit(struct trussi } print_syscall_ret(trussinfo, fsc.name, fsc.nargs, fsc.s_args, errorp, - errorp ? i : retval); + errorp ? i : retval, fsc.sc); clear_fsc(); return (retval); Modified: head/usr.bin/truss/i386-fbsd.c ============================================================================== --- head/usr.bin/truss/i386-fbsd.c Tue May 12 19:33:36 2009 (r192024) +++ head/usr.bin/truss/i386-fbsd.c Tue May 12 20:42:12 2009 (r192025) @@ -329,7 +329,8 @@ i386_syscall_exit(struct trussinfo *trus * but that complicates things considerably. */ - print_syscall_ret(trussinfo, fsc.name, fsc.nargs, fsc.s_args, errorp, retval); + print_syscall_ret(trussinfo, fsc.name, fsc.nargs, fsc.s_args, errorp, + retval, fsc.sc); clear_fsc(); return (retval); Modified: head/usr.bin/truss/i386-linux.c ============================================================================== --- head/usr.bin/truss/i386-linux.c Tue May 12 19:33:36 2009 (r192024) +++ head/usr.bin/truss/i386-linux.c Tue May 12 20:42:12 2009 (r192025) @@ -309,7 +309,7 @@ i386_linux_syscall_exit(struct trussinfo } print_syscall_ret(trussinfo, fsc.name, fsc.nargs, fsc.s_args, errorp, - errorp ? i : retval); + errorp ? i : retval, fsc.sc); clear_fsc(); return (retval); Modified: head/usr.bin/truss/ia64-fbsd.c ============================================================================== --- head/usr.bin/truss/ia64-fbsd.c Tue May 12 19:33:36 2009 (r192024) +++ head/usr.bin/truss/ia64-fbsd.c Tue May 12 20:42:12 2009 (r192025) @@ -294,7 +294,8 @@ ia64_syscall_exit(struct trussinfo *trus * but that complicates things considerably. */ - print_syscall_ret(trussinfo, fsc.name, fsc.nargs, fsc.s_args, errorp, retval); + print_syscall_ret(trussinfo, fsc.name, fsc.nargs, fsc.s_args, errorp, + fsc.sc, retval); clear_fsc(); return (retval); Modified: head/usr.bin/truss/main.c ============================================================================== --- head/usr.bin/truss/main.c Tue May 12 19:33:36 2009 (r192024) +++ head/usr.bin/truss/main.c Tue May 12 20:42:12 2009 (r192025) @@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$"); #include "truss.h" #include "extern.h" +#include "syscall.h" #define MAXARGS 6 @@ -65,8 +66,8 @@ static void usage(void) { fprintf(stderr, "%s\n%s\n", - "usage: truss [-faedDS] [-o file] [-s strsize] -p pid", - " truss [-faedDS] [-o file] [-s strsize] command [args]"); + "usage: truss [-cfaedDS] [-o file] [-s strsize] -p pid", + " truss [-cfaedDS] [-o file] [-s strsize] command [args]"); exit(1); } @@ -188,7 +189,7 @@ main(int ac, char **av) trussinfo->pr_why = S_NONE; trussinfo->curthread = NULL; SLIST_INIT(&trussinfo->threadlist); - while ((c = getopt(ac, av, "p:o:faedDs:S")) != -1) { + while ((c = getopt(ac, av, "p:o:facedDs:S")) != -1) { switch (c) { case 'p': /* specified pid */ trussinfo->pid = atoi(optarg); @@ -204,6 +205,9 @@ main(int ac, char **av) case 'a': /* Print execve() argument strings. */ trussinfo->flags |= EXECVEARGS; break; + case 'c': /* Count number of system calls and time. */ + trussinfo->flags |= COUNTONLY; + break; case 'e': /* Print execve() environment strings. */ trussinfo->flags |= EXECVEENVS; break; @@ -337,6 +341,8 @@ START_TRACE: free(signame); break; case S_EXIT: + if (trussinfo->flags & COUNTONLY) + break; if (trussinfo->flags & FOLLOWFORKS) fprintf(trussinfo->outfile, "%5d: ", trussinfo->pid); @@ -360,12 +366,16 @@ START_TRACE: break; } } while (trussinfo->pr_why != S_EXIT); - fflush(trussinfo->outfile); if (trussinfo->flags & FOLLOWFORKS) do { childpid = wait(&status); } while (childpid != -1); + if (trussinfo->flags & COUNTONLY) + print_summary(trussinfo); + + fflush(trussinfo->outfile); + return (0); } Modified: head/usr.bin/truss/powerpc-fbsd.c ============================================================================== --- head/usr.bin/truss/powerpc-fbsd.c Tue May 12 19:33:36 2009 (r192024) +++ head/usr.bin/truss/powerpc-fbsd.c Tue May 12 20:42:12 2009 (r192025) @@ -331,7 +331,8 @@ powerpc_syscall_exit(struct trussinfo *t * but that complicates things considerably. */ - print_syscall_ret(trussinfo, fsc.name, fsc.nargs, fsc.s_args, errorp, retval); + print_syscall_ret(trussinfo, fsc.name, fsc.nargs, fsc.s_args, errorp, + retval, fsc.sc); clear_fsc(); return (retval); Modified: head/usr.bin/truss/sparc64-fbsd.c ============================================================================== --- head/usr.bin/truss/sparc64-fbsd.c Tue May 12 19:33:36 2009 (r192024) +++ head/usr.bin/truss/sparc64-fbsd.c Tue May 12 20:42:12 2009 (r192025) @@ -336,7 +336,8 @@ sparc64_syscall_exit(struct trussinfo *t * but that complicates things considerably. */ - print_syscall_ret(trussinfo, fsc.name, fsc.nargs, fsc.s_args, errorp, retval); + print_syscall_ret(trussinfo, fsc.name, fsc.nargs, fsc.s_args, errorp, + retval, fsc.sc); clear_fsc(); return (retval); Modified: head/usr.bin/truss/syscall.h ============================================================================== --- head/usr.bin/truss/syscall.h Tue May 12 19:33:36 2009 (r192024) +++ head/usr.bin/truss/syscall.h Tue May 12 20:42:12 2009 (r192025) @@ -57,10 +57,14 @@ struct syscall { int nargs; /* actual number of meaningful arguments */ /* Hopefully, no syscalls with > 10 args */ struct syscall_args args[10]; + struct timespec time; /* Time spent for this call */ + int ncalls; /* Number of calls */ + int nerror; /* Number of calls that returned with error */ }; struct syscall *get_syscall(const char*); char *print_arg(struct syscall_args *, unsigned long*, long, struct trussinfo *); void print_syscall(struct trussinfo *, const char *, int, char **); void print_syscall_ret(struct trussinfo *, const char *, int, char **, int, - long); + long, struct syscall *); +void print_summary(struct trussinfo *trussinfo); Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Tue May 12 19:33:36 2009 (r192024) +++ head/usr.bin/truss/syscalls.c Tue May 12 20:42:12 2009 (r192025) @@ -89,135 +89,162 @@ static const char rcsid[] = /* * This should probably be in its own file, sorted alphabetically. */ - struct syscall syscalls[] = { - { "fcntl", 1, 3, - { { Int, 0 } , { Fcntl, 1 }, { Fcntlflag | OUT, 2 } } }, - { "readlink", 1, 3, - { { Name, 0 } , { Readlinkres | OUT, 1 }, { Int, 2 } } }, - { "lseek", 2, 3, - { { Int, 0 }, { Quad, 1 + QUAD_ALIGN }, { Whence, 1 + QUAD_SLOTS + QUAD_ALIGN } } }, - { "linux_lseek", 2, 3, - { { Int, 0 }, { Int, 1 }, { Whence, 2 } } }, - { "mmap", 2, 6, - { { Ptr, 0 }, { Int, 1 }, { Mprot, 2 }, { Mmapflags, 3 }, { Int, 4 }, { Quad, 5 + QUAD_ALIGN } } }, - { "mprotect", 1, 3, - { { Ptr, 0 }, { Int, 1 }, { Mprot, 2 } } }, - { "open", 1, 3, - { { Name | IN, 0 } , { Open, 1 }, { Octal, 2 } } }, - { "mkdir", 1, 2, - { { Name, 0 } , { Octal, 1 } } }, - { "linux_open", 1, 3, - { { Name, 0 }, { Hex, 1 }, { Octal, 2 } } }, - { "close", 1, 1, - { { Int, 0 } } }, - { "link", 0, 2, - { { Name, 0 }, { Name, 1 } } }, - { "unlink", 0, 1, - { { Name, 0 } } }, - { "chdir", 0, 1, - { { Name, 0 } } }, - { "chroot", 0, 1, - { { Name, 0 } } }, - { "mknod", 0, 3, - { { Name, 0 }, { Octal, 1 }, { Int, 3 } } }, - { "chmod", 0, 2, - { { Name, 0 }, { Octal, 1 } } }, - { "chown", 0, 3, - { { Name, 0 }, { Int, 1 }, { Int, 2 } } }, - { "mount", 0, 4, - { { Name, 0 }, { Name, 1 }, { Int, 2 }, { Ptr, 3 } } }, - { "umount", 0, 2, - { { Name, 0 }, { Int, 2 } } }, - { "fstat", 1, 2, - { { Int, 0 }, { Stat | OUT , 1 } } }, - { "stat", 1, 2, - { { Name | IN, 0 }, { Stat | OUT, 1 } } }, - { "lstat", 1, 2, - { { Name | IN, 0 }, { Stat | OUT, 1 } } }, - { "linux_newstat", 1, 2, - { { Name | IN, 0 }, { Ptr | OUT, 1 } } }, - { "linux_newfstat", 1, 2, - { { Int, 0 }, { Ptr | OUT, 1 } } }, - { "write", 1, 3, - { { Int, 0 }, { BinString | IN, 1 }, { Int, 2 } } }, - { "ioctl", 1, 3, - { { Int, 0 }, { Ioctl, 1 }, { Hex, 2 } } }, - { "break", 1, 1, { { Ptr, 0 } } }, - { "exit", 0, 1, { { Hex, 0 } } }, - { "access", 1, 2, { { Name | IN, 0 }, { Int, 1 } } }, - { "sigaction", 1, 3, - { { Signal, 0 }, { Sigaction | IN, 1 }, { Sigaction | OUT, 2 } } }, - { "accept", 1, 3, - { { Int, 0 }, { Sockaddr | OUT, 1 }, { Ptr | OUT, 2 } } }, - { "bind", 1, 3, - { { Int, 0 }, { Sockaddr | IN, 1 }, { Int, 2 } } }, - { "connect", 1, 3, - { { Int, 0 }, { Sockaddr | IN, 1 }, { Int, 2 } } }, - { "getpeername", 1, 3, - { { Int, 0 }, { Sockaddr | OUT, 1 }, { Ptr | OUT, 2 } } }, - { "getsockname", 1, 3, - { { Int, 0 }, { Sockaddr | OUT, 1 }, { Ptr | OUT, 2 } } }, - { "recvfrom", 1, 6, - { { Int, 0 }, { BinString | OUT, 1 }, { Int, 2 }, { Hex, 3 }, { Sockaddr | OUT, 4 }, { Ptr | OUT, 5 } } }, - { "sendto", 1, 6, - { { Int, 0 }, { BinString | IN, 1 }, { Int, 2 }, { Hex, 3 }, { Sockaddr | IN, 4 }, { Ptr | IN, 5 } } }, - { "execve", 1, 3, - { { Name | IN, 0 }, { StringArray | IN, 1 }, { StringArray | IN, 2 } } }, - { "linux_execve", 1, 3, - { { Name | IN, 0 }, { StringArray | IN, 1 }, { StringArray | IN, 2 } } }, - { "kldload", 0, 1, { { Name | IN, 0 } } }, - { "kldunload", 0, 1, { { Int, 0 } } }, - { "kldfind", 0, 1, { { Name | IN, 0 } } }, - { "kldnext", 0, 1, { { Int, 0 } } }, - { "kldstat", 0, 2, { { Int, 0 }, { Ptr, 1 } } }, - { "kldfirstmod", 0, 1, { { Int, 0 } } }, - { "nanosleep", 0, 1, { { Timespec, 0 } } }, - { "select", 1, 5, { { Int, 0 }, { Fd_set, 1 }, { Fd_set, 2 }, { Fd_set, 3 }, { Timeval, 4 } } }, - { "poll", 1, 3, { { Pollfd, 0 }, { Int, 1 }, { Int, 2 } } }, - { "gettimeofday", 1, 2, { { Timeval | OUT, 0 }, { Ptr, 1 } } }, - { "clock_gettime", 1, 2, { { Int, 0 }, { Timespec | OUT, 1 } } }, - { "getitimer", 1, 2, { { Int, 0 }, { Itimerval | OUT, 2 } } }, - { "setitimer", 1, 3, { { Int, 0 }, { Itimerval, 1 } , { Itimerval | OUT, 2 } } }, - { "kse_release", 0, 1, { { Timespec, 0 } } }, - { "kevent", 0, 6, { { Int, 0 }, { Kevent, 1 }, { Int, 2 }, { Kevent | OUT, 3 }, { Int, 4 }, { Timespec, 5 } } }, - { "_umtx_lock", 0, 1, { { Umtx, 0 } } }, - { "_umtx_unlock", 0, 1, { { Umtx, 0 } } }, - { "sigprocmask", 0, 3, { { Sigprocmask, 0 }, { Sigset, 1 }, { Sigset | OUT, 2 } } }, - { "unmount", 1, 2, { { Name, 0 }, { Int, 1 } } }, - { "socket", 1, 3, { { Sockdomain, 0 }, { Socktype, 1 }, { Int, 2 } } }, - { "getrusage", 1, 2, { { Int, 0 }, { Rusage | OUT, 1 } } }, - { "__getcwd", 1, 2, { { Name | OUT, 0 }, { Int, 1 } } }, - { "shutdown", 1, 2, { { Int, 0 }, { Shutdown, 1 } } }, - { "getrlimit", 1, 2, { { Resource, 0 }, { Rlimit | OUT, 1 } } }, - { "setrlimit", 1, 2, { { Resource, 0 }, { Rlimit | IN, 1 } } }, - { "utimes", 1, 2, - { { Name | IN, 0 }, { Timeval2 | IN, 1 } } }, - { "lutimes", 1, 2, - { { Name | IN, 0 }, { Timeval2 | IN, 1 } } }, - { "futimes", 1, 2, - { { Int, 0 }, { Timeval | IN, 1 } } }, - { "chflags", 1, 2, - { { Name | IN, 0 }, { Hex, 1 } } }, - { "lchflags", 1, 2, - { { Name | IN, 0 }, { Hex, 1 } } }, - { "pathconf", 1, 2, - { { Name | IN, 0 }, { Pathconf, 1 } } }, - { "truncate", 1, 3, - { { Name | IN, 0 }, { Int | IN, 1 }, { Quad | IN, 2 } } }, - { "ftruncate", 1, 3, - { { Int | IN, 0 }, { Int | IN, 1 }, { Quad | IN, 2 } } }, - { "kill", 1, 2, - { { Int | IN, 0 }, { Signal | IN, 1 } } }, - { "munmap", 1, 2, - { { Ptr, 0 }, { Int, 1 } } }, - { "read", 1, 3, - { { Int, 0 }, { BinString | OUT, 1 }, { Int, 2 } } }, - { "rename", 1, 2, - { { Name , 0 } , { Name, 1 } } }, - { "symlink", 1, 2, - { { Name , 0 } , { Name, 1 } } }, - { 0, 0, 0, { { 0, 0 } } }, + { .name = "fcntl", .ret_type = 1, .nargs = 3, + .args = { { Int, 0 } , { Fcntl, 1 }, { Fcntlflag | OUT, 2 } } }, + { .name = "readlink", .ret_type = 1, .nargs = 3, + .args = { { Name, 0 } , { Readlinkres | OUT, 1 }, { Int, 2 } } }, + { .name = "lseek", .ret_type = 2, .nargs = 3, + .args = { { Int, 0 }, { Quad, 1 + QUAD_ALIGN }, { Whence, 1 + QUAD_SLOTS + QUAD_ALIGN } } }, + { .name = "linux_lseek", .ret_type = 2, .nargs = 3, + .args = { { Int, 0 }, { Int, 1 }, { Whence, 2 } } }, + { .name = "mmap", .ret_type = 2, .nargs = 6, + .args = { { Ptr, 0 }, { Int, 1 }, { Mprot, 2 }, { Mmapflags, 3 }, { Int, 4 }, { Quad, 5 + QUAD_ALIGN } } }, + { .name = "mprotect", .ret_type = 1, .nargs = 3, + .args = { { Ptr, 0 }, { Int, 1 }, { Mprot, 2 } } }, + { .name = "open", .ret_type = 1, .nargs = 3, + .args = { { Name | IN, 0 } , { Open, 1 }, { Octal, 2 } } }, + { .name = "mkdir", .ret_type = 1, .nargs = 2, + .args = { { Name, 0 } , { Octal, 1 } } }, + { .name = "linux_open", .ret_type = 1, .nargs = 3, + .args = { { Name, 0 }, { Hex, 1 }, { Octal, 2 } } }, + { .name = "close", .ret_type = 1, .nargs = 1, + .args = { { Int, 0 } } }, + { .name = "link", .ret_type = 0, .nargs = 2, + .args = { { Name, 0 }, { Name, 1 } } }, + { .name = "unlink", .ret_type = 0, .nargs = 1, + .args = { { Name, 0 } } }, + { .name = "chdir", .ret_type = 0, .nargs = 1, + .args = { { Name, 0 } } }, + { .name = "chroot", .ret_type = 0, .nargs = 1, + .args = { { Name, 0 } } }, + { .name = "mknod", .ret_type = 0, .nargs = 3, + .args = { { Name, 0 }, { Octal, 1 }, { Int, 3 } } }, + { .name = "chmod", .ret_type = 0, .nargs = 2, + .args = { { Name, 0 }, { Octal, 1 } } }, + { .name = "chown", .ret_type = 0, .nargs = 3, + .args = { { Name, 0 }, { Int, 1 }, { Int, 2 } } }, + { .name = "mount", .ret_type = 0, .nargs = 4, + .args = { { Name, 0 }, { Name, 1 }, { Int, 2 }, { Ptr, 3 } } }, + { .name = "umount", .ret_type = 0, .nargs = 2, + .args = { { Name, 0 }, { Int, 2 } } }, + { .name = "fstat", .ret_type = 1, .nargs = 2, + .args = { { Int, 0 }, { Stat | OUT , 1 } } }, + { .name = "stat", .ret_type = 1, .nargs = 2, + .args = { { Name | IN, 0 }, { Stat | OUT, 1 } } }, + { .name = "lstat", .ret_type = 1, .nargs = 2, + .args = { { Name | IN, 0 }, { Stat | OUT, 1 } } }, + { .name = "linux_newstat", .ret_type = 1, .nargs = 2, + .args = { { Name | IN, 0 }, { Ptr | OUT, 1 } } }, + { .name = "linux_newfstat", .ret_type = 1, .nargs = 2, + .args = { { Int, 0 }, { Ptr | OUT, 1 } } }, + { .name = "write", .ret_type = 1, .nargs = 3, + .args = { { Int, 0 }, { BinString | IN, 1 }, { Int, 2 } } }, + { .name = "ioctl", .ret_type = 1, .nargs = 3, + .args = { { Int, 0 }, { Ioctl, 1 }, { Hex, 2 } } }, + { .name = "break", .ret_type = 1, .nargs = 1, + .args = { { Ptr, 0 } } }, + { .name = "exit", .ret_type = 0, .nargs = 1, + .args = { { Hex, 0 } } }, + { .name = "access", .ret_type = 1, .nargs = 2, + .args = { { Name | IN, 0 }, { Int, 1 } } }, + { .name = "sigaction", .ret_type = 1, .nargs = 3, + .args = { { Signal, 0 }, { Sigaction | IN, 1 }, { Sigaction | OUT, 2 } } }, + { .name = "accept", .ret_type = 1, .nargs = 3, + .args = { { Int, 0 }, { Sockaddr | OUT, 1 }, { Ptr | OUT, 2 } } }, + { .name = "bind", .ret_type = 1, .nargs = 3, + .args = { { Int, 0 }, { Sockaddr | IN, 1 }, { Int, 2 } } }, + { .name = "connect", .ret_type = 1, .nargs = 3, + .args = { { Int, 0 }, { Sockaddr | IN, 1 }, { Int, 2 } } }, + { .name = "getpeername", .ret_type = 1, .nargs = 3, + .args = { { Int, 0 }, { Sockaddr | OUT, 1 }, { Ptr | OUT, 2 } } }, + { .name = "getsockname", .ret_type = 1, .nargs = 3, + .args = { { Int, 0 }, { Sockaddr | OUT, 1 }, { Ptr | OUT, 2 } } }, + { .name = "recvfrom", .ret_type = 1, .nargs = 6, + .args = { { Int, 0 }, { BinString | OUT, 1 }, { Int, 2 }, { Hex, 3 }, { Sockaddr | OUT, 4 }, { Ptr | OUT, 5 } } }, + { .name = "sendto", .ret_type = 1, .nargs = 6, + .args = { { Int, 0 }, { BinString | IN, 1 }, { Int, 2 }, { Hex, 3 }, { Sockaddr | IN, 4 }, { Ptr | IN, 5 } } }, + { .name = "execve", .ret_type = 1, .nargs = 3, + .args = { { Name | IN, 0 }, { StringArray | IN, 1 }, { StringArray | IN, 2 } } }, + { .name = "linux_execve", .ret_type = 1, .nargs = 3, + .args = { { Name | IN, 0 }, { StringArray | IN, 1 }, { StringArray | IN, 2 } } }, + { .name = "kldload", .ret_type = 0, .nargs = 1, + .args = { { Name | IN, 0 } } }, + { .name = "kldunload", .ret_type = 0, .nargs = 1, + .args = { { Int, 0 } } }, + { .name = "kldfind", .ret_type = 0, .nargs = 1, + .args = { { Name | IN, 0 } } }, + { .name = "kldnext", .ret_type = 0, .nargs = 1, + .args = { { Int, 0 } } }, + { .name = "kldstat", .ret_type = 0, .nargs = 2, + .args = { { Int, 0 }, { Ptr, 1 } } }, + { .name = "kldfirstmod", .ret_type = 0, .nargs = 1, + .args = { { Int, 0 } } }, + { .name = "nanosleep", .ret_type = 0, .nargs = 1, + .args = { { Timespec, 0 } } }, + { .name = "select", .ret_type = 1, .nargs = 5, + .args = { { Int, 0 }, { Fd_set, 1 }, { Fd_set, 2 }, { Fd_set, 3 }, { Timeval, 4 } } }, + { .name = "poll", .ret_type = 1, .nargs = 3, + .args = { { Pollfd, 0 }, { Int, 1 }, { Int, 2 } } }, + { .name = "gettimeofday", .ret_type = 1, .nargs = 2, + .args = { { Timeval | OUT, 0 }, { Ptr, 1 } } }, + { .name = "clock_gettime", .ret_type = 1, .nargs = 2, + .args = { { Int, 0 }, { Timespec | OUT, 1 } } }, + { .name = "getitimer", .ret_type = 1, .nargs = 2, + .args = { { Int, 0 }, { Itimerval | OUT, 2 } } }, + { .name = "setitimer", .ret_type = 1, .nargs = 3, + .args = { { Int, 0 }, { Itimerval, 1 } , { Itimerval | OUT, 2 } } }, + { .name = "kse_release", .ret_type = 0, .nargs = 1, + .args = { { Timespec, 0 } } }, + { .name = "kevent", .ret_type = 0, .nargs = 6, + .args = { { Int, 0 }, { Kevent, 1 }, { Int, 2 }, { Kevent | OUT, 3 }, { Int, 4 }, { Timespec, 5 } } }, + { .name = "_umtx_lock", .ret_type = 0, .nargs = 1, + .args = { { Umtx, 0 } } }, + { .name = "_umtx_unlock", .ret_type = 0, .nargs = 1, + .args = { { Umtx, 0 } } }, + { .name = "sigprocmask", .ret_type = 0, .nargs = 3, + .args = { { Sigprocmask, 0 }, { Sigset, 1 }, { Sigset | OUT, 2 } } }, + { .name = "unmount", .ret_type = 1, .nargs = 2, + .args = { { Name, 0 }, { Int, 1 } } }, + { .name = "socket", .ret_type = 1, .nargs = 3, + .args = { { Sockdomain, 0 }, { Socktype, 1 }, { Int, 2 } } }, + { .name = "getrusage", .ret_type = 1, .nargs = 2, + .args = { { Int, 0 }, { Rusage | OUT, 1 } } }, + { .name = "__getcwd", .ret_type = 1, .nargs = 2, + .args = { { Name | OUT, 0 }, { Int, 1 } } }, + { .name = "shutdown", .ret_type = 1, .nargs = 2, + .args = { { Int, 0 }, { Shutdown, 1 } } }, + { .name = "getrlimit", .ret_type = 1, .nargs = 2, + .args = { { Resource, 0 }, { Rlimit | OUT, 1 } } }, + { .name = "setrlimit", .ret_type = 1, .nargs = 2, + .args = { { Resource, 0 }, { Rlimit | IN, 1 } } }, + { .name = "utimes", .ret_type = 1, .nargs = 2, + .args = { { Name | IN, 0 }, { Timeval2 | IN, 1 } } }, + { .name = "lutimes", .ret_type = 1, .nargs = 2, + .args = { { Name | IN, 0 }, { Timeval2 | IN, 1 } } }, + { .name = "futimes", .ret_type = 1, .nargs = 2, + .args = { { Int, 0 }, { Timeval | IN, 1 } } }, + { .name = "chflags", .ret_type = 1, .nargs = 2, + .args = { { Name | IN, 0 }, { Hex, 1 } } }, + { .name = "lchflags", .ret_type = 1, .nargs = 2, + .args = { { Name | IN, 0 }, { Hex, 1 } } }, + { .name = "pathconf", .ret_type = 1, .nargs = 2, + .args = { { Name | IN, 0 }, { Pathconf, 1 } } }, + { .name = "truncate", .ret_type = 1, .nargs = 3, + .args = { { Name | IN, 0 }, { Int | IN, 1 }, { Quad | IN, 2 } } }, + { .name = "ftruncate", .ret_type = 1, .nargs = 3, + .args = { { Int | IN, 0 }, { Int | IN, 1 }, { Quad | IN, 2 } } }, + { .name = "kill", .ret_type = 1, .nargs = 2, + .args = { { Int | IN, 0 }, { Signal | IN, 1 } } }, + { .name = "munmap", .ret_type = 1, .nargs = 2, + .args = { { Ptr, 0 }, { Int, 1 } } }, + { .name = "read", .ret_type = 1, .nargs = 3, + .args = { { Int, 0 }, { BinString | OUT, 1 }, { Int, 2 } } }, + { .name = "rename", .ret_type = 1, .nargs = 2, + .args = { { Name , 0 } , { Name, 1 } } }, + { .name = "symlink", .ret_type = 1, .nargs = 2, + .args = { { Name , 0 } , { Name, 1 } } }, + { .name = 0 }, }; /* Xlat idea taken from strace */ @@ -1077,8 +1104,21 @@ print_syscall(struct trussinfo *trussinf void print_syscall_ret(struct trussinfo *trussinfo, const char *name, int nargs, - char **s_args, int errorp, long retval) + char **s_args, int errorp, long retval, struct syscall *sc) { + struct timespec timediff; + + if (trussinfo->flags & COUNTONLY) { + if (!sc) + return; + clock_gettime(CLOCK_REALTIME, &trussinfo->after); + timespecsubt(&trussinfo->after, &trussinfo->before, &timediff); + timespecadd(&sc->time, &timediff, &sc->time); + sc->ncalls++; + if (errorp) + sc->nerror++; + return; + } print_syscall(trussinfo, name, nargs, s_args); fflush(trussinfo->outfile); @@ -1088,3 +1128,28 @@ print_syscall_ret(struct trussinfo *trus fprintf(trussinfo->outfile, " = %ld (0x%lx)\n", retval, retval); } } + +void +print_summary(struct trussinfo *trussinfo) +{ + struct syscall *sc; + struct timespec total = {0, 0}; + int ncall, nerror; + + fprintf(trussinfo->outfile, "%-20s%15s%8s%8s\n", + "syscall", "seconds", "calls", "errors"); + ncall = nerror = 0; + for (sc = syscalls; sc->name != NULL; sc++) + if (sc->ncalls) { + fprintf(trussinfo->outfile, "%-20s%5d.%09ld%8d%8d\n", + sc->name, sc->time.tv_sec, sc->time.tv_nsec, + sc->ncalls, sc->nerror); + timespecadd(&total, &sc->time, &total); + ncall += sc->ncalls; + nerror += sc->nerror; + } + fprintf(trussinfo->outfile, "%20s%15s%8s%8s\n", + "", "-------------", "-------", "-------"); + fprintf(trussinfo->outfile, "%-20s%5d.%09ld%8d%8d\n", + "", total.tv_sec, total.tv_nsec, ncall, nerror); +} Modified: head/usr.bin/truss/truss.1 ============================================================================== --- head/usr.bin/truss/truss.1 Tue May 12 19:33:36 2009 (r192024) +++ head/usr.bin/truss/truss.1 Tue May 12 20:42:12 2009 (r192025) @@ -1,6 +1,6 @@ .\" $FreeBSD$ .\" -.Dd January 22, 2009 +.Dd May 12, 2009 .Dt TRUSS 1 .Os .Sh NAME @@ -8,12 +8,12 @@ .Nd trace system calls .Sh SYNOPSIS .Nm -.Op Fl faedDS +.Op Fl facedDS .Op Fl o Ar file .Op Fl s Ar strsize .Fl p Ar pid .Nm -.Op Fl faedDS +.Op Fl facedDS .Op Fl o Ar file .Op Fl s Ar strsize .Ar command Op Ar args @@ -36,6 +36,12 @@ etc. Show the argument strings that are passed in each .Xr execve 2 system call. +.It Fl c +Do not display individual system calls. +Instead, before exiting, print a summary containing for each system call: +the total system time used, +the number of times the call was invoked, +and the number of times the call returned with an error. .It Fl e Show the environment strings that are passed in each .Xr execve 2 Modified: head/usr.bin/truss/truss.h ============================================================================== --- head/usr.bin/truss/truss.h Tue May 12 19:33:36 2009 (r192024) +++ head/usr.bin/truss/truss.h Tue May 12 20:42:12 2009 (r192025) @@ -33,6 +33,7 @@ #define NOSIGS 0x00000008 #define EXECVEARGS 0x00000010 #define EXECVEENVS 0x00000020 +#define COUNTONLY 0x00000040 struct threadinfo { @@ -70,6 +71,16 @@ struct trussinfo } \ } while (0) +#define timespecadd(tvp, uvp, vvp) \ + do { \ + (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \ + (vvp)->tv_nsec = (tvp)->tv_nsec + (uvp)->tv_nsec; \ + if ((vvp)->tv_nsec > 1000000000) { \ + (vvp)->tv_sec++; \ + (vvp)->tv_nsec -= 1000000000; \ + } \ + } while (0) + #define S_NONE 0 #define S_SCE 1 #define S_SCX 2 From owner-svn-src-head@FreeBSD.ORG Tue May 12 20:56:36 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0E23F1065674; Tue, 12 May 2009 20:56:36 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EFE8D8FC1E; Tue, 12 May 2009 20:56:35 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4CKuY82032805; Tue, 12 May 2009 20:56:34 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4CKuYpZ032804; Tue, 12 May 2009 20:56:34 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200905122056.n4CKuYpZ032804@svn.freebsd.org> From: Marius Strobl Date: Tue, 12 May 2009 20:56:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192026 - head/share/man/man9 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 20:56:36 -0000 Author: marius Date: Tue May 12 20:56:34 2009 New Revision: 192026 URL: http://svn.freebsd.org/changeset/base/192026 Log: Correct r190283 (partially reverting it) as on sparc64 BUS_DMA_NOCACHE actually is only valid for bus_dmamap_load(). MFC after: 3 days Modified: head/share/man/man9/bus_dma.9 Modified: head/share/man/man9/bus_dma.9 ============================================================================== --- head/share/man/man9/bus_dma.9 Tue May 12 20:42:12 2009 (r192025) +++ head/share/man/man9/bus_dma.9 Tue May 12 20:56:34 2009 (r192026) @@ -60,7 +60,7 @@ .\" $FreeBSD$ .\" $NetBSD: bus_dma.9,v 1.25 2002/10/14 13:43:16 wiz Exp $ .\" -.Dd November 16, 2008 +.Dd May 12, 2009 .Dt BUS_DMA 9 .Os .Sh NAME @@ -561,6 +561,13 @@ Are as follows: .It Dv BUS_DMA_NOWAIT The load should not be deferred in case of insufficient mapping resources, and instead should return immediately with an appropriate error. +.It Dv BUS_DMA_NOCACHE +The generated transactions to and from the virtual page are non-cacheable. +For +.Fn bus_dmamap_load , +the +.Dv BUS_DMA_NOCACHE +flag is currently implemented on sparc64. .El .El .Pp @@ -780,11 +787,12 @@ Causes the allocated memory to be set to The allocated memory will not be cached in the processor caches. All memory accesses appear on the bus and are executed without reordering. -On the amd64 and i386 architectures this flag results in the -Strong Uncacheable PAT to be set for the allocated virtual address range. -The +For +.Fn bus_dmamem_alloc , +the .Dv BUS_DMA_NOCACHE -flag is currently implemented on amd64, i386 and sparc64. +flag is currently implemented on amd64 and i386 where it results in the +Strong Uncacheable PAT to be set for the allocated virtual address range. .El .It Fa mapp Pointer to a From owner-svn-src-head@FreeBSD.ORG Tue May 12 21:14:36 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 63463106566B; Tue, 12 May 2009 21:14:36 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 45CC18FC1F; Tue, 12 May 2009 21:14:36 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4CLEagu033209; Tue, 12 May 2009 21:14:36 GMT (envelope-from stas@svn.freebsd.org) Received: (from stas@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4CLEag9033208; Tue, 12 May 2009 21:14:36 GMT (envelope-from stas@svn.freebsd.org) Message-Id: <200905122114.n4CLEag9033208@svn.freebsd.org> From: Stanislav Sedov Date: Tue, 12 May 2009 21:14:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192027 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 21:14:36 -0000 Author: stas Date: Tue May 12 21:14:36 2009 New Revision: 192027 URL: http://svn.freebsd.org/changeset/base/192027 Log: - Eliminate extra register reads by using a variable to store registers contents. - Use memory barriers to preserve the order of buffer space operations. This might be needed if we'll ever use this driver on architectures where ordering is not guaranteed. Modified: head/sys/arm/at91/if_ate.c Modified: head/sys/arm/at91/if_ate.c ============================================================================== --- head/sys/arm/at91/if_ate.c Tue May 12 20:56:34 2009 (r192026) +++ head/sys/arm/at91/if_ate.c Tue May 12 21:14:36 2009 (r192027) @@ -118,6 +118,13 @@ WR4(struct ate_softc *sc, bus_size_t off bus_write_4(sc->mem_res, off, val); } +static inline void +BARRIER(struct ate_softc *sc, bus_size_t off, bus_size_t len, int flags) +{ + + bus_barrier(sc->mem_res, off, len, flags); +} + #define ATE_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #define ATE_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) #define ATE_LOCK_INIT(_sc) \ @@ -586,18 +593,19 @@ ate_ifmedia_sts(struct ifnet *ifp, struc static void ate_stat_update(struct ate_softc *sc, int active) { + uint32_t reg; + /* * The speed and full/half-duplex state needs to be reflected * in the ETH_CFG register. */ - if (IFM_SUBTYPE(active) == IFM_10_T) - WR4(sc, ETH_CFG, RD4(sc, ETH_CFG) & ~ETH_CFG_SPD); - else - WR4(sc, ETH_CFG, RD4(sc, ETH_CFG) | ETH_CFG_SPD); + reg = RD4(sc, ETH_CFG); + reg &= ~(ETH_CFG_SPD | ETH_CFG_FD); + if (IFM_SUBTYPE(active) != IFM_10_T) + reg |= ETH_CFG_SPD; if (active & IFM_FDX) - WR4(sc, ETH_CFG, RD4(sc, ETH_CFG) | ETH_CFG_FD); - else - WR4(sc, ETH_CFG, RD4(sc, ETH_CFG) & ~ETH_CFG_FD); + reg |= ETH_CFG_FD; + WR4(sc, ETH_CFG, reg); } static void @@ -709,11 +717,10 @@ ate_intr(void *xsc) { struct ate_softc *sc = xsc; struct ifnet *ifp = sc->ifp; - int status; - int i; - void *bp; struct mbuf *mb; - uint32_t rx_stat; + void *bp; + uint32_t status, reg, rx_stat; + int i; status = RD4(sc, ETH_ISR); if (status == 0) @@ -800,10 +807,11 @@ ate_intr(void *xsc) ATE_UNLOCK(sc); } if (status & ETH_ISR_RBNA) { - printf("RBNA workaround\n"); /* Workaround Errata #11 */ - WR4(sc, ETH_CTL, RD4(sc, ETH_CTL) &~ ETH_CTL_RE); - WR4(sc, ETH_CTL, RD4(sc, ETH_CTL) | ETH_CTL_RE); + reg = RD4(sc, ETH_CTL); + WR4(sc, ETH_CTL, reg & ~ETH_CTL_RE); + BARRIER(sc, ETH_CTL, 4, BUS_SPACE_BARRIER_WRITE); + WR4(sc, ETH_CTL, reg | ETH_CTL_RE); } } @@ -816,6 +824,7 @@ ateinit_locked(void *xsc) struct ate_softc *sc = xsc; struct ifnet *ifp = sc->ifp; struct mii_data *mii; + uint32_t reg; ATE_ASSERT_LOCKED(sc); @@ -834,10 +843,12 @@ ateinit_locked(void *xsc) * to this chip. Select the right one based on a compile-time * option. */ + reg = RD4(sc, ETH_CFG); if (sc->use_rmii) - WR4(sc, ETH_CFG, RD4(sc, ETH_CFG) | ETH_CFG_RMII); + reg |= ETH_CFG_RMII; else - WR4(sc, ETH_CFG, RD4(sc, ETH_CFG) & ~ETH_CFG_RMII); + reg &= ~ETH_CFG_RMII; + WR4(sc, ETH_CFG, reg); ate_rxfilter(sc); @@ -926,6 +937,7 @@ atestart_locked(struct ifnet *ifp) * tell the hardware to xmit the packet. */ WR4(sc, ETH_TAR, segs[0].ds_addr); + BARRIER(sc, ETH_TAR, 8, BUS_SPACE_BARRIER_WRITE); WR4(sc, ETH_TCR, segs[0].ds_len); /* From owner-svn-src-head@FreeBSD.ORG Tue May 12 21:28:15 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9FF8C1065673; Tue, 12 May 2009 21:28:15 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id 2F4438FC08; Tue, 12 May 2009 21:28:14 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.3/8.14.3/ALCHEMY.FRANKEN.DE) with ESMTP id n4CLSDtJ052222; Tue, 12 May 2009 23:28:13 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.3/8.14.3/Submit) id n4CLSDj7052221; Tue, 12 May 2009 23:28:13 +0200 (CEST) (envelope-from marius) Date: Tue, 12 May 2009 23:28:13 +0200 From: Marius Strobl To: Robert Noland Message-ID: <20090512212813.GF1158@alchemy.franken.de> References: <200905122056.n4CKuYpZ032804@svn.freebsd.org> <1242162786.1755.51.camel@balrog.2hip.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1242162786.1755.51.camel@balrog.2hip.net> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r192026 - head/share/man/man9 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 21:28:16 -0000 On Tue, May 12, 2009 at 04:13:06PM -0500, Robert Noland wrote: > On Tue, 2009-05-12 at 20:56 +0000, Marius Strobl wrote: > > Author: marius > > Date: Tue May 12 20:56:34 2009 > > New Revision: 192026 > > URL: http://svn.freebsd.org/changeset/base/192026 > > > > Log: > > Correct r190283 (partially reverting it) as on sparc64 BUS_DMA_NOCACHE > > actually is only valid for bus_dmamap_load(). > > Ok, this is getting very confusing... This means that code has to set > this flag on both alloc and load to allow for somethine resembling > consistent behavior. > Personally I don't understand why amd64 and i386 where decided to implement BUS_DMA_NOCACHE for bus_dmamem_alloc(9) only as this is less flexible than using it with bus_dmamap_load(9) (which also is the older existing implementation). Anyway, documents BUS_DMA_NOCACHE and BUS_DMA_NOWRITE as "non-standard or specific to only certain architectures" so I think it's okay for the usage of these flags to differ across them. Marius From owner-svn-src-head@FreeBSD.ORG Tue May 12 21:28:42 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 721CC1065670; Tue, 12 May 2009 21:28:42 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5FD3B8FC0C; Tue, 12 May 2009 21:28:42 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4CLSgbp033512; Tue, 12 May 2009 21:28:42 GMT (envelope-from stas@svn.freebsd.org) Received: (from stas@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4CLSge8033511; Tue, 12 May 2009 21:28:42 GMT (envelope-from stas@svn.freebsd.org) Message-Id: <200905122128.n4CLSge8033511@svn.freebsd.org> From: Stanislav Sedov Date: Tue, 12 May 2009 21:28:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192028 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 21:28:43 -0000 Author: stas Date: Tue May 12 21:28:41 2009 New Revision: 192028 URL: http://svn.freebsd.org/changeset/base/192028 Log: - Resurrect the debug printf message I accidentally dropped in the previous commit. - Use device_printf instead of printf. - Put all printfs in the interrupt handler under bootverbose. Modified: head/sys/arm/at91/if_ate.c Modified: head/sys/arm/at91/if_ate.c ============================================================================== --- head/sys/arm/at91/if_ate.c Tue May 12 21:14:36 2009 (r192027) +++ head/sys/arm/at91/if_ate.c Tue May 12 21:28:41 2009 (r192028) @@ -734,7 +734,8 @@ ate_intr(void *xsc) bp = sc->rx_buf[i]; rx_stat = sc->rx_descs[i].status; if ((rx_stat & ETH_LEN_MASK) == 0) { - printf("ignoring bogus 0 len packet\n"); + if (bootverbose) + device_printf(sc->dev, "ignoring bogus zero-length packet\n"); bus_dmamap_sync(sc->rx_desc_tag, sc->rx_desc_map, BUS_DMASYNC_PREWRITE); sc->rx_descs[i].addr &= ~ETH_CPU_OWNER; @@ -808,6 +809,8 @@ ate_intr(void *xsc) } if (status & ETH_ISR_RBNA) { /* Workaround Errata #11 */ + if (bootverbose) + device_printf(sc->dev, "RBNA workaround\n"); reg = RD4(sc, ETH_CTL); WR4(sc, ETH_CTL, reg & ~ETH_CTL_RE); BARRIER(sc, ETH_CTL, 4, BUS_SPACE_BARRIER_WRITE); From owner-svn-src-head@FreeBSD.ORG Tue May 12 21:35:12 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DEE11106571F; Tue, 12 May 2009 21:35:12 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from gizmo.2hip.net (gizmo.2hip.net [64.74.207.195]) by mx1.freebsd.org (Postfix) with ESMTP id A27C68FC18; Tue, 12 May 2009 21:35:12 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from [192.168.1.4] (adsl-19-244-249.bna.bellsouth.net [68.19.244.249]) (authenticated bits=0) by gizmo.2hip.net (8.14.3/8.14.3) with ESMTP id n4CLDYqD027627 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 12 May 2009 17:13:34 -0400 (EDT) (envelope-from rnoland@FreeBSD.org) From: Robert Noland To: Marius Strobl In-Reply-To: <200905122056.n4CKuYpZ032804@svn.freebsd.org> References: <200905122056.n4CKuYpZ032804@svn.freebsd.org> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-HeMJTa+plO0fQHwDQk5R" Organization: FreeBSD Date: Tue, 12 May 2009 16:13:06 -0500 Message-Id: <1242162786.1755.51.camel@balrog.2hip.net> Mime-Version: 1.0 X-Mailer: Evolution 2.26.1.1 FreeBSD GNOME Team Port X-Spam-Status: No, score=-3.2 required=5.0 tests=AWL,BAYES_00,RDNS_DYNAMIC autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on gizmo.2hip.net Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r192026 - head/share/man/man9 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 21:35:13 -0000 --=-HeMJTa+plO0fQHwDQk5R Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Tue, 2009-05-12 at 20:56 +0000, Marius Strobl wrote: > Author: marius > Date: Tue May 12 20:56:34 2009 > New Revision: 192026 > URL: http://svn.freebsd.org/changeset/base/192026 >=20 > Log: > Correct r190283 (partially reverting it) as on sparc64 BUS_DMA_NOCACHE > actually is only valid for bus_dmamap_load(). Ok, this is getting very confusing... This means that code has to set this flag on both alloc and load to allow for somethine resembling consistent behavior. robert. > MFC after: 3 days >=20 > Modified: > head/share/man/man9/bus_dma.9 >=20 > Modified: head/share/man/man9/bus_dma.9 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/share/man/man9/bus_dma.9 Tue May 12 20:42:12 2009 (r192025) > +++ head/share/man/man9/bus_dma.9 Tue May 12 20:56:34 2009 (r192026) > @@ -60,7 +60,7 @@ > .\" $FreeBSD$ > .\" $NetBSD: bus_dma.9,v 1.25 2002/10/14 13:43:16 wiz Exp $ > .\" > -.Dd November 16, 2008 > +.Dd May 12, 2009 > .Dt BUS_DMA 9 > .Os > .Sh NAME > @@ -561,6 +561,13 @@ Are as follows: > .It Dv BUS_DMA_NOWAIT > The load should not be deferred in case of insufficient mapping resource= s, > and instead should return immediately with an appropriate error. > +.It Dv BUS_DMA_NOCACHE > +The generated transactions to and from the virtual page are non-cacheabl= e. > +For > +.Fn bus_dmamap_load , > +the > +.Dv BUS_DMA_NOCACHE > +flag is currently implemented on sparc64. > .El > .El > .Pp > @@ -780,11 +787,12 @@ Causes the allocated memory to be set to > The allocated memory will not be cached in the processor caches. > All memory accesses appear on the bus and are executed > without reordering. > -On the amd64 and i386 architectures this flag results in the > -Strong Uncacheable PAT to be set for the allocated virtual address range= . > -The > +For > +.Fn bus_dmamem_alloc , > +the > .Dv BUS_DMA_NOCACHE > -flag is currently implemented on amd64, i386 and sparc64. > +flag is currently implemented on amd64 and i386 where it results in the > +Strong Uncacheable PAT to be set for the allocated virtual address range= . > .El > .It Fa mapp > Pointer to a --=20 Robert Noland FreeBSD --=-HeMJTa+plO0fQHwDQk5R Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.11 (FreeBSD) iEYEABECAAYFAkoJ5mIACgkQM4TrQ4qfROO5tgCdGoQQ8owEejHrVAM8qLDnJDR9 270AniMlv8pZDhG3r1Oafi93B1q5JWRJ =a2L/ -----END PGP SIGNATURE----- --=-HeMJTa+plO0fQHwDQk5R-- From owner-svn-src-head@FreeBSD.ORG Tue May 12 22:11:02 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A748B106566B; Tue, 12 May 2009 22:11:02 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 955608FC14; Tue, 12 May 2009 22:11:02 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4CMB2F7034480; Tue, 12 May 2009 22:11:02 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4CMB2Vo034479; Tue, 12 May 2009 22:11:02 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <200905122211.n4CMB2Vo034479@svn.freebsd.org> From: Christian Brueffer Date: Tue, 12 May 2009 22:11:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192029 - head/sys/i386/cpufreq X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 22:11:03 -0000 Author: brueffer Date: Tue May 12 22:11:02 2009 New Revision: 192029 URL: http://svn.freebsd.org/changeset/base/192029 Log: Remove unused variables. Found with: Coverity Prevent(tm) CID: 4285, 4286 Modified: head/sys/i386/cpufreq/hwpstate.c Modified: head/sys/i386/cpufreq/hwpstate.c ============================================================================== --- head/sys/i386/cpufreq/hwpstate.c Tue May 12 21:28:41 2009 (r192028) +++ head/sys/i386/cpufreq/hwpstate.c Tue May 12 22:11:02 2009 (r192029) @@ -161,7 +161,6 @@ DRIVER_MODULE(hwpstate, cpu, hwpstate_dr static int hwpstate_goto_pstate(device_t dev, int pstate) { - struct hwpstate_softc *sc; struct pcpu *pc; int i; uint64_t msr; @@ -170,7 +169,6 @@ hwpstate_goto_pstate(device_t dev, int p int id = pstate; int error; - sc = device_get_softc(dev); /* get the current pstate limit */ msr = rdmsr(MSR_AMD_10H_11H_LIMIT); limit = AMD_10H_11H_GET_PSTATE_LIMIT(msr); @@ -299,7 +297,6 @@ hwpstate_type(device_t dev, int *type) static void hwpstate_identify(driver_t *driver, device_t parent) { - device_t child; if (device_find_child(parent, "hwpstate", -1) != NULL) return; @@ -318,7 +315,7 @@ hwpstate_identify(driver_t *driver, devi if (resource_disabled("hwpstate", 0)) return; - if ((child = BUS_ADD_CHILD(parent, 10, "hwpstate", -1)) == NULL) + if (BUS_ADD_CHILD(parent, 10, "hwpstate", -1) == NULL) device_printf(parent, "hwpstate: add child failed\n"); } From owner-svn-src-head@FreeBSD.ORG Tue May 12 23:22:58 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E1BE106566B; Tue, 12 May 2009 23:22:58 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6C86C8FC17; Tue, 12 May 2009 23:22:58 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4CNMwna035818; Tue, 12 May 2009 23:22:58 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4CNMwmK035817; Tue, 12 May 2009 23:22:58 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <200905122322.n4CNMwmK035817@svn.freebsd.org> From: Christian Brueffer Date: Tue, 12 May 2009 23:22:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192030 - head/sys/dev/acpi_support X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2009 23:22:58 -0000 Author: brueffer Date: Tue May 12 23:22:58 2009 New Revision: 192030 URL: http://svn.freebsd.org/changeset/base/192030 Log: Remove unused variables. Found with: Coverity Prevent(tm) CID: 544, 545 Modified: head/sys/dev/acpi_support/acpi_ibm.c head/sys/dev/acpi_support/acpi_sony.c Modified: head/sys/dev/acpi_support/acpi_ibm.c ============================================================================== --- head/sys/dev/acpi_support/acpi_ibm.c Tue May 12 22:11:02 2009 (r192029) +++ head/sys/dev/acpi_support/acpi_ibm.c Tue May 12 23:22:58 2009 (r192030) @@ -332,7 +332,6 @@ static int acpi_ibm_attach(device_t dev) { struct acpi_ibm_softc *sc; - struct acpi_softc *acpi_sc; devclass_t ec_devclass; ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__); @@ -341,8 +340,6 @@ acpi_ibm_attach(device_t dev) sc->dev = dev; sc->handle = acpi_get_handle(dev); - acpi_sc = acpi_device_get_parent_softc(dev); - /* Look for the first embedded controller */ if (!(ec_devclass = devclass_find ("acpi_ec"))) { if (bootverbose) Modified: head/sys/dev/acpi_support/acpi_sony.c ============================================================================== --- head/sys/dev/acpi_support/acpi_sony.c Tue May 12 22:11:02 2009 (r192029) +++ head/sys/dev/acpi_support/acpi_sony.c Tue May 12 23:22:58 2009 (r192030) @@ -102,10 +102,7 @@ static char *sny_id[] = {"SNY5001", N static int acpi_sony_probe(device_t dev) { - struct acpi_sony_softc *sc; - int ret = ENXIO; - - sc = device_get_softc(dev); + int ret = ENXIO; if (ACPI_ID_PROBE(device_get_parent(dev), dev, sny_id)) { device_set_desc(dev, "Sony notebook controller"); From owner-svn-src-head@FreeBSD.ORG Wed May 13 00:04:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A185B1065673; Wed, 13 May 2009 00:04:08 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 906AA8FC08; Wed, 13 May 2009 00:04:08 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4D048xx036585; Wed, 13 May 2009 00:04:08 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4D048Aw036584; Wed, 13 May 2009 00:04:08 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200905130004.n4D048Aw036584@svn.freebsd.org> From: Tim Kientzle Date: Wed, 13 May 2009 00:04:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192031 - head/lib/libarchive X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2009 00:04:09 -0000 Author: kientzle Date: Wed May 13 00:04:08 2009 New Revision: 192031 URL: http://svn.freebsd.org/changeset/base/192031 Log: Eliminate duplicate error messages from "tar c". Reported by: pav@ Modified: head/lib/libarchive/archive_read_disk_entry_from_file.c Modified: head/lib/libarchive/archive_read_disk_entry_from_file.c ============================================================================== --- head/lib/libarchive/archive_read_disk_entry_from_file.c Tue May 12 23:22:58 2009 (r192030) +++ head/lib/libarchive/archive_read_disk_entry_from_file.c Wed May 13 00:04:08 2009 (r192031) @@ -92,6 +92,7 @@ archive_read_disk_entry_from_file(struct int initial_fd = fd; int r, r1; + archive_clear_error(_a); path = archive_entry_sourcepath(entry); if (path == NULL) path = archive_entry_pathname(entry); From owner-svn-src-head@FreeBSD.ORG Wed May 13 02:26:35 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F965106566C; Wed, 13 May 2009 02:26:35 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1EBEC8FC14; Wed, 13 May 2009 02:26:35 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4D2QZp3039378; Wed, 13 May 2009 02:26:35 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4D2QZrD039377; Wed, 13 May 2009 02:26:35 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200905130226.n4D2QZrD039377@svn.freebsd.org> From: Alexander Motin Date: Wed, 13 May 2009 02:26:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192032 - head/sys/netgraph/netflow X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2009 02:26:35 -0000 Author: mav Date: Wed May 13 02:26:34 2009 New Revision: 192032 URL: http://svn.freebsd.org/changeset/base/192032 Log: Fix copy-paste bug in NGM_NETFLOW_SETCONFIG argument size verification. PR: kern/134220 Submitted by: Eugene Mychlo MFC after: 1 week Modified: head/sys/netgraph/netflow/ng_netflow.c Modified: head/sys/netgraph/netflow/ng_netflow.c ============================================================================== --- head/sys/netgraph/netflow/ng_netflow.c Wed May 13 00:04:08 2009 (r192031) +++ head/sys/netgraph/netflow/ng_netflow.c Wed May 13 02:26:34 2009 (r192032) @@ -422,7 +422,7 @@ ng_netflow_rcvmsg (node_p node, item_p i { struct ng_netflow_setconfig *set; - if (msg->header.arglen != sizeof(struct ng_netflow_settimeouts)) + if (msg->header.arglen != sizeof(struct ng_netflow_setconfig)) ERROUT(EINVAL); set = (struct ng_netflow_setconfig *)msg->data; From owner-svn-src-head@FreeBSD.ORG Wed May 13 05:39:40 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 68181106566C; Wed, 13 May 2009 05:39:40 +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 55DBE8FC17; Wed, 13 May 2009 05:39:40 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4D5deRF043381; Wed, 13 May 2009 05:39:40 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4D5defE043378; Wed, 13 May 2009 05:39:40 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200905130539.n4D5defE043378@svn.freebsd.org> From: Alan Cox Date: Wed, 13 May 2009 05:39:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192034 - in head/sys: kern vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2009 05:39:40 -0000 Author: alc Date: Wed May 13 05:39:39 2009 New Revision: 192034 URL: http://svn.freebsd.org/changeset/base/192034 Log: Eliminate page queues locking from bufdone_finish() through the following changes: Rename vfs_page_set_valid() to vfs_page_set_validclean() to reflect what this function actually does. Suggested by: tegge Introduce a new version of vfs_page_set_valid() that does no more than what the function's name implies. Specifically, it does not update the page's dirty mask, and thus it does not require the page queues lock to be held. Update two of the three callers to the old vfs_page_set_valid() to call vfs_page_set_validclean() instead because they actually require the page's dirty mask to be cleared. Introduce vm_page_set_valid(). Reviewed by: tegge Modified: head/sys/kern/vfs_bio.c head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Wed May 13 02:55:21 2009 (r192033) +++ head/sys/kern/vfs_bio.c Wed May 13 05:39:39 2009 (r192034) @@ -98,7 +98,8 @@ static void vm_hold_free_pages(struct bu vm_offset_t to); static void vm_hold_load_pages(struct buf *bp, vm_offset_t from, vm_offset_t to); -static void vfs_page_set_valid(struct buf *bp, vm_ooffset_t off, +static void vfs_page_set_valid(struct buf *bp, vm_ooffset_t off, vm_page_t m); +static void vfs_page_set_validclean(struct buf *bp, vm_ooffset_t off, vm_page_t m); static void vfs_clean_pages(struct buf *bp); static void vfs_setdirty(struct buf *bp); @@ -3277,7 +3278,6 @@ bufdone_finish(struct buf *bp) vm_object_t obj; int iosize; struct vnode *vp = bp->b_vp; - boolean_t are_queues_locked; obj = bp->b_bufobj->bo_object; @@ -3314,11 +3314,6 @@ bufdone_finish(struct buf *bp) !(bp->b_ioflags & BIO_ERROR)) { bp->b_flags |= B_CACHE; } - if (bp->b_iocmd == BIO_READ) { - vm_page_lock_queues(); - are_queues_locked = TRUE; - } else - are_queues_locked = FALSE; for (i = 0; i < bp->b_npages; i++) { int bogusflag = 0; int resid; @@ -3354,6 +3349,9 @@ bufdone_finish(struct buf *bp) * only need to do this here in the read case. */ if ((bp->b_iocmd == BIO_READ) && !bogusflag && resid > 0) { + KASSERT((m->dirty & vm_page_bits(foff & + PAGE_MASK, resid)) == 0, ("bufdone_finish:" + " page %p has unexpected dirty bits", m)); vfs_page_set_valid(bp, foff, m); } @@ -3387,8 +3385,6 @@ bufdone_finish(struct buf *bp) foff = (foff + PAGE_SIZE) & ~(off_t)PAGE_MASK; iosize -= resid; } - if (are_queues_locked) - vm_page_unlock_queues(); vm_object_pip_wakeupn(obj, 0); VM_OBJECT_UNLOCK(obj); } @@ -3454,6 +3450,35 @@ vfs_unbusy_pages(struct buf *bp) static void vfs_page_set_valid(struct buf *bp, vm_ooffset_t off, vm_page_t m) { + vm_ooffset_t eoff; + + /* + * Compute the end offset, eoff, such that [off, eoff) does not span a + * page boundary and eoff is not greater than the end of the buffer. + * The end of the buffer, in this case, is our file EOF, not the + * allocation size of the buffer. + */ + eoff = (off + PAGE_SIZE) & ~(vm_ooffset_t)PAGE_MASK; + if (eoff > bp->b_offset + bp->b_bcount) + eoff = bp->b_offset + bp->b_bcount; + + /* + * Set valid range. This is typically the entire buffer and thus the + * entire page. + */ + if (eoff > off) + vm_page_set_valid(m, off & PAGE_MASK, eoff - off); +} + +/* + * vfs_page_set_validclean: + * + * Set the valid bits and clear the dirty bits in a page based on the + * supplied offset. The range is restricted to the buffer's size. + */ +static void +vfs_page_set_validclean(struct buf *bp, vm_ooffset_t off, vm_page_t m) +{ vm_ooffset_t soff, eoff; mtx_assert(&vm_page_queue_mtx, MA_OWNED); @@ -3545,7 +3570,7 @@ retry: */ if (clear_modify) { pmap_remove_write(m); - vfs_page_set_valid(bp, foff, m); + vfs_page_set_validclean(bp, foff, m); } else if (m->valid == VM_PAGE_BITS_ALL && (bp->b_flags & B_CACHE) == 0) { bp->b_pages[i] = bogus_page; @@ -3591,7 +3616,7 @@ vfs_clean_pages(struct buf *bp) if (eoff > bp->b_offset + bp->b_bufsize) eoff = bp->b_offset + bp->b_bufsize; - vfs_page_set_valid(bp, foff, m); + vfs_page_set_validclean(bp, foff, m); /* vm_page_clear_dirty(m, foff & PAGE_MASK, eoff - foff); */ foff = noff; } Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Wed May 13 02:55:21 2009 (r192033) +++ head/sys/vm/vm_page.c Wed May 13 05:39:39 2009 (r192034) @@ -1852,6 +1852,51 @@ vm_page_bits(int base, int size) } /* + * vm_page_set_valid: + * + * Sets portions of a page valid. The arguments are expected + * to be DEV_BSIZE aligned but if they aren't the bitmap is inclusive + * of any partial chunks touched by the range. The invalid portion of + * such chunks will be zeroed. + * + * (base + size) must be less then or equal to PAGE_SIZE. + */ +void +vm_page_set_valid(vm_page_t m, int base, int size) +{ + int endoff, frag; + + VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); + if (size == 0) /* handle degenerate case */ + return; + + /* + * If the base is not DEV_BSIZE aligned and the valid + * bit is clear, we have to zero out a portion of the + * first block. + */ + if ((frag = base & ~(DEV_BSIZE - 1)) != base && + (m->valid & (1 << (base >> DEV_BSHIFT))) == 0) + pmap_zero_page_area(m, frag, base - frag); + + /* + * If the ending offset is not DEV_BSIZE aligned and the + * valid bit is clear, we have to zero out a portion of + * the last block. + */ + endoff = base + size; + if ((frag = endoff & ~(DEV_BSIZE - 1)) != endoff && + (m->valid & (1 << (endoff >> DEV_BSHIFT))) == 0) + pmap_zero_page_area(m, endoff, + DEV_BSIZE - (endoff & (DEV_BSIZE - 1))); + + /* + * Set valid bits inclusive of any overlap. + */ + m->valid |= vm_page_bits(base, size); +} + +/* * vm_page_set_validclean: * * Sets portions of a page valid and clean. The arguments are expected Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Wed May 13 02:55:21 2009 (r192033) +++ head/sys/vm/vm_page.h Wed May 13 05:39:39 2009 (r192034) @@ -321,6 +321,7 @@ vm_page_t vm_page_lookup (vm_object_t, v void vm_page_remove (vm_page_t); void vm_page_rename (vm_page_t, vm_object_t, vm_pindex_t); void vm_page_requeue(vm_page_t m); +void vm_page_set_valid(vm_page_t m, int base, int size); void vm_page_sleep(vm_page_t m, const char *msg); vm_page_t vm_page_splay(vm_pindex_t, vm_page_t); vm_offset_t vm_page_startup(vm_offset_t vaddr); From owner-svn-src-head@FreeBSD.ORG Wed May 13 07:42:53 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 748E2106564A; Wed, 13 May 2009 07:42:53 +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 594718FC08; Wed, 13 May 2009 07:42:53 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4D7gr6E045682; Wed, 13 May 2009 07:42:53 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4D7gr81045680; Wed, 13 May 2009 07:42:53 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200905130742.n4D7gr81045680@svn.freebsd.org> From: Alan Cox Date: Wed, 13 May 2009 07:42:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192035 - in head/sys: amd64/amd64 i386/i386 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2009 07:42:53 -0000 Author: alc Date: Wed May 13 07:42:53 2009 New Revision: 192035 URL: http://svn.freebsd.org/changeset/base/192035 Log: Correct a rare use-after-free error in pmap_copy(). This error was introduced in amd64 revision 1.540 and i386 revision 1.547. However, it had no harmful effects until after a recent change, r189698, on amd64. (In other words, the error is harmless in RELENG_7.) The error is triggered by the failure to allocate a pv entry for the one and only mapping in a page table page. I am addressing the error by changing pmap_copy() to abort if either pv entry allocation or page table page allocation fails. This is appropriate because the creation of mappings by pmap_copy() is optional. They are a (possible) optimization, and not a requirement. Correct a nearby whitespace error in the i386 pmap_copy(). Crash reported by: jeff@ MFC after: 6 weeks Modified: head/sys/amd64/amd64/pmap.c head/sys/i386/i386/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Wed May 13 05:39:39 2009 (r192034) +++ head/sys/amd64/amd64/pmap.c Wed May 13 07:42:53 2009 (r192035) @@ -3556,7 +3556,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm dstmpte->wire_count++; else if ((dstmpte = pmap_allocpte(dst_pmap, addr, M_NOWAIT)) == NULL) - break; + goto out; dst_pte = (pt_entry_t *) PHYS_TO_DMAP(VM_PAGE_TO_PHYS(dstmpte)); dst_pte = &dst_pte[pmap_pte_index(addr)]; @@ -3579,6 +3579,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm addr); pmap_free_zero_pages(free); } + goto out; } if (dstmpte->wire_count >= srcmpte->wire_count) break; @@ -3587,6 +3588,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm src_pte++; } } +out: vm_page_unlock_queues(); PMAP_UNLOCK(src_pmap); PMAP_UNLOCK(dst_pmap); Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Wed May 13 05:39:39 2009 (r192034) +++ head/sys/i386/i386/pmap.c Wed May 13 07:42:53 2009 (r192035) @@ -3638,7 +3638,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm dstmpte = pmap_allocpte(dst_pmap, addr, M_NOWAIT); if (dstmpte == NULL) - break; + goto out; dst_pte = pmap_pte_quick(dst_pmap, addr); if (*dst_pte == 0 && pmap_try_insert_pv_entry(dst_pmap, addr, @@ -3653,12 +3653,13 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm dst_pmap->pm_stats.resident_count++; } else { free = NULL; - if (pmap_unwire_pte_hold( dst_pmap, + if (pmap_unwire_pte_hold(dst_pmap, dstmpte, &free)) { pmap_invalidate_page(dst_pmap, addr); pmap_free_zero_pages(free); } + goto out; } if (dstmpte->wire_count >= srcmpte->wire_count) break; @@ -3667,6 +3668,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm src_pte++; } } +out: sched_unpin(); vm_page_unlock_queues(); PMAP_UNLOCK(src_pmap); From owner-svn-src-head@FreeBSD.ORG Wed May 13 08:50:14 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 328951065676; Wed, 13 May 2009 08:50:14 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2090C8FC25; Wed, 13 May 2009 08:50:14 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4D8oE8B046932; Wed, 13 May 2009 08:50:14 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4D8oE0P046931; Wed, 13 May 2009 08:50:14 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <200905130850.n4D8oE0P046931@svn.freebsd.org> From: Christian Brueffer Date: Wed, 13 May 2009 08:50:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192036 - head/sys/compat/ndis X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2009 08:50:14 -0000 Author: brueffer Date: Wed May 13 08:50:13 2009 New Revision: 192036 URL: http://svn.freebsd.org/changeset/base/192036 Log: Fix memory leak in an error case. Found with: Coverity Prevent(tm) CID: 371 MFC after: 2 weeks Modified: head/sys/compat/ndis/kern_windrv.c Modified: head/sys/compat/ndis/kern_windrv.c ============================================================================== --- head/sys/compat/ndis/kern_windrv.c Wed May 13 07:42:53 2009 (r192035) +++ head/sys/compat/ndis/kern_windrv.c Wed May 13 08:50:13 2009 (r192036) @@ -531,7 +531,10 @@ windrv_bus_attach(drv, name) RtlInitAnsiString(&as, name); if (RtlAnsiStringToUnicodeString(&drv->dro_drivername, &as, TRUE)) + { + free(new, M_DEVBUF); return(ENOMEM); + } /* * Set up a fake image pointer to avoid false matches From owner-svn-src-head@FreeBSD.ORG Wed May 13 12:43:37 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BB90E1065674; Wed, 13 May 2009 12:43:37 +0000 (UTC) (envelope-from dds@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A982B8FC18; Wed, 13 May 2009 12:43:37 +0000 (UTC) (envelope-from dds@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4DChbii056634; Wed, 13 May 2009 12:43:37 GMT (envelope-from dds@svn.freebsd.org) Received: (from dds@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4DChbuC056633; Wed, 13 May 2009 12:43:37 GMT (envelope-from dds@svn.freebsd.org) Message-Id: <200905131243.n4DChbuC056633@svn.freebsd.org> From: Diomidis Spinellis Date: Wed, 13 May 2009 12:43:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192040 - head/usr.bin/truss X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2009 12:43:38 -0000 Author: dds Date: Wed May 13 12:43:37 2009 New Revision: 192040 URL: http://svn.freebsd.org/changeset/base/192040 Log: Fix compilation error introduced in r192025. Modified: head/usr.bin/truss/mips-fbsd.c Modified: head/usr.bin/truss/mips-fbsd.c ============================================================================== --- head/usr.bin/truss/mips-fbsd.c Wed May 13 12:19:54 2009 (r192039) +++ head/usr.bin/truss/mips-fbsd.c Wed May 13 12:43:37 2009 (r192040) @@ -338,7 +338,8 @@ mips_syscall_exit(struct trussinfo *trus * but that complicates things considerably. */ - print_syscall_ret(trussinfo, fsc.name, fsc.nargs, fsc.s_args, errorp, retval); + print_syscall_ret(trussinfo, fsc.name, fsc.nargs, fsc.s_args, errorp, + fsc.sc, retval); clear_fsc(); return (retval); From owner-svn-src-head@FreeBSD.ORG Wed May 13 13:00:52 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CF45C1065678; Wed, 13 May 2009 13:00:52 +0000 (UTC) (envelope-from dds@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BD7918FC20; Wed, 13 May 2009 13:00:52 +0000 (UTC) (envelope-from dds@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4DD0qgA057070; Wed, 13 May 2009 13:00:52 GMT (envelope-from dds@svn.freebsd.org) Received: (from dds@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4DD0qU9057069; Wed, 13 May 2009 13:00:52 GMT (envelope-from dds@svn.freebsd.org) Message-Id: <200905131300.n4DD0qU9057069@svn.freebsd.org> From: Diomidis Spinellis Date: Wed, 13 May 2009 13:00:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192041 - head/usr.bin/truss X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2009 13:00:53 -0000 Author: dds Date: Wed May 13 13:00:52 2009 New Revision: 192041 URL: http://svn.freebsd.org/changeset/base/192041 Log: Fix print_syscall_ret parameter order. Modified: head/usr.bin/truss/mips-fbsd.c Modified: head/usr.bin/truss/mips-fbsd.c ============================================================================== --- head/usr.bin/truss/mips-fbsd.c Wed May 13 12:43:37 2009 (r192040) +++ head/usr.bin/truss/mips-fbsd.c Wed May 13 13:00:52 2009 (r192041) @@ -339,7 +339,7 @@ mips_syscall_exit(struct trussinfo *trus */ print_syscall_ret(trussinfo, fsc.name, fsc.nargs, fsc.s_args, errorp, - fsc.sc, retval); + retval, fsc.sc); clear_fsc(); return (retval); From owner-svn-src-head@FreeBSD.ORG Wed May 13 14:25:55 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AB2291065678; Wed, 13 May 2009 14:25:55 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 98C978FC1C; Wed, 13 May 2009 14:25:55 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4DEPt7x058775; Wed, 13 May 2009 14:25:55 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4DEPthr058774; Wed, 13 May 2009 14:25:55 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200905131425.n4DEPthr058774@svn.freebsd.org> From: Nathan Whitehorn Date: Wed, 13 May 2009 14:25:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192042 - head/sys/dev/bwi X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2009 14:25:56 -0000 Author: nwhitehorn Date: Wed May 13 14:25:55 2009 New Revision: 192042 URL: http://svn.freebsd.org/changeset/base/192042 Log: Add a short delay after programming PHY registers to give some time for the engine to catch up. This prevents a machine check exception from illegal memory requests with a BCM4318. Modified: head/sys/dev/bwi/bwiphy.c Modified: head/sys/dev/bwi/bwiphy.c ============================================================================== --- head/sys/dev/bwi/bwiphy.c Wed May 13 13:00:52 2009 (r192041) +++ head/sys/dev/bwi/bwiphy.c Wed May 13 14:25:55 2009 (r192042) @@ -664,6 +664,7 @@ bwi_phy_init_11b_rev6(struct bwi_mac *ma for (ofs = 0xa8; ofs < 0xc8; ++ofs) { PHY_WRITE(mac, ofs, (val & 0x3f3f)); val += 0x202; + DELAY(10); } if (phy->phy_mode == IEEE80211_MODE_11G) { From owner-svn-src-head@FreeBSD.ORG Wed May 13 14:27:29 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E62E61065673; Wed, 13 May 2009 14:27:29 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id B67BC8FC0A; Wed, 13 May 2009 14:27:29 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 6B98546B49; Wed, 13 May 2009 10:27:29 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 681F98A026; Wed, 13 May 2009 10:27:28 -0400 (EDT) From: John Baldwin To: Marius Strobl Date: Wed, 13 May 2009 09:51:29 -0400 User-Agent: KMail/1.9.7 References: <200905122056.n4CKuYpZ032804@svn.freebsd.org> <1242162786.1755.51.camel@balrog.2hip.net> <20090512212813.GF1158@alchemy.franken.de> In-Reply-To: <20090512212813.GF1158@alchemy.franken.de> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200905130951.30037.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Wed, 13 May 2009 10:27:28 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Robert Noland Subject: Re: svn commit: r192026 - head/share/man/man9 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2009 14:27:30 -0000 On Tuesday 12 May 2009 5:28:13 pm Marius Strobl wrote: > On Tue, May 12, 2009 at 04:13:06PM -0500, Robert Noland wrote: > > On Tue, 2009-05-12 at 20:56 +0000, Marius Strobl wrote: > > > Author: marius > > > Date: Tue May 12 20:56:34 2009 > > > New Revision: 192026 > > > URL: http://svn.freebsd.org/changeset/base/192026 > > > > > > Log: > > > Correct r190283 (partially reverting it) as on sparc64 BUS_DMA_NOCACHE > > > actually is only valid for bus_dmamap_load(). > > > > Ok, this is getting very confusing... This means that code has to set > > this flag on both alloc and load to allow for somethine resembling > > consistent behavior. > > > > Personally I don't understand why amd64 and i386 where decided to > implement BUS_DMA_NOCACHE for bus_dmamem_alloc(9) only as this > is less flexible than using it with bus_dmamap_load(9) (which also > is the older existing implementation). Anyway, > documents BUS_DMA_NOCACHE and BUS_DMA_NOWRITE as "non-standard or > specific to only certain architectures" so I think it's okay for > the usage of these flags to differ across them. Hmm, it might be possible to move it to bus_dmamap_load() instead. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Wed May 13 14:43:27 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 18375106566B; Wed, 13 May 2009 14:43:27 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 06C678FC12; Wed, 13 May 2009 14:43:27 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4DEhQXx059185; Wed, 13 May 2009 14:43:26 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4DEhQQn059183; Wed, 13 May 2009 14:43:26 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200905131443.n4DEhQQn059183@svn.freebsd.org> From: Warner Losh Date: Wed, 13 May 2009 14:43:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192043 - head/sys/dev/ed X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2009 14:43:27 -0000 Author: imp Date: Wed May 13 14:43:26 2009 New Revision: 192043 URL: http://svn.freebsd.org/changeset/base/192043 Log: ifp->if_softc is managed entirely by the driver. We never set it to NULL or change it. We initialize it before we set if_ioctl. It can therefore never be NULL, and most other drivers don't bother with this sanity check. Modified: head/sys/dev/ed/if_ed.c Modified: head/sys/dev/ed/if_ed.c ============================================================================== --- head/sys/dev/ed/if_ed.c Wed May 13 14:25:55 2009 (r192042) +++ head/sys/dev/ed/if_ed.c Wed May 13 14:43:26 2009 (r192043) @@ -1164,14 +1164,6 @@ ed_ioctl(struct ifnet *ifp, u_long comma struct ifreq *ifr = (struct ifreq *)data; int error = 0; - /* - * XXX really needed? - */ - if (sc == NULL) { - ifp->if_drv_flags &= ~IFF_DRV_RUNNING; - return (ENXIO); - } - switch (command) { case SIOCSIFFLAGS: /* From owner-svn-src-head@FreeBSD.ORG Wed May 13 16:19:05 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B95821065672; Wed, 13 May 2009 16:19:05 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A78908FC0C; Wed, 13 May 2009 16:19:05 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4DGJ5Rp061011; Wed, 13 May 2009 16:19:05 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4DGJ5t7061010; Wed, 13 May 2009 16:19:05 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200905131619.n4DGJ5t7061010@svn.freebsd.org> From: Nathan Whitehorn Date: Wed, 13 May 2009 16:19:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192046 - head/sys/dev/bwi X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2009 16:19:06 -0000 Author: nwhitehorn Date: Wed May 13 16:19:05 2009 New Revision: 192046 URL: http://svn.freebsd.org/changeset/base/192046 Log: Add a comment to motivate my last change. Suggested by: sam, imp Modified: head/sys/dev/bwi/bwiphy.c Modified: head/sys/dev/bwi/bwiphy.c ============================================================================== --- head/sys/dev/bwi/bwiphy.c Wed May 13 15:09:01 2009 (r192045) +++ head/sys/dev/bwi/bwiphy.c Wed May 13 16:19:05 2009 (r192046) @@ -664,6 +664,8 @@ bwi_phy_init_11b_rev6(struct bwi_mac *ma for (ofs = 0xa8; ofs < 0xc8; ++ofs) { PHY_WRITE(mac, ofs, (val & 0x3f3f)); val += 0x202; + + /* XXX: delay 10 us to avoid PCI parity errors with BCM4318 */ DELAY(10); } From owner-svn-src-head@FreeBSD.ORG Wed May 13 17:09:43 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 49FDB106566B; Wed, 13 May 2009 17:09:43 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id DCBAF8FC2B; Wed, 13 May 2009 17:09:42 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 9430446B06; Wed, 13 May 2009 13:09:42 -0400 (EDT) Date: Wed, 13 May 2009 18:09:42 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Weongyo Jeong In-Reply-To: <200905110239.n4B2dnSX075285@svn.freebsd.org> Message-ID: References: <200905110239.n4B2dnSX075285@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191983 - in head/sys: dev/usb/wlan modules/usb/upgt X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2009 17:09:43 -0000 On Mon, 11 May 2009, Weongyo Jeong wrote: > Author: weongyo > Date: Mon May 11 02:39:49 2009 > New Revision: 191983 > URL: http://svn.freebsd.org/changeset/base/191983 > > Log: > ports upgt(4) driver for USB2. Ah, great! Do you have any similar plans regarding urtw? Robert N M Watson Computer Laboratory University of Cambridge > > Added: > head/sys/dev/usb/wlan/if_upgt.c (contents, props changed) > head/sys/dev/usb/wlan/if_upgtvar.h (contents, props changed) > head/sys/modules/usb/upgt/ > head/sys/modules/usb/upgt/Makefile (contents, props changed) > > Added: head/sys/dev/usb/wlan/if_upgt.c > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/dev/usb/wlan/if_upgt.c Mon May 11 02:39:49 2009 (r191983) > @@ -0,0 +1,2404 @@ > +/* $OpenBSD: if_upgt.c,v 1.35 2008/04/16 18:32:15 damien Exp $ */ > +/* $FreeBSD$ */ > + > +/* > + * Copyright (c) 2007 Marcus Glocker > + * > + * Permission to use, copy, modify, and distribute this software for any > + * purpose with or without fee is hereby granted, provided that the above > + * copyright notice and this permission notice appear in all copies. > + * > + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES > + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF > + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR > + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES > + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN > + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF > + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > + > +#include > +#include > +#include > +#include > + > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include "usbdevs.h" > + > +#include > + > +/* > + * Driver for the USB PrismGT devices. > + * > + * For now just USB 2.0 devices with the GW3887 chipset are supported. > + * The driver has been written based on the firmware version 2.13.1.0_LM87. > + * > + * TODO's: > + * - MONITOR mode test. > + * - Add HOSTAP mode. > + * - Add IBSS mode. > + * - Support the USB 1.0 devices (NET2280, ISL3880, ISL3886 chipsets). > + * > + * Parts of this driver has been influenced by reading the p54u driver > + * written by Jean-Baptiste Note and > + * Sebastien Bourdeauducq . > + */ > + > +SYSCTL_NODE(_hw, OID_AUTO, upgt, CTLFLAG_RD, 0, > + "USB PrismGT GW3887 driver parameters"); > + > +#ifdef UPGT_DEBUG > +int upgt_debug = 0; > +SYSCTL_INT(_hw_upgt, OID_AUTO, debug, CTLFLAG_RW, &upgt_debug, > + 0, "control debugging printfs"); > +TUNABLE_INT("hw.upgt.debug", &upgt_debug); > +enum { > + UPGT_DEBUG_XMIT = 0x00000001, /* basic xmit operation */ > + UPGT_DEBUG_RECV = 0x00000002, /* basic recv operation */ > + UPGT_DEBUG_RESET = 0x00000004, /* reset processing */ > + UPGT_DEBUG_INTR = 0x00000008, /* INTR */ > + UPGT_DEBUG_TX_PROC = 0x00000010, /* tx ISR proc */ > + UPGT_DEBUG_RX_PROC = 0x00000020, /* rx ISR proc */ > + UPGT_DEBUG_STATE = 0x00000040, /* 802.11 state transitions */ > + UPGT_DEBUG_STAT = 0x00000080, /* statistic */ > + UPGT_DEBUG_FW = 0x00000100, /* firmware */ > + UPGT_DEBUG_ANY = 0xffffffff > +}; > +#define DPRINTF(sc, m, fmt, ...) do { \ > + if (sc->sc_debug & (m)) \ > + printf(fmt, __VA_ARGS__); \ > +} while (0) > +#else > +#define DPRINTF(sc, m, fmt, ...) do { \ > + (void) sc; \ > +} while (0) > +#endif > + > +/* > + * Prototypes. > + */ > +static device_probe_t upgt_match; > +static device_attach_t upgt_attach; > +static device_detach_t upgt_detach; > +static int upgt_alloc_tx(struct upgt_softc *); > +static int upgt_alloc_rx(struct upgt_softc *); > +static int upgt_device_reset(struct upgt_softc *); > +static void upgt_bulk_tx(struct upgt_softc *, struct upgt_data *); > +static int upgt_fw_verify(struct upgt_softc *); > +static int upgt_mem_init(struct upgt_softc *); > +static int upgt_fw_load(struct upgt_softc *); > +static int upgt_fw_copy(const uint8_t *, char *, int); > +static uint32_t upgt_crc32_le(const void *, size_t); > +static struct mbuf * > + upgt_rxeof(struct usb2_xfer *, struct upgt_data *, int *); > +static struct mbuf * > + upgt_rx(struct upgt_softc *, uint8_t *, int, int *); > +static void upgt_txeof(struct usb2_xfer *, struct upgt_data *); > +static int upgt_eeprom_read(struct upgt_softc *); > +static int upgt_eeprom_parse(struct upgt_softc *); > +static void upgt_eeprom_parse_hwrx(struct upgt_softc *, uint8_t *); > +static void upgt_eeprom_parse_freq3(struct upgt_softc *, uint8_t *, int); > +static void upgt_eeprom_parse_freq4(struct upgt_softc *, uint8_t *, int); > +static void upgt_eeprom_parse_freq6(struct upgt_softc *, uint8_t *, int); > +static uint32_t upgt_chksum_le(const uint32_t *, size_t); > +static void upgt_tx_done(struct upgt_softc *, uint8_t *); > +static void upgt_init(void *); > +static void upgt_init_locked(struct upgt_softc *); > +static int upgt_ioctl(struct ifnet *, u_long, caddr_t); > +static void upgt_start(struct ifnet *); > +static int upgt_raw_xmit(struct ieee80211_node *, struct mbuf *, > + const struct ieee80211_bpf_params *); > +static void upgt_scan_start(struct ieee80211com *); > +static void upgt_scan_end(struct ieee80211com *); > +static void upgt_set_channel(struct ieee80211com *); > +static struct ieee80211vap *upgt_vap_create(struct ieee80211com *, > + const char name[IFNAMSIZ], int unit, int opmode, > + int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], > + const uint8_t mac[IEEE80211_ADDR_LEN]); > +static void upgt_vap_delete(struct ieee80211vap *); > +static void upgt_update_mcast(struct ifnet *); > +static uint8_t upgt_rx_rate(struct upgt_softc *, const int); > +static void upgt_set_multi(void *); > +static void upgt_stop(struct upgt_softc *); > +static void upgt_setup_rates(struct ieee80211vap *, struct ieee80211com *); > +static int upgt_set_macfilter(struct upgt_softc *, uint8_t); > +static int upgt_newstate(struct ieee80211vap *, enum ieee80211_state, int); > +static void upgt_set_chan(struct upgt_softc *, struct ieee80211_channel *); > +static void upgt_set_led(struct upgt_softc *, int); > +static void upgt_set_led_blink(void *); > +static void upgt_get_stats(struct upgt_softc *); > +static void upgt_mem_free(struct upgt_softc *, uint32_t); > +static uint32_t upgt_mem_alloc(struct upgt_softc *); > +static void upgt_free_tx(struct upgt_softc *); > +static void upgt_free_rx(struct upgt_softc *); > +static void upgt_watchdog(void *); > +static void upgt_abort_xfers(struct upgt_softc *); > +static void upgt_abort_xfers_locked(struct upgt_softc *); > +static void upgt_sysctl_node(struct upgt_softc *); > +static struct upgt_data * > + upgt_getbuf(struct upgt_softc *); > +static struct upgt_data * > + upgt_gettxbuf(struct upgt_softc *); > +static int upgt_tx_start(struct upgt_softc *, struct mbuf *, > + struct ieee80211_node *, struct upgt_data *); > + > +static const char *upgt_fwname = "upgt-gw3887"; > + > +static const struct usb2_device_id upgt_devs_2[] = { > +#define UPGT_DEV(v,p) { USB_VP(USB_VENDOR_##v, USB_PRODUCT_##v##_##p) } > + /* version 2 devices */ > + UPGT_DEV(ACCTON, PRISM_GT), > + UPGT_DEV(BELKIN, F5D7050), > + UPGT_DEV(CISCOLINKSYS, WUSB54AG), > + UPGT_DEV(CONCEPTRONIC, PRISM_GT), > + UPGT_DEV(DELL, PRISM_GT_1), > + UPGT_DEV(DELL, PRISM_GT_2), > + UPGT_DEV(FSC, E5400), > + UPGT_DEV(GLOBESPAN, PRISM_GT_1), > + UPGT_DEV(GLOBESPAN, PRISM_GT_2), > + UPGT_DEV(INTERSIL, PRISM_GT), > + UPGT_DEV(SMC, 2862WG), > + UPGT_DEV(WISTRONNEWEB, UR045G), > + UPGT_DEV(XYRATEX, PRISM_GT_1), > + UPGT_DEV(XYRATEX, PRISM_GT_2), > + UPGT_DEV(ZCOM, XG703A), > + UPGT_DEV(ZCOM, XM142) > +}; > + > +static usb2_callback_t upgt_bulk_rx_callback; > +static usb2_callback_t upgt_bulk_tx_callback; > + > +static const struct usb2_config upgt_config[UPGT_N_XFERS] = { > + [UPGT_BULK_TX] = { > + .type = UE_BULK, > + .endpoint = UE_ADDR_ANY, > + .direction = UE_DIR_OUT, > + .bufsize = MCLBYTES, > + .flags = { > + .ext_buffer = 1, > + .force_short_xfer = 1, > + .pipe_bof = 1 > + }, > + .callback = upgt_bulk_tx_callback, > + .timeout = UPGT_USB_TIMEOUT, /* ms */ > + }, > + [UPGT_BULK_RX] = { > + .type = UE_BULK, > + .endpoint = UE_ADDR_ANY, > + .direction = UE_DIR_IN, > + .bufsize = MCLBYTES, > + .flags = { > + .ext_buffer = 1, > + .pipe_bof = 1, > + .short_xfer_ok = 1 > + }, > + .callback = upgt_bulk_rx_callback, > + }, > +}; > + > +static int > +upgt_match(device_t dev) > +{ > + struct usb2_attach_arg *uaa = device_get_ivars(dev); > + > + if (uaa->usb2_mode != USB_MODE_HOST) > + return (ENXIO); > + if (uaa->info.bConfigIndex != UPGT_CONFIG_INDEX) > + return (ENXIO); > + if (uaa->info.bIfaceIndex != UPGT_IFACE_INDEX) > + return (ENXIO); > + > + return (usb2_lookup_id_by_uaa(upgt_devs_2, sizeof(upgt_devs_2), uaa)); > +} > + > +static int > +upgt_attach(device_t dev) > +{ > + int error; > + struct ieee80211com *ic; > + struct ifnet *ifp; > + struct upgt_softc *sc = device_get_softc(dev); > + struct usb2_attach_arg *uaa = device_get_ivars(dev); > + uint8_t bands, iface_index = UPGT_IFACE_INDEX; > + > + sc->sc_dev = dev; > + sc->sc_udev = uaa->device; > +#ifdef UPGT_DEBUG > + sc->sc_debug = upgt_debug; > +#endif > + > + mtx_init(&sc->sc_mtx, device_get_nameunit(sc->sc_dev), MTX_NETWORK_LOCK, > + MTX_DEF); > + callout_init(&sc->sc_led_ch, 0); > + callout_init(&sc->sc_watchdog_ch, 0); > + > + /* Allocate TX and RX xfers. */ > + error = upgt_alloc_tx(sc); > + if (error) > + goto fail1; > + error = upgt_alloc_rx(sc); > + if (error) > + goto fail2; > + > + error = usb2_transfer_setup(uaa->device, &iface_index, sc->sc_xfer, > + upgt_config, UPGT_N_XFERS, sc, &sc->sc_mtx); > + if (error) { > + device_printf(dev, "could not allocate USB transfers, " > + "err=%s\n", usb2_errstr(error)); > + goto fail3; > + } > + > + ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211); > + if (ifp == NULL) { > + device_printf(dev, "can not if_alloc()\n"); > + goto fail4; > + } > + > + /* Initialize the device. */ > + error = upgt_device_reset(sc); > + if (error) > + goto fail5; > + /* Verify the firmware. */ > + error = upgt_fw_verify(sc); > + if (error) > + goto fail5; > + /* Calculate device memory space. */ > + if (sc->sc_memaddr_frame_start == 0 || sc->sc_memaddr_frame_end == 0) { > + device_printf(dev, > + "could not find memory space addresses on FW!\n"); > + error = EIO; > + goto fail5; > + } > + sc->sc_memaddr_frame_end -= UPGT_MEMSIZE_RX + 1; > + sc->sc_memaddr_rx_start = sc->sc_memaddr_frame_end + 1; > + > + DPRINTF(sc, UPGT_DEBUG_FW, "memory address frame start=0x%08x\n", > + sc->sc_memaddr_frame_start); > + DPRINTF(sc, UPGT_DEBUG_FW, "memory address frame end=0x%08x\n", > + sc->sc_memaddr_frame_end); > + DPRINTF(sc, UPGT_DEBUG_FW, "memory address rx start=0x%08x\n", > + sc->sc_memaddr_rx_start); > + > + upgt_mem_init(sc); > + > + /* Load the firmware. */ > + error = upgt_fw_load(sc); > + if (error) > + goto fail5; > + > + /* Read the whole EEPROM content and parse it. */ > + error = upgt_eeprom_read(sc); > + if (error) > + goto fail5; > + error = upgt_eeprom_parse(sc); > + if (error) > + goto fail5; > + > + /* all works related with the device have done here. */ > + upgt_abort_xfers(sc); > + > + /* Setup the 802.11 device. */ > + ifp->if_softc = sc; > + if_initname(ifp, "upgt", device_get_unit(sc->sc_dev)); > + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; > + ifp->if_init = upgt_init; > + ifp->if_ioctl = upgt_ioctl; > + ifp->if_start = upgt_start; > + IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); > + IFQ_SET_READY(&ifp->if_snd); > + > + ic = ifp->if_l2com; > + ic->ic_ifp = ifp; > + ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */ > + ic->ic_opmode = IEEE80211_M_STA; > + /* set device capabilities */ > + ic->ic_caps = > + IEEE80211_C_STA /* station mode */ > + | IEEE80211_C_MONITOR /* monitor mode */ > + | IEEE80211_C_SHPREAMBLE /* short preamble supported */ > + | IEEE80211_C_SHSLOT /* short slot time supported */ > + | IEEE80211_C_BGSCAN /* capable of bg scanning */ > + | IEEE80211_C_WPA /* 802.11i */ > + ; > + > + bands = 0; > + setbit(&bands, IEEE80211_MODE_11B); > + setbit(&bands, IEEE80211_MODE_11G); > + ieee80211_init_channels(ic, NULL, &bands); > + > + ieee80211_ifattach(ic, sc->sc_myaddr); > + ic->ic_raw_xmit = upgt_raw_xmit; > + ic->ic_scan_start = upgt_scan_start; > + ic->ic_scan_end = upgt_scan_end; > + ic->ic_set_channel = upgt_set_channel; > + > + ic->ic_vap_create = upgt_vap_create; > + ic->ic_vap_delete = upgt_vap_delete; > + ic->ic_update_mcast = upgt_update_mcast; > + > + bpfattach(ifp, DLT_IEEE802_11_RADIO, > + sizeof(struct ieee80211_frame) + sizeof(sc->sc_txtap)); > + sc->sc_rxtap_len = sizeof(sc->sc_rxtap); > + sc->sc_rxtap.wr_ihdr.it_len = htole16(sc->sc_rxtap_len); > + sc->sc_rxtap.wr_ihdr.it_present = htole32(UPGT_RX_RADIOTAP_PRESENT); > + sc->sc_txtap_len = sizeof(sc->sc_txtap); > + sc->sc_txtap.wt_ihdr.it_len = htole16(sc->sc_txtap_len); > + sc->sc_txtap.wt_ihdr.it_present = htole32(UPGT_TX_RADIOTAP_PRESENT); > + > + upgt_sysctl_node(sc); > + > + if (bootverbose) > + ieee80211_announce(ic); > + > + return (0); > + > +fail5: if_free(ifp); > +fail4: usb2_transfer_unsetup(sc->sc_xfer, UPGT_N_XFERS); > +fail3: upgt_free_rx(sc); > +fail2: upgt_free_tx(sc); > +fail1: mtx_destroy(&sc->sc_mtx); > + > + return (error); > +} > + > +static void > +upgt_txeof(struct usb2_xfer *xfer, struct upgt_data *data) > +{ > + struct upgt_softc *sc = xfer->priv_sc; > + struct ifnet *ifp = sc->sc_ifp; > + struct mbuf *m; > + > + UPGT_ASSERT_LOCKED(sc); > + > + /* > + * Do any tx complete callback. Note this must be done before releasing > + * the node reference. > + */ > + if (data->m) { > + m = data->m; > + if (m->m_flags & M_TXCB) { > + /* XXX status? */ > + ieee80211_process_callback(data->ni, m, 0); > + } > + m_freem(m); > + data->m = NULL; > + } > + if (data->ni) { > + ieee80211_free_node(data->ni); > + data->ni = NULL; > + } > + ifp->if_opackets++; > +} > + > +static void > +upgt_get_stats(struct upgt_softc *sc) > +{ > + struct upgt_data *data_cmd; > + struct upgt_lmac_mem *mem; > + struct upgt_lmac_stats *stats; > + > + data_cmd = upgt_getbuf(sc); > + if (data_cmd == NULL) { > + device_printf(sc->sc_dev, "%s: out of buffer.\n", __func__); > + return; > + } > + > + /* > + * Transmit the URB containing the CMD data. > + */ > + bzero(data_cmd->buf, MCLBYTES); > + > + mem = (struct upgt_lmac_mem *)data_cmd->buf; > + mem->addr = htole32(sc->sc_memaddr_frame_start + > + UPGT_MEMSIZE_FRAME_HEAD); > + > + stats = (struct upgt_lmac_stats *)(mem + 1); > + > + stats->header1.flags = 0; > + stats->header1.type = UPGT_H1_TYPE_CTRL; > + stats->header1.len = htole16( > + sizeof(struct upgt_lmac_stats) - sizeof(struct upgt_lmac_header)); > + > + stats->header2.reqid = htole32(sc->sc_memaddr_frame_start); > + stats->header2.type = htole16(UPGT_H2_TYPE_STATS); > + stats->header2.flags = 0; > + > + data_cmd->buflen = sizeof(*mem) + sizeof(*stats); > + > + mem->chksum = upgt_chksum_le((uint32_t *)stats, > + data_cmd->buflen - sizeof(*mem)); > + > + upgt_bulk_tx(sc, data_cmd); > +} > + > +static int > +upgt_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) > +{ > + struct upgt_softc *sc = ifp->if_softc; > + struct ieee80211com *ic = ifp->if_l2com; > + struct ifreq *ifr = (struct ifreq *) data; > + int error = 0, startall = 0; > + > + switch (cmd) { > + case SIOCSIFFLAGS: > + mtx_lock(&Giant); > + if (ifp->if_flags & IFF_UP) { > + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { > + if ((ifp->if_flags ^ sc->sc_if_flags) & > + (IFF_ALLMULTI | IFF_PROMISC)) > + upgt_set_multi(sc); > + } else { > + upgt_init(sc); > + startall = 1; > + } > + } else { > + if (ifp->if_drv_flags & IFF_DRV_RUNNING) > + upgt_stop(sc); > + } > + sc->sc_if_flags = ifp->if_flags; > + if (startall) > + ieee80211_start_all(ic); > + mtx_unlock(&Giant); > + break; > + case SIOCGIFMEDIA: > + error = ifmedia_ioctl(ifp, ifr, &ic->ic_media, cmd); > + break; > + case SIOCGIFADDR: > + error = ether_ioctl(ifp, cmd, data); > + break; > + default: > + error = EINVAL; > + break; > + } > + return error; > +} > + > +static void > +upgt_stop_locked(struct upgt_softc *sc) > +{ > + struct ifnet *ifp = sc->sc_ifp; > + > + UPGT_ASSERT_LOCKED(sc); > + > + if (ifp->if_drv_flags & IFF_DRV_RUNNING) > + upgt_set_macfilter(sc, IEEE80211_S_INIT); > + upgt_abort_xfers_locked(sc); > +} > + > +static void > +upgt_stop(struct upgt_softc *sc) > +{ > + struct ifnet *ifp = sc->sc_ifp; > + > + UPGT_LOCK(sc); > + upgt_stop_locked(sc); > + UPGT_UNLOCK(sc); > + > + /* device down */ > + sc->sc_tx_timer = 0; > + ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); > + sc->sc_flags &= ~UPGT_FLAG_INITDONE; > +} > + > +static void > +upgt_set_led(struct upgt_softc *sc, int action) > +{ > + struct upgt_data *data_cmd; > + struct upgt_lmac_mem *mem; > + struct upgt_lmac_led *led; > + > + data_cmd = upgt_getbuf(sc); > + if (data_cmd == NULL) { > + device_printf(sc->sc_dev, "%s: out of buffers.\n", __func__); > + return; > + } > + > + /* > + * Transmit the URB containing the CMD data. > + */ > + bzero(data_cmd->buf, MCLBYTES); > + > + mem = (struct upgt_lmac_mem *)data_cmd->buf; > + mem->addr = htole32(sc->sc_memaddr_frame_start + > + UPGT_MEMSIZE_FRAME_HEAD); > + > + led = (struct upgt_lmac_led *)(mem + 1); > + > + led->header1.flags = UPGT_H1_FLAGS_TX_NO_CALLBACK; > + led->header1.type = UPGT_H1_TYPE_CTRL; > + led->header1.len = htole16( > + sizeof(struct upgt_lmac_led) - > + sizeof(struct upgt_lmac_header)); > + > + led->header2.reqid = htole32(sc->sc_memaddr_frame_start); > + led->header2.type = htole16(UPGT_H2_TYPE_LED); > + led->header2.flags = 0; > + > + switch (action) { > + case UPGT_LED_OFF: > + led->mode = htole16(UPGT_LED_MODE_SET); > + led->action_fix = 0; > + led->action_tmp = htole16(UPGT_LED_ACTION_OFF); > + led->action_tmp_dur = 0; > + break; > + case UPGT_LED_ON: > + led->mode = htole16(UPGT_LED_MODE_SET); > + led->action_fix = 0; > + led->action_tmp = htole16(UPGT_LED_ACTION_ON); > + led->action_tmp_dur = 0; > + break; > + case UPGT_LED_BLINK: > + if (sc->sc_state != IEEE80211_S_RUN) { > + STAILQ_INSERT_TAIL(&sc->sc_tx_inactive, data_cmd, next); > + return; > + } > + if (sc->sc_led_blink) { > + /* previous blink was not finished */ > + STAILQ_INSERT_TAIL(&sc->sc_tx_inactive, data_cmd, next); > + return; > + } > + led->mode = htole16(UPGT_LED_MODE_SET); > + led->action_fix = htole16(UPGT_LED_ACTION_OFF); > + led->action_tmp = htole16(UPGT_LED_ACTION_ON); > + led->action_tmp_dur = htole16(UPGT_LED_ACTION_TMP_DUR); > + /* lock blink */ > + sc->sc_led_blink = 1; > + callout_reset(&sc->sc_led_ch, hz, upgt_set_led_blink, sc); > + break; > + default: > + STAILQ_INSERT_TAIL(&sc->sc_tx_inactive, data_cmd, next); > + return; > + } > + > + data_cmd->buflen = sizeof(*mem) + sizeof(*led); > + > + mem->chksum = upgt_chksum_le((uint32_t *)led, > + data_cmd->buflen - sizeof(*mem)); > + > + upgt_bulk_tx(sc, data_cmd); > +} > + > +static void > +upgt_set_led_blink(void *arg) > +{ > + struct upgt_softc *sc = arg; > + > + /* blink finished, we are ready for a next one */ > + sc->sc_led_blink = 0; > +} > + > +static void > +upgt_init(void *priv) > +{ > + struct upgt_softc *sc = priv; > + struct ifnet *ifp = sc->sc_ifp; > + struct ieee80211com *ic = ifp->if_l2com; > + > + UPGT_LOCK(sc); > + upgt_init_locked(sc); > + UPGT_UNLOCK(sc); > + > + if (ifp->if_drv_flags & IFF_DRV_RUNNING) > + ieee80211_start_all(ic); /* start all vap's */ > +} > + > +static void > +upgt_init_locked(struct upgt_softc *sc) > +{ > + struct ifnet *ifp = sc->sc_ifp; > + > + UPGT_ASSERT_LOCKED(sc); > + > + if (ifp->if_drv_flags & IFF_DRV_RUNNING) > + upgt_stop_locked(sc); > + > + usb2_transfer_start(sc->sc_xfer[UPGT_BULK_RX]); > + > + (void)upgt_set_macfilter(sc, IEEE80211_S_SCAN); > + > + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; > + ifp->if_drv_flags |= IFF_DRV_RUNNING; > + sc->sc_flags |= UPGT_FLAG_INITDONE; > + > + callout_reset(&sc->sc_watchdog_ch, hz, upgt_watchdog, sc); > +} > + > +static int > +upgt_set_macfilter(struct upgt_softc *sc, uint8_t state) > +{ > + struct ifnet *ifp = sc->sc_ifp; > + struct ieee80211com *ic = ifp->if_l2com; > + struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); > + struct ieee80211_node *ni = vap->iv_bss; > + struct upgt_data *data_cmd; > + struct upgt_lmac_mem *mem; > + struct upgt_lmac_filter *filter; > + uint8_t broadcast[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; > + > + UPGT_ASSERT_LOCKED(sc); > + > + data_cmd = upgt_getbuf(sc); > + if (data_cmd == NULL) { > + device_printf(sc->sc_dev, "out of TX buffers.\n"); > + return (ENOBUFS); > + } > + > + /* > + * Transmit the URB containing the CMD data. > + */ > + bzero(data_cmd->buf, MCLBYTES); > + > + mem = (struct upgt_lmac_mem *)data_cmd->buf; > + mem->addr = htole32(sc->sc_memaddr_frame_start + > + UPGT_MEMSIZE_FRAME_HEAD); > + > + filter = (struct upgt_lmac_filter *)(mem + 1); > + > + filter->header1.flags = UPGT_H1_FLAGS_TX_NO_CALLBACK; > + filter->header1.type = UPGT_H1_TYPE_CTRL; > + filter->header1.len = htole16( > + sizeof(struct upgt_lmac_filter) - > + sizeof(struct upgt_lmac_header)); > + > + filter->header2.reqid = htole32(sc->sc_memaddr_frame_start); > + filter->header2.type = htole16(UPGT_H2_TYPE_MACFILTER); > + filter->header2.flags = 0; > + > + switch (state) { > + case IEEE80211_S_INIT: > + DPRINTF(sc, UPGT_DEBUG_STATE, "%s: set MAC filter to INIT\n", > + __func__); > + filter->type = htole16(UPGT_FILTER_TYPE_RESET); > + break; > + case IEEE80211_S_SCAN: > + DPRINTF(sc, UPGT_DEBUG_STATE, > + "set MAC filter to SCAN (bssid %s)\n", > + ether_sprintf(broadcast)); > + filter->type = htole16(UPGT_FILTER_TYPE_NONE); > + IEEE80211_ADDR_COPY(filter->dst, sc->sc_myaddr); > + IEEE80211_ADDR_COPY(filter->src, broadcast); > + filter->unknown1 = htole16(UPGT_FILTER_UNKNOWN1); > + filter->rxaddr = htole32(sc->sc_memaddr_rx_start); > + filter->unknown2 = htole16(UPGT_FILTER_UNKNOWN2); > + filter->rxhw = htole32(sc->sc_eeprom_hwrx); > + filter->unknown3 = htole16(UPGT_FILTER_UNKNOWN3); > + break; > + case IEEE80211_S_RUN: > + /* XXX monitor mode isn't tested yet. */ > + if (vap->iv_opmode == IEEE80211_M_MONITOR) { > + filter->type = htole16(UPGT_FILTER_TYPE_MONITOR); > + IEEE80211_ADDR_COPY(filter->dst, sc->sc_myaddr); > + IEEE80211_ADDR_COPY(filter->src, ni->ni_bssid); > + filter->unknown1 = htole16(UPGT_FILTER_MONITOR_UNKNOWN1); > + filter->rxaddr = htole32(sc->sc_memaddr_rx_start); > + filter->unknown2 = htole16(UPGT_FILTER_MONITOR_UNKNOWN2); > + filter->rxhw = htole32(sc->sc_eeprom_hwrx); > + filter->unknown3 = htole16(UPGT_FILTER_MONITOR_UNKNOWN3); > + } else { > + DPRINTF(sc, UPGT_DEBUG_STATE, > + "set MAC filter to RUN (bssid %s)\n", > + ether_sprintf(ni->ni_bssid)); > + filter->type = htole16(UPGT_FILTER_TYPE_STA); > + IEEE80211_ADDR_COPY(filter->dst, sc->sc_myaddr); > + IEEE80211_ADDR_COPY(filter->src, ni->ni_bssid); > + filter->unknown1 = htole16(UPGT_FILTER_UNKNOWN1); > + filter->rxaddr = htole32(sc->sc_memaddr_rx_start); > + filter->unknown2 = htole16(UPGT_FILTER_UNKNOWN2); > + filter->rxhw = htole32(sc->sc_eeprom_hwrx); > + filter->unknown3 = htole16(UPGT_FILTER_UNKNOWN3); > + } > + break; > + default: > + device_printf(sc->sc_dev, > + "MAC filter does not know that state!\n"); > + break; > + } > + > + data_cmd->buflen = sizeof(*mem) + sizeof(*filter); > + > + mem->chksum = upgt_chksum_le((uint32_t *)filter, > + data_cmd->buflen - sizeof(*mem)); > + > + upgt_bulk_tx(sc, data_cmd); > + > + return (0); > +} > + > +static void > +upgt_setup_rates(struct ieee80211vap *vap, struct ieee80211com *ic) > +{ > + struct ifnet *ifp = ic->ic_ifp; > + struct upgt_softc *sc = ifp->if_softc; > + const struct ieee80211_txparam *tp; > + > + /* > + * 0x01 = OFMD6 0x10 = DS1 > + * 0x04 = OFDM9 0x11 = DS2 > + * 0x06 = OFDM12 0x12 = DS5 > + * 0x07 = OFDM18 0x13 = DS11 > + * 0x08 = OFDM24 > + * 0x09 = OFDM36 > + * 0x0a = OFDM48 > + * 0x0b = OFDM54 > + */ > + const uint8_t rateset_auto_11b[] = > + { 0x13, 0x13, 0x12, 0x11, 0x11, 0x10, 0x10, 0x10 }; > + const uint8_t rateset_auto_11g[] = > + { 0x0b, 0x0a, 0x09, 0x08, 0x07, 0x06, 0x04, 0x01 }; > + const uint8_t rateset_fix_11bg[] = > + { 0x10, 0x11, 0x12, 0x13, 0x01, 0x04, 0x06, 0x07, > + 0x08, 0x09, 0x0a, 0x0b }; > + > + tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_curchan)]; > + > + /* XXX */ > + if (tp->ucastrate == IEEE80211_FIXED_RATE_NONE) { > + /* > + * Automatic rate control is done by the device. > + * We just pass the rateset from which the device > + * will pickup a rate. > + */ > + if (ic->ic_curmode == IEEE80211_MODE_11B) > + bcopy(rateset_auto_11b, sc->sc_cur_rateset, > + sizeof(sc->sc_cur_rateset)); > + if (ic->ic_curmode == IEEE80211_MODE_11G || > + ic->ic_curmode == IEEE80211_MODE_AUTO) > + bcopy(rateset_auto_11g, sc->sc_cur_rateset, > + sizeof(sc->sc_cur_rateset)); > + } else { > + /* set a fixed rate */ > + memset(sc->sc_cur_rateset, rateset_fix_11bg[tp->ucastrate], > + sizeof(sc->sc_cur_rateset)); > + } > +} > + > +static void > +upgt_set_multi(void *arg) > +{ > + struct upgt_softc *sc = arg; > + struct ifnet *ifp = sc->sc_ifp; > + > + if (!(ifp->if_flags & IFF_UP)) > + return; > + > + /* > + * XXX don't know how to set a device. Lack of docs. Just try to set > + * IFF_ALLMULTI flag here. > + */ > + IF_ADDR_LOCK(ifp); > + ifp->if_flags |= IFF_ALLMULTI; > + IF_ADDR_UNLOCK(ifp); > +} > + > +static void > +upgt_start(struct ifnet *ifp) > +{ > + struct upgt_softc *sc = ifp->if_softc; > + struct upgt_data *data_tx; > + struct ieee80211_node *ni; > + struct mbuf *m; > + > + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) > + return; > + > + UPGT_LOCK(sc); > + for (;;) { > + IFQ_DRV_DEQUEUE(&ifp->if_snd, m); > + if (m == NULL) > + break; > + > + data_tx = upgt_gettxbuf(sc); > + if (data_tx == NULL) { > + IFQ_DRV_PREPEND(&ifp->if_snd, m); > + break; > + } > + > + ni = (struct ieee80211_node *)m->m_pkthdr.rcvif; > + m->m_pkthdr.rcvif = NULL; > + > + if (upgt_tx_start(sc, m, ni, data_tx) != 0) { > + STAILQ_INSERT_HEAD(&sc->sc_tx_inactive, data_tx, next); > + UPGT_STAT_INC(sc, st_tx_inactive); > + ieee80211_free_node(ni); > + ifp->if_oerrors++; > + continue; > + } > + sc->sc_tx_timer = 5; > + } > + UPGT_UNLOCK(sc); > +} > + > +static int > +upgt_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, > + const struct ieee80211_bpf_params *params) > +{ > + struct ieee80211com *ic = ni->ni_ic; > + struct ifnet *ifp = ic->ic_ifp; > + struct upgt_softc *sc = ifp->if_softc; > + struct upgt_data *data_tx = NULL; > + > + /* prevent management frames from being sent if we're not ready */ > + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { > + m_freem(m); > + ieee80211_free_node(ni); > + return ENETDOWN; > + } > + > + UPGT_LOCK(sc); > + data_tx = upgt_gettxbuf(sc); > + if (data_tx == NULL) { > + ieee80211_free_node(ni); > + m_freem(m); > + UPGT_UNLOCK(sc); > + return (ENOBUFS); > + } > + > + if (upgt_tx_start(sc, m, ni, data_tx) != 0) { > + STAILQ_INSERT_HEAD(&sc->sc_tx_inactive, data_tx, next); > + UPGT_STAT_INC(sc, st_tx_inactive); > + ieee80211_free_node(ni); > + ifp->if_oerrors++; > + UPGT_UNLOCK(sc); > + return (EIO); > + } > + UPGT_UNLOCK(sc); > + > + sc->sc_tx_timer = 5; > + return (0); > +} > + > +static void > +upgt_watchdog(void *arg) > +{ > + struct upgt_softc *sc = arg; > + struct ifnet *ifp = sc->sc_ifp; > + > + if (sc->sc_tx_timer > 0) { > + if (--sc->sc_tx_timer == 0) { > + device_printf(sc->sc_dev, "watchdog timeout\n"); > + /* upgt_init(ifp); XXX needs a process context ? */ > + ifp->if_oerrors++; > + return; > + } > + callout_reset(&sc->sc_watchdog_ch, hz, upgt_watchdog, sc); > + } > +} > + > +static uint32_t > +upgt_mem_alloc(struct upgt_softc *sc) > +{ > + int i; > + > + for (i = 0; i < sc->sc_memory.pages; i++) { > + if (sc->sc_memory.page[i].used == 0) { > + sc->sc_memory.page[i].used = 1; > + return (sc->sc_memory.page[i].addr); > + } > + } > + > + return (0); > +} > + > +static void > +upgt_scan_start(struct ieee80211com *ic) > +{ > + /* do nothing. */ > +} > + > +static void > +upgt_scan_end(struct ieee80211com *ic) > +{ > + /* do nothing. */ > +} > + > +static void > +upgt_set_channel(struct ieee80211com *ic) > +{ > + struct upgt_softc *sc = ic->ic_ifp->if_softc; > + > + UPGT_LOCK(sc); > + upgt_set_chan(sc, ic->ic_curchan); > + UPGT_UNLOCK(sc); > +} > + > +static void > +upgt_set_chan(struct upgt_softc *sc, struct ieee80211_channel *c) > +{ > + struct ifnet *ifp = sc->sc_ifp; > + struct ieee80211com *ic = ifp->if_l2com; > + struct upgt_data *data_cmd; > + struct upgt_lmac_mem *mem; > + struct upgt_lmac_channel *chan; > + int channel; > + > + UPGT_ASSERT_LOCKED(sc); > + > + channel = ieee80211_chan2ieee(ic, c); > + if (channel == 0 || channel == IEEE80211_CHAN_ANY) { > + /* XXX should NEVER happen */ > + device_printf(sc->sc_dev, > + "%s: invalid channel %x\n", __func__, channel); > + return; > + } > + > + DPRINTF(sc, UPGT_DEBUG_STATE, "%s: channel %d\n", __func__, channel); > + > + data_cmd = upgt_getbuf(sc); > + if (data_cmd == NULL) { > + device_printf(sc->sc_dev, "%s: out of buffers.\n", __func__); > + return; > + } > + /* > + * Transmit the URB containing the CMD data. > + */ > + bzero(data_cmd->buf, MCLBYTES); > + > + mem = (struct upgt_lmac_mem *)data_cmd->buf; > + mem->addr = htole32(sc->sc_memaddr_frame_start + > + UPGT_MEMSIZE_FRAME_HEAD); > + > + chan = (struct upgt_lmac_channel *)(mem + 1); > + > + chan->header1.flags = UPGT_H1_FLAGS_TX_NO_CALLBACK; > + chan->header1.type = UPGT_H1_TYPE_CTRL; > + chan->header1.len = htole16( > + sizeof(struct upgt_lmac_channel) - sizeof(struct upgt_lmac_header)); > + > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > From owner-svn-src-head@FreeBSD.ORG Wed May 13 17:11:26 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2324B1065766; Wed, 13 May 2009 17:11:25 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ADC2E8FC0A; Wed, 13 May 2009 17:11:25 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4DHBP5B062134; Wed, 13 May 2009 17:11:25 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4DHBP5g062133; Wed, 13 May 2009 17:11:25 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200905131711.n4DHBP5g062133@svn.freebsd.org> From: Robert Watson Date: Wed, 13 May 2009 17:11:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192047 - head/sys/legacy/dev/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2009 17:11:45 -0000 Author: rwatson Date: Wed May 13 17:11:25 2009 New Revision: 192047 URL: http://svn.freebsd.org/changeset/base/192047 Log: Garbage collect legacy upgt driver now that it is available in the new USB implementation. Garbage collect legacy USB ethernet framework now that it is unused. Deleted: head/sys/legacy/dev/usb/if_upgt.c head/sys/legacy/dev/usb/if_upgtvar.h head/sys/legacy/dev/usb/usb_ethersubr.c head/sys/legacy/dev/usb/usb_ethersubr.h From owner-svn-src-head@FreeBSD.ORG Wed May 13 17:17:05 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B16681065697; Wed, 13 May 2009 17:17:05 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9FDA78FC1E; Wed, 13 May 2009 17:17:05 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4DHH5Od062270; Wed, 13 May 2009 17:17:05 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4DHH5pJ062269; Wed, 13 May 2009 17:17:05 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200905131717.n4DHH5pJ062269@svn.freebsd.org> From: Robert Watson Date: Wed, 13 May 2009 17:17:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192048 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2009 17:17:06 -0000 Author: rwatson Date: Wed May 13 17:17:05 2009 New Revision: 192048 URL: http://svn.freebsd.org/changeset/base/192048 Log: Remove now-unused NETISR_USB. Modified: head/sys/net/netisr.h Modified: head/sys/net/netisr.h ============================================================================== --- head/sys/net/netisr.h Wed May 13 17:11:25 2009 (r192047) +++ head/sys/net/netisr.h Wed May 13 17:17:05 2009 (r192048) @@ -53,7 +53,6 @@ #define NETISR_ATALK1 17 /* Appletalk phase 1 */ #define NETISR_ARP 18 /* same as AF_LINK */ #define NETISR_IPX 23 /* same as AF_IPX */ -#define NETISR_USB 25 /* USB soft interrupt */ #define NETISR_PPP 26 /* PPP soft interrupt */ #define NETISR_IPV6 27 #define NETISR_NATM 28 From owner-svn-src-head@FreeBSD.ORG Wed May 13 17:22:33 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90FBA10656E1; Wed, 13 May 2009 17:22:33 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 61B7E8FC16; Wed, 13 May 2009 17:22:33 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4DHMXY1062424; Wed, 13 May 2009 17:22:33 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4DHMX3O062422; Wed, 13 May 2009 17:22:33 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200905131722.n4DHMX3O062422@svn.freebsd.org> From: Robert Watson Date: Wed, 13 May 2009 17:22:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192049 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2009 17:22:34 -0000 Author: rwatson Date: Wed May 13 17:22:33 2009 New Revision: 192049 URL: http://svn.freebsd.org/changeset/base/192049 Log: Garbage collect now-unused NETISR_FORCEQUEUE, which overrode the global direct dispatch policy for specific protocols (NETISR_USB). We leave the additional 'flags' argument to netisr_register() for the time being, even though it is no longer required. Modified: head/sys/net/netisr.c head/sys/net/netisr.h Modified: head/sys/net/netisr.c ============================================================================== --- head/sys/net/netisr.c Wed May 13 17:17:05 2009 (r192048) +++ head/sys/net/netisr.c Wed May 13 17:22:33 2009 (r192049) @@ -78,8 +78,7 @@ netisr_register(int num, netisr_t *handl KASSERT(!(num < 0 || num >= (sizeof(netisrs)/sizeof(*netisrs))), ("bad isr %d", num)); - KASSERT(flags == 0 || flags == NETISR_FORCEQUEUE, - ("netisr_register: bad flags 0x%x\n", flags)); + KASSERT(flags == 0, ("netisr_register: bad flags 0x%x\n", flags)); netisrs[num].ni_handler = handler; netisrs[num].ni_queue = inq; netisrs[num].ni_flags = flags; @@ -169,15 +168,11 @@ netisr_dispatch(int num, struct mbuf *m) } /* - * Unless NETISR_FORCEQUEUE is set on the netisr (generally - * indicating that the handler still requires Giant, which cannot be - * acquired in arbitrary order with respect to a caller), directly - * dispatch handling of this packet. Source ordering is maintained - * by virtue of callers consistently calling one of queued or direct - * dispatch, and the forcequeue flag being immutable after - * registration. + * Directly dispatch handling of this packet, if permitted by global + * policy. Source ordering is maintained by virtue of callers + * consistently calling one of queued or direct dispatch. */ - if (netisr_direct && !(ni->ni_flags & NETISR_FORCEQUEUE)) { + if (netisr_direct) { isrstat.isrs_directed++; ni->ni_handler(m); } else { Modified: head/sys/net/netisr.h ============================================================================== --- head/sys/net/netisr.h Wed May 13 17:17:05 2009 (r192048) +++ head/sys/net/netisr.h Wed May 13 17:22:33 2009 (r192049) @@ -83,7 +83,6 @@ typedef void netisr_t (struct mbuf *); void netisr_dispatch(int, struct mbuf *); int netisr_queue(int, struct mbuf *); -#define NETISR_FORCEQUEUE 0x0002 /* Force queued dispatch. */ void netisr_register(int, netisr_t *, struct ifqueue *, int); void netisr_unregister(int); From owner-svn-src-head@FreeBSD.ORG Wed May 13 17:25:40 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C8398106566C; Wed, 13 May 2009 17:25:40 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from pele.citylink.co.nz (pele.citylink.co.nz [202.8.44.226]) by mx1.freebsd.org (Postfix) with ESMTP id 87AD28FC17; Wed, 13 May 2009 17:25:40 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) by pele.citylink.co.nz (Postfix) with ESMTP id AE556FF47; Thu, 14 May 2009 05:25:39 +1200 (NZST) X-Virus-Scanned: Debian amavisd-new at citylink.co.nz Received: from pele.citylink.co.nz ([127.0.0.1]) by localhost (pele.citylink.co.nz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id x8T5Jv35q55l; Thu, 14 May 2009 05:25:35 +1200 (NZST) Received: from citylink.fud.org.nz (unknown [202.8.44.45]) by pele.citylink.co.nz (Postfix) with ESMTP; Thu, 14 May 2009 05:25:35 +1200 (NZST) Received: by citylink.fud.org.nz (Postfix, from userid 1001) id 18B9F11432; Thu, 14 May 2009 05:25:35 +1200 (NZST) Date: Wed, 13 May 2009 10:25:34 -0700 From: Andrew Thompson To: Dimitry Andric Message-ID: <20090513172534.GA2537@citylink.fud.org.nz> References: <200905120741.n4C7fK8o014803@svn.freebsd.org> <4A09B57C.6050709@andric.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4A09B57C.6050709@andric.com> User-Agent: Mutt/1.5.17 (2007-11-01) Cc: svn-src-head@freebsd.org, Qing Li , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r192011 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2009 17:25:41 -0000 On Tue, May 12, 2009 at 07:44:28PM +0200, Dimitry Andric wrote: > On 2009-05-12 09:41, Qing Li wrote: > > Author: qingli > > Date: Tue May 12 07:41:20 2009 > > New Revision: 192011 > > URL: http://svn.freebsd.org/changeset/base/192011 > > > > Log: > > This patch adds a host route to an interface address (that is assigned > > to a non loopback/ppp link types) through the loopback interface. Prior > > to the new L2/L3 rewrite, this host route is implicitly added by the L2 > > code during RTM_RESOLVE of that interface address. This host route is > > deleted when that interface is removed. > > This commit breaks dhclient startup, I now get: > > [...] > in_ifinit: insertion failed > ifconfig: ioctl (SIOCAIFADDR): File exists > em0: not found > exiting. > > So it seems to hit this part: > > + } else if (error != 0) > + log(LOG_INFO, "in_ifinit: insertion failed\n"); > > Reverting the commit makes dhclient work again. It also breaks PXE booting, can it be fixed or reverted? bootpc_init: wired to interface 'npe0' in_ifinit: insertion failed panic: bootpc_fakeup_interface: set if addr, error=17 Andrew From owner-svn-src-head@FreeBSD.ORG Wed May 13 17:53:04 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BFC6C10656A4; Wed, 13 May 2009 17:53:04 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AC4798FC0C; Wed, 13 May 2009 17:53:04 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4DHr4LR063076; Wed, 13 May 2009 17:53:04 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4DHr4YL063065; Wed, 13 May 2009 17:53:04 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200905131753.n4DHr4YL063065@svn.freebsd.org> From: John Baldwin Date: Wed, 13 May 2009 17:53:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192050 - in head/sys: amd64/amd64 amd64/include conf i386/i386 i386/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2009 17:53:05 -0000 Author: jhb Date: Wed May 13 17:53:04 2009 New Revision: 192050 URL: http://svn.freebsd.org/changeset/base/192050 Log: Implement simple machine check support for amd64 and i386. - For CPUs that only support MCE (the machine check exception) but not MCA (i.e. Pentium), all this does is print out the value of the machine check registers and then panic when a machine check exception occurs. - For CPUs that support MCA (the machine check architecture), the support is a bit more involved. - First, there is limited support for decoding the CPU-independent MCA error codes in the kernel, and the kernel uses this to output a short description of any machine check events that occur. - When a machine check exception occurs, all of the MCx banks on the current CPU are scanned and any events are reported to the console before panic'ing. - To catch events for correctable errors, a periodic timer kicks off a task which scans the MCx banks on all CPUs. The frequency of these checks is controlled via the "hw.mca.interval" sysctl. - Userland can request an immediate scan of the MCx banks by writing a non-zero value to "hw.mca.force_scan". - If any correctable events are encountered, the appropriate details are stored in a 'struct mca_record' (defined in ). The "hw.mca.count" is a count of such records and each record may be queried via the "hw.mca.records" tree by specifying the record index (0 .. count - 1) as the next name in the MIB similar to using PIDs with the kern.proc.* sysctls. The idea is to export machine check events to userland for more detailed processing. - The periodic timer and hw.mca sysctls are only present if the CPU supports MCA. Discussed with: emaste (briefly) MFC after: 1 month Added: head/sys/amd64/amd64/mca.c (contents, props changed) head/sys/amd64/include/mca.h (contents, props changed) head/sys/i386/i386/mca.c (contents, props changed) head/sys/i386/include/mca.h (contents, props changed) Modified: head/sys/amd64/amd64/machdep.c head/sys/amd64/amd64/mp_machdep.c head/sys/amd64/amd64/trap.c head/sys/amd64/include/specialreg.h head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/i386/i386/machdep.c head/sys/i386/i386/mp_machdep.c head/sys/i386/i386/trap.c head/sys/i386/include/specialreg.h Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Wed May 13 17:22:33 2009 (r192049) +++ head/sys/amd64/amd64/machdep.c Wed May 13 17:53:04 2009 (r192050) @@ -109,6 +109,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -274,6 +275,7 @@ cpu_startup(dummy) vm_pager_bufferinit(); cpu_setregs(); + mca_init(); } /* Added: head/sys/amd64/amd64/mca.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/amd64/amd64/mca.c Wed May 13 17:53:04 2009 (r192050) @@ -0,0 +1,530 @@ +/*- + * Copyright (c) 2009 Advanced Computing Technologies LLC + * Written by: John H. Baldwin + * 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. + */ + +/* + * Support for x86 machine check architecture. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct mca_internal { + struct mca_record rec; + int logged; + STAILQ_ENTRY(mca_internal) link; +}; + +static MALLOC_DEFINE(M_MCA, "MCA", "Machine Check Architecture"); + +static struct sysctl_oid *mca_sysctl_tree; + +static int mca_count; /* Number of records stored. */ + +static STAILQ_HEAD(, mca_internal) mca_records; +static struct callout mca_timer; +static int mca_ticks = 3600; /* Check hourly by default. */ +static struct task mca_task; +static struct mtx mca_lock; + +static int +sysctl_mca_ticks(SYSCTL_HANDLER_ARGS) +{ + int error, value; + + value = mca_ticks; + error = sysctl_handle_int(oidp, &value, 0, req); + if (error || req->newptr == NULL) + return (error); + if (value <= 0) + return (EINVAL); + mca_ticks = value; + return (0); +} + +static int +sysctl_mca_records(SYSCTL_HANDLER_ARGS) +{ + int *name = (int *)arg1; + u_int namelen = arg2; + struct mca_record record; + struct mca_internal *rec; + int i; + + if (namelen != 1) + return (EINVAL); + + if (name[0] < 0 || name[0] >= mca_count) + return (EINVAL); + + mtx_lock_spin(&mca_lock); + if (name[0] >= mca_count) { + mtx_unlock_spin(&mca_lock); + return (EINVAL); + } + i = 0; + STAILQ_FOREACH(rec, &mca_records, link) { + if (i == name[0]) { + record = rec->rec; + break; + } + i++; + } + mtx_unlock_spin(&mca_lock); + return (SYSCTL_OUT(req, &record, sizeof(record))); +} + +static struct mca_record * +mca_record_entry(int bank) +{ + struct mca_internal *rec; + uint64_t status; + u_int p[4]; + + status = rdmsr(MSR_MC_STATUS(bank)); + if (!(status & MC_STATUS_VAL)) + return (NULL); + + rec = malloc(sizeof(*rec), M_MCA, M_NOWAIT | M_ZERO); + if (rec == NULL) { + printf("MCA: Unable to allocate space for an event.\n"); + return (NULL); + } + + /* Save exception information. */ + rec->rec.mr_status = status; + if (status & MC_STATUS_ADDRV) + rec->rec.mr_addr = rdmsr(MSR_MC_ADDR(bank)); + if (status & MC_STATUS_MISCV) + rec->rec.mr_misc = rdmsr(MSR_MC_MISC(bank)); + rec->rec.mr_tsc = rdtsc(); + rec->rec.mr_apic_id = PCPU_GET(apic_id); + + /* + * Clear machine check. Don't do this for uncorrectable + * errors so that the BIOS can see them. + */ + if (!(rec->rec.mr_status & (MC_STATUS_PCC | MC_STATUS_UC))) { + wrmsr(MSR_MC_STATUS(bank), 0); + do_cpuid(0, p); + } + + mtx_lock_spin(&mca_lock); + STAILQ_INSERT_TAIL(&mca_records, rec, link); + mca_count++; + mtx_unlock_spin(&mca_lock); + return (&rec->rec); +} + +static const char * +mca_error_ttype(uint16_t mca_error) +{ + + switch ((mca_error & 0x000c) >> 2) { + case 0: + return ("I"); + case 1: + return ("D"); + case 2: + return ("G"); + } + return ("?"); +} + +static const char * +mca_error_level(uint16_t mca_error) +{ + + switch (mca_error & 0x0003) { + case 0: + return ("L0"); + case 1: + return ("L1"); + case 2: + return ("L2"); + case 3: + return ("LG"); + } + return ("L?"); +} + +static const char * +mca_error_request(uint16_t mca_error) +{ + + switch ((mca_error & 0x00f0) >> 4) { + case 0x0: + return ("ERR"); + case 0x1: + return ("RD"); + case 0x2: + return ("WR"); + case 0x3: + return ("DRD"); + case 0x4: + return ("DWR"); + case 0x5: + return ("IRD"); + case 0x6: + return ("PREFETCH"); + case 0x7: + return ("EVICT"); + case 0x8: + return ("SNOOP"); + } + return ("???"); +} + +/* Dump details about a single machine check. */ +static void +mca_log(struct mca_record *rec) +{ + uint16_t mca_error; + + printf("MCA: CPU %d ", rec->mr_apic_id); + if (rec->mr_status & MC_STATUS_UC) + printf("UNCOR "); + else + printf("COR "); + if (rec->mr_status & MC_STATUS_PCC) + printf("PCC "); + if (rec->mr_status & MC_STATUS_OVER) + printf("OVER "); + mca_error = rec->mr_status & MC_STATUS_MCA_ERROR; + switch (mca_error) { + /* Simple error codes. */ + case 0x0000: + printf("no error"); + break; + case 0x0001: + printf("unclassified error"); + break; + case 0x0002: + printf("ucode ROM parity error"); + break; + case 0x0003: + printf("external error"); + break; + case 0x0004: + printf("FRC error"); + break; + case 0x0400: + printf("internal timer error"); + break; + default: + if ((mca_error & 0xfc00) == 0x0400) { + printf("internal error %x", mca_error & 0x03ff); + break; + } + + /* Compound error codes. */ + + /* Memory hierarchy error. */ + if ((mca_error & 0xeffc) == 0x000c) { + printf("%s memory error", mca_error_level(mca_error)); + break; + } + + /* TLB error. */ + if ((mca_error & 0xeff0) == 0x0010) { + printf("%sTLB %s error", mca_error_ttype(mca_error), + mca_error_level(mca_error)); + break; + } + + /* Cache error. */ + if ((mca_error & 0xef00) == 0x0100) { + printf("%sCACHE %s %s error", + mca_error_ttype(mca_error), + mca_error_level(mca_error), + mca_error_request(mca_error)); + break; + } + + /* Bus and/or Interconnect error. */ + if ((mca_error & 0xe800) == 0x0800) { + printf("BUS%s ", mca_error_level(mca_error)); + switch ((mca_error & 0x0600) >> 9) { + case 0: + printf("Source"); + break; + case 1: + printf("Responder"); + break; + case 2: + printf("Observer"); + break; + default: + printf("???"); + break; + } + printf(" %s ", mca_error_request(mca_error)); + switch ((mca_error & 0x000c) >> 2) { + case 0: + printf("Memory"); + break; + case 2: + printf("I/O"); + break; + case 3: + printf("Other"); + break; + default: + printf("???"); + break; + } + if (mca_error & 0x0100) + printf(" timed out"); + break; + } + + printf("unknown error %x", mca_error); + break; + } + printf("\n"); + if (rec->mr_status & MC_STATUS_ADDRV) + printf("MCA: Address 0x%llx\n", (long long)rec->mr_addr); +} + +/* + * This scans all the machine check banks of the current CPU to see if + * there are any machine checks. Any non-recoverable errors are + * reported immediately via mca_log(). The current thread must be + * pinned when this is called. The 'mcip' parameter indicates if we + * are being called from the MC exception handler. In that case this + * function returns true if the system is restartable. Otherwise, it + * returns a count of the number of valid MC records found. + */ +static int +mca_scan(int mcip) +{ + struct mca_record *rec; + uint64_t mcg_cap, ucmask; + int count, i, recoverable; + + count = 0; + recoverable = 1; + ucmask = MC_STATUS_UC | MC_STATUS_PCC; + + /* When handling a MCE#, treat the OVER flag as non-restartable. */ + if (mcip) + ucmask = MC_STATUS_OVER; + mcg_cap = rdmsr(MSR_MCG_CAP); + for (i = 0; i < (mcg_cap & MCG_CAP_COUNT); i++) { + rec = mca_record_entry(i); + if (rec != NULL) { + count++; + if (rec->mr_status & ucmask) { + recoverable = 0; + mca_log(rec); + } + } + } + return (mcip ? recoverable : count); +} + +/* + * Scan the machine check banks on all CPUs by binding to each CPU in + * turn. If any of the CPUs contained new machine check records, log + * them to the console. + */ +static void +mca_scan_cpus(void *context, int pending) +{ + struct mca_internal *mca; + struct thread *td; + int count, cpu; + + td = curthread; + count = 0; + thread_lock(td); + for (cpu = 0; cpu <= mp_maxid; cpu++) { + if (CPU_ABSENT(cpu)) + continue; + sched_bind(td, cpu); + thread_unlock(td); + count += mca_scan(0); + thread_lock(td); + sched_unbind(td); + } + thread_unlock(td); + if (count != 0) { + mtx_lock_spin(&mca_lock); + STAILQ_FOREACH(mca, &mca_records, link) { + if (!mca->logged) { + mca->logged = 1; + mtx_unlock_spin(&mca_lock); + mca_log(&mca->rec); + mtx_lock_spin(&mca_lock); + } + } + mtx_unlock_spin(&mca_lock); + } +} + +static void +mca_periodic_scan(void *arg) +{ + + taskqueue_enqueue(taskqueue_thread, &mca_task); + callout_reset(&mca_timer, mca_ticks * hz, mca_periodic_scan, NULL); +} + +static int +sysctl_mca_scan(SYSCTL_HANDLER_ARGS) +{ + int error, i; + + i = 0; + error = sysctl_handle_int(oidp, &i, 0, req); + if (error) + return (error); + if (i) + taskqueue_enqueue(taskqueue_thread, &mca_task); + return (0); +} + +static void +mca_startup(void *dummy) +{ + + if (!(cpu_feature & CPUID_MCA)) + return; + + callout_reset(&mca_timer, mca_ticks * hz, mca_periodic_scan, + NULL); +} +SYSINIT(mca_startup, SI_SUB_SMP, SI_ORDER_ANY, mca_startup, NULL); + +static void +mca_setup(void) +{ + + mtx_init(&mca_lock, "mca", NULL, MTX_SPIN); + STAILQ_INIT(&mca_records); + TASK_INIT(&mca_task, 0x8000, mca_scan_cpus, NULL); + callout_init(&mca_timer, CALLOUT_MPSAFE); + mca_sysctl_tree = SYSCTL_ADD_NODE(NULL, SYSCTL_STATIC_CHILDREN(_hw), + OID_AUTO, "mca", CTLFLAG_RW, NULL, "MCA container"); + SYSCTL_ADD_INT(NULL, SYSCTL_CHILDREN(mca_sysctl_tree), OID_AUTO, + "count", CTLFLAG_RD, &mca_count, 0, "Record count"); + SYSCTL_ADD_PROC(NULL, SYSCTL_CHILDREN(mca_sysctl_tree), OID_AUTO, + "interval", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, &mca_ticks, + 0, sysctl_mca_ticks, "I", + "Periodic interval in seconds to scan for machine checks"); + SYSCTL_ADD_NODE(NULL, SYSCTL_CHILDREN(mca_sysctl_tree), OID_AUTO, + "records", CTLFLAG_RD, sysctl_mca_records, "Machine check records"); + SYSCTL_ADD_PROC(NULL, SYSCTL_CHILDREN(mca_sysctl_tree), OID_AUTO, + "force_scan", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, 0, + sysctl_mca_scan, "I", "Force an immediate scan for machine checks"); +} + +/* Must be executed on each CPU. */ +void +mca_init(void) +{ + uint64_t mcg_cap; + int i; + + /* MCE is required. */ + if (!(cpu_feature & CPUID_MCE)) + return; + + if (cpu_feature & CPUID_MCA) { + if (PCPU_GET(cpuid) == 0) + mca_setup(); + + sched_pin(); + mcg_cap = rdmsr(MSR_MCG_CAP); + if (mcg_cap & MCG_CAP_CTL_P) + /* Enable MCA features. */ + wrmsr(MSR_MCG_CTL, MCG_CTL_ENABLE); + + for (i = 0; i < (mcg_cap & MCG_CAP_COUNT); i++) { + /* + * Enable logging of all errors. For P6 + * processors, MC0_CTL is always enabled. + * + * XXX: Better CPU test needed here? + */ + if (!(i == 0 && (cpu_id & 0xf00) == 0x600)) + wrmsr(MSR_MC_CTL(i), 0xffffffffffffffffUL); + + /* XXX: Better CPU test needed here. */ + if ((cpu_id & 0xf00) == 0xf00) + mca_record_entry(i); + + /* Clear all errors. */ + wrmsr(MSR_MC_STATUS(i), 0); + } + sched_unpin(); + } + + load_cr4(rcr4() | CR4_MCE); +} + +/* Called when a machine check exception fires. */ +int +mca_intr(void) +{ + uint64_t mcg_status; + int recoverable; + + if (!(cpu_feature & CPUID_MCA)) { + /* + * Just print the values of the old Pentium registers + * and panic. + */ + printf("MC Type: 0x%lx Address: 0x%lx\n", + rdmsr(MSR_P5_MC_TYPE), rdmsr(MSR_P5_MC_ADDR)); + return (0); + } + + /* Scan the banks and check for any non-recoverable errors. */ + recoverable = mca_scan(1); + mcg_status = rdmsr(MSR_MCG_STATUS); + if (!(mcg_status & MCG_STATUS_RIPV)) + recoverable = 0; + + /* Clear MCIP. */ + wrmsr(MSR_MCG_STATUS, mcg_status & ~MCG_STATUS_MCIP); + return (recoverable); +} Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Wed May 13 17:22:33 2009 (r192049) +++ head/sys/amd64/amd64/mp_machdep.c Wed May 13 17:53:04 2009 (r192050) @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -667,6 +668,8 @@ init_secondary(void) KASSERT(PCPU_GET(idlethread) != NULL, ("no idle thread")); PCPU_SET(curthread, PCPU_GET(idlethread)); + mca_init(); + mtx_lock_spin(&ap_boot_mtx); /* Init local apic for irq's */ Modified: head/sys/amd64/amd64/trap.c ============================================================================== --- head/sys/amd64/amd64/trap.c Wed May 13 17:22:33 2009 (r192049) +++ head/sys/amd64/amd64/trap.c Wed May 13 17:53:04 2009 (r192050) @@ -88,6 +88,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #ifdef SMP @@ -266,6 +267,12 @@ trap(struct trapframe *frame) goto out; #endif + if (type == T_MCHK) { + if (!mca_intr()) + trap_fatal(frame, 0); + goto out; + } + #ifdef KDTRACE_HOOKS /* * A trap can occur while DTrace executes a probe. Before Added: head/sys/amd64/include/mca.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/amd64/include/mca.h Wed May 13 17:53:04 2009 (r192050) @@ -0,0 +1,48 @@ +/*- + * Copyright (c) 2009 Advanced Computing Technologies LLC + * Written by: John H. Baldwin + * 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$ + */ + +#ifndef __MACHINE_MCA_H__ +#define __MACHINE_MCA_H__ + +struct mca_record { + uint64_t mr_status; + uint64_t mr_addr; + uint64_t mr_misc; + uint64_t mr_tsc; + int mr_apic_id; +}; + +#ifdef _KERNEL + +void mca_init(void); +int mca_intr(void); + +#endif + +#endif /* !__MACHINE_MCA_H__ */ Modified: head/sys/amd64/include/specialreg.h ============================================================================== --- head/sys/amd64/include/specialreg.h Wed May 13 17:22:33 2009 (r192049) +++ head/sys/amd64/include/specialreg.h Wed May 13 17:53:04 2009 (r192050) @@ -346,6 +346,34 @@ #define DIR1 0xff /* + * Machine Check register constants. + */ +#define MCG_CAP_COUNT 0x000000ff +#define MCG_CAP_CTL_P 0x00000100 +#define MCG_CAP_EXT_P 0x00000200 +#define MCG_CAP_TES_P 0x00000800 +#define MCG_CAP_EXT_CNT 0x00ff0000 +#define MCG_STATUS_RIPV 0x00000001 +#define MCG_STATUS_EIPV 0x00000002 +#define MCG_STATUS_MCIP 0x00000004 +#define MCG_CTL_ENABLE 0xffffffffffffffffUL +#define MCG_CTL_DISABLE 0x0000000000000000UL +#define MSR_MC_CTL(x) (MSR_MC0_CTL + (x) * 4) +#define MSR_MC_STATUS(x) (MSR_MC0_STATUS + (x) * 4) +#define MSR_MC_ADDR(x) (MSR_MC0_ADDR + (x) * 4) +#define MSR_MC_MISC(x) (MSR_MC0_MISC + (x) * 4) +#define MC_STATUS_MCA_ERROR 0x000000000000ffffUL +#define MC_STATUS_MODEL_ERROR 0x00000000ffff0000UL +#define MC_STATUS_OTHER_INFO 0x01ffffff00000000UL +#define MC_STATUS_PCC 0x0200000000000000UL +#define MC_STATUS_ADDRV 0x0400000000000000UL +#define MC_STATUS_MISCV 0x0800000000000000UL +#define MC_STATUS_EN 0x1000000000000000UL +#define MC_STATUS_UC 0x2000000000000000UL +#define MC_STATUS_OVER 0x4000000000000000UL +#define MC_STATUS_VAL 0x8000000000000000UL + +/* * The following four 3-byte registers control the non-cacheable regions. * These registers must be written as three separate bytes. * Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Wed May 13 17:22:33 2009 (r192049) +++ head/sys/conf/files.amd64 Wed May 13 17:53:04 2009 (r192050) @@ -110,6 +110,7 @@ amd64/amd64/legacy.c standard amd64/amd64/local_apic.c standard amd64/amd64/locore.S standard no-obj amd64/amd64/machdep.c standard +amd64/amd64/mca.c standard amd64/amd64/mem.c optional mem amd64/amd64/minidump_machdep.c standard amd64/amd64/mp_machdep.c optional smp Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Wed May 13 17:22:33 2009 (r192049) +++ head/sys/conf/files.i386 Wed May 13 17:53:04 2009 (r192050) @@ -278,6 +278,7 @@ i386/xen/locore.s optional xen no-obj i386/i386/longrun.c optional cpu_enable_longrun i386/i386/machdep.c standard i386/xen/xen_machdep.c optional xen +i386/i386/mca.c standard i386/i386/mem.c optional mem i386/i386/minidump_machdep.c standard i386/i386/mp_clock.c optional smp Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Wed May 13 17:22:33 2009 (r192049) +++ head/sys/i386/i386/machdep.c Wed May 13 17:53:04 2009 (r192050) @@ -113,6 +113,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -320,6 +321,7 @@ cpu_startup(dummy) #ifndef XEN cpu_setregs(); #endif + mca_init(); } /* Added: head/sys/i386/i386/mca.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/i386/i386/mca.c Wed May 13 17:53:04 2009 (r192050) @@ -0,0 +1,530 @@ +/*- + * Copyright (c) 2009 Advanced Computing Technologies LLC + * Written by: John H. Baldwin + * 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. + */ + +/* + * Support for x86 machine check architecture. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct mca_internal { + struct mca_record rec; + int logged; + STAILQ_ENTRY(mca_internal) link; +}; + +static MALLOC_DEFINE(M_MCA, "MCA", "Machine Check Architecture"); + +static struct sysctl_oid *mca_sysctl_tree; + +static int mca_count; /* Number of records stored. */ + +static STAILQ_HEAD(, mca_internal) mca_records; +static struct callout mca_timer; +static int mca_ticks = 3600; /* Check hourly by default. */ +static struct task mca_task; +static struct mtx mca_lock; + +static int +sysctl_mca_ticks(SYSCTL_HANDLER_ARGS) +{ + int error, value; + + value = mca_ticks; + error = sysctl_handle_int(oidp, &value, 0, req); + if (error || req->newptr == NULL) + return (error); + if (value <= 0) + return (EINVAL); + mca_ticks = value; + return (0); +} + +static int +sysctl_mca_records(SYSCTL_HANDLER_ARGS) +{ + int *name = (int *)arg1; + u_int namelen = arg2; + struct mca_record record; + struct mca_internal *rec; + int i; + + if (namelen != 1) + return (EINVAL); + + if (name[0] < 0 || name[0] >= mca_count) + return (EINVAL); + + mtx_lock_spin(&mca_lock); + if (name[0] >= mca_count) { + mtx_unlock_spin(&mca_lock); + return (EINVAL); + } + i = 0; + STAILQ_FOREACH(rec, &mca_records, link) { + if (i == name[0]) { + record = rec->rec; + break; + } + i++; + } + mtx_unlock_spin(&mca_lock); + return (SYSCTL_OUT(req, &record, sizeof(record))); +} + +static struct mca_record * +mca_record_entry(int bank) +{ + struct mca_internal *rec; + uint64_t status; + u_int p[4]; + + status = rdmsr(MSR_MC_STATUS(bank)); + if (!(status & MC_STATUS_VAL)) + return (NULL); + + rec = malloc(sizeof(*rec), M_MCA, M_NOWAIT | M_ZERO); + if (rec == NULL) { + printf("MCA: Unable to allocate space for an event.\n"); + return (NULL); + } + + /* Save exception information. */ + rec->rec.mr_status = status; + if (status & MC_STATUS_ADDRV) + rec->rec.mr_addr = rdmsr(MSR_MC_ADDR(bank)); + if (status & MC_STATUS_MISCV) + rec->rec.mr_misc = rdmsr(MSR_MC_MISC(bank)); + rec->rec.mr_tsc = rdtsc(); + rec->rec.mr_apic_id = PCPU_GET(apic_id); + + /* + * Clear machine check. Don't do this for uncorrectable + * errors so that the BIOS can see them. + */ + if (!(rec->rec.mr_status & (MC_STATUS_PCC | MC_STATUS_UC))) { + wrmsr(MSR_MC_STATUS(bank), 0); + do_cpuid(0, p); + } + + mtx_lock_spin(&mca_lock); + STAILQ_INSERT_TAIL(&mca_records, rec, link); + mca_count++; + mtx_unlock_spin(&mca_lock); + return (&rec->rec); +} + +static const char * +mca_error_ttype(uint16_t mca_error) +{ + + switch ((mca_error & 0x000c) >> 2) { + case 0: + return ("I"); + case 1: + return ("D"); + case 2: + return ("G"); + } + return ("?"); +} + +static const char * +mca_error_level(uint16_t mca_error) +{ + + switch (mca_error & 0x0003) { + case 0: + return ("L0"); + case 1: + return ("L1"); + case 2: + return ("L2"); + case 3: + return ("LG"); + } + return ("L?"); +} + +static const char * +mca_error_request(uint16_t mca_error) +{ + + switch ((mca_error & 0x00f0) >> 4) { + case 0x0: + return ("ERR"); + case 0x1: + return ("RD"); + case 0x2: + return ("WR"); + case 0x3: + return ("DRD"); + case 0x4: + return ("DWR"); + case 0x5: + return ("IRD"); + case 0x6: + return ("PREFETCH"); + case 0x7: + return ("EVICT"); + case 0x8: + return ("SNOOP"); + } + return ("???"); +} + +/* Dump details about a single machine check. */ +static void +mca_log(struct mca_record *rec) +{ + uint16_t mca_error; + + printf("MCA: CPU %d ", rec->mr_apic_id); + if (rec->mr_status & MC_STATUS_UC) + printf("UNCOR "); + else + printf("COR "); + if (rec->mr_status & MC_STATUS_PCC) + printf("PCC "); + if (rec->mr_status & MC_STATUS_OVER) + printf("OVER "); + mca_error = rec->mr_status & MC_STATUS_MCA_ERROR; + switch (mca_error) { + /* Simple error codes. */ + case 0x0000: + printf("no error"); + break; + case 0x0001: + printf("unclassified error"); + break; + case 0x0002: + printf("ucode ROM parity error"); + break; + case 0x0003: + printf("external error"); + break; + case 0x0004: + printf("FRC error"); + break; + case 0x0400: + printf("internal timer error"); + break; + default: + if ((mca_error & 0xfc00) == 0x0400) { + printf("internal error %x", mca_error & 0x03ff); + break; + } + + /* Compound error codes. */ + + /* Memory hierarchy error. */ + if ((mca_error & 0xeffc) == 0x000c) { + printf("%s memory error", mca_error_level(mca_error)); + break; + } + + /* TLB error. */ + if ((mca_error & 0xeff0) == 0x0010) { + printf("%sTLB %s error", mca_error_ttype(mca_error), + mca_error_level(mca_error)); + break; + } + + /* Cache error. */ + if ((mca_error & 0xef00) == 0x0100) { + printf("%sCACHE %s %s error", + mca_error_ttype(mca_error), + mca_error_level(mca_error), + mca_error_request(mca_error)); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed May 13 17:58:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 20EC81065674; Wed, 13 May 2009 17:58:38 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0FF388FC16; Wed, 13 May 2009 17:58:38 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4DHwbDJ063226; Wed, 13 May 2009 17:58:37 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4DHwbsF063225; Wed, 13 May 2009 17:58:37 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200905131758.n4DHwbsF063225@svn.freebsd.org> From: Andrew Thompson Date: Wed, 13 May 2009 17:58:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192051 - head/sys/dev/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2009 17:58:38 -0000 Author: thompsa Date: Wed May 13 17:58:37 2009 New Revision: 192051 URL: http://svn.freebsd.org/changeset/base/192051 Log: The transfer must return USB_ERR_CANCELLED when the device is gone due to the way usb drivers work. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/usb_transfer.c Modified: head/sys/dev/usb/usb_transfer.c ============================================================================== --- head/sys/dev/usb/usb_transfer.c Wed May 13 17:53:04 2009 (r192050) +++ head/sys/dev/usb/usb_transfer.c Wed May 13 17:58:37 2009 (r192051) @@ -1439,7 +1439,11 @@ usb2_start_hardware(struct usb2_xfer *xf /* Check if the device is still alive */ if (info->udev->state < USB_STATE_POWERED) { USB_BUS_LOCK(bus); - usb2_transfer_done(xfer, USB_ERR_NOT_CONFIGURED); + /* + * Must return cancelled error code else + * device drivers can hang. + */ + usb2_transfer_done(xfer, USB_ERR_CANCELLED); USB_BUS_UNLOCK(bus); return; } From owner-svn-src-head@FreeBSD.ORG Wed May 13 18:03:23 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 665511065675; Wed, 13 May 2009 18:03:23 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 547EC8FC1A; Wed, 13 May 2009 18:03:23 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4DI3NKv063385; Wed, 13 May 2009 18:03:23 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4DI3Nj7063383; Wed, 13 May 2009 18:03:23 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200905131803.n4DI3Nj7063383@svn.freebsd.org> From: Andrew Thompson Date: Wed, 13 May 2009 18:03:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192052 - in head/sys/dev/usb: . storage X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2009 18:03:23 -0000 Author: thompsa Date: Wed May 13 18:03:23 2009 New Revision: 192052 URL: http://svn.freebsd.org/changeset/base/192052 Log: Sync to P4 Add umass quirks for Alcor AU6390, Cypress PATA 6830XX and MPMan MPF400. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/storage/umass.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/storage/umass.c ============================================================================== --- head/sys/dev/usb/storage/umass.c Wed May 13 17:58:37 2009 (r192051) +++ head/sys/dev/usb/storage/umass.c Wed May 13 18:03:23 2009 (r192052) @@ -309,6 +309,7 @@ struct umass_devdescr { /* wire and command protocol */ uint16_t proto; +#define UMASS_PROTO_DEFAULT 0x0000 /* use protocol indicated by USB descriptors */ #define UMASS_PROTO_BBB 0x0001 /* USB wire protocol */ #define UMASS_PROTO_CBI 0x0002 #define UMASS_PROTO_CBI_I 0x0004 @@ -372,7 +373,7 @@ struct umass_devdescr { static const struct umass_devdescr umass_devdescr[] = { {USB_VENDOR_ASAHIOPTICAL, PID_WILDCARD, RID_WILDCARD, - UMASS_PROTO_ATAPI | UMASS_PROTO_CBI_I, + UMASS_PROTO_DEFAULT, RS_NO_CLEAR_UA }, {USB_VENDOR_ADDON, USB_PRODUCT_ADDON_ATTACHE, RID_WILDCARD, @@ -395,6 +396,10 @@ static const struct umass_devdescr umass UMASS_PROTO_SCSI | UMASS_PROTO_BBB, NO_QUIRKS }, + {USB_VENDOR_ALCOR, USB_PRODUCT_ALCOR_AU6390, RID_WILDCARD, + UMASS_PROTO_DEFAULT, + NO_SYNCHRONIZE_CACHE + }, {USB_VENDOR_ALCOR, USB_PRODUCT_ALCOR_UMCR_9361, RID_WILDCARD, UMASS_PROTO_SCSI | UMASS_PROTO_BBB, NO_GETMAXLUN @@ -427,6 +432,10 @@ static const struct umass_devdescr umass UMASS_PROTO_SCSI | UMASS_PROTO_BBB, FORCE_SHORT_INQUIRY | NO_START_STOP | IGNORE_RESIDUE }, + {USB_VENDOR_CYPRESS, USB_PRODUCT_CYPRESS_XX6830XX, RID_WILDCARD, + UMASS_PROTO_DEFAULT, + NO_GETMAXLUN | NO_SYNCHRONIZE_CACHE + }, {USB_VENDOR_DESKNOTE, USB_PRODUCT_DESKNOTE_UCR_61S2B, RID_WILDCARD, UMASS_PROTO_SCSI | UMASS_PROTO_BBB, NO_QUIRKS @@ -600,6 +609,10 @@ static const struct umass_devdescr umass UMASS_PROTO_SCSI | UMASS_PROTO_BBB, FORCE_SHORT_INQUIRY | NO_INQUIRY_EVPD | NO_GETMAXLUN }, + {USB_VENDOR_MPMAN, PID_WILDCARD, RID_WILDCARD, + UMASS_PROTO_DEFAULT, + NO_SYNCHRONIZE_CACHE + }, {USB_VENDOR_MSYSTEMS, USB_PRODUCT_MSYSTEMS_DISKONKEY, RID_WILDCARD, UMASS_PROTO_SCSI | UMASS_PROTO_BBB, IGNORE_RESIDUE | NO_GETMAXLUN | RS_NO_CLEAR_UA @@ -609,11 +622,11 @@ static const struct umass_devdescr umass NO_QUIRKS }, {USB_VENDOR_MYSON, USB_PRODUCT_MYSON_HEDEN, RID_WILDCARD, - UMASS_PROTO_SCSI | UMASS_PROTO_BBB, + UMASS_PROTO_DEFAULT, IGNORE_RESIDUE | NO_SYNCHRONIZE_CACHE }, {USB_VENDOR_MYSON, USB_PRODUCT_MYSON_STARREADER, RID_WILDCARD, - UMASS_PROTO_SCSI | UMASS_PROTO_BBB, + UMASS_PROTO_DEFAULT, NO_SYNCHRONIZE_CACHE }, {USB_VENDOR_NEODIO, USB_PRODUCT_NEODIO_ND3260, RID_WILDCARD, @@ -849,7 +862,7 @@ static const struct umass_devdescr umass NO_QUIRKS }, {USB_VENDOR_SUPERTOP, USB_PRODUCT_SUPERTOP_IDE, RID_WILDCARD, - UMASS_PROTO_SCSI | UMASS_PROTO_BBB, + UMASS_PROTO_DEFAULT, IGNORE_RESIDUE | NO_SYNCHRONIZE_CACHE }, {USB_VENDOR_TAUGA, USB_PRODUCT_TAUGA_CAMERAMATE, RID_WILDCARD, @@ -1281,6 +1294,58 @@ MODULE_DEPEND(umass, cam, 1, 1, 1); * USB device probe/attach/detach */ +static uint16_t +umass_get_proto(struct usb2_interface *iface) +{ + struct usb2_interface_descriptor *id; + uint16_t retval; + + retval = 0; + + /* Check for a standards compliant device */ + id = usb2_get_interface_descriptor(iface); + if ((id == NULL) || + (id->bInterfaceClass != UICLASS_MASS)) { + goto done; + } + switch (id->bInterfaceSubClass) { + case UISUBCLASS_SCSI: + retval |= UMASS_PROTO_SCSI; + break; + case UISUBCLASS_UFI: + retval |= UMASS_PROTO_UFI; + break; + case UISUBCLASS_RBC: + retval |= UMASS_PROTO_RBC; + break; + case UISUBCLASS_SFF8020I: + case UISUBCLASS_SFF8070I: + retval |= UMASS_PROTO_ATAPI; + break; + default: + retval = 0; + goto done; + } + + switch (id->bInterfaceProtocol) { + case UIPROTO_MASS_CBI: + retval |= UMASS_PROTO_CBI; + break; + case UIPROTO_MASS_CBI_I: + retval |= UMASS_PROTO_CBI_I; + break; + case UIPROTO_MASS_BBB_OLD: + case UIPROTO_MASS_BBB: + retval |= UMASS_PROTO_BBB; + break; + default: + retval = 0; + goto done; + } +done: + return (retval); +} + /* * Match the device we are seeing with the * devices supported. @@ -1289,10 +1354,9 @@ static struct umass_probe_proto umass_probe_proto(device_t dev, struct usb2_attach_arg *uaa) { const struct umass_devdescr *udd = umass_devdescr; - struct usb2_interface_descriptor *id; struct umass_probe_proto ret; - bzero(&ret, sizeof(ret)); + memset(&ret, 0, sizeof(ret)); /* * An entry specifically for Y-E Data devices as they don't fit in @@ -1319,7 +1383,6 @@ umass_probe_proto(device_t dev, struct u ret.quirks |= NO_TEST_UNIT_READY; } ret.quirks |= RS_NO_CLEAR_UA | FLOPPY_SPEED; - ret.error = 0; goto done; } /* @@ -1327,13 +1390,6 @@ umass_probe_proto(device_t dev, struct u * check for wildcarded and fully matched. First match wins. */ for (; udd->vid != VID_EOT; udd++) { - if ((udd->vid == VID_WILDCARD) && - (udd->pid == PID_WILDCARD) && - (udd->rid == RID_WILDCARD)) { - device_printf(dev, "ignoring invalid " - "wildcard quirk\n"); - continue; - } if (((udd->vid == uaa->info.idVendor) || (udd->vid == VID_WILDCARD)) && ((udd->pid == uaa->info.idProduct) || @@ -1341,64 +1397,27 @@ umass_probe_proto(device_t dev, struct u if (udd->rid == RID_WILDCARD) { ret.proto = udd->proto; ret.quirks = udd->quirks; - ret.error = 0; - goto done; + if (ret.proto == UMASS_PROTO_DEFAULT) + goto default_proto; + else + goto done; } else if (udd->rid == uaa->info.bcdDevice) { ret.proto = udd->proto; ret.quirks = udd->quirks; - ret.error = 0; - goto done; + if (ret.proto == UMASS_PROTO_DEFAULT) + goto default_proto; + else + goto done; } /* else RID does not match */ } } - /* Check for a standards compliant device */ - id = usb2_get_interface_descriptor(uaa->iface); - if ((id == NULL) || - (id->bInterfaceClass != UICLASS_MASS)) { - ret.error = ENXIO; - goto done; - } - switch (id->bInterfaceSubClass) { - case UISUBCLASS_SCSI: - ret.proto |= UMASS_PROTO_SCSI; - break; - case UISUBCLASS_UFI: - ret.proto |= UMASS_PROTO_UFI; - break; - case UISUBCLASS_RBC: - ret.proto |= UMASS_PROTO_RBC; - break; - case UISUBCLASS_SFF8020I: - case UISUBCLASS_SFF8070I: - ret.proto |= UMASS_PROTO_ATAPI; - break; - default: - device_printf(dev, "unsupported command " - "protocol %d\n", id->bInterfaceSubClass); - ret.error = ENXIO; - goto done; - } - - switch (id->bInterfaceProtocol) { - case UIPROTO_MASS_CBI: - ret.proto |= UMASS_PROTO_CBI; - break; - case UIPROTO_MASS_CBI_I: - ret.proto |= UMASS_PROTO_CBI_I; - break; - case UIPROTO_MASS_BBB_OLD: - case UIPROTO_MASS_BBB: - ret.proto |= UMASS_PROTO_BBB; - break; - default: - device_printf(dev, "unsupported wire " - "protocol %d\n", id->bInterfaceProtocol); +default_proto: + ret.proto = umass_get_proto(uaa->iface); + if (ret.proto == 0) ret.error = ENXIO; - goto done; - } - - ret.error = 0; + else + ret.error = 0; done: return (ret); } Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Wed May 13 17:58:37 2009 (r192051) +++ head/sys/dev/usb/usbdevs Wed May 13 18:03:23 2009 (r192052) @@ -624,6 +624,7 @@ vendor QCOM 0x18e8 Qcom vendor LINKSYS3 0x1915 Linksys vendor QUALCOMMINC 0x19d2 Qualcomm, Incorporated vendor STELERA 0x1a8d Stelera Wireless +vendor MPMAN 0x1cae MpMan vendor DRESDENELEKTRONIK 0x1cf1 dresden elektronik vendor DLINK 0x2001 D-Link vendor PLANEX2 0x2019 Planex Communications @@ -817,6 +818,7 @@ product ALCOR AU9814 0x9215 AU9814 Hub product ALCOR UMCR_9361 0x9361 USB Multimedia Card Reader product ALCOR SM_KBD 0x9410 MicroConnectors/StrongMan Keyboard product ALCOR NEC_KBD_HUB 0x9472 NEC Kbd Hub +product ALCOR AU6390 0x6390 AU6390 USB-IDE converter /* Altec Lansing products */ product ALTEC ADA70 0x0070 ADA70 Speakers @@ -1107,6 +1109,7 @@ product CYPRESS KBDHUB 0x0101 Keyboard/ product CYPRESS FMRADIO 0x1002 FM Radio product CYPRESS USBRS232 0x5500 USB-RS232 Interface product CYPRESS SLIM_HUB 0x6560 Slim Hub +product CYPRESS XX6830XX 0x6830 PATA Storage Device /* Daisy Technology products */ product DAISY DMC 0x6901 USB MultiMedia Reader @@ -2297,6 +2300,10 @@ product SPHAIRON UB801R 0x0110 UB801R product STELERA ZEROCD 0x1000 Zerocd Installer product STELERA C105 0x1002 Stelera/Bandrish C105 USB +/* MpMan products */ +product MPMAN MPF400_1 0x36d0 MPF400 Music Player 1Go +product MPMAN MPF400_2 0x25a8 MPF400 Music Player 2Go + /* STMicroelectronics products */ product STMICRO BIOCPU 0x2016 Biometric Coprocessor product STMICRO COMMUNICATOR 0x7554 USB Communicator From owner-svn-src-head@FreeBSD.ORG Wed May 13 18:04:52 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1BAFB106564A; Wed, 13 May 2009 18:04:52 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0AD6F8FC19; Wed, 13 May 2009 18:04:52 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4DI4pWW063452; Wed, 13 May 2009 18:04:51 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4DI4pQQ063451; Wed, 13 May 2009 18:04:51 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200905131804.n4DI4pQQ063451@svn.freebsd.org> From: Andrew Thompson Date: Wed, 13 May 2009 18:04:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192053 - head/sys/dev/usb/controller X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2009 18:04:52 -0000 Author: thompsa Date: Wed May 13 18:04:51 2009 New Revision: 192053 URL: http://svn.freebsd.org/changeset/base/192053 Log: Add debug lines for fullspeed and highspeed xfer completion. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/controller/ehci.c Modified: head/sys/dev/usb/controller/ehci.c ============================================================================== --- head/sys/dev/usb/controller/ehci.c Wed May 13 18:03:23 2009 (r192052) +++ head/sys/dev/usb/controller/ehci.c Wed May 13 18:04:51 2009 (r192053) @@ -2028,6 +2028,8 @@ ehci_isoc_fs_done(ehci_softc_t *sc, stru len = EHCI_SITD_GET_LEN(status); + DPRINTFN(2, "status=0x%08x, rem=%u\n", status, len); + if (*plen >= len) { len = *plen - len; } else { @@ -2081,6 +2083,8 @@ ehci_isoc_hs_done(ehci_softc_t *sc, stru len = EHCI_ITD_GET_LEN(status); + DPRINTFN(2, "status=0x%08x, len=%u\n", status, len); + if (*plen >= len) { /* * The length is valid. NOTE: The complete From owner-svn-src-head@FreeBSD.ORG Wed May 13 18:05:41 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0168A1065687; Wed, 13 May 2009 18:05:41 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E46628FC22; Wed, 13 May 2009 18:05:40 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4DI5eLL063515; Wed, 13 May 2009 18:05:40 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4DI5e3B063514; Wed, 13 May 2009 18:05:40 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200905131805.n4DI5e3B063514@svn.freebsd.org> From: Andrew Thompson Date: Wed, 13 May 2009 18:05:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192054 - head/sys/dev/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2009 18:05:41 -0000 Author: thompsa Date: Wed May 13 18:05:40 2009 New Revision: 192054 URL: http://svn.freebsd.org/changeset/base/192054 Log: Check the correct variable for IO_NDELAY. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/usb_dev.c Modified: head/sys/dev/usb/usb_dev.c ============================================================================== --- head/sys/dev/usb/usb_dev.c Wed May 13 18:04:51 2009 (r192053) +++ head/sys/dev/usb/usb_dev.c Wed May 13 18:05:40 2009 (r192054) @@ -1203,7 +1203,7 @@ usb2_read(struct cdev *dev, struct uio * (f->methods->f_start_read) (f); - if (fflags & IO_NDELAY) { + if (ioflag & IO_NDELAY) { if (tr_data) { /* return length before error */ break; @@ -1326,7 +1326,7 @@ usb2_write(struct cdev *dev, struct uio if (m == NULL) { - if (fflags & IO_NDELAY) { + if (ioflag & IO_NDELAY) { if (tr_data) { /* return length before error */ break; From owner-svn-src-head@FreeBSD.ORG Wed May 13 18:06:53 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4BCE2106568B; Wed, 13 May 2009 18:06:53 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3AD4D8FC16; Wed, 13 May 2009 18:06:53 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4DI6rnj063575; Wed, 13 May 2009 18:06:53 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4DI6rDs063574; Wed, 13 May 2009 18:06:53 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200905131806.n4DI6rDs063574@svn.freebsd.org> From: Andrew Thompson Date: Wed, 13 May 2009 18:06:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192055 - head/sys/dev/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2009 18:06:53 -0000 Author: thompsa Date: Wed May 13 18:06:52 2009 New Revision: 192055 URL: http://svn.freebsd.org/changeset/base/192055 Log: Make sure collections have the usage field set. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/usb_hid.c Modified: head/sys/dev/usb/usb_hid.c ============================================================================== --- head/sys/dev/usb/usb_hid.c Wed May 13 18:05:40 2009 (r192054) +++ head/sys/dev/usb/usb_hid.c Wed May 13 18:06:52 2009 (r192055) @@ -309,6 +309,7 @@ hid_get_item(struct hid_data *s, struct c->kind = hid_collection; c->collection = dval; c->collevel++; + c->usage = s->usage_last; *h = *c; return (1); case 11: /* Feature */ @@ -408,6 +409,9 @@ hid_get_item(struct hid_data *s, struct if (bSize != 4) dval = (dval & mask) | c->_usage_page; + /* set last usage, in case of a collection */ + s->usage_last = dval; + if (s->nusage < MAXUSAGE) { s->usages_min[s->nusage] = dval; s->usages_max[s->nusage] = dval; @@ -630,9 +634,11 @@ hid_is_collection(const void *desc, usb2 if (hd == NULL) return (0); - err = hid_get_item(hd, &hi) && - hi.kind == hid_collection && - hi.usage == usage; + while ((err = hid_get_item(hd, &hi))) { + if (hi.kind == hid_collection && + hi.usage == usage) + break; + } hid_end_parse(hd); return (err); } From owner-svn-src-head@FreeBSD.ORG Wed May 13 18:25:15 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A1C21065670; Wed, 13 May 2009 18:25:15 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ED48C8FC21; Wed, 13 May 2009 18:25:14 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4DIPEAO064000; Wed, 13 May 2009 18:25:14 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4DIPEfI063999; Wed, 13 May 2009 18:25:14 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200905131825.n4DIPEfI063999@svn.freebsd.org> From: Andrew Thompson Date: Wed, 13 May 2009 18:25:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192056 - head/sys/dev/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2009 18:25:15 -0000 Author: thompsa Date: Wed May 13 18:25:14 2009 New Revision: 192056 URL: http://svn.freebsd.org/changeset/base/192056 Log: Add parenthesis around the xfer macro argument. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/usb_core.h Modified: head/sys/dev/usb/usb_core.h ============================================================================== --- head/sys/dev/usb/usb_core.h Wed May 13 18:06:52 2009 (r192055) +++ head/sys/dev/usb/usb_core.h Wed May 13 18:25:14 2009 (r192056) @@ -233,9 +233,9 @@ * The following macro will tell if an USB transfer is currently * receiving or transferring data. */ -#define USB_GET_DATA_ISREAD(xfer) (((xfer)->flags_int.usb2_mode == \ - USB_MODE_DEVICE) ? ((xfer->endpoint & UE_DIR_IN) ? 0 : 1) : \ - ((xfer->endpoint & UE_DIR_IN) ? 1 : 0)) +#define USB_GET_DATA_ISREAD(xfer) ((xfer)->flags_int.usb2_mode == \ + USB_MODE_DEVICE ? (((xfer)->endpoint & UE_DIR_IN) ? 0 : 1) : \ + (((xfer)->endpoint & UE_DIR_IN) ? 1 : 0)) /* * The following macros are used used to convert milliseconds into From owner-svn-src-head@FreeBSD.ORG Wed May 13 18:26:56 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4215E1065678; Wed, 13 May 2009 18:26:56 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3117E8FC08; Wed, 13 May 2009 18:26:56 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4DIQuML064065; Wed, 13 May 2009 18:26:56 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4DIQu5V064064; Wed, 13 May 2009 18:26:56 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200905131826.n4DIQu5V064064@svn.freebsd.org> From: Andrew Thompson Date: Wed, 13 May 2009 18:26:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192057 - head/sys/dev/usb/storage X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2009 18:26:56 -0000 Author: thompsa Date: Wed May 13 18:26:55 2009 New Revision: 192057 URL: http://svn.freebsd.org/changeset/base/192057 Log: Ensure the bmRequestType is the right type for the incoming control request. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/storage/ustorage_fs.c Modified: head/sys/dev/usb/storage/ustorage_fs.c ============================================================================== --- head/sys/dev/usb/storage/ustorage_fs.c Wed May 13 18:25:14 2009 (r192056) +++ head/sys/dev/usb/storage/ustorage_fs.c Wed May 13 18:26:55 2009 (r192057) @@ -466,7 +466,8 @@ ustorage_fs_handle_request(device_t dev, const struct usb2_device_request *req = preq; if (!is_complete) { - if (req->bRequest == UR_BBB_RESET) { + if ((req->bmRequestType == UT_WRITE_CLASS_INTERFACE) && + (req->bRequest == UR_BBB_RESET)) { *plen = 0; mtx_lock(&sc->sc_mtx); ustorage_fs_transfer_stop(sc); @@ -475,7 +476,8 @@ ustorage_fs_handle_request(device_t dev, USTORAGE_FS_T_BBB_COMMAND); mtx_unlock(&sc->sc_mtx); return (0); - } else if (req->bRequest == UR_BBB_GET_MAX_LUN) { + } else if ((req->bmRequestType == UT_READ_CLASS_INTERFACE) && + (req->bRequest == UR_BBB_GET_MAX_LUN)) { if (offset == 0) { *plen = 1; *pptr = &sc->sc_last_lun; From owner-svn-src-head@FreeBSD.ORG Wed May 13 18:31:29 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2D4331065672; Wed, 13 May 2009 18:31:29 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1C7CF8FC18; Wed, 13 May 2009 18:31:29 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4DIVTPD064192; Wed, 13 May 2009 18:31:29 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4DIVTY6064191; Wed, 13 May 2009 18:31:29 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <200905131831.n4DIVTY6064191@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Wed, 13 May 2009 18:31:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192058 - head/sys/dev/flash X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2009 18:31:29 -0000 Author: gonzo Date: Wed May 13 18:31:28 2009 New Revision: 192058 URL: http://svn.freebsd.org/changeset/base/192058 Log: - Remove nonexistent header file from includes list Modified: head/sys/dev/flash/at45d.c Modified: head/sys/dev/flash/at45d.c ============================================================================== --- head/sys/dev/flash/at45d.c Wed May 13 18:26:55 2009 (r192057) +++ head/sys/dev/flash/at45d.c Wed May 13 18:31:28 2009 (r192058) @@ -30,7 +30,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include From owner-svn-src-head@FreeBSD.ORG Wed May 13 18:42:49 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EC48B1065670; Wed, 13 May 2009 18:42:49 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DAEDB8FC1A; Wed, 13 May 2009 18:42:49 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4DIgnuF064431; Wed, 13 May 2009 18:42:49 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4DIgnnu064429; Wed, 13 May 2009 18:42:49 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <200905131842.n4DIgnnu064429@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Wed, 13 May 2009 18:42:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192059 - in head/sys: arm/at91 dev/spibus X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2009 18:42:50 -0000 Author: gonzo Date: Wed May 13 18:42:49 2009 New Revision: 192059 URL: http://svn.freebsd.org/changeset/base/192059 Log: - Make SPI bus bridge be non-arch dependent by using more generic name Reviewed by: imp Modified: head/sys/arm/at91/at91_spi.c head/sys/dev/spibus/spibus.c Modified: head/sys/arm/at91/at91_spi.c ============================================================================== --- head/sys/arm/at91/at91_spi.c Wed May 13 18:31:28 2009 (r192058) +++ head/sys/arm/at91/at91_spi.c Wed May 13 18:42:49 2009 (r192059) @@ -297,7 +297,7 @@ static device_method_t at91_spi_methods[ }; static driver_t at91_spi_driver = { - "at91_spi", + "spi", at91_spi_methods, sizeof(struct at91_spi_softc), }; Modified: head/sys/dev/spibus/spibus.c ============================================================================== --- head/sys/dev/spibus/spibus.c Wed May 13 18:31:28 2009 (r192058) +++ head/sys/dev/spibus/spibus.c Wed May 13 18:42:49 2009 (r192059) @@ -194,5 +194,5 @@ static driver_t spibus_driver = { devclass_t spibus_devclass; -DRIVER_MODULE(spibus, at91_spi, spibus_driver, spibus_devclass, 0, 0); +DRIVER_MODULE(spibus, spi, spibus_driver, spibus_devclass, 0, 0); MODULE_VERSION(spibus, 1); From owner-svn-src-head@FreeBSD.ORG Wed May 13 19:29:50 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7DD721065670; Wed, 13 May 2009 19:29:50 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6CF558FC15; Wed, 13 May 2009 19:29:50 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4DJTowr065455; Wed, 13 May 2009 19:29:50 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4DJTo0X065454; Wed, 13 May 2009 19:29:50 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200905131929.n4DJTo0X065454@svn.freebsd.org> From: Ed Schouten Date: Wed, 13 May 2009 19:29:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192062 - head/sys/dev/snp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2009 19:29:51 -0000 Author: ed Date: Wed May 13 19:29:50 2009 New Revision: 192062 URL: http://svn.freebsd.org/changeset/base/192062 Log: Keep this line shorter than 80 columns. Modified: head/sys/dev/snp/snp.c Modified: head/sys/dev/snp/snp.c ============================================================================== --- head/sys/dev/snp/snp.c Wed May 13 19:26:19 2009 (r192061) +++ head/sys/dev/snp/snp.c Wed May 13 19:29:50 2009 (r192062) @@ -257,8 +257,8 @@ snp_ioctl(struct cdev *dev, u_long cmd, SNP_UNLOCK(); return (EBUSY); } - error = ttyhook_register(&ss->snp_tty, td->td_proc, *(int *)data, - &snp_hook, ss); + error = ttyhook_register(&ss->snp_tty, td->td_proc, + *(int *)data, &snp_hook, ss); SNP_UNLOCK(); if (error != 0) return (error); From owner-svn-src-head@FreeBSD.ORG Wed May 13 20:25:33 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 075EA106567D for ; Wed, 13 May 2009 20:25:33 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from mx0.deglitch.com (backbone.deglitch.com [IPv6:2001:16d8:fffb:4::abba]) by mx1.freebsd.org (Postfix) with ESMTP id AB94E8FC1E for ; Wed, 13 May 2009 20:25:32 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from DSPAM-Daemon (localhost [127.0.0.1]) by mx0.deglitch.com (Postfix) with SMTP id A875D8FC51 for ; Thu, 14 May 2009 00:25:31 +0400 (MSD) Received: from orion.SpringDaemons.com (unknown [77.232.3.143]) by mx0.deglitch.com (Postfix) with ESMTPA id B879E8FC18; Thu, 14 May 2009 00:25:28 +0400 (MSD) Received: from orion (localhost [127.0.0.1]) by orion.SpringDaemons.com (Postfix) with SMTP id 2AD7139830; Thu, 14 May 2009 00:25:55 +0400 (MSD) Date: Thu, 14 May 2009 00:25:55 +0400 From: Stanislav Sedov To: Oleksandr Tymoshenko Message-Id: <20090514002555.f56ba38b.stas@FreeBSD.org> In-Reply-To: <200905131842.n4DIgnnu064429@svn.freebsd.org> References: <200905131842.n4DIgnnu064429@svn.freebsd.org> Organization: The FreeBSD Project X-XMPP: ssedov@jabber.ru X-Voice: +7 916 849 20 23 X-PGP-Fingerprint: F21E D6CC 5626 9609 6CE2 A385 2BF5 5993 EB26 9581 X-Mailer: carrier-pigeon Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-DSPAM-Result: Whitelisted X-DSPAM-Processed: Thu May 14 00:25:31 2009 X-DSPAM-Confidence: 0.9899 X-DSPAM-Improbability: 1 in 9809 chance of being spam X-DSPAM-Probability: 0.0000 X-DSPAM-Signature: 4a0b2cbb994291963314094 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r192059 - in head/sys: arm/at91 dev/spibus X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2009 20:25:33 -0000 On Wed, 13 May 2009 18:42:49 +0000 (UTC) Oleksandr Tymoshenko mentioned: > Author: gonzo > Date: Wed May 13 18:42:49 2009 > New Revision: 192059 > URL: http://svn.freebsd.org/changeset/base/192059 > > Log: > - Make SPI bus bridge be non-arch dependent by using more generic > name > > Reviewed by: imp > > Modified: > head/sys/arm/at91/at91_spi.c > head/sys/dev/spibus/spibus.c > > Modified: head/sys/arm/at91/at91_spi.c > ============================================================================== > --- head/sys/arm/at91/at91_spi.c Wed May 13 18:31:28 2009 (r192058) > +++ head/sys/arm/at91/at91_spi.c Wed May 13 18:42:49 2009 (r192059) > @@ -297,7 +297,7 @@ static device_method_t at91_spi_methods[ > }; > > static driver_t at91_spi_driver = { > - "at91_spi", > + "spi", > at91_spi_methods, > sizeof(struct at91_spi_softc), > }; > > Modified: head/sys/dev/spibus/spibus.c > ============================================================================== > --- head/sys/dev/spibus/spibus.c Wed May 13 18:31:28 2009 (r192058) > +++ head/sys/dev/spibus/spibus.c Wed May 13 18:42:49 2009 (r192059) > @@ -194,5 +194,5 @@ static driver_t spibus_driver = { > > devclass_t spibus_devclass; > > -DRIVER_MODULE(spibus, at91_spi, spibus_driver, spibus_devclass, 0, 0); > +DRIVER_MODULE(spibus, spi, spibus_driver, spibus_devclass, 0, 0); > MODULE_VERSION(spibus, 1); > On the other hand this driver appears to be machine-specific. What if one would like to have a kernel with several SPI bus drivers included for devices that doesn't support enumeration? In this case it will be impossible to diffirentiate these drivers in the hints file. -- Stanislav Sedov ST4096-RIPE !DSPAM:4a0b2cbb994291963314094! From owner-svn-src-head@FreeBSD.ORG Wed May 13 20:29:53 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 714161065673; Wed, 13 May 2009 20:29:53 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5F9D28FC28; Wed, 13 May 2009 20:29:53 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4DKTrQL066691; Wed, 13 May 2009 20:29:53 GMT (envelope-from stas@svn.freebsd.org) Received: (from stas@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4DKTrXc066690; Wed, 13 May 2009 20:29:53 GMT (envelope-from stas@svn.freebsd.org) Message-Id: <200905132029.n4DKTrXc066690@svn.freebsd.org> From: Stanislav Sedov Date: Wed, 13 May 2009 20:29:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192063 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2009 20:29:54 -0000 Author: stas Date: Wed May 13 20:29:53 2009 New Revision: 192063 URL: http://svn.freebsd.org/changeset/base/192063 Log: - Style(9) and consistency nitpicking. Reviewed by: imp Modified: head/sys/arm/at91/if_ate.c Modified: head/sys/arm/at91/if_ate.c ============================================================================== --- head/sys/arm/at91/if_ate.c Wed May 13 19:29:50 2009 (r192062) +++ head/sys/arm/at91/if_ate.c Wed May 13 20:29:53 2009 (r192063) @@ -69,8 +69,8 @@ __FBSDID("$FreeBSD$"); #include "miibus_if.h" -#define ATE_MAX_TX_BUFFERS 2 /* We have ping-pong tx buffers */ -#define ATE_MAX_RX_BUFFERS 64 +#define ATE_MAX_TX_BUFFERS 2 /* We have ping-pong tx buffers */ +#define ATE_MAX_RX_BUFFERS 64 /* * Driver-specific flags. @@ -80,41 +80,43 @@ __FBSDID("$FreeBSD$"); struct ate_softc { - struct ifnet *ifp; /* ifnet pointer */ - struct mtx sc_mtx; /* basically a perimeter lock */ - device_t dev; /* Myself */ - device_t miibus; /* My child miibus */ - void *intrhand; /* Interrupt handle */ - struct resource *irq_res; /* IRQ resource */ + struct ifnet *ifp; /* ifnet pointer */ + struct mtx sc_mtx; /* Basically a perimeter lock */ + device_t dev; /* Myself */ + device_t miibus; /* My child miibus */ + struct resource *irq_res; /* IRQ resource */ struct resource *mem_res; /* Memory resource */ - struct callout tick_ch; /* Tick callout */ - bus_dma_tag_t mtag; /* bus dma tag for mbufs */ - bus_dmamap_t tx_map[ATE_MAX_TX_BUFFERS]; - struct mbuf *sent_mbuf[ATE_MAX_TX_BUFFERS]; /* Sent mbufs */ - bus_dma_tag_t rxtag; - bus_dmamap_t rx_map[ATE_MAX_RX_BUFFERS]; - void *rx_buf[ATE_MAX_RX_BUFFERS]; /* RX buffer space */ - int rx_buf_ptr; - bus_dma_tag_t rx_desc_tag; - bus_dmamap_t rx_desc_map; - int txcur; /* current tx map pointer */ - bus_addr_t rx_desc_phys; - eth_rx_desc_t *rx_descs; - int use_rmii; - struct ifmib_iso_8802_3 mibdata; /* stuff for network mgmt */ - int flags; - int if_flags; + struct callout tick_ch; /* Tick callout */ + struct ifmib_iso_8802_3 mibdata; /* Stuff for network mgmt */ + struct mbuf *sent_mbuf[ATE_MAX_TX_BUFFERS]; /* Sent mbufs */ + bus_dma_tag_t mtag; /* bus dma tag for mbufs */ + bus_dma_tag_t rxtag; + bus_dma_tag_t rx_desc_tag; + bus_dmamap_t rx_desc_map; + bus_dmamap_t rx_map[ATE_MAX_RX_BUFFERS]; + bus_dmamap_t tx_map[ATE_MAX_TX_BUFFERS]; + bus_addr_t rx_desc_phys; + eth_rx_desc_t *rx_descs; + void *rx_buf[ATE_MAX_RX_BUFFERS]; /* RX buffer space */ + void *intrhand; /* Interrupt handle */ + int flags; + int if_flags; + int rx_buf_ptr; + int txcur; /* Current TX map pointer */ + int use_rmii; }; static inline uint32_t RD4(struct ate_softc *sc, bus_size_t off) { - return bus_read_4(sc->mem_res, off); + + return (bus_read_4(sc->mem_res, off)); } static inline void WR4(struct ate_softc *sc, bus_size_t off, uint32_t val) { + bus_write_4(sc->mem_res, off, val); } @@ -125,41 +127,45 @@ BARRIER(struct ate_softc *sc, bus_size_t bus_barrier(sc->mem_res, off, len, flags); } -#define ATE_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) +#define ATE_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #define ATE_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) -#define ATE_LOCK_INIT(_sc) \ - mtx_init(&_sc->sc_mtx, device_get_nameunit(_sc->dev), \ +#define ATE_LOCK_INIT(_sc) \ + mtx_init(&_sc->sc_mtx, device_get_nameunit(_sc->dev), \ MTX_NETWORK_LOCK, MTX_DEF) -#define ATE_LOCK_DESTROY(_sc) mtx_destroy(&_sc->sc_mtx); -#define ATE_ASSERT_LOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_OWNED); -#define ATE_ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_NOTOWNED); +#define ATE_LOCK_DESTROY(_sc) mtx_destroy(&_sc->sc_mtx); +#define ATE_ASSERT_LOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_OWNED); +#define ATE_ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_NOTOWNED); static devclass_t ate_devclass; -/* ifnet entry points */ +/* + * ifnet entry points. + */ +static void ateinit_locked(void *); +static void atestart_locked(struct ifnet *); + +static void ateinit(void *); +static void atestart(struct ifnet *); +static void atestop(struct ate_softc *); +static int ateioctl(struct ifnet * ifp, u_long, caddr_t); -static void ateinit_locked(void *); -static void atestart_locked(struct ifnet *); +/* + * Bus entry points. + */ +static int ate_probe(device_t dev); +static int ate_attach(device_t dev); +static int ate_detach(device_t dev); +static void ate_intr(void *); -static void ateinit(void *); -static void atestart(struct ifnet *); -static void atestop(struct ate_softc *); -static int ateioctl(struct ifnet * ifp, u_long, caddr_t); - -/* bus entry points */ - -static int ate_probe(device_t dev); -static int ate_attach(device_t dev); -static int ate_detach(device_t dev); -static void ate_intr(void *); - -/* helper routines */ -static int ate_activate(device_t dev); -static void ate_deactivate(struct ate_softc *sc); -static int ate_ifmedia_upd(struct ifnet *ifp); -static void ate_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr); -static int ate_get_mac(struct ate_softc *sc, u_char *eaddr); -static void ate_set_mac(struct ate_softc *sc, u_char *eaddr); +/* + * Helper routines. + */ +static int ate_activate(device_t dev); +static void ate_deactivate(struct ate_softc *sc); +static int ate_ifmedia_upd(struct ifnet *ifp); +static void ate_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr); +static int ate_get_mac(struct ate_softc *sc, u_char *eaddr); +static void ate_set_mac(struct ate_softc *sc, u_char *eaddr); static void ate_rxfilter(struct ate_softc *sc); /* @@ -171,6 +177,7 @@ static void ate_rxfilter(struct ate_soft static int ate_probe(device_t dev) { + device_set_desc(dev, "EMAC"); return (0); } @@ -178,7 +185,7 @@ ate_probe(device_t dev) static int ate_attach(device_t dev) { - struct ate_softc *sc = device_get_softc(dev); + struct ate_softc *sc; struct ifnet *ifp = NULL; struct sysctl_ctx_list *sctx; struct sysctl_oid *soid; @@ -186,6 +193,7 @@ ate_attach(device_t dev) uint32_t rnd; int rid, err; + sc = device_get_softc(dev); sc->dev = dev; ATE_LOCK_INIT(sc); @@ -221,7 +229,7 @@ ate_attach(device_t dev) SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "rmii", CTLFLAG_RD, &sc->use_rmii, 0, "rmii in use"); - /* calling atestop before ifp is set is OK */ + /* Calling atestop before ifp is set is OK. */ ATE_LOCK(sc); atestop(sc); ATE_UNLOCK(sc); @@ -261,7 +269,7 @@ ate_attach(device_t dev) if_initname(ifp, device_get_name(dev), device_get_unit(dev)); ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_capabilities |= IFCAP_VLAN_MTU; - ifp->if_capenable |= IFCAP_VLAN_MTU; /* the hw bits already set */ + ifp->if_capenable |= IFCAP_VLAN_MTU; /* The hw bits already set. */ ifp->if_start = atestart; ifp->if_ioctl = ateioctl; ifp->if_init = ateinit; @@ -435,8 +443,9 @@ ate_activate(device_t dev) int err, i; sc = device_get_softc(dev); + /* - * Allocate DMA tags and maps + * Allocate DMA tags and maps. */ err = bus_dma_tag_create(bus_get_dma_tag(dev), 1, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, @@ -448,11 +457,7 @@ ate_activate(device_t dev) if (err != 0) goto errout; } - /* - * Allocate our Rx buffers. This chip has a rx structure that's filled - * in - */ - + /* * Allocate DMA tags and maps for RX. */ @@ -462,7 +467,9 @@ ate_activate(device_t dev) if (err != 0) goto errout; - /* Dma TAG and MAP for the rx descriptors. */ + /* + * DMA tag and map for the RX descriptors. + */ err = bus_dma_tag_create(bus_get_dma_tag(dev), sizeof(eth_rx_desc_t), 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, ATE_MAX_RX_BUFFERS * sizeof(eth_rx_desc_t), 1, @@ -477,6 +484,11 @@ ate_activate(device_t dev) sc->rx_descs, ATE_MAX_RX_BUFFERS * sizeof(eth_rx_desc_t), ate_getaddr, sc, 0) != 0) goto errout; + + /* + * Allocate our RX buffers. This chip has a RX structure that's filled + * in. + */ for (i = 0; i < ATE_MAX_RX_BUFFERS; i++) { sc->rx_buf_ptr = i; if (bus_dmamem_alloc(sc->rxtag, (void **)&sc->rx_buf[i], @@ -487,7 +499,7 @@ ate_activate(device_t dev) goto errout; } sc->rx_buf_ptr = 0; - /* Flush the memory for the EMAC rx descriptor */ + /* Flush the memory for the EMAC rx descriptor. */ bus_dmamap_sync(sc->rx_desc_tag, sc->rx_desc_map, BUS_DMASYNC_PREWRITE); /* Write the descriptor queue address. */ WR4(sc, ETH_RBQP, sc->rx_desc_phys); @@ -662,8 +674,9 @@ ate_tick(void *xsc) sc->mibdata.dot3StatsCarrierSenseErrors += RD4(sc, ETH_CSE); sc->mibdata.dot3StatsFrameTooLongs += RD4(sc, ETH_ELR); sc->mibdata.dot3StatsInternalMacReceiveErrors += RD4(sc, ETH_DRFC); + /* - * not sure where to lump these, so count them against the errors + * Not sure where to lump these, so count them against the errors * for the interface. */ sc->ifp->if_oerrors += RD4(sc, ETH_TUE); @@ -679,6 +692,7 @@ ate_tick(void *xsc) static void ate_set_mac(struct ate_softc *sc, u_char *eaddr) { + WR4(sc, ETH_SA1L, (eaddr[3] << 24) | (eaddr[2] << 16) | (eaddr[1] << 8) | eaddr[0]); WR4(sc, ETH_SA1H, (eaddr[5] << 8) | (eaddr[4])); @@ -819,7 +833,7 @@ ate_intr(void *xsc) } /* - * Reset and initialize the chip + * Reset and initialize the chip. */ static void ateinit_locked(void *xsc) @@ -868,12 +882,12 @@ ateinit_locked(void *xsc) * swapping to do. Again, if we need it (which I don't think we do). */ - /* enable big packets */ + /* Enable big packets. */ WR4(sc, ETH_CFG, RD4(sc, ETH_CFG) | ETH_CFG_BIG); /* * Set 'running' flag, and clear output active flag - * and attempt to start the output + * and attempt to start the output. */ ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; @@ -887,7 +901,7 @@ ateinit_locked(void *xsc) } /* - * dequeu packets and transmit + * Dequeue packets and transmit. */ static void atestart_locked(struct ifnet *ifp) @@ -903,7 +917,7 @@ atestart_locked(struct ifnet *ifp) while (sc->txcur < ATE_MAX_TX_BUFFERS) { /* - * check to see if there's room to put another packet into the + * Check to see if there's room to put another packet into the * xmit queue. The EMAC chip has a ping-pong buffer for xmit * packets. We use OACTIVE to indicate "we can stuff more into * our buffers (clear) or not (set)." @@ -937,7 +951,7 @@ atestart_locked(struct ifnet *ifp) BUS_DMASYNC_PREWRITE); /* - * tell the hardware to xmit the packet. + * Tell the hardware to xmit the packet. */ WR4(sc, ETH_TAR, segs[0].ds_addr); BARRIER(sc, ETH_TAR, 8, BUS_SPACE_BARRIER_WRITE); @@ -957,6 +971,7 @@ static void ateinit(void *xsc) { struct ate_softc *sc = xsc; + ATE_LOCK(sc); ateinit_locked(sc); ATE_UNLOCK(sc); @@ -966,13 +981,14 @@ static void atestart(struct ifnet *ifp) { struct ate_softc *sc = ifp->if_softc; + ATE_LOCK(sc); atestart_locked(ifp); ATE_UNLOCK(sc); } /* - * Turn off interrupts, and stop the nic. Can be called with sc->ifp NULL + * Turn off interrupts, and stop the NIC. Can be called with sc->ifp NULL, * so be careful. */ static void From owner-svn-src-head@FreeBSD.ORG Wed May 13 21:01:11 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5150C106566C; Wed, 13 May 2009 21:01:11 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3F1968FC29; Wed, 13 May 2009 21:01:11 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4DL1AMK067313; Wed, 13 May 2009 21:01:10 GMT (envelope-from stas@svn.freebsd.org) Received: (from stas@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4DL1AOm067312; Wed, 13 May 2009 21:01:10 GMT (envelope-from stas@svn.freebsd.org) Message-Id: <200905132101.n4DL1AOm067312@svn.freebsd.org> From: Stanislav Sedov Date: Wed, 13 May 2009 21:01:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192064 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2009 21:01:11 -0000 Author: stas Date: Wed May 13 21:01:10 2009 New Revision: 192064 URL: http://svn.freebsd.org/changeset/base/192064 Log: - Set MAC address in ateinit, so it can be changed later. Modified: head/sys/arm/at91/if_ate.c Modified: head/sys/arm/at91/if_ate.c ============================================================================== --- head/sys/arm/at91/if_ate.c Wed May 13 20:29:53 2009 (r192063) +++ head/sys/arm/at91/if_ate.c Wed May 13 21:01:10 2009 (r192064) @@ -256,7 +256,6 @@ ate_attach(device_t dev) eaddr[4] = (rnd >> 8) & 0xff; eaddr[5] = rnd & 0xff; } - ate_set_mac(sc, eaddr); sc->ifp = ifp = if_alloc(IFT_ETHER); if (mii_phy_probe(dev, &sc->miibus, ate_ifmedia_upd, ate_ifmedia_sts)) { @@ -841,6 +840,7 @@ ateinit_locked(void *xsc) struct ate_softc *sc = xsc; struct ifnet *ifp = sc->ifp; struct mii_data *mii; + uint8_t eaddr[ETHER_ADDR_LEN]; uint32_t reg; ATE_ASSERT_LOCKED(sc); @@ -870,17 +870,16 @@ ateinit_locked(void *xsc) ate_rxfilter(sc); /* - * Turn on MACs and interrupt processing. + * Set the chip MAC address. */ - WR4(sc, ETH_CTL, RD4(sc, ETH_CTL) | ETH_CTL_TE | ETH_CTL_RE); - WR4(sc, ETH_IER, ETH_ISR_RCOM | ETH_ISR_TCOM | ETH_ISR_RBNA); + bcopy(IF_LLADDR(ifp), eaddr, ETHER_ADDR_LEN); + ate_set_mac(sc, eaddr); /* - * Boot loader fills in MAC address. If that's not the case, then - * we should set SA1L and SA1H here to the appropriate value. Note: - * the byte order is big endian, not little endian, so we have some - * swapping to do. Again, if we need it (which I don't think we do). + * Turn on MACs and interrupt processing. */ + WR4(sc, ETH_CTL, RD4(sc, ETH_CTL) | ETH_CTL_TE | ETH_CTL_RE); + WR4(sc, ETH_IER, ETH_ISR_RCOM | ETH_ISR_TCOM | ETH_ISR_RBNA); /* Enable big packets. */ WR4(sc, ETH_CFG, RD4(sc, ETH_CFG) | ETH_CFG_BIG); From owner-svn-src-head@FreeBSD.ORG Wed May 13 21:18:35 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F32A8106566B; Wed, 13 May 2009 21:18:34 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E22CD8FC0A; Wed, 13 May 2009 21:18:34 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4DLIY57067679; Wed, 13 May 2009 21:18:34 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4DLIYZY067678; Wed, 13 May 2009 21:18:34 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200905132118.n4DLIYZY067678@svn.freebsd.org> From: Rick Macklem Date: Wed, 13 May 2009 21:18:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192065 - head/sys/fs/nfsclient X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2009 21:18:35 -0000 Author: rmacklem Date: Wed May 13 21:18:34 2009 New Revision: 192065 URL: http://svn.freebsd.org/changeset/base/192065 Log: Apply a one line change to nfs_clbio.c (which is largely a copy of sys/nfsclient/nfs_bio.c) to track the change recently committed by acl for nfs_bio.c. Approved by: kib (mentor) Modified: head/sys/fs/nfsclient/nfs_clbio.c Modified: head/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clbio.c Wed May 13 21:01:10 2009 (r192064) +++ head/sys/fs/nfsclient/nfs_clbio.c Wed May 13 21:18:34 2009 (r192065) @@ -306,7 +306,8 @@ ncl_getpages(struct vop_getpages_args *a * Read operation filled an entire page */ m->valid = VM_PAGE_BITS_ALL; - vm_page_undirty(m); + KASSERT(m->dirty == 0, + ("nfs_getpages: page %p is dirty", m)); } else if (size > toff) { /* * Read operation filled a partial page. From owner-svn-src-head@FreeBSD.ORG Wed May 13 22:31:26 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2333A10656D2; Wed, 13 May 2009 22:31:26 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 122648FC08; Wed, 13 May 2009 22:31:26 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4DMVPKO069134; Wed, 13 May 2009 22:31:25 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4DMVPJE069133; Wed, 13 May 2009 22:31:25 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200905132231.n4DMVPJE069133@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Wed, 13 May 2009 22:31:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192066 - head/sys/dev/aic X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2009 22:31:26 -0000 Author: des Date: Wed May 13 22:31:25 2009 New Revision: 192066 URL: http://svn.freebsd.org/changeset/base/192066 Log: Snip redundant assignment. Approved by: scottl MFC after: 2 weeks Coverity ID: 3863 Modified: head/sys/dev/aic/aic.c Modified: head/sys/dev/aic/aic.c ============================================================================== --- head/sys/dev/aic/aic.c Wed May 13 21:18:34 2009 (r192065) +++ head/sys/dev/aic/aic.c Wed May 13 22:31:25 2009 (r192066) @@ -168,7 +168,7 @@ aic_action(struct cam_sim *sim, union cc } case XPT_SET_TRAN_SETTINGS: { - struct ccb_trans_settings *cts = cts = &ccb->cts; + struct ccb_trans_settings *cts = &ccb->cts; struct aic_tinfo *ti = &aic->tinfo[ccb->ccb_h.target_id]; struct ccb_trans_settings_scsi *scsi = &cts->proto_specific.scsi; From owner-svn-src-head@FreeBSD.ORG Thu May 14 00:34:28 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 440531065672; Thu, 14 May 2009 00:34:28 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 301058FC18; Thu, 14 May 2009 00:34:28 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4E0YR2R071459; Thu, 14 May 2009 00:34:27 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4E0YRqR071440; Thu, 14 May 2009 00:34:27 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200905140034.n4E0YRqR071440@svn.freebsd.org> From: Nathan Whitehorn Date: Thu, 14 May 2009 00:34:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192067 - in head/sys: conf powerpc/aim powerpc/booke powerpc/include powerpc/powerpc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 00:34:28 -0000 Author: nwhitehorn Date: Thu May 14 00:34:26 2009 New Revision: 192067 URL: http://svn.freebsd.org/changeset/base/192067 Log: Factor out platform dependent things unrelated to device drivers into a new platform module. These are probed in early boot, and have the responsibility of determining the layout of physical memory, determining the CPU timebase frequency, and handling the zoo of SMP mechanisms found on PowerPC. Reviewed by: marcel, raj Book-E parts by: raj Added: head/sys/powerpc/aim/platform_chrp.c (contents, props changed) head/sys/powerpc/booke/platform_bare.c (contents, props changed) head/sys/powerpc/include/platform.h - copied, changed from r192066, head/sys/powerpc/include/powerpc.h head/sys/powerpc/include/platformvar.h (contents, props changed) head/sys/powerpc/powerpc/platform.c (contents, props changed) head/sys/powerpc/powerpc/platform_if.m (contents, props changed) Deleted: head/sys/powerpc/include/powerpc.h Modified: head/sys/conf/files.powerpc head/sys/powerpc/aim/clock.c head/sys/powerpc/aim/machdep.c head/sys/powerpc/aim/mmu_oea.c head/sys/powerpc/aim/mmu_oea64.c head/sys/powerpc/aim/mp_cpudep.c head/sys/powerpc/aim/ofw_machdep.c head/sys/powerpc/aim/vm_machdep.c head/sys/powerpc/booke/clock.c head/sys/powerpc/booke/machdep.c head/sys/powerpc/booke/pmap.c head/sys/powerpc/booke/vm_machdep.c head/sys/powerpc/include/md_var.h head/sys/powerpc/include/ofw_machdep.h head/sys/powerpc/include/pmap.h head/sys/powerpc/include/smp.h head/sys/powerpc/include/spr.h head/sys/powerpc/powerpc/mp_machdep.c head/sys/powerpc/powerpc/pmap_dispatch.c Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Wed May 13 22:31:25 2009 (r192066) +++ head/sys/conf/files.powerpc Thu May 14 00:34:26 2009 (r192067) @@ -81,6 +81,7 @@ powerpc/aim/mp_cpudep.c optional aim sm powerpc/aim/nexus.c optional aim powerpc/aim/ofw_machdep.c optional aim powerpc/aim/ofwmagic.S optional aim +powerpc/aim/platform_chrp.c optional aim powerpc/aim/swtch.S optional aim powerpc/aim/trap.c optional aim powerpc/aim/uma_machdep.c optional aim @@ -90,6 +91,7 @@ powerpc/booke/copyinout.c optional e500 powerpc/booke/interrupt.c optional e500 powerpc/booke/locore.S optional e500 no-obj powerpc/booke/machdep.c optional e500 +powerpc/booke/platform_bare.c optional mpc85xx powerpc/booke/pmap.c optional e500 powerpc/booke/swtch.S optional e500 powerpc/booke/trap.c optional e500 @@ -155,6 +157,8 @@ powerpc/powerpc/mp_machdep.c optional sm powerpc/powerpc/openpic.c standard powerpc/powerpc/pic_if.m standard powerpc/powerpc/pmap_dispatch.c standard +powerpc/powerpc/platform.c standard +powerpc/powerpc/platform_if.m standard powerpc/powerpc/sc_machdep.c optional sc powerpc/powerpc/setjmp.S standard powerpc/powerpc/sigcode.S standard Modified: head/sys/powerpc/aim/clock.c ============================================================================== --- head/sys/powerpc/aim/clock.c Wed May 13 22:31:25 2009 (r192066) +++ head/sys/powerpc/aim/clock.c Thu May 14 00:34:26 2009 (r192067) @@ -125,44 +125,27 @@ decr_intr(struct trapframe *frame) void decr_init(void) { - int qhandle, phandle; - char name[32]; - unsigned int msr; - - phandle = 0; + struct cpuref cpu; + register_t msr; /* - * Get this info during autoconf? XXX + * Check the BSP's timebase frequency. Sometimes we can't find the BSP, so fall + * back to the first CPU in this case. */ - for (qhandle = OF_peer(0); qhandle; qhandle = phandle) { - if (OF_getprop(qhandle, "device_type", name, sizeof name) >= 0 - && !strcmp(name, "cpu") - && OF_getprop(qhandle, "timebase-frequency", - &ticks_per_sec, sizeof ticks_per_sec) >= 0) { - /* - * Should check for correct CPU here? XXX - */ - msr = mfmsr(); - mtmsr(msr & ~PSL_EE); - - ns_per_tick = 1000000000 / ticks_per_sec; - ticks_per_intr = ticks_per_sec / hz; - mtdec(ticks_per_intr); - - mtmsr(msr); - - break; - } - if ((phandle = OF_child(qhandle))) - continue; - while (qhandle) { - if ((phandle = OF_peer(qhandle))) - break; - qhandle = OF_parent(qhandle); - } - } - if (!phandle) - panic("no cpu node"); + + if (platform_smp_get_bsp(&cpu) != 0) + platform_smp_first_cpu(&cpu); + + ticks_per_sec = platform_timebase_freq(&cpu); + + msr = mfmsr(); + mtmsr(msr & ~PSL_EE); + + ns_per_tick = 1000000000 / ticks_per_sec; + ticks_per_intr = ticks_per_sec / hz; + mtdec(ticks_per_intr); + + mtmsr(msr); } void Modified: head/sys/powerpc/aim/machdep.c ============================================================================== --- head/sys/powerpc/aim/machdep.c Wed May 13 22:31:25 2009 (r192066) +++ head/sys/powerpc/aim/machdep.c Thu May 14 00:34:26 2009 (r192067) @@ -114,7 +114,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -472,14 +471,22 @@ powerpc_init(u_int startkernel, u_int en */ mtmsr(msr); isync(); + + /* + * Choose a platform module so we can get the physical memory map. + */ + + platform_probe_and_attach(); /* - * Initialise virtual memory. + * Initialise virtual memory. Use BUS_PROBE_GENERIC priority + * in case the platform module had a better idea of what we + * should do. */ if (ppc64) - pmap_mmu_install(MMU_TYPE_G5, 0); + pmap_mmu_install(MMU_TYPE_G5, BUS_PROBE_GENERIC); else - pmap_mmu_install(MMU_TYPE_OEA, 0); + pmap_mmu_install(MMU_TYPE_OEA, BUS_PROBE_GENERIC); pmap_bootstrap(startkernel, endkernel); mtmsr(mfmsr() | PSL_IR|PSL_DR|PSL_ME|PSL_RI); Modified: head/sys/powerpc/aim/mmu_oea.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea.c Wed May 13 22:31:25 2009 (r192066) +++ head/sys/powerpc/aim/mmu_oea.c Thu May 14 00:34:26 2009 (r192067) @@ -141,7 +141,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include #include Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Wed May 13 22:31:25 2009 (r192066) +++ head/sys/powerpc/aim/mmu_oea64.c Thu May 14 00:34:26 2009 (r192067) @@ -143,7 +143,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include #include Modified: head/sys/powerpc/aim/mp_cpudep.c ============================================================================== --- head/sys/powerpc/aim/mp_cpudep.c Wed May 13 22:31:25 2009 (r192066) +++ head/sys/powerpc/aim/mp_cpudep.c Thu May 14 00:34:26 2009 (r192067) @@ -54,91 +54,6 @@ extern register_t l3cr_config; void *ap_pcpu; -static int -powerpc_smp_fill_cpuref(struct cpuref *cpuref, phandle_t cpu) -{ - int cpuid, res; - - cpuref->cr_hwref = cpu; - res = OF_getprop(cpu, "reg", &cpuid, sizeof(cpuid)); - if (res < 0) - return (ENOENT); - - cpuref->cr_cpuid = cpuid & 0xff; - return (0); -} - -int -powerpc_smp_first_cpu(struct cpuref *cpuref) -{ - char buf[8]; - phandle_t cpu, dev, root; - int res; - - root = OF_peer(0); - - dev = OF_child(root); - while (dev != 0) { - res = OF_getprop(dev, "name", buf, sizeof(buf)); - if (res > 0 && strcmp(buf, "cpus") == 0) - break; - dev = OF_peer(dev); - } - if (dev == 0) - return (ENOENT); - - cpu = OF_child(dev); - while (cpu != 0) { - res = OF_getprop(cpu, "device_type", buf, sizeof(buf)); - if (res > 0 && strcmp(buf, "cpu") == 0) - break; - cpu = OF_peer(cpu); - } - if (cpu == 0) - return (ENOENT); - - return (powerpc_smp_fill_cpuref(cpuref, cpu)); -} - -int -powerpc_smp_next_cpu(struct cpuref *cpuref) -{ - char buf[8]; - phandle_t cpu; - int res; - - cpu = OF_peer(cpuref->cr_hwref); - while (cpu != 0) { - res = OF_getprop(cpu, "device_type", buf, sizeof(buf)); - if (res > 0 && strcmp(buf, "cpu") == 0) - break; - cpu = OF_peer(cpu); - } - if (cpu == 0) - return (ENOENT); - - return (powerpc_smp_fill_cpuref(cpuref, cpu)); -} - -int -powerpc_smp_get_bsp(struct cpuref *cpuref) -{ - ihandle_t inst; - phandle_t bsp, chosen; - int res; - - chosen = OF_finddevice("/chosen"); - if (chosen == 0) - return (ENXIO); - - res = OF_getprop(chosen, "cpu", &inst, sizeof(inst)); - if (res < 0) - return (ENXIO); - - bsp = OF_instance_to_package(inst); - return (powerpc_smp_fill_cpuref(cpuref, bsp)); -} - static register_t l2_enable(void) { @@ -269,31 +184,3 @@ cpudep_ap_bootstrap(void) return (sp); } -int -powerpc_smp_start_cpu(struct pcpu *pc) -{ - phandle_t cpu; - volatile uint8_t *rstvec; - int res, reset, timeout; - - cpu = pc->pc_hwref; - res = OF_getprop(cpu, "soft-reset", &reset, sizeof(reset)); - if (res < 0) - return (ENXIO); - - ap_pcpu = pc; - - rstvec = (uint8_t *)(0x80000000 + reset); - - *rstvec = 4; - powerpc_sync(); - DELAY(1); - *rstvec = 0; - powerpc_sync(); - - timeout = 1000; - while (!pc->pc_awake && timeout--) - DELAY(100); - - return ((pc->pc_awake) ? 0 : EBUSY); -} Modified: head/sys/powerpc/aim/ofw_machdep.c ============================================================================== --- head/sys/powerpc/aim/ofw_machdep.c Wed May 13 22:31:25 2009 (r192066) +++ head/sys/powerpc/aim/ofw_machdep.c Thu May 14 00:34:26 2009 (r192067) @@ -55,7 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #define OFMEM_REGIONS 32 @@ -144,7 +144,7 @@ memr_merge(struct mem_region *from, stru * to provide space for two additional entry beyond the terminating one. */ void -mem_regions(struct mem_region **memp, int *memsz, +ofw_mem_regions(struct mem_region **memp, int *memsz, struct mem_region **availp, int *availsz) { phandle_t phandle; Added: head/sys/powerpc/aim/platform_chrp.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/aim/platform_chrp.c Thu May 14 00:34:26 2009 (r192067) @@ -0,0 +1,236 @@ +/*- + * Copyright (c) 2008 Marcel Moolenaar + * Copyright (c) 2009 Nathan Whitehorn + * 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 ``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 BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "platform_if.h" + +#ifdef SMP +extern void *ap_pcpu; +#endif + +static int chrp_probe(platform_t); +void chrp_mem_regions(platform_t, struct mem_region **phys, int *physsz, + struct mem_region **avail, int *availsz); +static u_long chrp_timebase_freq(platform_t, struct cpuref *cpuref); +static int chrp_smp_first_cpu(platform_t, struct cpuref *cpuref); +static int chrp_smp_next_cpu(platform_t, struct cpuref *cpuref); +static int chrp_smp_get_bsp(platform_t, struct cpuref *cpuref); +static int chrp_smp_start_cpu(platform_t, struct pcpu *cpu); + +static platform_method_t chrp_methods[] = { + PLATFORMMETHOD(platform_probe, chrp_probe), + PLATFORMMETHOD(platform_mem_regions, chrp_mem_regions), + PLATFORMMETHOD(platform_timebase_freq, chrp_timebase_freq), + + PLATFORMMETHOD(platform_smp_first_cpu, chrp_smp_first_cpu), + PLATFORMMETHOD(platform_smp_next_cpu, chrp_smp_next_cpu), + PLATFORMMETHOD(platform_smp_get_bsp, chrp_smp_get_bsp), + PLATFORMMETHOD(platform_smp_start_cpu, chrp_smp_start_cpu), + + { 0, 0 } +}; + +static platform_def_t chrp_platform = { + "chrp", + chrp_methods, + 0 +}; + +PLATFORM_DEF(chrp_platform); + +static int +chrp_probe(platform_t plat) +{ + if (OF_finddevice("/memory") != -1) + return (BUS_PROBE_GENERIC); + + return (ENXIO); +} + +void +chrp_mem_regions(platform_t plat, struct mem_region **phys, int *physsz, + struct mem_region **avail, int *availsz) +{ + ofw_mem_regions(phys,physsz,avail,availsz); +} + +static u_long +chrp_timebase_freq(platform_t plat, struct cpuref *cpuref) +{ + phandle_t phandle; + u_long ticks = -1; + + phandle = cpuref->cr_hwref; + + OF_getprop(phandle, "timebase-frequency", &ticks, sizeof(ticks)); + + if (ticks <= 0) + panic("Unable to determine timebase frequency!"); + + return (ticks); +} + + +static int +chrp_smp_fill_cpuref(struct cpuref *cpuref, phandle_t cpu) +{ + int cpuid, res; + + cpuref->cr_hwref = cpu; + res = OF_getprop(cpu, "reg", &cpuid, sizeof(cpuid)); + if (res < 0) + return (ENOENT); + + cpuref->cr_cpuid = cpuid & 0xff; + return (0); +} + +static int +chrp_smp_first_cpu(platform_t plat, struct cpuref *cpuref) +{ + char buf[8]; + phandle_t cpu, dev, root; + int res; + + root = OF_peer(0); + + dev = OF_child(root); + while (dev != 0) { + res = OF_getprop(dev, "name", buf, sizeof(buf)); + if (res > 0 && strcmp(buf, "cpus") == 0) + break; + dev = OF_peer(dev); + } + if (dev == 0) + return (ENOENT); + + cpu = OF_child(dev); + while (cpu != 0) { + res = OF_getprop(cpu, "device_type", buf, sizeof(buf)); + if (res > 0 && strcmp(buf, "cpu") == 0) + break; + cpu = OF_peer(cpu); + } + if (cpu == 0) + return (ENOENT); + + return (chrp_smp_fill_cpuref(cpuref, cpu)); +} + +static int +chrp_smp_next_cpu(platform_t plat, struct cpuref *cpuref) +{ + char buf[8]; + phandle_t cpu; + int res; + + cpu = OF_peer(cpuref->cr_hwref); + while (cpu != 0) { + res = OF_getprop(cpu, "device_type", buf, sizeof(buf)); + if (res > 0 && strcmp(buf, "cpu") == 0) + break; + cpu = OF_peer(cpu); + } + if (cpu == 0) + return (ENOENT); + + return (chrp_smp_fill_cpuref(cpuref, cpu)); +} + +static int +chrp_smp_get_bsp(platform_t plat, struct cpuref *cpuref) +{ + ihandle_t inst; + phandle_t bsp, chosen; + int res; + + chosen = OF_finddevice("/chosen"); + if (chosen == 0) + return (ENXIO); + + res = OF_getprop(chosen, "cpu", &inst, sizeof(inst)); + if (res < 0) + return (ENXIO); + + bsp = OF_instance_to_package(inst); + return (chrp_smp_fill_cpuref(cpuref, bsp)); +} + +static int +chrp_smp_start_cpu(platform_t plat, struct pcpu *pc) +{ +#ifdef SMP + phandle_t cpu; + volatile uint8_t *rstvec; + int res, reset, timeout; + + cpu = pc->pc_hwref; + res = OF_getprop(cpu, "soft-reset", &reset, sizeof(reset)); + if (res < 0) + return (ENXIO); + + ap_pcpu = pc; + + rstvec = (uint8_t *)(0x80000000 + reset); + + *rstvec = 4; + powerpc_sync(); + DELAY(1); + *rstvec = 0; + powerpc_sync(); + + timeout = 1000; + while (!pc->pc_awake && timeout--) + DELAY(100); + + return ((pc->pc_awake) ? 0 : EBUSY); +#else + /* No SMP support */ + return (ENXIO); +#endif +} + Modified: head/sys/powerpc/aim/vm_machdep.c ============================================================================== --- head/sys/powerpc/aim/vm_machdep.c Wed May 13 22:31:25 2009 (r192066) +++ head/sys/powerpc/aim/vm_machdep.c Thu May 14 00:34:26 2009 (r192067) @@ -89,7 +89,6 @@ #include #include #include -#include #include Modified: head/sys/powerpc/booke/clock.c ============================================================================== --- head/sys/powerpc/booke/clock.c Wed May 13 22:31:25 2009 (r192066) +++ head/sys/powerpc/booke/clock.c Thu May 14 00:34:26 2009 (r192067) @@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -123,29 +124,22 @@ void cpu_initclocks(void) { - return; -} - -void -decr_config (unsigned long freq) -{ - ticks_per_sec = freq; - decr_timecounter.tc_frequency = freq; + decr_tc_init(); } void decr_init (void) { + struct cpuref cpu; unsigned int msr; - /* - * Should check for correct CPU here? XXX - */ + if (platform_smp_get_bsp(&cpu) != 0) + platform_smp_first_cpu(&cpu); + ticks_per_sec = platform_timebase_freq(&cpu); + msr = mfmsr(); mtmsr(msr & ~(PSL_EE)); - tc_init(&decr_timecounter); - ns_per_tick = 1000000000 / ticks_per_sec; ticks_per_intr = ticks_per_sec / hz; @@ -173,6 +167,15 @@ mftb (void) return tb; } +void +decr_tc_init(void) +{ + + decr_timecounter.tc_frequency = ticks_per_sec; + tc_init(&decr_timecounter); +} + + static unsigned decr_get_timecount(struct timecounter *tc) { Modified: head/sys/powerpc/booke/machdep.c ============================================================================== --- head/sys/powerpc/booke/machdep.c Wed May 13 22:31:25 2009 (r192066) +++ head/sys/powerpc/booke/machdep.c Thu May 14 00:34:26 2009 (r192067) @@ -127,11 +127,10 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include -#include +#include #include #include @@ -157,9 +156,6 @@ extern unsigned char __sbss_start[]; extern unsigned char __sbss_end[]; extern unsigned char _end[]; -extern struct mem_region availmem_regions[]; -extern int availmem_regions_sz; - extern void dcache_enable(void); extern void dcache_inval(void); extern void icache_enable(void); @@ -339,9 +335,7 @@ e500_init(u_int32_t startkernel, u_int32 struct pcpu *pc; void *kmdp; vm_offset_t end; - struct bi_mem_region *mr; uint32_t csr; - int i; kmdp = NULL; @@ -381,31 +375,9 @@ e500_init(u_int32_t startkernel, u_int32 while(1); } - /* Initialize memory regions table */ - mr = bootinfo_mr(); - for (i = 0; i < bootinfo->bi_mem_reg_no; i++, mr++) { - if (i == MEM_REGIONS) - break; - if (mr->mem_base < 1048576) { - availmem_regions[i].mr_start = 1048576; - availmem_regions[i].mr_size = mr->mem_size - - (1048576 - mr->mem_base); - } else { - availmem_regions[i].mr_start = mr->mem_base; - availmem_regions[i].mr_size = mr->mem_size; - } - } - availmem_regions_sz = i; - /* Initialize TLB1 handling */ tlb1_init(bootinfo->bi_bar_base); - /* - * Time Base and Decrementer are updated every 8 CCB bus clocks. - * HID0[SEL_TBCLK] = 0 - */ - decr_config(bootinfo->bi_bus_clk / 8); - /* Init params/tunables that can be overridden by the loader. */ init_param1(); @@ -450,6 +422,9 @@ e500_init(u_int32_t startkernel, u_int32 kdb_enter(KDB_WHY_BOOTFLAGS, "Boot flags requested debugger"); #endif + /* Initialise platform module */ + platform_probe_and_attach(); + /* Initialise virtual memory. */ pmap_mmu_install(MMU_TYPE_BOOKE, 0); pmap_bootstrap(startkernel, end); Added: head/sys/powerpc/booke/platform_bare.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/booke/platform_bare.c Thu May 14 00:34:26 2009 (r192067) @@ -0,0 +1,185 @@ +/*- + * Copyright (c) 2008-2009 Semihalf, Rafal Jaworowski + * 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 ``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 BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "platform_if.h" + +static int cpu; + +static int bare_probe(platform_t); +static void bare_mem_regions(platform_t, struct mem_region **phys, int *physsz, + struct mem_region **avail, int *availsz); +static u_long bare_timebase_freq(platform_t, struct cpuref *cpuref); +static int bare_smp_first_cpu(platform_t, struct cpuref *cpuref); +static int bare_smp_next_cpu(platform_t, struct cpuref *cpuref); +static int bare_smp_get_bsp(platform_t, struct cpuref *cpuref); +static int bare_smp_start_cpu(platform_t, struct pcpu *cpu); + +static platform_method_t bare_methods[] = { + PLATFORMMETHOD(platform_probe, bare_probe), + PLATFORMMETHOD(platform_mem_regions, bare_mem_regions), + PLATFORMMETHOD(platform_timebase_freq, bare_timebase_freq), + + PLATFORMMETHOD(platform_smp_first_cpu, bare_smp_first_cpu), + PLATFORMMETHOD(platform_smp_next_cpu, bare_smp_next_cpu), + PLATFORMMETHOD(platform_smp_get_bsp, bare_smp_get_bsp), + PLATFORMMETHOD(platform_smp_start_cpu, bare_smp_start_cpu), + + { 0, 0 } +}; + +static platform_def_t bare_platform = { + "bare metal", + bare_methods, + 0 +}; + +PLATFORM_DEF(bare_platform); + +static int +bare_probe(platform_t plat) +{ + + return (BUS_PROBE_GENERIC); +} + +#define MEM_REGIONS 8 +static struct mem_region avail_regions[MEM_REGIONS]; + +void +bare_mem_regions(platform_t plat, struct mem_region **phys, int *physsz, + struct mem_region **avail, int *availsz) +{ + struct bi_mem_region *mr; + int i; + + /* Initialize memory regions table */ + mr = bootinfo_mr(); + for (i = 0; i < bootinfo->bi_mem_reg_no; i++, mr++) { + if (i == MEM_REGIONS) + break; + if (mr->mem_base < 1048576) { + avail_regions[i].mr_start = 1048576; + avail_regions[i].mr_size = mr->mem_size - + (1048576 - mr->mem_base); + } else { + avail_regions[i].mr_start = mr->mem_base; + avail_regions[i].mr_size = mr->mem_size; + } + } + *availsz = i; + *avail = avail_regions; + + /* On the bare metal platform phys == avail memory */ + *physsz = *availsz; + *phys = *avail; +} + +static u_long +bare_timebase_freq(platform_t plat, struct cpuref *cpuref) +{ + u_long ticks = -1; + + /* + * Time Base and Decrementer are updated every 8 CCB bus clocks. + * HID0[SEL_TBCLK] = 0 + */ + ticks = bootinfo->bi_bus_clk / 8; + if (ticks <= 0) + panic("Unable to determine timebase frequency!"); + + return (ticks); +} + +static int +bare_smp_first_cpu(platform_t plat, struct cpuref *cpuref) +{ + + cpu = 0; + cpuref->cr_cpuid = cpu; + cpuref->cr_hwref = cpuref->cr_cpuid; + if (bootverbose) + printf("powerpc_smp_first_cpu: cpuid %d\n", cpuref->cr_cpuid); + cpu++; + + return (0); +} + +static int +bare_smp_next_cpu(platform_t plat, struct cpuref *cpuref) +{ + + if (cpu >= MAXCPU) + return (ENOENT); + + cpuref->cr_cpuid = cpu++; + cpuref->cr_hwref = cpuref->cr_cpuid; + if (bootverbose) + printf("powerpc_smp_next_cpu: cpuid %d\n", cpuref->cr_cpuid); + + return (0); +} + +static int +bare_smp_get_bsp(platform_t plat, struct cpuref *cpuref) +{ + + cpuref->cr_cpuid = mfspr(SPR_PIR); + cpuref->cr_hwref = cpuref->cr_cpuid; + + return (0); +} + +static int +bare_smp_start_cpu(platform_t plat, struct pcpu *pc) +{ + + /* No SMP support */ + return (ENXIO); +} Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Wed May 13 22:31:25 2009 (r192066) +++ head/sys/powerpc/booke/pmap.c Thu May 14 00:34:26 2009 (r192067) @@ -79,7 +79,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include @@ -122,8 +122,11 @@ vm_size_t kernsize; static vm_offset_t data_start; static vm_size_t data_end; -struct mem_region availmem_regions[MEM_REGIONS]; -int availmem_regions_sz; +/* Phys/avail memory regions. */ +static struct mem_region *availmem_regions; +static int availmem_regions_sz; +static struct mem_region *physmem_regions; +static int physmem_regions_sz; /* Reserved KVA space and mutex for mmu_booke_zero_page. */ static vm_offset_t zero_page_va; @@ -1013,6 +1016,10 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset * align all regions. Non-page aligned memory isn't very interesting * to us. Also, sort the entries for ascending addresses. */ + + /* Retrieve phys/avail mem regions */ + mem_regions(&physmem_regions, &physmem_regions_sz, + &availmem_regions, &availmem_regions_sz); sz = 0; cnt = availmem_regions_sz; debugf("processing avail regions:\n"); Modified: head/sys/powerpc/booke/vm_machdep.c ============================================================================== --- head/sys/powerpc/booke/vm_machdep.c Wed May 13 22:31:25 2009 (r192066) +++ head/sys/powerpc/booke/vm_machdep.c Thu May 14 00:34:26 2009 (r192067) @@ -124,7 +124,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include Modified: head/sys/powerpc/include/md_var.h ============================================================================== --- head/sys/powerpc/include/md_var.h Wed May 13 22:31:25 2009 (r192066) +++ head/sys/powerpc/include/md_var.h Thu May 14 00:34:26 2009 (r192067) @@ -55,7 +55,6 @@ void busdma_swi(void); int is_physical_memory(vm_offset_t addr); int mem_valid(vm_offset_t addr, int len); -void decr_config(unsigned long); void decr_init(void); void decr_tc_init(void); Modified: head/sys/powerpc/include/ofw_machdep.h ============================================================================== --- head/sys/powerpc/include/ofw_machdep.h Wed May 13 22:31:25 2009 (r192066) +++ head/sys/powerpc/include/ofw_machdep.h Thu May 14 00:34:26 2009 (r192067) @@ -33,6 +33,7 @@ #include #include #include +#include typedef uint32_t cell_t; @@ -42,4 +43,9 @@ void OF_getetheraddr(device_t dev, u_cha void OF_initial_setup(void *fdt_ptr, void *junk, int (*openfirm)(void *)); boolean_t OF_bootstrap(void); +void OF_halt(void); +void OF_reboot(void); + +void ofw_mem_regions(struct mem_region **, int *, struct mem_region **, int *); + #endif /* _MACHINE_OFW_MACHDEP_H_ */ Copied and modified: head/sys/powerpc/include/platform.h (from r192066, head/sys/powerpc/include/powerpc.h) ============================================================================== --- head/sys/powerpc/include/powerpc.h Wed May 13 22:31:25 2009 (r192066, copy source) +++ head/sys/powerpc/include/platform.h Thu May 14 00:34:26 2009 (r192067) @@ -32,8 +32,11 @@ * $FreeBSD$ */ -#ifndef _MACHINE_POWERPC_H_ -#define _MACHINE_POWERPC_H_ +#ifndef _MACHINE_PLATFORM_H_ +#define _MACHINE_PLATFORM_H_ + +#include +#include struct mem_region { vm_offset_t mr_start; @@ -42,18 +45,14 @@ struct mem_region { void mem_regions(struct mem_region **, int *, struct mem_region **, int *); -/* - * These two functions get used solely in boot() in machdep.c. - * - * Not sure whether boot itself should be implementation dependent instead. XXX - */ -void OF_halt(void); -void OF_reboot(void); - -int dk_match(char *name); - -void ofrootfound(void); - -extern int booted_partition; - -#endif /* _MACHINE_POWERPC_H_ */ +u_long platform_timebase_freq(struct cpuref *); + +int platform_smp_first_cpu(struct cpuref *); +int platform_smp_next_cpu(struct cpuref *); +int platform_smp_get_bsp(struct cpuref *); +int platform_smp_start_cpu(struct pcpu *); + +const char *installed_platform(void); +void platform_probe_and_attach(void); + +#endif /* _MACHINE_PLATFORM_H_ */ Added: head/sys/powerpc/include/platformvar.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/include/platformvar.h Thu May 14 00:34:26 2009 (r192067) @@ -0,0 +1,88 @@ +/*- + * Copyright (c) 2005 Peter Grehan *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Thu May 14 02:34:49 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 20AD1106564A; Thu, 14 May 2009 02:34:49 +0000 (UTC) (envelope-from weongyo.jeong@gmail.com) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.235]) by mx1.freebsd.org (Postfix) with ESMTP id CAA428FC14; Thu, 14 May 2009 02:34:48 +0000 (UTC) (envelope-from weongyo.jeong@gmail.com) Received: by rv-out-0506.google.com with SMTP id k40so655970rvb.43 for ; Wed, 13 May 2009 19:34:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:received:from:date:to:cc :subject:message-id:reply-to:references:mime-version:content-type :content-disposition:in-reply-to:user-agent:organization :x-operation-sytem; bh=slPnMtQ0gvkgSvxRaar2T1owOMsjVTRji5ICFuTM3a8=; b=bMZPRgsoNIjXi73BrOZRzSvkKwylu0CPozN4AcRTZZ383HICrXy8tECCztwoceniv3 yYs5H/UAeMwrsQ3F2R2634INI/+CpBmIzRIOrM+y6Dum60C+gesONFp3Epg0eYFIZOCb Aa3cfQ+DClmpfUQNrAhr5XzFE/uSDVND8ZxzM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:date:to:cc:subject:message-id:reply-to:references:mime-version :content-type:content-disposition:in-reply-to:user-agent :organization:x-operation-sytem; b=UIYFhoK+LVGiez8gFFhbPMhSBhTeYbRlIibLgSlCj7HpVUFwIOVjAYKWXRFllcmraE J8Vxy3rmwMP3J/EU+Pn8mxiLvzcX+SuvOZIqTPT6F8MytkXkD9GT4z8Az7qF1A4Of8o6 nF9xzQT+eK+hF0Q2O6MHi0RvwXVr/nT8I8fv8= Received: by 10.141.18.15 with SMTP id v15mr543071rvi.197.1242266510422; Wed, 13 May 2009 19:01:50 -0700 (PDT) Received: from weongyo ([114.111.62.249]) by mx.google.com with ESMTPS id k37sm1889840rvb.28.2009.05.13.19.01.48 (version=SSLv3 cipher=RC4-MD5); Wed, 13 May 2009 19:01:50 -0700 (PDT) Received: by weongyo (sSMTP sendmail emulation); Thu, 14 May 2009 11:01:44 +0900 From: Weongyo Jeong Date: Thu, 14 May 2009 11:01:44 +0900 To: Robert Watson Message-ID: <20090514020144.GA42412@weongyo.cdnetworks.kr> References: <200905110239.n4B2dnSX075285@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Organization: CDNetworks. X-Operation-Sytem: FreeBSD Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191983 - in head/sys: dev/usb/wlan modules/usb/upgt X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Weongyo Jeong List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 02:34:49 -0000 On Wed, May 13, 2009 at 06:09:42PM +0100, Robert Watson wrote: > > On Mon, 11 May 2009, Weongyo Jeong wrote: > > >Author: weongyo > >Date: Mon May 11 02:39:49 2009 > >New Revision: 191983 > >URL: http://svn.freebsd.org/changeset/base/191983 > > > >Log: > > ports upgt(4) driver for USB2. > > Ah, great! Do you have any similar plans regarding urtw? Yes it'll happen before the code slush. :-) regards, Weongyo Jeong From owner-svn-src-head@FreeBSD.ORG Thu May 14 03:24:23 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E083010656F7; Thu, 14 May 2009 03:24:22 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CCC6C8FC13; Thu, 14 May 2009 03:24:22 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4E3OMUT075738; Thu, 14 May 2009 03:24:22 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4E3OM81075732; Thu, 14 May 2009 03:24:22 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <200905140324.n4E3OM81075732@svn.freebsd.org> From: Jeff Roberson Date: Thu, 14 May 2009 03:24:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192080 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 03:24:23 -0000 Author: jeff Date: Thu May 14 03:24:22 2009 New Revision: 192080 URL: http://svn.freebsd.org/changeset/base/192080 Log: - Implement a lockless file descriptor lookup algorithm in fget_unlocked(). - Save old file descriptor tables created on expansion until the entire descriptor table is freed so that pointers may be followed without regard for expanders. - Mark the file zone as NOFREE so we may attempt to reference potentially freed files. - Convert several fget_locked() users to fget_unlocked(). This requires us to manage reference counts explicitly but reduces locking overhead in the common case. Modified: head/sys/kern/kern_descrip.c head/sys/kern/sys_generic.c head/sys/kern/tty.c head/sys/kern/uipc_syscalls.c head/sys/kern/vfs_syscalls.c head/sys/sys/filedesc.h Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Thu May 14 02:42:29 2009 (r192079) +++ head/sys/kern/kern_descrip.c Thu May 14 03:24:22 2009 (r192080) @@ -125,12 +125,24 @@ static void fdused(struct filedesc *fdp, #define OFILESIZE (sizeof(struct file *) + sizeof(char)) /* + * Storage to hold unused ofiles that need to be reclaimed. + */ +struct freetable { + struct file **ft_table; + SLIST_ENTRY(freetable) ft_next; +}; + +/* * Basic allocation of descriptors: * one of the above, plus arrays for NDFILE descriptors. */ struct filedesc0 { struct filedesc fd_fd; /* + * ofiles which need to be reclaimed on free. + */ + SLIST_HEAD(,freetable) fd_free; + /* * These arrays are used when the number of open files is * <= NDFILE, and are then pointed to by the pointers above. */ @@ -1268,7 +1280,10 @@ out: static void fdgrowtable(struct filedesc *fdp, int nfd) { + struct filedesc0 *fdp0; + struct freetable *fo; struct file **ntable; + struct file **otable; char *nfileflags; int nnfiles, onfiles; NDSLOTTYPE *nmap; @@ -1287,7 +1302,7 @@ fdgrowtable(struct filedesc *fdp, int nf /* allocate a new table and (if required) new bitmaps */ FILEDESC_XUNLOCK(fdp); - ntable = malloc(nnfiles * OFILESIZE, + ntable = malloc((nnfiles * OFILESIZE) + sizeof(struct freetable), M_FILEDESC, M_ZERO | M_WAITOK); nfileflags = (char *)&ntable[nnfiles]; if (NDSLOTS(nnfiles) > NDSLOTS(onfiles)) @@ -1311,10 +1326,20 @@ fdgrowtable(struct filedesc *fdp, int nf } bcopy(fdp->fd_ofiles, ntable, onfiles * sizeof(*ntable)); bcopy(fdp->fd_ofileflags, nfileflags, onfiles); - if (onfiles > NDFILE) - free(fdp->fd_ofiles, M_FILEDESC); - fdp->fd_ofiles = ntable; + otable = fdp->fd_ofiles; fdp->fd_ofileflags = nfileflags; + fdp->fd_ofiles = ntable; + /* + * We must preserve ofiles until the process exits because we can't + * be certain that no threads have references to the old table via + * _fget(). + */ + if (onfiles > NDFILE) { + fo = (struct freetable *)&otable[onfiles]; + fdp0 = (struct filedesc0 *)fdp; + fo->ft_table = otable; + SLIST_INSERT_HEAD(&fdp0->fd_free, fo, ft_next); + } if (NDSLOTS(nnfiles) > NDSLOTS(onfiles)) { bcopy(fdp->fd_map, nmap, NDSLOTS(onfiles) * sizeof(*nmap)); if (NDSLOTS(onfiles) > NDSLOTS(NDFILE)) @@ -1512,6 +1537,8 @@ fdhold(struct proc *p) static void fddrop(struct filedesc *fdp) { + struct filedesc0 *fdp0; + struct freetable *ft; int i; mtx_lock(&fdesc_mtx); @@ -1521,6 +1548,11 @@ fddrop(struct filedesc *fdp) return; FILEDESC_LOCK_DESTROY(fdp); + fdp0 = (struct filedesc0 *)fdp; + while ((ft = SLIST_FIRST(&fdp0->fd_free)) != NULL) { + SLIST_REMOVE_HEAD(&fdp0->fd_free, ft_next); + free(ft->ft_table, M_FILEDESC); + } free(fdp, M_FILEDESC); } @@ -2022,6 +2054,38 @@ finit(struct file *fp, u_int flag, short atomic_store_rel_ptr((volatile uintptr_t *)&fp->f_ops, (uintptr_t)ops); } +struct file * +fget_unlocked(struct filedesc *fdp, int fd) +{ + struct file *fp; + u_int count; + + if (fd < 0 || fd >= fdp->fd_nfiles) + return (NULL); + /* + * Fetch the descriptor locklessly. We avoid fdrop() races by + * never raising a refcount above 0. To accomplish this we have + * to use a cmpset loop rather than an atomic_add. The descriptor + * must be re-verified once we acquire a reference to be certain + * that the identity is still correct and we did not lose a race + * due to preemption. + */ + for (;;) { + fp = fdp->fd_ofiles[fd]; + if (fp == NULL) + break; + count = fp->f_count; + if (count == 0) + continue; + if (atomic_cmpset_int(&fp->f_count, count, count + 1) != 1) + continue; + if (fp == ((struct file *volatile*)fdp->fd_ofiles)[fd]) + break; + fdrop(fp, curthread); + } + + return (fp); +} /* * Extract the file pointer associated with the specified descriptor for the @@ -2030,16 +2094,12 @@ finit(struct file *fp, u_int flag, short * If the descriptor doesn't exist or doesn't match 'flags', EBADF is * returned. * - * If 'hold' is set (non-zero) the file's refcount will be bumped on return. - * It should be dropped with fdrop(). If it is not set, then the refcount - * will not be bumped however the thread's filedesc struct will be returned - * locked (for fgetsock). - * * If an error occured the non-zero error is returned and *fpp is set to - * NULL. Otherwise *fpp is set and zero is returned. + * NULL. Otherwise *fpp is held and set and zero is returned. Caller is + * responsible for fdrop(). */ static __inline int -_fget(struct thread *td, int fd, struct file **fpp, int flags, int hold) +_fget(struct thread *td, int fd, struct file **fpp, int flags) { struct filedesc *fdp; struct file *fp; @@ -2047,29 +2107,22 @@ _fget(struct thread *td, int fd, struct *fpp = NULL; if (td == NULL || (fdp = td->td_proc->p_fd) == NULL) return (EBADF); - FILEDESC_SLOCK(fdp); - if ((fp = fget_locked(fdp, fd)) == NULL || fp->f_ops == &badfileops) { - FILEDESC_SUNLOCK(fdp); + if ((fp = fget_unlocked(fdp, fd)) == NULL) + return (EBADF); + if (fp->f_ops == &badfileops) { + fdrop(fp, td); return (EBADF); } - /* * FREAD and FWRITE failure return EBADF as per POSIX. * * Only one flag, or 0, may be specified. */ - if (flags == FREAD && (fp->f_flag & FREAD) == 0) { - FILEDESC_SUNLOCK(fdp); - return (EBADF); - } - if (flags == FWRITE && (fp->f_flag & FWRITE) == 0) { - FILEDESC_SUNLOCK(fdp); + if ((flags == FREAD && (fp->f_flag & FREAD) == 0) || + (flags == FWRITE && (fp->f_flag & FWRITE) == 0)) { + fdrop(fp, td); return (EBADF); } - if (hold) { - fhold(fp); - FILEDESC_SUNLOCK(fdp); - } *fpp = fp; return (0); } @@ -2078,21 +2131,21 @@ int fget(struct thread *td, int fd, struct file **fpp) { - return(_fget(td, fd, fpp, 0, 1)); + return(_fget(td, fd, fpp, 0)); } int fget_read(struct thread *td, int fd, struct file **fpp) { - return(_fget(td, fd, fpp, FREAD, 1)); + return(_fget(td, fd, fpp, FREAD)); } int fget_write(struct thread *td, int fd, struct file **fpp) { - return(_fget(td, fd, fpp, FWRITE, 1)); + return(_fget(td, fd, fpp, FWRITE)); } /* @@ -2109,7 +2162,7 @@ _fgetvp(struct thread *td, int fd, struc int error; *vpp = NULL; - if ((error = _fget(td, fd, &fp, flags, 0)) != 0) + if ((error = _fget(td, fd, &fp, flags)) != 0) return (error); if (fp->f_vnode == NULL) { error = EINVAL; @@ -2117,7 +2170,8 @@ _fgetvp(struct thread *td, int fd, struc *vpp = fp->f_vnode; vref(*vpp); } - FILEDESC_SUNLOCK(td->td_proc->p_fd); + fdrop(fp, td); + return (error); } @@ -2164,7 +2218,7 @@ fgetsock(struct thread *td, int fd, stru *spp = NULL; if (fflagp != NULL) *fflagp = 0; - if ((error = _fget(td, fd, &fp, 0, 0)) != 0) + if ((error = _fget(td, fd, &fp, 0)) != 0) return (error); if (fp->f_type != DTYPE_SOCKET) { error = ENOTSOCK; @@ -2176,7 +2230,8 @@ fgetsock(struct thread *td, int fd, stru soref(*spp); SOCK_UNLOCK(*spp); } - FILEDESC_SUNLOCK(td->td_proc->p_fd); + fdrop(fp, td); + return (error); } @@ -3147,7 +3202,7 @@ filelistinit(void *dummy) { file_zone = uma_zcreate("Files", sizeof(struct file), NULL, NULL, - NULL, NULL, UMA_ALIGN_PTR, 0); + NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); mtx_init(&sigio_lock, "sigio lock", NULL, MTX_DEF); mtx_init(&fdesc_mtx, "fdesc", NULL, MTX_DEF); } Modified: head/sys/kern/sys_generic.c ============================================================================== --- head/sys/kern/sys_generic.c Thu May 14 02:42:29 2009 (r192079) +++ head/sys/kern/sys_generic.c Thu May 14 03:24:22 2009 (r192080) @@ -988,7 +988,6 @@ selrescan(struct thread *td, fd_mask **i fdp = td->td_proc->p_fd; stp = td->td_sel; n = 0; - FILEDESC_SLOCK(fdp); STAILQ_FOREACH_SAFE(sfp, &stp->st_selq, sf_link, sfn) { fd = (int)(uintptr_t)sfp->sf_cookie; si = sfp->sf_si; @@ -996,17 +995,15 @@ selrescan(struct thread *td, fd_mask **i /* If the selinfo wasn't cleared the event didn't fire. */ if (si != NULL) continue; - if ((fp = fget_locked(fdp, fd)) == NULL) { - FILEDESC_SUNLOCK(fdp); + if ((fp = fget_unlocked(fdp, fd)) == NULL) return (EBADF); - } idx = fd / NFDBITS; bit = (fd_mask)1 << (fd % NFDBITS); ev = fo_poll(fp, selflags(ibits, idx, bit), td->td_ucred, td); + fdrop(fp, td); if (ev != 0) n += selsetbits(ibits, obits, idx, bit, ev); } - FILEDESC_SUNLOCK(fdp); stp->st_flags = 0; td->td_retval[0] = n; return (0); @@ -1030,7 +1027,6 @@ selscan(td, ibits, obits, nfd) fdp = td->td_proc->p_fd; n = 0; - FILEDESC_SLOCK(fdp); for (idx = 0, fd = 0; fd < nfd; idx++) { end = imin(fd + NFDBITS, nfd); for (bit = 1; fd < end; bit <<= 1, fd++) { @@ -1038,18 +1034,16 @@ selscan(td, ibits, obits, nfd) flags = selflags(ibits, idx, bit); if (flags == 0) continue; - if ((fp = fget_locked(fdp, fd)) == NULL) { - FILEDESC_SUNLOCK(fdp); + if ((fp = fget_unlocked(fdp, fd)) == NULL) return (EBADF); - } selfdalloc(td, (void *)(uintptr_t)fd); ev = fo_poll(fp, flags, td->td_ucred, td); + fdrop(fp, td); if (ev != 0) n += selsetbits(ibits, obits, idx, bit, ev); } } - FILEDESC_SUNLOCK(fdp); td->td_retval[0] = n; return (0); } Modified: head/sys/kern/tty.c ============================================================================== --- head/sys/kern/tty.c Thu May 14 02:42:29 2009 (r192079) +++ head/sys/kern/tty.c Thu May 14 03:24:22 2009 (r192080) @@ -1720,10 +1720,13 @@ ttyhook_register(struct tty **rtp, struc /* Validate the file descriptor. */ if ((fdp = p->p_fd) == NULL) return (EBADF); - FILEDESC_SLOCK(fdp); - if ((fp = fget_locked(fdp, fd)) == NULL || fp->f_ops == &badfileops) { - FILEDESC_SUNLOCK(fdp); + + fp = fget_unlocked(fdp, fd); + if (fp == NULL) return (EBADF); + if (fp->f_ops == &badfileops) { + error = EBADF; + goto done1; } /* Make sure the vnode is bound to a character device. */ @@ -1763,7 +1766,7 @@ ttyhook_register(struct tty **rtp, struc done3: tty_unlock(tp); done2: dev_relthread(dev); -done1: FILEDESC_SUNLOCK(fdp); +done1: fdrop(fp, curthread); return (error); } Modified: head/sys/kern/uipc_syscalls.c ============================================================================== --- head/sys/kern/uipc_syscalls.c Thu May 14 02:42:29 2009 (r192079) +++ head/sys/kern/uipc_syscalls.c Thu May 14 03:24:22 2009 (r192080) @@ -122,23 +122,16 @@ getsock(struct filedesc *fdp, int fd, st int error; fp = NULL; - if (fdp == NULL) + if (fdp == NULL || (fp = fget_unlocked(fdp, fd)) == NULL) { error = EBADF; - else { - FILEDESC_SLOCK(fdp); - fp = fget_locked(fdp, fd); - if (fp == NULL) - error = EBADF; - else if (fp->f_type != DTYPE_SOCKET) { - fp = NULL; - error = ENOTSOCK; - } else { - fhold(fp); - if (fflagp != NULL) - *fflagp = fp->f_flag; - error = 0; - } - FILEDESC_SUNLOCK(fdp); + } else if (fp->f_type != DTYPE_SOCKET) { + fdrop(fp, curthread); + fp = NULL; + error = ENOTSOCK; + } else { + if (fflagp != NULL) + *fflagp = fp->f_flag; + error = 0; } *fpp = fp; return (error); Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Thu May 14 02:42:29 2009 (r192079) +++ head/sys/kern/vfs_syscalls.c Thu May 14 03:24:22 2009 (r192080) @@ -4235,22 +4235,13 @@ getvnode(fdp, fd, fpp) int error; struct file *fp; + error = 0; fp = NULL; - if (fdp == NULL) + if (fdp == NULL || (fp = fget_unlocked(fdp, fd)) == NULL) error = EBADF; - else { - FILEDESC_SLOCK(fdp); - if ((u_int)fd >= fdp->fd_nfiles || - (fp = fdp->fd_ofiles[fd]) == NULL) - error = EBADF; - else if (fp->f_vnode == NULL) { - fp = NULL; - error = EINVAL; - } else { - fhold(fp); - error = 0; - } - FILEDESC_SUNLOCK(fdp); + else if (fp->f_vnode == NULL) { + error = EINVAL; + fdrop(fp, curthread); } *fpp = fp; return (error); Modified: head/sys/sys/filedesc.h ============================================================================== --- head/sys/sys/filedesc.h Thu May 14 02:42:29 2009 (r192079) +++ head/sys/sys/filedesc.h Thu May 14 03:24:22 2009 (r192080) @@ -129,6 +129,10 @@ int getvnode(struct filedesc *fdp, int f void mountcheckdirs(struct vnode *olddp, struct vnode *newdp); void setugidsafety(struct thread *td); +/* Return a referenced file from an unlocked descriptor. */ +struct file *fget_unlocked(struct filedesc *fdp, int fd); + +/* Requires a FILEDESC_{S,X}LOCK held and returns without a ref. */ static __inline struct file * fget_locked(struct filedesc *fdp, int fd) { From owner-svn-src-head@FreeBSD.ORG Thu May 14 03:33:05 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 182CB106566B; Thu, 14 May 2009 03:33:05 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0656F8FC08; Thu, 14 May 2009 03:33:05 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4E3X4j8075933; Thu, 14 May 2009 03:33:04 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4E3X4sG075932; Thu, 14 May 2009 03:33:04 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905140333.n4E3X4sG075932@svn.freebsd.org> From: Kip Macy Date: Thu, 14 May 2009 03:33:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192081 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 03:33:05 -0000 Author: kmacy Date: Thu May 14 03:33:04 2009 New Revision: 192081 URL: http://svn.freebsd.org/changeset/base/192081 Log: Call drbr_stats_update to update ifp stats directly when we bypass the buf_ring on transmit Modified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Thu May 14 03:24:22 2009 (r192080) +++ head/sys/dev/e1000/if_em.c Thu May 14 03:33:04 2009 (r192081) @@ -1006,15 +1006,18 @@ em_transmit_locked(struct ifnet *ifp, st || (!adapter->link_active)) { error = drbr_enqueue(ifp, adapter->br, m); return (error); - } - - if (ADAPTER_RING_EMPTY(adapter) && + } else if (ADAPTER_RING_EMPTY(adapter) && (adapter->num_tx_desc_avail > EM_TX_OP_THRESHOLD)) { if (em_xmit(adapter, &m)) { if (m && (error = drbr_enqueue(ifp, adapter->br, m)) != 0) return (error); } else { /* + * We've bypassed the buf ring so we need to update + * ifp directly + */ + drbr_stats_update(ifp, m->m_pkthdr.len, m->m_flags); + /* ** Send a copy of the frame to the BPF ** listener and set the watchdog on. */ From owner-svn-src-head@FreeBSD.ORG Thu May 14 05:27:10 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 58848106564A; Thu, 14 May 2009 05:27:10 +0000 (UTC) (envelope-from qingli@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 463B88FC1F; Thu, 14 May 2009 05:27:10 +0000 (UTC) (envelope-from qingli@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4E5R97g078251; Thu, 14 May 2009 05:27:09 GMT (envelope-from qingli@svn.freebsd.org) Received: (from qingli@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4E5R9Lj078250; Thu, 14 May 2009 05:27:09 GMT (envelope-from qingli@svn.freebsd.org) Message-Id: <200905140527.n4E5R9Lj078250@svn.freebsd.org> From: Qing Li Date: Thu, 14 May 2009 05:27:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192085 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 05:27:10 -0000 Author: qingli Date: Thu May 14 05:27:09 2009 New Revision: 192085 URL: http://svn.freebsd.org/changeset/base/192085 Log: Ignore the INADDR_ANY address inserted/deleted by DHCP when installing a loopback route to the interface address. Modified: head/sys/netinet/in.c Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Thu May 14 03:54:03 2009 (r192084) +++ head/sys/netinet/in.c Thu May 14 05:27:09 2009 (r192085) @@ -906,6 +906,9 @@ in_ifinit(struct ifnet *ifp, struct in_i if ((error = in_addprefix(ia, flags)) != 0) return (error); + if (ia->ia_addr.sin_addr.s_addr == INADDR_ANY) + return (0); + /* * add a loopback route to self */ @@ -1014,7 +1017,8 @@ in_scrubprefix(struct in_ifaddr *target) if ((target->ia_flags & IFA_ROUTE) == 0) return (0); - if (!(target->ia_ifp->if_flags & (IFF_LOOPBACK | IFF_POINTOPOINT))) { + if ((target->ia_addr.sin_addr.s_addr != INADDR_ANY) && + !(target->ia_ifp->if_flags & (IFF_LOOPBACK | IFF_POINTOPOINT))) { bzero(&null_sdl, sizeof(null_sdl)); null_sdl.sdl_len = sizeof(null_sdl); null_sdl.sdl_family = AF_LINK; From owner-svn-src-head@FreeBSD.ORG Thu May 14 08:26:20 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6FF8D106564A; Thu, 14 May 2009 08:26:20 +0000 (UTC) (envelope-from rodrigc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5EA7C8FC0A; Thu, 14 May 2009 08:26:20 +0000 (UTC) (envelope-from rodrigc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4E8QKxJ081909; Thu, 14 May 2009 08:26:20 GMT (envelope-from rodrigc@svn.freebsd.org) Received: (from rodrigc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4E8QK0t081908; Thu, 14 May 2009 08:26:20 GMT (envelope-from rodrigc@svn.freebsd.org) Message-Id: <200905140826.n4E8QK0t081908@svn.freebsd.org> From: Craig Rodrigues Date: Thu, 14 May 2009 08:26:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192089 - head/etc/defaults X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 08:26:20 -0000 Author: rodrigc Date: Thu May 14 08:26:20 2009 New Revision: 192089 URL: http://svn.freebsd.org/changeset/base/192089 Log: Set crashinfo_enable to "YES" by default. During bootup, if /etc/rc.d/savecore detects a core dump file on the dump device, the core file will be saved, and the crashinfo script will be run to generate a human-readable report. This will make it easier for end-users to provide feedback to developers about kernel crashes. Reviewed by: jhb Modified: head/etc/defaults/rc.conf Modified: head/etc/defaults/rc.conf ============================================================================== --- head/etc/defaults/rc.conf Thu May 14 07:32:33 2009 (r192088) +++ head/etc/defaults/rc.conf Thu May 14 08:26:20 2009 (r192089) @@ -543,7 +543,7 @@ chkprintcap_flags="-d" # Create missing dumpdev="AUTO" # Device to crashdump to (device name, AUTO, or NO). dumpdir="/var/crash" # Directory where crash dumps are to be stored savecore_flags="" # Used if dumpdev is enabled above, and present. -crashinfo_enable="NO" # Automatically generate crash dump summary. +crashinfo_enable="YES" # Automatically generate crash dump summary. crashinfo_program="/usr/sbin/crashinfo" # Script to generate crash dump summary. quota_enable="NO" # turn on quotas on startup (or NO). check_quotas="YES" # Check quotas on startup (or NO). From owner-svn-src-head@FreeBSD.ORG Thu May 14 09:28:02 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9900106564A; Thu, 14 May 2009 09:28:02 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 989638FC1C; Thu, 14 May 2009 09:28:02 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4E9S2tC083182; Thu, 14 May 2009 09:28:02 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4E9S2ac083181; Thu, 14 May 2009 09:28:02 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <200905140928.n4E9S2ac083181@svn.freebsd.org> From: Christian Brueffer Date: Thu, 14 May 2009 09:28:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192090 - head/sys/compat/ndis X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 09:28:03 -0000 Author: brueffer Date: Thu May 14 09:28:02 2009 New Revision: 192090 URL: http://svn.freebsd.org/changeset/base/192090 Log: Remove an unused variable. Found with: Coverity Prevent(tm) CID: 1167 Modified: head/sys/compat/ndis/subr_ndis.c Modified: head/sys/compat/ndis/subr_ndis.c ============================================================================== --- head/sys/compat/ndis/subr_ndis.c Thu May 14 08:26:20 2009 (r192089) +++ head/sys/compat/ndis/subr_ndis.c Thu May 14 09:28:02 2009 (r192090) @@ -2390,11 +2390,9 @@ NdisMDeregisterInterrupt(intr) ndis_miniport_interrupt *intr; { ndis_miniport_block *block; - struct ndis_softc *sc; uint8_t irql; block = intr->ni_block; - sc = device_get_softc(block->nmb_physdeviceobj->do_devext); /* Should really be KeSynchronizeExecution() */ From owner-svn-src-head@FreeBSD.ORG Thu May 14 10:54:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EAD511065673; Thu, 14 May 2009 10:54:57 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DAB488FC1C; Thu, 14 May 2009 10:54:57 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4EAsvVu088978; Thu, 14 May 2009 10:54:57 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4EAsvp1088977; Thu, 14 May 2009 10:54:57 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200905141054.n4EAsvp1088977@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 14 May 2009 10:54:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192094 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 10:54:58 -0000 Author: kib Date: Thu May 14 10:54:57 2009 New Revision: 192094 URL: http://svn.freebsd.org/changeset/base/192094 Log: Do not advance req->oldidx when sysctl_old_user returning an error due to copyout failure or short buffer. The later breaks the usermode iterators of the sysctl results that pack arbitrary number of variable-sized structures. Iterator expects that kernel filled exactly oldlen bytes, and tries to interpret half-filled or garbage structure at the end of the buffer. In particular, kinfo_getfile(3) segfaulted. Reported and tested by: pho MFC after: 3 weeks Modified: head/sys/kern/kern_sysctl.c Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Thu May 14 10:47:11 2009 (r192093) +++ head/sys/kern/kern_sysctl.c Thu May 14 10:54:57 2009 (r192094) @@ -1221,9 +1221,9 @@ sysctl_old_kernel(struct sysctl_req *req if (i > 0) bcopy(p, (char *)req->oldptr + req->oldidx, i); } - req->oldidx += l; if (req->oldptr && i != l) return (ENOMEM); + req->oldidx += l; return (0); } @@ -1320,9 +1320,10 @@ sysctl_old_user(struct sysctl_req *req, size_t i, len, origidx; origidx = req->oldidx; - req->oldidx += l; - if (req->oldptr == NULL) + if (req->oldptr == NULL) { + req->oldidx += l; return (0); + } /* * If we have not wired the user supplied buffer and we are currently * holding locks, drop a witness warning, as it's possible that @@ -1344,6 +1345,7 @@ sysctl_old_user(struct sysctl_req *req, return (error); if (i < l) return (ENOMEM); + req->oldidx += l; return (0); } From owner-svn-src-head@FreeBSD.ORG Thu May 14 12:39:22 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CFB5D1065679; Thu, 14 May 2009 12:39:22 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BD77E8FC24; Thu, 14 May 2009 12:39:22 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4ECdMPe091152; Thu, 14 May 2009 12:39:22 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4ECdMsp091151; Thu, 14 May 2009 12:39:22 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200905141239.n4ECdMsp091151@svn.freebsd.org> From: Robert Watson Date: Thu, 14 May 2009 12:39:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192096 - head/sys/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 12:39:23 -0000 Author: rwatson Date: Thu May 14 12:39:22 2009 New Revision: 192096 URL: http://svn.freebsd.org/changeset/base/192096 Log: Remove usb_ethersubr.c missed reference -- we don't build ousb with LINT, so the tinderbox didn't pick this up. Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu May 14 11:03:05 2009 (r192095) +++ head/sys/conf/files Thu May 14 12:39:22 2009 (r192096) @@ -1535,7 +1535,6 @@ legacy/dev/usb/ums.c optional oums legacy/dev/usb/uplcom.c optional ouplcom legacy/dev/usb/urio.c optional ourio legacy/dev/usb/usb.c optional ousb -legacy/dev/usb/usb_ethersubr.c optional ousb legacy/dev/usb/usb_if.m optional ousb legacy/dev/usb/usb_mem.c optional ousb legacy/dev/usb/usb_quirks.c optional ousb From owner-svn-src-head@FreeBSD.ORG Thu May 14 13:32:34 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 559991065679; Thu, 14 May 2009 13:32:34 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 433588FC1D; Thu, 14 May 2009 13:32:34 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4EDWY5K092269; Thu, 14 May 2009 13:32:34 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4EDWYdL092268; Thu, 14 May 2009 13:32:34 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <200905141332.n4EDWYdL092268@svn.freebsd.org> From: Christian Brueffer Date: Thu, 14 May 2009 13:32:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192097 - head/sys/dev/iir X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 13:32:35 -0000 Author: brueffer Date: Thu May 14 13:32:33 2009 New Revision: 192097 URL: http://svn.freebsd.org/changeset/base/192097 Log: Compare the correct variable against NULL. Reviewed by: scottl Found with: Coverity Prevent(tm) CID: 821 MFC after: 2 weeks Modified: head/sys/dev/iir/iir_pci.c Modified: head/sys/dev/iir/iir_pci.c ============================================================================== --- head/sys/dev/iir/iir_pci.c Thu May 14 12:39:22 2009 (r192096) +++ head/sys/dev/iir/iir_pci.c Thu May 14 13:32:33 2009 (r192097) @@ -202,7 +202,7 @@ iir_pci_attach(device_t dev) rid = 0; irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE | RF_SHAREABLE); - if (io == NULL) { + if (irq == NULL) { device_printf(dev, "can't find IRQ value\n"); error = ENOMEM; goto err; From owner-svn-src-head@FreeBSD.ORG Thu May 14 14:51:30 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB2BC1065670; Thu, 14 May 2009 14:51:30 +0000 (UTC) (envelope-from gnn@neville-neil.com) Received: from mail.meer.net (mail.meer.net [64.13.141.3]) by mx1.freebsd.org (Postfix) with ESMTP id CE5268FC18; Thu, 14 May 2009 14:51:30 +0000 (UTC) (envelope-from gnn@neville-neil.com) Received: from mail2.meer.net (mail2.meer.net [64.13.141.16]) by mail.meer.net (8.13.3/8.13.3/meer) with ESMTP id n4EEaPNE080782; Thu, 14 May 2009 07:36:25 -0700 (PDT) (envelope-from gnn@neville-neil.com) Received: from 2-196.dhcp.neophilic.net (faustus.neophilic.net [64.81.247.227]) (authenticated bits=0) by mail2.meer.net (8.14.1/8.14.3) with ESMTP id n4EEaOMC024782 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Thu, 14 May 2009 07:36:25 -0700 (PDT) (envelope-from gnn@neville-neil.com) Message-Id: <9CCFD49C-C5B3-4C45-BA74-AC29CF1F0EDA@neville-neil.com> From: George Neville-Neil To: Qing Li In-Reply-To: <200905140527.n4E5R9Lj078250@svn.freebsd.org> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v935.3) Date: Thu, 14 May 2009 07:36:24 -0700 References: <200905140527.n4E5R9Lj078250@svn.freebsd.org> X-Mailer: Apple Mail (2.935.3) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r192085 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 14:51:31 -0000 On May 13, 2009, at 22:27 , Qing Li wrote: > Author: qingli > Date: Thu May 14 05:27:09 2009 > New Revision: 192085 > URL: http://svn.freebsd.org/changeset/base/192085 > > Log: > Ignore the INADDR_ANY address inserted/deleted by DHCP when > installing a loopback route > to the interface address. > Hi, Can you give more detail as to the purpose of this change? I'm a bit confused by it. Does this fix any of the recent problems seen with DHCP and PXE or is this unrelated? Best, George From owner-svn-src-head@FreeBSD.ORG Thu May 14 14:57:14 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB110106567B; Thu, 14 May 2009 14:57:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C83248FC17; Thu, 14 May 2009 14:57:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4EEvD8r094449; Thu, 14 May 2009 14:57:13 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4EEvDah094446; Thu, 14 May 2009 14:57:13 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200905141457.n4EEvDah094446@svn.freebsd.org> From: John Baldwin Date: Thu, 14 May 2009 14:57:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192105 - in head/sys/dev/ata: . chipsets X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 14:57:14 -0000 Author: jhb Date: Thu May 14 14:57:13 2009 New Revision: 192105 URL: http://svn.freebsd.org/changeset/base/192105 Log: - Add a void pointer to the ata-pci controller softc to allow chipset-specific code to attach chipset-specific data. - Use chipset-specific data in the acard and promise chipsets rather than changing the ivars of ATA PCI devices. ivars are reserved for use by the parent bus driver and are _not_ available for use by devices directly. This fixes a panic during sysctl -a with certain Promise controllers with ACPI enabled. Reviewed by: mav Tested by: Magnus Kling (kingfon @ gmail) (on 7) MFC after: 3 days Modified: head/sys/dev/ata/ata-pci.h head/sys/dev/ata/chipsets/ata-acard.c head/sys/dev/ata/chipsets/ata-promise.c Modified: head/sys/dev/ata/ata-pci.h ============================================================================== --- head/sys/dev/ata/ata-pci.h Thu May 14 14:18:53 2009 (r192104) +++ head/sys/dev/ata/ata-pci.h Thu May 14 14:57:13 2009 (r192105) @@ -66,6 +66,7 @@ struct ata_pci_controller { void (*function)(void *); void *argument; } interrupt[8]; /* XXX SOS max ch# for now */ + void *chipset_data; }; /* defines for known chipset PCI id's */ Modified: head/sys/dev/ata/chipsets/ata-acard.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-acard.c Thu May 14 14:18:53 2009 (r192104) +++ head/sys/dev/ata/chipsets/ata-acard.c Thu May 14 14:57:13 2009 (r192105) @@ -51,6 +51,12 @@ __FBSDID("$FreeBSD$"); #include #include +struct ata_serialize { + struct mtx locked_mtx; + int locked_ch; + int restart_ch; +}; + /* local prototypes */ static int ata_acard_chipinit(device_t dev); static int ata_acard_ch_attach(device_t dev); @@ -58,6 +64,7 @@ static int ata_acard_status(device_t dev static void ata_acard_850_setmode(device_t dev, int mode); static void ata_acard_86X_setmode(device_t dev, int mode); static int ata_serialize(device_t dev, int flags); +static void ata_serialize_init(struct ata_serialize *serial); /* misc defines */ #define ATP_OLD 1 @@ -93,6 +100,7 @@ static int ata_acard_chipinit(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); + struct ata_serialize *serial; if (ata_setup_interrupt(dev, ata_generic_intr)) return ENXIO; @@ -102,6 +110,10 @@ ata_acard_chipinit(device_t dev) if (ctlr->chip->cfg1 == ATP_OLD) { ctlr->setmode = ata_acard_850_setmode; ctlr->locking = ata_serialize; + serial = malloc(sizeof(struct ata_serialize), + M_TEMP, M_WAITOK | M_ZERO); + ata_serialize_init(serial); + ctlr->chipset_data = serial; } else ctlr->setmode = ata_acard_86X_setmode; @@ -225,11 +237,14 @@ ata_acard_86X_setmode(device_t dev, int /* we could set PIO mode timings, but we assume the BIOS did that */ } -struct ata_serialize { - struct mtx locked_mtx; - int locked_ch; - int restart_ch; -}; +static void +ata_serialize_init(struct ata_serialize *serial) +{ + + mtx_init(&serial->locked_mtx, "ATA serialize lock", NULL, MTX_DEF); + serial->locked_ch = -1; + serial->restart_ch = -1; +} static int ata_serialize(device_t dev, int flags) @@ -237,20 +252,9 @@ ata_serialize(device_t dev, int flags) struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ata_channel *ch = device_get_softc(dev); struct ata_serialize *serial; - static int inited = 0; int res; - if (!inited) { - serial = malloc(sizeof(struct ata_serialize), - M_TEMP, M_NOWAIT | M_ZERO); - mtx_init(&serial->locked_mtx, "ATA serialize lock", NULL, MTX_DEF); - serial->locked_ch = -1; - serial->restart_ch = -1; - device_set_ivars(ctlr->dev, serial); - inited = 1; - } - else - serial = device_get_ivars(ctlr->dev); + serial = ctlr->chipset_data; mtx_lock(&serial->locked_mtx); switch (flags) { Modified: head/sys/dev/ata/chipsets/ata-promise.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-promise.c Thu May 14 14:18:53 2009 (r192104) +++ head/sys/dev/ata/chipsets/ata-promise.c Thu May 14 14:57:13 2009 (r192105) @@ -283,7 +283,7 @@ ata_promise_chipinit(device_t dev) mtx_init(&hpkt->mtx, "ATA promise HPKT lock", NULL, MTX_DEF); TAILQ_INIT(&hpkt->queue); hpkt->busy = 0; - device_set_ivars(dev, hpkt); + ctlr->chipset_data = hpkt; ctlr->ch_attach = ata_promise_mio_ch_attach; ctlr->ch_detach = ata_promise_mio_ch_detach; ctlr->reset = ata_promise_mio_reset; @@ -730,7 +730,7 @@ ata_promise_mio_reset(device_t dev) case PR_SX4X: /* softreset channel ATA module */ - hpktp = device_get_ivars(ctlr->dev); + hpktp = ctlr->chipset_data; ATA_OUTL(ctlr->r_res2, 0xc0260 + (ch->unit << 7), ch->unit + 1); ata_udelay(1000); ATA_OUTL(ctlr->r_res2, 0xc0260 + (ch->unit << 7), @@ -1208,7 +1208,7 @@ ata_promise_apkt(u_int8_t *bytep, struct static void ata_promise_queue_hpkt(struct ata_pci_controller *ctlr, u_int32_t hpkt) { - struct ata_promise_sx4 *hpktp = device_get_ivars(ctlr->dev); + struct ata_promise_sx4 *hpktp = ctlr->chipset_data; mtx_lock(&hpktp->mtx); if (hpktp->busy) { @@ -1227,7 +1227,7 @@ ata_promise_queue_hpkt(struct ata_pci_co static void ata_promise_next_hpkt(struct ata_pci_controller *ctlr) { - struct ata_promise_sx4 *hpktp = device_get_ivars(ctlr->dev); + struct ata_promise_sx4 *hpktp = ctlr->chipset_data; struct host_packet *hp; mtx_lock(&hpktp->mtx); From owner-svn-src-head@FreeBSD.ORG Thu May 14 15:14:24 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0406A106564A; Thu, 14 May 2009 15:14:24 +0000 (UTC) (envelope-from dimitry@andric.com) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id B78E88FC08; Thu, 14 May 2009 15:14:23 +0000 (UTC) (envelope-from dimitry@andric.com) Received: from [IPv6:2001:7b8:3a7:0:78da:88d8:784a:2f5d] (unknown [IPv6:2001:7b8:3a7:0:78da:88d8:784a:2f5d]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id D65685C43; Thu, 14 May 2009 17:14:22 +0200 (CEST) Message-ID: <4A0C3551.1090501@andric.com> Date: Thu, 14 May 2009 17:14:25 +0200 From: Dimitry Andric User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.1b5pre) Gecko/20090508 Shredder/3.0b3pre MIME-Version: 1.0 To: George Neville-Neil References: <200905140527.n4E5R9Lj078250@svn.freebsd.org> <9CCFD49C-C5B3-4C45-BA74-AC29CF1F0EDA@neville-neil.com> In-Reply-To: <9CCFD49C-C5B3-4C45-BA74-AC29CF1F0EDA@neville-neil.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, Qing Li , svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r192085 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 15:14:24 -0000 On 2009-05-14 16:36, George Neville-Neil wrote: > Can you give more detail as to the purpose of this change? I'm a bit > confused by it. Does > this fix any of the recent problems seen with DHCP and PXE or is this > unrelated? It fixes at least the DHCP issue, but I didn't see any independent confirmation of it having fixed PXE, although it likely will. This fix originated from: http://docs.freebsd.org/cgi/mid.cgi?B583FBF374231F4A89607B4D08578A43041C25D9 From owner-svn-src-head@FreeBSD.ORG Thu May 14 16:01:29 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E19B41065673; Thu, 14 May 2009 16:01:29 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CE8AA8FC1D; Thu, 14 May 2009 16:01:29 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4EG1TaR095664; Thu, 14 May 2009 16:01:29 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4EG1TP2095661; Thu, 14 May 2009 16:01:29 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <200905141601.n4EG1TP2095661@svn.freebsd.org> From: Takahashi Yoshihiro Date: Thu, 14 May 2009 16:01:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192106 - in head/sys: conf pc98/include pc98/pc98 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 16:01:30 -0000 Author: nyan Date: Thu May 14 16:01:29 2009 New Revision: 192106 URL: http://svn.freebsd.org/changeset/base/192106 Log: MFi386: revision 192050 Implement simple machine check support. Added: head/sys/pc98/include/mca.h (contents, props changed) Modified: head/sys/conf/files.pc98 head/sys/pc98/pc98/machdep.c Modified: head/sys/conf/files.pc98 ============================================================================== --- head/sys/conf/files.pc98 Thu May 14 14:57:13 2009 (r192105) +++ head/sys/conf/files.pc98 Thu May 14 16:01:29 2009 (r192106) @@ -150,6 +150,7 @@ i386/i386/k6_mem.c optional mem i386/i386/legacy.c standard i386/i386/local_apic.c optional apic i386/i386/locore.s standard no-obj +i386/i386/mca.c standard i386/i386/mem.c optional mem i386/i386/minidump_machdep.c standard i386/i386/mp_clock.c optional smp Added: head/sys/pc98/include/mca.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/pc98/include/mca.h Thu May 14 16:01:29 2009 (r192106) @@ -0,0 +1,6 @@ +/*- + * This file is in the public domain. + */ +/* $FreeBSD$ */ + +#include Modified: head/sys/pc98/pc98/machdep.c ============================================================================== --- head/sys/pc98/pc98/machdep.c Thu May 14 14:57:13 2009 (r192105) +++ head/sys/pc98/pc98/machdep.c Thu May 14 16:01:29 2009 (r192106) @@ -111,6 +111,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -256,6 +257,8 @@ cpu_startup(dummy) vm_pager_bufferinit(); cpu_setregs(); + + mca_init(); } /* From owner-svn-src-head@FreeBSD.ORG Thu May 14 16:23:24 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 80285106564A; Thu, 14 May 2009 16:23:24 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6E0ED8FC29; Thu, 14 May 2009 16:23:24 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4EGNOgi096167; Thu, 14 May 2009 16:23:24 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4EGNOF8096166; Thu, 14 May 2009 16:23:24 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200905141623.n4EGNOF8096166@svn.freebsd.org> From: Sam Leffler Date: Thu, 14 May 2009 16:23:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192107 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 16:23:24 -0000 Author: sam Date: Thu May 14 16:23:24 2009 New Revision: 192107 URL: http://svn.freebsd.org/changeset/base/192107 Log: correct handling of ctl frames: the sender's address is always i_addr2 for frames we should expect to process (old code was trying to handle frames we should never see--like ACK) Reviewed by: thompsa, cbzimmer Modified: head/sys/net80211/ieee80211_node.c Modified: head/sys/net80211/ieee80211_node.c ============================================================================== --- head/sys/net80211/ieee80211_node.c Thu May 14 16:01:29 2009 (r192106) +++ head/sys/net80211/ieee80211_node.c Thu May 14 16:23:24 2009 (r192107) @@ -1439,12 +1439,6 @@ ieee80211_add_neighbor(struct ieee80211v return ni; } -#define IS_CTL(wh) \ - ((wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_CTL) -#define IS_PSPOLL(wh) \ - ((wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) == IEEE80211_FC0_SUBTYPE_PS_POLL) -#define IS_BAR(wh) \ - ((wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) == IEEE80211_FC0_SUBTYPE_BAR) #define IS_PROBEREQ(wh) \ ((wh->i_fc[0] & (IEEE80211_FC0_TYPE_MASK|IEEE80211_FC0_SUBTYPE_MASK)) \ == (IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_PROBE_REQ)) @@ -1456,9 +1450,6 @@ static __inline struct ieee80211_node * _find_rxnode(struct ieee80211_node_table *nt, const struct ieee80211_frame_min *wh) { - /* XXX 4-address frames? */ - if (IS_CTL(wh) && !IS_PSPOLL(wh) && !IS_BAR(wh) /*&& !IS_RTS(ah)*/) - return ieee80211_find_node_locked(nt, wh->i_addr1); if (IS_BCAST_PROBEREQ(wh)) return NULL; /* spam bcast probe req to all vap's */ return ieee80211_find_node_locked(nt, wh->i_addr2); @@ -1547,9 +1538,6 @@ ieee80211_find_rxnode_withkey(struct iee } #undef IS_BCAST_PROBEREQ #undef IS_PROBEREQ -#undef IS_BAR -#undef IS_PSPOLL -#undef IS_CTL /* * Return a reference to the appropriate node for sending From owner-svn-src-head@FreeBSD.ORG Thu May 14 16:25:58 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B1E5106566C; Thu, 14 May 2009 16:25:58 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 08D4B8FC17; Thu, 14 May 2009 16:25:58 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4EGPvX5096252; Thu, 14 May 2009 16:25:57 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4EGPvtS096251; Thu, 14 May 2009 16:25:57 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200905141625.n4EGPvtS096251@svn.freebsd.org> From: Sam Leffler Date: Thu, 14 May 2009 16:25:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192108 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 16:25:58 -0000 Author: sam Date: Thu May 14 16:25:57 2009 New Revision: 192108 URL: http://svn.freebsd.org/changeset/base/192108 Log: add missing type for SYSCTL_PROC items; w/o a type you can view the value but not change it Modified: head/sys/net80211/ieee80211_freebsd.c Modified: head/sys/net80211/ieee80211_freebsd.c ============================================================================== --- head/sys/net80211/ieee80211_freebsd.c Thu May 14 16:23:24 2009 (r192107) +++ head/sys/net80211/ieee80211_freebsd.c Thu May 14 16:25:57 2009 (r192108) @@ -175,27 +175,27 @@ ieee80211_sysctl_msecs_ticks(SYSCTL_HAND #ifdef IEEE80211_AMPDU_AGE extern int ieee80211_ampdu_age; -SYSCTL_PROC(_net_wlan, OID_AUTO, ampdu_age, CTLFLAG_RW, +SYSCTL_PROC(_net_wlan, OID_AUTO, ampdu_age, CTLTYPE_INT | CTLFLAG_RW, &ieee80211_ampdu_age, 0, ieee80211_sysctl_msecs_ticks, "I", "AMPDU max reorder age (ms)"); #endif extern int ieee80211_addba_timeout; -SYSCTL_PROC(_net_wlan, OID_AUTO, addba_timeout, CTLFLAG_RW, +SYSCTL_PROC(_net_wlan, OID_AUTO, addba_timeout, CTLTYPE_INT | CTLFLAG_RW, &ieee80211_addba_timeout, 0, ieee80211_sysctl_msecs_ticks, "I", "ADDBA request timeout (ms)"); extern int ieee80211_addba_backoff; -SYSCTL_PROC(_net_wlan, OID_AUTO, addba_backoff, CTLFLAG_RW, +SYSCTL_PROC(_net_wlan, OID_AUTO, addba_backoff, CTLTYPE_INT | CTLFLAG_RW, &ieee80211_addba_backoff, 0, ieee80211_sysctl_msecs_ticks, "I", "ADDBA request backoff (ms)"); extern int ieee80211_addba_maxtries; -SYSCTL_INT(_net_wlan, OID_AUTO, addba_maxtries, CTLFLAG_RW, +SYSCTL_INT(_net_wlan, OID_AUTO, addba_maxtries, CTLTYPE_INT | CTLFLAG_RW, &ieee80211_addba_maxtries, 0, "max ADDBA requests sent before backoff"); #ifdef IEEE80211_SUPPORT_SUPERG extern int ieee80211_ffppsmin; -SYSCTL_INT(_net_wlan, OID_AUTO, ffppsmin, CTLFLAG_RW, +SYSCTL_INT(_net_wlan, OID_AUTO, ffppsmin, CTLTYPE_INT | CTLFLAG_RW, &ieee80211_ffppsmin, 0, "min packet rate before fast-frame staging"); extern int ieee80211_ffagemax; -SYSCTL_PROC(_net_wlan, OID_AUTO, ffagemax, CTLFLAG_RW, +SYSCTL_PROC(_net_wlan, OID_AUTO, ffagemax, CTLTYPE_INT | CTLFLAG_RW, &ieee80211_ffagemax, 0, ieee80211_sysctl_msecs_ticks, "I", "max hold time for fast-frame staging (ms)"); #endif /* IEEE80211_SUPPORT_SUPERG */ From owner-svn-src-head@FreeBSD.ORG Thu May 14 16:48:25 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EABD11065670; Thu, 14 May 2009 16:48:25 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D74838FC16; Thu, 14 May 2009 16:48:25 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4EGmP1D096748; Thu, 14 May 2009 16:48:25 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4EGmPFp096742; Thu, 14 May 2009 16:48:25 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200905141648.n4EGmPFp096742@svn.freebsd.org> From: Rafal Jaworowski Date: Thu, 14 May 2009 16:48:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192109 - in head/sys/powerpc: aim booke include powerpc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 16:48:26 -0000 Author: raj Date: Thu May 14 16:48:25 2009 New Revision: 192109 URL: http://svn.freebsd.org/changeset/base/192109 Log: PowerPC common SMP startup and time base rework. - make mftb() shared, rewrite in C, provide complementary mttb() - adjust SMP startup per the above, additional comments, minor naming changes - eliminate redundant TB defines, other minor cosmetics Reviewed by: marcel, nwhitehorn Obtained from: Freescale, Semihalf Modified: head/sys/powerpc/aim/clock.c head/sys/powerpc/booke/clock.c head/sys/powerpc/include/cpufunc.h head/sys/powerpc/include/md_var.h head/sys/powerpc/include/spr.h head/sys/powerpc/powerpc/mp_machdep.c Modified: head/sys/powerpc/aim/clock.c ============================================================================== --- head/sys/powerpc/aim/clock.c Thu May 14 16:25:57 2009 (r192108) +++ head/sys/powerpc/aim/clock.c Thu May 14 16:48:25 2009 (r192109) @@ -148,22 +148,19 @@ decr_init(void) mtmsr(msr); } +#ifdef SMP void -decr_tc_init(void) +decr_ap_init(void) { - decr_timecounter.tc_frequency = ticks_per_sec; - tc_init(&decr_timecounter); + } +#endif -static __inline u_quad_t -mftb(void) +void +decr_tc_init(void) { - u_long scratch; - u_quad_t tb; - - __asm ("1: mftbu %0; mftb %0+1; mftbu %1; cmpw 0,%0,%1; bne 1b" - : "=r"(tb), "=r"(scratch)); - return tb; + decr_timecounter.tc_frequency = ticks_per_sec; + tc_init(&decr_timecounter); } static unsigned Modified: head/sys/powerpc/booke/clock.c ============================================================================== --- head/sys/powerpc/booke/clock.c Thu May 14 16:25:57 2009 (r192108) +++ head/sys/powerpc/booke/clock.c Thu May 14 16:48:25 2009 (r192109) @@ -151,22 +151,6 @@ decr_init (void) mtmsr(msr); } -static __inline u_quad_t -mftb (void) -{ - u_long scratch; - u_quad_t tb; - - __asm__ __volatile__( - "1: mftbu %0;" - " mftb %0+1;" - " mftbu %1;" - " cmpw 0,%0,%1;" - " bne 1b" - : "=r"(tb), "=r"(scratch)); - return tb; -} - void decr_tc_init(void) { Modified: head/sys/powerpc/include/cpufunc.h ============================================================================== --- head/sys/powerpc/include/cpufunc.h Thu May 14 16:25:57 2009 (r192108) +++ head/sys/powerpc/include/cpufunc.h Thu May 14 16:48:25 2009 (r192109) @@ -115,13 +115,37 @@ mfdec(void) static __inline register_t mfpvr(void) { - register_t value; + register_t value; __asm __volatile ("mfpvr %0" : "=r"(value)); return (value); } +static __inline u_quad_t +mftb(void) +{ + u_quad_t tb; + uint32_t *tbup = (uint32_t *)&tb; + uint32_t *tblp = tbup + 1; + + do { + *tbup = mfspr(TBR_TBU); + *tblp = mfspr(TBR_TBL); + } while (*tbup != mfspr(TBR_TBU)); + + return (tb); +} + +static __inline void +mttb(u_quad_t time) +{ + + mtspr(TBR_TBWL, 0); + mtspr(TBR_TBWU, (uint32_t)(time >> 32)); + mtspr(TBR_TBWL, (uint32_t)(time & 0xffffffff)); +} + static __inline void eieio(void) { Modified: head/sys/powerpc/include/md_var.h ============================================================================== --- head/sys/powerpc/include/md_var.h Thu May 14 16:25:57 2009 (r192108) +++ head/sys/powerpc/include/md_var.h Thu May 14 16:48:25 2009 (r192109) @@ -56,11 +56,12 @@ int is_physical_memory(vm_offset_t addr) int mem_valid(vm_offset_t addr, int len); void decr_init(void); +void decr_ap_init(void); void decr_tc_init(void); void cpu_setup(u_int); -struct trapframe; +struct trapframe; void powerpc_interrupt(struct trapframe *); #endif /* !_MACHINE_MD_VAR_H_ */ Modified: head/sys/powerpc/include/spr.h ============================================================================== --- head/sys/powerpc/include/spr.h Thu May 14 16:25:57 2009 (r192108) +++ head/sys/powerpc/include/spr.h Thu May 14 16:48:25 2009 (r192109) @@ -129,8 +129,6 @@ #define SPR_SPRG7 0x117 /* 4.. SPR General 7 */ #define SPR_ASR 0x118 /* ... Address Space Register (PPC64) */ #define SPR_EAR 0x11a /* .68 External Access Register */ -#define SPR_TBL 0x11c /* 468 Time Base Lower */ -#define SPR_TBU 0x11d /* 468 Time Base Upper */ #define SPR_PVR 0x11f /* 468 Processor Version Register */ #define MPC601 0x0001 #define MPC603 0x0003 Modified: head/sys/powerpc/powerpc/mp_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/mp_machdep.c Thu May 14 16:25:57 2009 (r192108) +++ head/sys/powerpc/powerpc/mp_machdep.c Thu May 14 16:48:25 2009 (r192109) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -40,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include "pic_if.h" @@ -47,30 +49,35 @@ __FBSDID("$FreeBSD$"); extern struct pcpu __pcpu[MAXCPU]; volatile static int ap_awake; -volatile static u_int ap_state; +volatile static u_int ap_letgo; volatile static uint32_t ap_decr; -volatile static uint32_t ap_tbl; +volatile static u_quad_t ap_timebase; +static u_int ipi_msg_cnt[32]; void machdep_ap_bootstrap(void) { - pcpup->pc_awake = 1; + PCPU_SET(pir, mfspr(SPR_PIR)); + PCPU_SET(awake, 1); + __asm __volatile("msync; isync"); - while (ap_state == 0) + while (ap_letgo == 0) ; - mtspr(SPR_TBL, 0); - mtspr(SPR_TBU, 0); - mtspr(SPR_TBL, ap_tbl); + /* Initialize DEC and TB, sync with the BSP values */ + decr_ap_init(); + mttb(ap_timebase); __asm __volatile("mtdec %0" :: "r"(ap_decr)); - ap_awake++; + atomic_add_int(&ap_awake, 1); + CTR1(KTR_SMP, "SMP: AP CPU%d launched", PCPU_GET(cpuid)); - /* Initialize curthread. */ + /* Initialize curthread */ PCPU_SET(curthread, PCPU_GET(idlethread)); PCPU_SET(curpcb, curthread->td_pcb); + /* Let the DEC and external interrupts go */ mtmsr(mfmsr() | PSL_EE); sched_throw(NULL); } @@ -149,8 +156,7 @@ cpu_mp_start(void) pc->pc_cpumask = 1 << pc->pc_cpuid; pc->pc_hwref = cpu.cr_hwref; all_cpus |= pc->pc_cpumask; - - next: +next: error = platform_smp_next_cpu(&cpu); } } @@ -176,7 +182,7 @@ static void cpu_mp_unleash(void *dummy) { struct pcpu *pc; - int cpus; + int cpus, timeout; if (mp_ncpus <= 1) return; @@ -187,35 +193,47 @@ cpu_mp_unleash(void *dummy) cpus++; pc->pc_other_cpus = all_cpus & ~pc->pc_cpumask; if (!pc->pc_bsp) { - printf("Waking up CPU %d (dev=%x)\n", pc->pc_cpuid, - pc->pc_hwref); + if (bootverbose) + printf("Waking up CPU %d (dev=%x)\n", + pc->pc_cpuid, pc->pc_hwref); + platform_smp_start_cpu(pc); + + timeout = 2000; /* wait 2sec for the AP */ + while (!pc->pc_awake && --timeout > 0) + DELAY(1000); + } else { - __asm __volatile("mfspr %0,1023" : "=r"(pc->pc_pir)); + PCPU_SET(pir, mfspr(SPR_PIR)); pc->pc_awake = 1; } - if (pc->pc_awake) + if (pc->pc_awake) { + if (bootverbose) + printf("Adding CPU %d, pir=%x, awake=%x\n", + pc->pc_cpuid, pc->pc_pir, pc->pc_awake); smp_cpus++; + } else + stopped_cpus |= (1 << pc->pc_cpuid); } ap_awake = 1; - __asm __volatile("mftb %0" : "=r"(ap_tbl)); - ap_tbl += 10; + /* Provide our current DEC and TB values for APs */ __asm __volatile("mfdec %0" : "=r"(ap_decr)); - ap_state++; - powerpc_sync(); + ap_timebase = mftb() + 10; + __asm __volatile("msync; isync"); + + /* Let APs continue */ + atomic_store_rel_int(&ap_letgo, 1); - mtspr(SPR_TBL, 0); - mtspr(SPR_TBU, 0); - mtspr(SPR_TBL, ap_tbl); + mttb(ap_timebase); while (ap_awake < smp_cpus) ; if (smp_cpus != cpus || cpus != mp_ncpus) { printf("SMP: %d CPUs found; %d CPUs usable; %d CPUs woken\n", - mp_ncpus, cpus, smp_cpus); + mp_ncpus, cpus, smp_cpus); } smp_active = 1; @@ -224,8 +242,6 @@ cpu_mp_unleash(void *dummy) SYSINIT(start_aps, SI_SUB_SMP, SI_ORDER_FIRST, cpu_mp_unleash, NULL); -static u_int ipi_msg_cnt[32]; - int powerpc_ipi_handler(void *arg) { From owner-svn-src-head@FreeBSD.ORG Thu May 14 16:56:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 095181065813; Thu, 14 May 2009 16:56:57 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EB6E28FC1D; Thu, 14 May 2009 16:56:56 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4EGuuDD096952; Thu, 14 May 2009 16:56:56 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4EGuucB096951; Thu, 14 May 2009 16:56:56 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200905141656.n4EGuucB096951@svn.freebsd.org> From: Rafal Jaworowski Date: Thu, 14 May 2009 16:56:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192110 - head/sys/powerpc/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 16:56:57 -0000 Author: raj Date: Thu May 14 16:56:56 2009 New Revision: 192110 URL: http://svn.freebsd.org/changeset/base/192110 Log: Improve style(9) Modified: head/sys/powerpc/include/cpufunc.h Modified: head/sys/powerpc/include/cpufunc.h ============================================================================== --- head/sys/powerpc/include/cpufunc.h Thu May 14 16:48:25 2009 (r192109) +++ head/sys/powerpc/include/cpufunc.h Thu May 14 16:56:56 2009 (r192110) @@ -71,7 +71,7 @@ mtmsr(register_t value) static __inline register_t mfmsr(void) { - register_t value; + register_t value; __asm __volatile ("mfmsr %0" : "=r"(value)); @@ -88,7 +88,7 @@ mtsrin(vm_offset_t va, register_t value) static __inline register_t mfsrin(vm_offset_t va) { - register_t value; + register_t value; __asm __volatile ("mfsrin %0,%1" : "=r"(value) : "r"(va)); @@ -105,7 +105,7 @@ mtdec(register_t value) static __inline register_t mfdec(void) { - register_t value; + register_t value; __asm __volatile ("mfdec %0" : "=r"(value)); @@ -170,7 +170,7 @@ powerpc_sync(void) static __inline register_t intr_disable(void) { - register_t msr; + register_t msr; msr = mfmsr(); mtmsr(msr & ~PSL_EE); @@ -187,11 +187,11 @@ intr_restore(register_t msr) static __inline struct pcpu * powerpc_get_pcpup(void) { - struct pcpu *ret; + struct pcpu *ret; __asm __volatile("mfsprg %0, 0" : "=r"(ret)); - return(ret); + return (ret); } #endif /* _KERNEL */ From owner-svn-src-head@FreeBSD.ORG Thu May 14 17:10:19 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E7EC91065673; Thu, 14 May 2009 17:10:19 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D5E5B8FC1A; Thu, 14 May 2009 17:10:19 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4EHAJam097326; Thu, 14 May 2009 17:10:19 GMT (envelope-from emax@svn.freebsd.org) Received: (from emax@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4EHAJ8g097325; Thu, 14 May 2009 17:10:19 GMT (envelope-from emax@svn.freebsd.org) Message-Id: <200905141710.n4EHAJ8g097325@svn.freebsd.org> From: Maksim Yevmenkin Date: Thu, 14 May 2009 17:10:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192113 - head/lib/libbluetooth X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 17:10:20 -0000 Author: emax Date: Thu May 14 17:10:19 2009 New Revision: 192113 URL: http://svn.freebsd.org/changeset/base/192113 Log: Avoid floating point arithmetic while calculating iquiry length. Submitted by: Iain Hibbert < plunky -at- rya-online -dot- net > MFC after: 1 week Modified: head/lib/libbluetooth/hci.c Modified: head/lib/libbluetooth/hci.c ============================================================================== --- head/lib/libbluetooth/hci.c Thu May 14 17:04:58 2009 (r192112) +++ head/lib/libbluetooth/hci.c Thu May 14 17:10:19 2009 (r192113) @@ -410,7 +410,6 @@ bt_devinquiry(char const *devname, time_ ng_hci_inquiry_response *ir; struct bt_devinquiry *i; int s, n; - time_t to; if (ii == NULL) { errno = EINVAL; @@ -452,16 +451,20 @@ bt_devinquiry(char const *devname, time_ cp->lap[1] = 0x8b; cp->lap[2] = 0x9e; - /* Calculate inquire length in 1.28 second units */ - to = (time_t) ((double) length / 1.28); - if (to <= 0) - cp->inquiry_length = 4; /* 5.12 seconds */ - else if (to > 254) - cp->inquiry_length = 255; /* 326.40 seconds */ - else - cp->inquiry_length = to + 1; + /* + * Calculate inquire length in 1.28 second units + * v2.x specification says that 1.28 -> 61.44 seconds + * range is acceptable + */ + + if (length <= 0) + length = 5; + else if (length == 1) + length = 2; + else if (length > 62) + length = 62; - to = (time_t)((double) cp->inquiry_length * 1.28) + 1; + cp->inquiry_length = (uint8_t)((length * 100) / 128); if (num_rsp <= 0 || num_rsp > 255) num_rsp = 8; @@ -484,7 +487,7 @@ bt_devinquiry(char const *devname, time_ wait_for_more: - n = bt_devrecv(s, buf, sizeof(buf), to); + n = bt_devrecv(s, buf, sizeof(buf), length); if (n < 0) { free(i); bt_devclose(s); From owner-svn-src-head@FreeBSD.ORG Thu May 14 17:43:01 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 587A0106564A; Thu, 14 May 2009 17:43:01 +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 43B968FC1D; Thu, 14 May 2009 17:43:01 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4EHh1cx098005; Thu, 14 May 2009 17:43:01 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4EHh026097997; Thu, 14 May 2009 17:43:00 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <200905141743.n4EHh026097997@svn.freebsd.org> From: Attilio Rao Date: Thu, 14 May 2009 17:43:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192114 - in head/sys: amd64/amd64 amd64/include gnu/fs/xfs/FreeBSD/support i386/i386 i386/include i386/xen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 17:43:01 -0000 Author: attilio Date: Thu May 14 17:43:00 2009 New Revision: 192114 URL: http://svn.freebsd.org/changeset/base/192114 Log: FreeBSD right now support 32 CPUs on all the architectures at least. With the arrival of 128+ cores it is necessary to handle more than that. One of the first thing to change is the support for cpumask_t that needs to handle more than 32 bits masking (which happens now). Some places, however, still assume that cpumask_t is a 32 bits mask. Fix that situation by using always correctly cpumask_t when needed. While here, remove the part under STOP_NMI for the Xen support as it is broken in any case. Additively make ipi_nmi_pending as static. Reviewed by: jhb, kmacy Tested by: Giovanni Trematerra Modified: head/sys/amd64/amd64/mp_machdep.c head/sys/amd64/include/smp.h head/sys/gnu/fs/xfs/FreeBSD/support/debug.h head/sys/i386/i386/mp_machdep.c head/sys/i386/i386/pmap.c head/sys/i386/include/smp.h head/sys/i386/xen/mp_machdep.c Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Thu May 14 17:10:19 2009 (r192113) +++ head/sys/amd64/amd64/mp_machdep.c Thu May 14 17:43:00 2009 (r192114) @@ -114,9 +114,9 @@ volatile int smp_tlb_wait; extern inthand_t IDTVEC(fast_syscall), IDTVEC(fast_syscall32); #ifdef STOP_NMI -volatile cpumask_t ipi_nmi_pending; +static volatile cpumask_t ipi_nmi_pending; -static void ipi_nmi_selected(u_int32_t cpus); +static void ipi_nmi_selected(cpumask_t cpus); #endif /* @@ -1016,7 +1016,7 @@ smp_tlb_shootdown(u_int vector, vm_offse } static void -smp_targeted_tlb_shootdown(u_int mask, u_int vector, vm_offset_t addr1, vm_offset_t addr2) +smp_targeted_tlb_shootdown(cpumask_t mask, u_int vector, vm_offset_t addr1, vm_offset_t addr2) { int ncpu, othercpus; @@ -1090,7 +1090,7 @@ smp_invlpg_range(vm_offset_t addr1, vm_o } void -smp_masked_invltlb(u_int mask) +smp_masked_invltlb(cpumask_t mask) { if (smp_started) { @@ -1099,7 +1099,7 @@ smp_masked_invltlb(u_int mask) } void -smp_masked_invlpg(u_int mask, vm_offset_t addr) +smp_masked_invlpg(cpumask_t mask, vm_offset_t addr) { if (smp_started) { @@ -1108,7 +1108,7 @@ smp_masked_invlpg(u_int mask, vm_offset_ } void -smp_masked_invlpg_range(u_int mask, vm_offset_t addr1, vm_offset_t addr2) +smp_masked_invlpg_range(cpumask_t mask, vm_offset_t addr1, vm_offset_t addr2) { if (smp_started) { @@ -1143,7 +1143,7 @@ ipi_bitmap_handler(struct trapframe fram * send an IPI to a set of cpus. */ void -ipi_selected(u_int32_t cpus, u_int ipi) +ipi_selected(cpumask_t cpus, u_int ipi) { int cpu; u_int bitmap = 0; @@ -1206,8 +1206,8 @@ ipi_all_but_self(u_int ipi) #define BEFORE_SPIN 1000000 -void -ipi_nmi_selected(u_int32_t cpus) +static void +ipi_nmi_selected(cpumask_t cpus) { int cpu; register_t icrlo; @@ -1331,7 +1331,7 @@ SYSINIT(start_aps, SI_SUB_SMP, SI_ORDER_ static int sysctl_hlt_cpus(SYSCTL_HANDLER_ARGS) { - u_int mask; + cpumask_t mask; int error; mask = hlt_cpus_mask; Modified: head/sys/amd64/include/smp.h ============================================================================== --- head/sys/amd64/include/smp.h Thu May 14 17:10:19 2009 (r192113) +++ head/sys/amd64/include/smp.h Thu May 14 17:43:00 2009 (r192114) @@ -52,19 +52,19 @@ void cpu_add(u_int apic_id, char boot_cp void cpustop_handler(void); void cpususpend_handler(void); void init_secondary(void); -void ipi_selected(u_int cpus, u_int ipi); +void ipi_selected(cpumask_t cpus, u_int ipi); void ipi_all_but_self(u_int ipi); void ipi_bitmap_handler(struct trapframe frame); u_int mp_bootaddress(u_int); int mp_grab_cpu_hlt(void); void smp_cache_flush(void); void smp_invlpg(vm_offset_t addr); -void smp_masked_invlpg(u_int mask, vm_offset_t addr); +void smp_masked_invlpg(cpumask_t mask, vm_offset_t addr); void smp_invlpg_range(vm_offset_t startva, vm_offset_t endva); -void smp_masked_invlpg_range(u_int mask, vm_offset_t startva, +void smp_masked_invlpg_range(cpumask_t mask, vm_offset_t startva, vm_offset_t endva); void smp_invltlb(void); -void smp_masked_invltlb(u_int mask); +void smp_masked_invltlb(cpumask_t mask); #ifdef STOP_NMI int ipi_nmi_handler(void); Modified: head/sys/gnu/fs/xfs/FreeBSD/support/debug.h ============================================================================== --- head/sys/gnu/fs/xfs/FreeBSD/support/debug.h Thu May 14 17:10:19 2009 (r192113) +++ head/sys/gnu/fs/xfs/FreeBSD/support/debug.h Thu May 14 17:43:00 2009 (r192114) @@ -75,6 +75,5 @@ extern int get_thread_id(void); #endif #define ASSERT_ALWAYS(EX) ((EX)?((void)0):assfail(#EX, __FILE__, __LINE__)) -#define debug_stop_all_cpus(param) /* param is "cpumask_t *" */ #endif /* __XFS_SUPPORT_DEBUG_H__ */ Modified: head/sys/i386/i386/mp_machdep.c ============================================================================== --- head/sys/i386/i386/mp_machdep.c Thu May 14 17:10:19 2009 (r192113) +++ head/sys/i386/i386/mp_machdep.c Thu May 14 17:43:00 2009 (r192114) @@ -155,9 +155,9 @@ vm_offset_t smp_tlb_addr2; volatile int smp_tlb_wait; #ifdef STOP_NMI -volatile cpumask_t ipi_nmi_pending; +static volatile cpumask_t ipi_nmi_pending; -static void ipi_nmi_selected(u_int32_t cpus); +static void ipi_nmi_selected(cpumask_t cpus); #endif #ifdef COUNT_IPIS @@ -1146,7 +1146,7 @@ smp_tlb_shootdown(u_int vector, vm_offse } static void -smp_targeted_tlb_shootdown(u_int mask, u_int vector, vm_offset_t addr1, vm_offset_t addr2) +smp_targeted_tlb_shootdown(cpumask_t mask, u_int vector, vm_offset_t addr1, vm_offset_t addr2) { int ncpu, othercpus; @@ -1231,7 +1231,7 @@ smp_invlpg_range(vm_offset_t addr1, vm_o } void -smp_masked_invltlb(u_int mask) +smp_masked_invltlb(cpumask_t mask) { if (smp_started) { @@ -1243,7 +1243,7 @@ smp_masked_invltlb(u_int mask) } void -smp_masked_invlpg(u_int mask, vm_offset_t addr) +smp_masked_invlpg(cpumask_t mask, vm_offset_t addr) { if (smp_started) { @@ -1255,7 +1255,7 @@ smp_masked_invlpg(u_int mask, vm_offset_ } void -smp_masked_invlpg_range(u_int mask, vm_offset_t addr1, vm_offset_t addr2) +smp_masked_invlpg_range(cpumask_t mask, vm_offset_t addr1, vm_offset_t addr2) { if (smp_started) { @@ -1303,7 +1303,7 @@ ipi_bitmap_handler(struct trapframe fram * send an IPI to a set of cpus. */ void -ipi_selected(u_int32_t cpus, u_int ipi) +ipi_selected(cpumask_t cpus, u_int ipi) { int cpu; u_int bitmap = 0; @@ -1367,7 +1367,7 @@ ipi_all_but_self(u_int ipi) #define BEFORE_SPIN 1000000 void -ipi_nmi_selected(u_int32_t cpus) +ipi_nmi_selected(cpumask_t cpus) { int cpu; register_t icrlo; @@ -1456,7 +1456,7 @@ SYSINIT(start_aps, SI_SUB_SMP, SI_ORDER_ static int sysctl_hlt_cpus(SYSCTL_HANDLER_ARGS) { - u_int mask; + cpumask_t mask; int error; mask = hlt_cpus_mask; Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Thu May 14 17:10:19 2009 (r192113) +++ head/sys/i386/i386/pmap.c Thu May 14 17:43:00 2009 (r192114) @@ -1624,7 +1624,7 @@ retry: * Deal with a SMP shootdown of other users of the pmap that we are * trying to dispose of. This can be a bit hairy. */ -static u_int *lazymask; +static cpumask_t *lazymask; static u_int lazyptd; static volatile u_int lazywait; @@ -1633,7 +1633,7 @@ void pmap_lazyfix_action(void); void pmap_lazyfix_action(void) { - u_int mymask = PCPU_GET(cpumask); + cpumask_t mymask = PCPU_GET(cpumask); #ifdef COUNT_IPIS (*ipi_lazypmap_counts[PCPU_GET(cpuid)])++; @@ -1645,7 +1645,7 @@ pmap_lazyfix_action(void) } static void -pmap_lazyfix_self(u_int mymask) +pmap_lazyfix_self(cpumask_t mymask) { if (rcr3() == lazyptd) @@ -1657,8 +1657,7 @@ pmap_lazyfix_self(u_int mymask) static void pmap_lazyfix(pmap_t pmap) { - u_int mymask; - u_int mask; + cpumask_t mymask, mask; u_int spins; while ((mask = pmap->pm_active) != 0) { Modified: head/sys/i386/include/smp.h ============================================================================== --- head/sys/i386/include/smp.h Thu May 14 17:10:19 2009 (r192113) +++ head/sys/i386/include/smp.h Thu May 14 17:43:00 2009 (r192114) @@ -69,12 +69,12 @@ u_int mp_bootaddress(u_int); int mp_grab_cpu_hlt(void); void smp_cache_flush(void); void smp_invlpg(vm_offset_t addr); -void smp_masked_invlpg(u_int mask, vm_offset_t addr); +void smp_masked_invlpg(cpumask_t mask, vm_offset_t addr); void smp_invlpg_range(vm_offset_t startva, vm_offset_t endva); -void smp_masked_invlpg_range(u_int mask, vm_offset_t startva, +void smp_masked_invlpg_range(cpumask_t mask, vm_offset_t startva, vm_offset_t endva); void smp_invltlb(void); -void smp_masked_invltlb(u_int mask); +void smp_masked_invltlb(cpumask_t mask); #ifdef STOP_NMI int ipi_nmi_handler(void); Modified: head/sys/i386/xen/mp_machdep.c ============================================================================== --- head/sys/i386/xen/mp_machdep.c Thu May 14 17:10:19 2009 (r192113) +++ head/sys/i386/xen/mp_machdep.c Thu May 14 17:43:00 2009 (r192114) @@ -993,7 +993,7 @@ smp_tlb_shootdown(u_int vector, vm_offse } static void -smp_targeted_tlb_shootdown(u_int mask, u_int vector, vm_offset_t addr1, vm_offset_t addr2) +smp_targeted_tlb_shootdown(cpumask_t mask, u_int vector, vm_offset_t addr1, vm_offset_t addr2) { int ncpu, othercpus; struct _call_data data; @@ -1072,7 +1072,7 @@ smp_invlpg_range(vm_offset_t addr1, vm_o } void -smp_masked_invltlb(u_int mask) +smp_masked_invltlb(cpumask_t mask) { if (smp_started) { @@ -1081,7 +1081,7 @@ smp_masked_invltlb(u_int mask) } void -smp_masked_invlpg(u_int mask, vm_offset_t addr) +smp_masked_invlpg(cpumask_t mask, vm_offset_t addr) { if (smp_started) { @@ -1090,7 +1090,7 @@ smp_masked_invlpg(u_int mask, vm_offset_ } void -smp_masked_invlpg_range(u_int mask, vm_offset_t addr1, vm_offset_t addr2) +smp_masked_invlpg_range(cpumask_t mask, vm_offset_t addr1, vm_offset_t addr2) { if (smp_started) { @@ -1102,7 +1102,7 @@ smp_masked_invlpg_range(u_int mask, vm_o * send an IPI to a set of cpus. */ void -ipi_selected(uint32_t cpus, u_int ipi) +ipi_selected(cpumask_t cpus, u_int ipi) { int cpu; u_int bitmap = 0; @@ -1114,12 +1114,6 @@ ipi_selected(uint32_t cpus, u_int ipi) ipi = IPI_BITMAP_VECTOR; } -#ifdef STOP_NMI - if (ipi == IPI_STOP && stop_cpus_with_nmi) { - ipi_nmi_selected(cpus); - return; - } -#endif CTR3(KTR_SMP, "%s: cpus: %x ipi: %x", __func__, cpus, ipi); while ((cpu = ffs(cpus)) != 0) { cpu--; @@ -1160,56 +1154,6 @@ ipi_all_but_self(u_int ipi) ipi_selected(PCPU_GET(other_cpus), ipi); } -#ifdef STOP_NMI -/* - * send NMI IPI to selected CPUs - */ - -#define BEFORE_SPIN 1000000 - -void -ipi_nmi_selected(u_int32_t cpus) -{ - int cpu; - register_t icrlo; - - icrlo = APIC_DELMODE_NMI | APIC_DESTMODE_PHY | APIC_LEVEL_ASSERT - | APIC_TRIGMOD_EDGE; - - CTR2(KTR_SMP, "%s: cpus: %x nmi", __func__, cpus); - - atomic_set_int(&ipi_nmi_pending, cpus); - - while ((cpu = ffs(cpus)) != 0) { - cpu--; - cpus &= ~(1 << cpu); - - KASSERT(cpu_apic_ids[cpu] != -1, - ("IPI NMI to non-existent CPU %d", cpu)); - - /* Wait for an earlier IPI to finish. */ - if (!lapic_ipi_wait(BEFORE_SPIN)) - panic("ipi_nmi_selected: previous IPI has not cleared"); - - lapic_ipi_raw(icrlo, cpu_apic_ids[cpu]); - } -} - -int -ipi_nmi_handler(void) -{ - int cpumask = PCPU_GET(cpumask); - - if (!(ipi_nmi_pending & cpumask)) - return 1; - - atomic_clear_int(&ipi_nmi_pending, cpumask); - cpustop_handler(); - return 0; -} - -#endif /* STOP_NMI */ - /* * Handle an IPI_STOP by saving our current context and spinning until we * are resumed. From owner-svn-src-head@FreeBSD.ORG Thu May 14 18:27:01 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2524A106564A; Thu, 14 May 2009 18:27:00 +0000 (UTC) (envelope-from gonzo@freebsd.org) Received: from core.tav.kiev.ua (tavex.colocall.com [62.149.10.42]) by mx1.freebsd.org (Postfix) with ESMTP id 739068FC08; Thu, 14 May 2009 18:27:00 +0000 (UTC) (envelope-from gonzo@freebsd.org) Received: from [76.77.86.2] (helo=[10.80.5.136]) by core.tav.kiev.ua with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.52 (FreeBSD)) id 1M4f29-000CY5-NW; Thu, 14 May 2009 20:47:54 +0300 Message-ID: <4A0C5934.7060101@freebsd.org> Date: Thu, 14 May 2009 10:47:32 -0700 From: Oleksandr Tymoshenko User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: Stanislav Sedov References: <200905131842.n4DIgnnu064429@svn.freebsd.org> <20090514002555.f56ba38b.stas@FreeBSD.org> In-Reply-To: <20090514002555.f56ba38b.stas@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Core-Spam-Level: / X-Core-Spam-Report: Spam detection software, running on the system "core.tav.kiev.ua", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see The administrator of that system for details. Content preview: Stanislav Sedov wrote: > On Wed, 13 May 2009 18:42:49 +0000 (UTC) > Oleksandr Tymoshenko mentioned: > .. skipped .. >> > > On the other hand this driver appears to be machine-specific. > What if one > would like to have a kernel with several SPI bus drivers included for devices > that doesn't support enumeration? In this case it will be impossible to > diffirentiate these drivers in the hints file. Could you elaborate on this? Completely different drivers or several instances of the same driver? Use case is welcome. dev/spibus is just abstraction that provides interface to child devices. It can't be machine-specific. Bridge implementation (at91_spi) is machine specific and implements actual hardware access. [...] Content analysis details: (-0.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.8 ALL_TRUSTED Passed through trusted hosts only via SMTP 0.0 BAYES_50 BODY: Bayesian spam probability is 40 to 60% [score: 0.5000] 1.8 AWL AWL: From: address is in the auto white-list Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r192059 - in head/sys: arm/at91 dev/spibus X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 18:27:01 -0000 Stanislav Sedov wrote: > On Wed, 13 May 2009 18:42:49 +0000 (UTC) > Oleksandr Tymoshenko mentioned: > .. skipped .. >> > > On the other hand this driver appears to be machine-specific. > What if one > would like to have a kernel with several SPI bus drivers included for devices > that doesn't support enumeration? In this case it will be impossible to > diffirentiate these drivers in the hints file. Could you elaborate on this? Completely different drivers or several instances of the same driver? Use case is welcome. dev/spibus is just abstraction that provides interface to child devices. It can't be machine-specific. Bridge implementation (at91_spi) is machine specific and implements actual hardware access. From owner-svn-src-head@FreeBSD.ORG Thu May 14 19:32:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 16C911065696; Thu, 14 May 2009 19:32:38 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from pele.citylink.co.nz (pele.citylink.co.nz [202.8.44.226]) by mx1.freebsd.org (Postfix) with ESMTP id CC0978FC19; Thu, 14 May 2009 19:32:37 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) by pele.citylink.co.nz (Postfix) with ESMTP id 8AFB9FF27; Fri, 15 May 2009 07:32:36 +1200 (NZST) X-Virus-Scanned: Debian amavisd-new at citylink.co.nz Received: from pele.citylink.co.nz ([127.0.0.1]) by localhost (pele.citylink.co.nz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mtC2dspxN1er; Fri, 15 May 2009 07:32:32 +1200 (NZST) Received: from citylink.fud.org.nz (unknown [202.8.44.45]) by pele.citylink.co.nz (Postfix) with ESMTP; Fri, 15 May 2009 07:32:32 +1200 (NZST) Received: by citylink.fud.org.nz (Postfix, from userid 1001) id 21C3611432; Fri, 15 May 2009 07:32:32 +1200 (NZST) Date: Thu, 14 May 2009 12:32:32 -0700 From: Andrew Thompson To: Qing Li Message-ID: <20090514193232.GC12952@citylink.fud.org.nz> References: <200905140527.n4E5R9Lj078250@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200905140527.n4E5R9Lj078250@svn.freebsd.org> User-Agent: Mutt/1.5.17 (2007-11-01) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r192085 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 19:32:40 -0000 On Thu, May 14, 2009 at 05:27:09AM +0000, Qing Li wrote: > Author: qingli > Date: Thu May 14 05:27:09 2009 > New Revision: 192085 > URL: http://svn.freebsd.org/changeset/base/192085 > > Log: > Ignore the INADDR_ANY address inserted/deleted by DHCP when installing a loopback route > to the interface address. > > Modified: > head/sys/netinet/in.c I have also tried this with pxe and its now working again. thanks. Andrew From owner-svn-src-head@FreeBSD.ORG Thu May 14 20:39:10 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E52DB1065686; Thu, 14 May 2009 20:39:09 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D2CDD8FC21; Thu, 14 May 2009 20:39:09 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4EKd9q5001739; Thu, 14 May 2009 20:39:09 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4EKd9Pp001738; Thu, 14 May 2009 20:39:09 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200905142039.n4EKd9Pp001738@svn.freebsd.org> From: Rick Macklem Date: Thu, 14 May 2009 20:39:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192115 - head/sys/fs/nfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 20:39:10 -0000 Author: rmacklem Date: Thu May 14 20:39:09 2009 New Revision: 192115 URL: http://svn.freebsd.org/changeset/base/192115 Log: Change the file names in the comments in sys/fs/nfs/nfs_var.h so that they are the names used in FreeBSD-CURRENT. Also shuffled a few entries around, so that they under the correct comment. Approved by: kib (mentor) Modified: head/sys/fs/nfs/nfs_var.h Modified: head/sys/fs/nfs/nfs_var.h ============================================================================== --- head/sys/fs/nfs/nfs_var.h Thu May 14 17:43:00 2009 (r192114) +++ head/sys/fs/nfs/nfs_var.h Thu May 14 20:39:09 2009 (r192115) @@ -85,7 +85,7 @@ NFS_LOOKUP_ARGS; NFS_READDIR_ARGS; #endif -/* nfsd_srvstate.c */ +/* nfs_nfsdstate.c */ int nfsrv_setclient(struct nfsrv_descript *, struct nfsclient **, nfsquad_t *, nfsquad_t *, NFSPROC_T *); int nfsrv_getclient(nfsquad_t, int, struct nfsclient **, nfsquad_t, @@ -125,7 +125,7 @@ int nfsrv_checkgetattr(struct nfsrv_desc int nfsrv_nfsuserdport(u_short, NFSPROC_T *); void nfsrv_nfsuserddelport(void); -/* nfsd_serv.c */ +/* nfs_nfsdserv.c */ int nfsrvd_access(struct nfsrv_descript *, int, vnode_t, NFSPROC_T *, struct nfsexstuff *); int nfsrvd_getattr(struct nfsrv_descript *, int, @@ -209,23 +209,11 @@ int nfsrvd_releaselckown(struct nfsrv_de int nfsrvd_pathconf(struct nfsrv_descript *, int, vnode_t, NFSPROC_T *, struct nfsexstuff *); -/* newnfs_socket.c */ -int newnfs_request(struct nfsrv_descript *, struct nfsmount *, - struct nfsclient *, struct nfssockreq *, vnode_t, NFSPROC_T *, - struct ucred *, u_int32_t, u_int32_t, u_char *, int, u_int64_t *); -int newnfs_connect(struct nfsmount *, struct nfssockreq *, - struct ucred *, NFSPROC_T *, int); -void newnfs_disconnect(struct nfssockreq *); -void newnfs_timer(void *); -int newnfs_sigintr(struct nfsmount *, NFSPROC_T *); -int newnfs_sndlock(int *); -void newnfs_sndunlock(int *); - -/* nfsd_srvsocket.c */ +/* nfs_nfsdsocket.c */ void nfsrvd_rephead(struct nfsrv_descript *); void nfsrvd_dorpc(struct nfsrv_descript *, int, NFSPROC_T *); -/* nfs_srvcache.c */ +/* nfs_nfsdcache.c */ void nfsrvd_initcache(void); int nfsrvd_getcache(struct nfsrv_descript *, struct socket *); struct nfsrvcache *nfsrvd_updatecache(struct nfsrv_descript *, @@ -236,7 +224,7 @@ void nfsrvd_refcache(struct nfsrvcache * void nfsrvd_derefcache(struct nfsrvcache *); void nfsrvd_delcache(struct nfsrvcache *); -/* newnfs_subs.c */ +/* nfs_commonsubs.c */ void newnfs_init(void); int nfsaddr_match(int, union nethostaddr *, NFSSOCKADDR_T); int nfsaddr2_match(NFSSOCKADDR_T, NFSSOCKADDR_T); @@ -265,8 +253,10 @@ void nfsv4_relref(struct nfsv4lock *); void nfsv4_getref(struct nfsv4lock *, int *, void *); int nfsrv_mtostr(struct nfsrv_descript *, char *, int); int nfsrv_checkutf8(u_int8_t *, int); +int newnfs_sndlock(int *); +void newnfs_sndunlock(int *); -/* nfscl_subs.c */ +/* nfs_clcomsubs.c */ void nfsm_uiombuf(struct nfsrv_descript *, struct uio *, int); void nfscl_reqstart(struct nfsrv_descript *, int, struct nfsmount *, u_int8_t *, int, u_int32_t **); @@ -286,7 +276,7 @@ int nfscl_request(struct nfsrv_descript NFSPROC_T *, struct ucred *, void *); void nfsm_stateidtom(struct nfsrv_descript *, nfsv4stateid_t *, int); -/* nfsd_srvsubs.c */ +/* nfs_nfsdsubs.c */ void nfsd_fhtovp(struct nfsrv_descript *, struct nfsrvfh *, vnode_t *, struct nfsexstuff *, mount_t *, int, NFSPROC_T *); @@ -315,13 +305,11 @@ int nfsrv_putreferralattr(struct nfsrv_d struct nfsreferral *, int, int *); int nfsrv_parsename(struct nfsrv_descript *, char *, u_long *, NFSPATHLEN_T *); - -/* nfs_srvsyscalls.c */ void nfsd_init(void); -/* nfs_vfsops.c */ +/* nfs_clvfsops.c */ -/* newnfs_port.c */ +/* nfs_commonport.c */ int nfsrv_checksockseqnum(struct socket *, tcp_seq); int nfsrv_getsockseqnum(struct socket *, tcp_seq *); int nfsrv_getsocksndseq(struct socket *, tcp_seq *, tcp_seq *); @@ -335,8 +323,9 @@ void newnfs_setroot(struct ucred *); int nfs_catnap(int, const char *); struct nfsreferral *nfsv4root_getreferral(vnode_t, vnode_t, u_int32_t); int nfsrv_atroot(vnode_t, long *); +void newnfs_timer(void *); -/* newnfs_acl.c */ +/* nfs_commonacl.c */ int nfsrv_dissectace(struct nfsrv_descript *, struct acl_entry *, int *, int *, NFSPROC_T *); #ifdef NFS4_ACL_EXTATTR_NAME @@ -349,7 +338,7 @@ int nfsrv_setacl(vnode_t, NFSACL_T *, st int nfsrv_compareacl(NFSACL_T *, NFSACL_T *); #endif -/* nfscl_rpcops.c */ +/* nfs_clrpcops.c */ int nfsrpc_null(vnode_t, struct ucred *, NFSPROC_T *); int nfsrpc_access(vnode_t, int, struct ucred *, NFSPROC_T *, struct nfsvattr *, int *); @@ -436,7 +425,7 @@ int nfsrpc_delegreturn(struct nfscldeleg int nfsrpc_getacl(vnode_t, struct ucred *, NFSPROC_T *, NFSACL_T *, void *); int nfsrpc_setacl(vnode_t, struct ucred *, NFSPROC_T *, NFSACL_T *, void *); -/* nfscl_state.c */ +/* nfs_clstate.c */ int nfscl_open(vnode_t, u_int8_t *, int, u_int32_t, int, struct ucred *, NFSPROC_T *, struct nfsclowner **, struct nfsclopen **, int *, int *, int); @@ -494,7 +483,7 @@ int nfscl_tryclose(struct nfsclopen *, s struct nfsmount *, NFSPROC_T *); void nfscl_cleanup(NFSPROC_T *); -/* nfscl_port.c */ +/* nfs_clport.c */ int nfscl_nget(mount_t, vnode_t, struct nfsfh *, struct componentname *, NFSPROC_T *, struct nfsnode **, void *); NFSPROC_T *nfscl_getparent(NFSPROC_T *); @@ -510,16 +499,16 @@ int nfscl_ngetreopen(mount_t, u_int8_t * int nfscl_procdoesntexist(u_int8_t *); int nfscl_maperr(NFSPROC_T *, int, uid_t, gid_t); -/* nfsclient/ncl_subs.c */ +/* nfs_clsubs.c */ void nfscl_init(void); -/* nfsclient/ncl_bio.c */ +/* nfs_clbio.c */ int ncl_flush(vnode_t, int, struct ucred *, NFSPROC_T *, int); -/* nfsclient/ncl_node.c */ +/* nfs_clnode.c */ void ncl_invalcaches(vnode_t); -/* nfsd/nfsd_port.c */ +/* nfs_nfsdport.c */ int nfsvno_getattr(vnode_t, struct nfsvattr *, struct ucred *, NFSPROC_T *); int nfsvno_setattr(vnode_t, struct nfsvattr *, struct ucred *, @@ -587,18 +576,25 @@ void nfsvno_unlockvfs(mount_t); int nfsvno_lockvfs(mount_t); int nfsrv_v4rootexport(void *, struct ucred *, NFSPROC_T *); -/* newnfs_krpc.c */ +/* nfs_commonkrpc.c */ int newnfs_nmcancelreqs(struct nfsmount *); void newnfs_set_sigmask(struct thread *, sigset_t *); void newnfs_restore_sigmask(struct thread *, sigset_t *); int newnfs_msleep(struct thread *, void *, struct mtx *, int, char *, int); +int newnfs_request(struct nfsrv_descript *, struct nfsmount *, + struct nfsclient *, struct nfssockreq *, vnode_t, NFSPROC_T *, + struct ucred *, u_int32_t, u_int32_t, u_char *, int, u_int64_t *); +int newnfs_connect(struct nfsmount *, struct nfssockreq *, + struct ucred *, NFSPROC_T *, int); +void newnfs_disconnect(struct nfssockreq *); +int newnfs_sigintr(struct nfsmount *, NFSPROC_T *); -/* nfsd_srvkrpc.c */ +/* nfs_nfsdkrpc.c */ int nfsrvd_addsock(struct file *); int nfsrvd_nfsd(NFSPROC_T *, struct nfsd_nfsd_args *); void nfsrvd_init(int); -/* nfscl_srvkrpc.c */ +/* nfs_clkrpc.c */ int nfscbd_addsock(struct file *); int nfscbd_nfsd(NFSPROC_T *, struct nfsd_nfscbd_args *); From owner-svn-src-head@FreeBSD.ORG Thu May 14 20:59:37 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 37D9910656B1; Thu, 14 May 2009 20:59:37 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 268108FC0A; Thu, 14 May 2009 20:59:37 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4EKxbMh002160; Thu, 14 May 2009 20:59:37 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4EKxa6h002158; Thu, 14 May 2009 20:59:36 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200905142059.n4EKxa6h002158@svn.freebsd.org> From: Robert Watson Date: Thu, 14 May 2009 20:59:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192116 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 20:59:38 -0000 Author: rwatson Date: Thu May 14 20:59:36 2009 New Revision: 192116 URL: http://svn.freebsd.org/changeset/base/192116 Log: Staticize two functions not used outside of in_pcb.c: in_pcbremlists() and db_print_inpcb(). MFC after: 1 month Modified: head/sys/netinet/in_pcb.c head/sys/netinet/in_pcb.h Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Thu May 14 20:39:09 2009 (r192115) +++ head/sys/netinet/in_pcb.c Thu May 14 20:59:36 2009 (r192116) @@ -120,6 +120,8 @@ int ipport_tcplastcount; if ((var) < (min)) { (var) = (min); } \ else if ((var) > (max)) { (var) = (max); } +static void in_pcbremlists(struct inpcb *inp); + static int sysctl_net_ipport_check(SYSCTL_HANDLER_ARGS) { @@ -1512,7 +1514,7 @@ in_pcbrehash(struct inpcb *inp) /* * Remove PCB from various lists. */ -void +static void in_pcbremlists(struct inpcb *inp) { struct inpcbinfo *pcbinfo = inp->inp_pcbinfo; @@ -1878,7 +1880,7 @@ db_print_inpvflag(u_char inp_vflag) } } -void +static void db_print_inpcb(struct inpcb *inp, const char *name, int indent) { Modified: head/sys/netinet/in_pcb.h ============================================================================== --- head/sys/netinet/in_pcb.h Thu May 14 20:39:09 2009 (r192115) +++ head/sys/netinet/in_pcb.h Thu May 14 20:59:36 2009 (r192116) @@ -501,14 +501,7 @@ int in_getsockaddr(struct socket *so, st struct sockaddr * in_sockaddr(in_port_t port, struct in_addr *addr); void in_pcbsosetlabel(struct socket *so); -void in_pcbremlists(struct inpcb *inp); void ipport_tick(void *xtp); - -/* - * Debugging routines compiled in when DDB is present. - */ -void db_print_inpcb(struct inpcb *inp, const char *name, int indent); - #endif /* _KERNEL */ #endif /* !_NETINET_IN_PCB_H_ */ From owner-svn-src-head@FreeBSD.ORG Thu May 14 21:39:09 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 197EC106564A; Thu, 14 May 2009 21:39:09 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 069388FC08; Thu, 14 May 2009 21:39:09 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4ELd9Ua003165; Thu, 14 May 2009 21:39:09 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4ELd8Zw003155; Thu, 14 May 2009 21:39:08 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200905142139.n4ELd8Zw003155@svn.freebsd.org> From: Rick Macklem Date: Thu, 14 May 2009 21:39:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192121 - in head/sys/fs: nfs nfsclient nfsserver X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 21:39:09 -0000 Author: rmacklem Date: Thu May 14 21:39:08 2009 New Revision: 192121 URL: http://svn.freebsd.org/changeset/base/192121 Log: Apply changes to the experimental nfs server so that it uses the security flavors as exported in FreeBSD-CURRENT. This allows it to use a slightly modified mountd.c instead of a different utility. Approved by: kib (mentor) Modified: head/sys/fs/nfs/nfs.h head/sys/fs/nfs/nfs_var.h head/sys/fs/nfs/nfsdport.h head/sys/fs/nfs/nfsport.h head/sys/fs/nfsclient/nfs_clkrpc.c head/sys/fs/nfsserver/nfs_nfsdkrpc.c head/sys/fs/nfsserver/nfs_nfsdport.c head/sys/fs/nfsserver/nfs_nfsdserv.c head/sys/fs/nfsserver/nfs_nfsdsocket.c head/sys/fs/nfsserver/nfs_nfsdsubs.c Modified: head/sys/fs/nfs/nfs.h ============================================================================== --- head/sys/fs/nfs/nfs.h Thu May 14 21:27:03 2009 (r192120) +++ head/sys/fs/nfs/nfs.h Thu May 14 21:39:08 2009 (r192121) @@ -580,7 +580,6 @@ struct nfsrv_descript { u_int64_t nd_compref; /* Compound RPC ref# */ time_t nd_tcpconntime; /* Time TCP connection est. */ nfsquad_t nd_clientid; /* Implied clientid */ - int nd_credflavor; /* credential flavor */ int nd_gssnamelen; /* principal name length */ char *nd_gssname; /* principal name */ }; @@ -608,8 +607,11 @@ struct nfsrv_descript { #define ND_V4WCCATTR 0x00010000 #define ND_NFSCB 0x00020000 #define ND_AUTHNONE 0x00040000 -#define ND_EXGSSONLY 0x00080000 -#define ND_INCRSEQID 0x00100000 +#define ND_EXAUTHSYS 0x00080000 +#define ND_EXGSS 0x00100000 +#define ND_EXGSSINTEGRITY 0x00200000 +#define ND_EXGSSPRIVACY 0x00400000 +#define ND_INCRSEQID 0x00800000 /* * ND_GSS should be the "or" of all GSS type authentications. @@ -631,11 +633,6 @@ struct nfsv4_opflag { #define NFSRVSEQID_OPEN 0x04 /* - * MNT_EXGSSONLY is the Or of all the EXGSS bits. - */ -#define MNT_EXGSSONLY MNT_EXGSSKRB5 - -/* * assign a doubly linked list to a new head * and prepend one list into another. */ Modified: head/sys/fs/nfs/nfs_var.h ============================================================================== --- head/sys/fs/nfs/nfs_var.h Thu May 14 21:27:03 2009 (r192120) +++ head/sys/fs/nfs/nfs_var.h Thu May 14 21:39:08 2009 (r192121) @@ -306,6 +306,7 @@ int nfsrv_putreferralattr(struct nfsrv_d int nfsrv_parsename(struct nfsrv_descript *, char *, u_long *, NFSPATHLEN_T *); void nfsd_init(void); +int nfsd_checkrootexp(struct nfsrv_descript *); /* nfs_clvfsops.c */ @@ -575,6 +576,7 @@ int nfsvno_advlock(vnode_t, int, u_int64 void nfsvno_unlockvfs(mount_t); int nfsvno_lockvfs(mount_t); int nfsrv_v4rootexport(void *, struct ucred *, NFSPROC_T *); +int nfsvno_testexp(struct nfsrv_descript *, struct nfsexstuff *); /* nfs_commonkrpc.c */ int newnfs_nmcancelreqs(struct nfsmount *); Modified: head/sys/fs/nfs/nfsdport.h ============================================================================== --- head/sys/fs/nfs/nfsdport.h Thu May 14 21:27:03 2009 (r192120) +++ head/sys/fs/nfs/nfsdport.h Thu May 14 21:39:08 2009 (r192121) @@ -52,8 +52,10 @@ * needs to be returned by nfsd_fhtovp(). */ struct nfsexstuff { - int nes_vfslocked; /* required for all ports */ - int nes_exflag; + int nes_vfslocked; /* required for all ports */ + int nes_exflag; /* export flags */ + int nes_numsecflavor; /* # of security flavors */ + int nes_secflavors[MAXSECFLAVORS]; /* and the flavors */ }; #define NFSVNO_EXINIT(e) ((e)->nes_exflag = 0) @@ -61,11 +63,9 @@ struct nfsexstuff { #define NFSVNO_EXRDONLY(e) ((e)->nes_exflag & MNT_EXRDONLY) #define NFSVNO_EXPORTANON(e) ((e)->nes_exflag & MNT_EXPORTANON) #define NFSVNO_EXSTRICTACCESS(e) ((e)->nes_exflag & MNT_EXSTRICTACCESS) -#define NFSVNO_EXGSSONLY(e) ((e)->nes_exflag & MNT_EXGSSONLY) #define NFSVNO_EXV4ONLY(e) ((e)->nes_exflag & MNT_EXV4ONLY) #define NFSVNO_SETEXRDONLY(e) ((e)->nes_exflag = (MNT_EXPORTED|MNT_EXRDONLY)) -#define NFSVNO_SETEXGSSONLY(e) ((e)->nes_exflag |= MNT_EXGSSONLY) #define NFSVNO_CMPFH(f1, f2) \ ((f1)->fh_fsid.val[0] == (f2)->fh_fsid.val[0] && \ Modified: head/sys/fs/nfs/nfsport.h ============================================================================== --- head/sys/fs/nfs/nfsport.h Thu May 14 21:27:03 2009 (r192120) +++ head/sys/fs/nfs/nfsport.h Thu May 14 21:39:08 2009 (r192121) @@ -645,11 +645,6 @@ struct nfsex_args { }; /* - * Define these here, so they don't have to be in mount.h, for now. - */ -#define MNT_EXGSSKRB5 MNT_EXKERB - -/* * These export flags should be defined, but there are no bits left. * Maybe a separate mnt_exflag field could be added or the mnt_flag * field increased to 64 bits? Modified: head/sys/fs/nfsclient/nfs_clkrpc.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clkrpc.c Thu May 14 21:27:03 2009 (r192120) +++ head/sys/fs/nfsclient/nfs_clkrpc.c Thu May 14 21:39:08 2009 (r192121) @@ -66,7 +66,7 @@ static void nfscb_program(struct svc_req *rqst, SVCXPRT *xprt) { struct nfsrv_descript nd; - int cacherep; + int cacherep, credflavor; memset(&nd, 0, sizeof(nd)); if (rqst->rq_proc != NFSPROC_NULL && @@ -94,12 +94,14 @@ nfscb_program(struct svc_req *rqst, SVCX nd.nd_cred = NULL; if (nd.nd_procnum != NFSPROC_NULL) { - if (!svc_getcred(rqst, &nd.nd_cred, &nd.nd_credflavor)) { + if (!svc_getcred(rqst, &nd.nd_cred, &credflavor)) { svcerr_weakauth(rqst); svc_freereq(rqst); m_freem(nd.nd_mrep); return; } + + /* For now, I don't care what credential flavor was used. */ #ifdef notyet #ifdef MAC mac_cred_associate_nfsd(nd.nd_cred); Modified: head/sys/fs/nfsserver/nfs_nfsdkrpc.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdkrpc.c Thu May 14 21:27:03 2009 (r192120) +++ head/sys/fs/nfsserver/nfs_nfsdkrpc.c Thu May 14 21:39:08 2009 (r192121) @@ -97,7 +97,7 @@ nfssvc_program(struct svc_req *rqst, SVC { struct nfsrv_descript nd; struct nfsrvcache *rp = NULL; - int cacherep; + int cacherep, credflavor; memset(&nd, 0, sizeof(nd)); if (rqst->rq_vers == NFS_VER2) { @@ -186,12 +186,27 @@ nfssvc_program(struct svc_req *rqst, SVC } if (nd.nd_procnum != NFSPROC_NULL) { - if (!svc_getcred(rqst, &nd.nd_cred, &nd.nd_credflavor)) { + if (!svc_getcred(rqst, &nd.nd_cred, &credflavor)) { svcerr_weakauth(rqst); svc_freereq(rqst); m_freem(nd.nd_mrep); return; } + + /* Set the flag based on credflavor */ + if (credflavor == RPCSEC_GSS_KRB5) { + nd.nd_flag |= ND_GSS; + } else if (credflavor == RPCSEC_GSS_KRB5I) { + nd.nd_flag |= (ND_GSS | ND_GSSINTEGRITY); + } else if (credflavor == RPCSEC_GSS_KRB5P) { + nd.nd_flag |= (ND_GSS | ND_GSSPRIVACY); + } else if (credflavor != AUTH_SYS) { + svcerr_weakauth(rqst); + svc_freereq(rqst); + m_freem(nd.nd_mrep); + return; + } + #ifdef MAC mac_cred_associate_nfsd(nd.nd_cred); #endif Modified: head/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdport.c Thu May 14 21:27:03 2009 (r192120) +++ head/sys/fs/nfsserver/nfs_nfsdport.c Thu May 14 21:39:08 2009 (r192121) @@ -2352,14 +2352,16 @@ nfsd_excred(struct nfsrv_descript *nd, s * Check/setup credentials. */ if (nd->nd_flag & ND_GSS) - exp->nes_exflag &= ~(MNT_EXGSSONLY | MNT_EXPORTANON); + exp->nes_exflag &= ~MNT_EXPORTANON; /* - * For AUTH_SYS, check to see if it is allowed. + * Check to see if the operation is allowed for this security flavor. * RFC2623 suggests that the NFSv3 Fsinfo RPC be allowed to * AUTH_NONE or AUTH_SYS for file systems requiring RPCSEC_GSS. + * Also, allow Secinfo, so that it can acquire the correct flavor(s). */ - if (NFSVNO_EXGSSONLY(exp) && + if (nfsvno_testexp(nd, exp) && + nd->nd_procnum != NFSV4OP_SECINFO && nd->nd_procnum != NFSPROC_FSINFO) { if (nd->nd_flag & ND_NFSV4) error = NFSERR_WRONGSEC; @@ -2400,14 +2402,20 @@ int nfsvno_checkexp(struct mount *mp, struct sockaddr *nam, struct nfsexstuff *exp, struct ucred **credp) { - int error; - int numsecflavor, *secflavors; + int i, error, *secflavors; error = VFS_CHECKEXP(mp, nam, &exp->nes_exflag, credp, - &numsecflavor, &secflavors); - if (error && nfs_rootfhset) { - exp->nes_exflag = 0; - error = 0; + &exp->nes_numsecflavor, &secflavors); + if (error) { + if (nfs_rootfhset) { + exp->nes_exflag = 0; + exp->nes_numsecflavor = 0; + error = 0; + } + } else { + /* Copy the security flavors. */ + for (i = 0; i < exp->nes_numsecflavor; i++) + exp->nes_secflavors[i] = secflavors[i]; } return (error); } @@ -2419,21 +2427,26 @@ int nfsvno_fhtovp(struct mount *mp, fhandle_t *fhp, struct sockaddr *nam, struct vnode **vpp, struct nfsexstuff *exp, struct ucred **credp) { - int error; - int numsecflavor, *secflavors; + int i, error, *secflavors; *credp = NULL; + exp->nes_numsecflavor = 0; error = VFS_FHTOVP(mp, &fhp->fh_fid, vpp); if (nam && !error) { error = VFS_CHECKEXP(mp, nam, &exp->nes_exflag, credp, - &numsecflavor, &secflavors); + &exp->nes_numsecflavor, &secflavors); if (error) { if (nfs_rootfhset) { exp->nes_exflag = 0; + exp->nes_numsecflavor = 0; error = 0; } else { vput(*vpp); } + } else { + /* Copy the security flavors. */ + for (i = 0; i < exp->nes_numsecflavor; i++) + exp->nes_secflavors[i] = secflavors[i]; } } return (error); @@ -2539,18 +2552,19 @@ nfsd_fhtovp(struct nfsrv_descript *nd, s */ #ifdef NFS_REQRSVPORT if (!nd->nd_repstat) { - struct sockaddr_in *saddr; - struct sockaddr_in6 *saddr6; - saddr = NFSSOCKADDR(nd->nd_nam, struct sockaddr_in *); - saddr6 = NFSSOCKADDR(nd->nd_nam, struct sockaddr_in6 *); - if (!(nd->nd_flag & ND_NFSV4) && - ((saddr->sin_family == AF_INET && - ntohs(saddr->sin_port) >= IPPORT_RESERVED) || - (saddr6->sin6_family == AF_INET6 && - ntohs(saddr6->sin6_port) >= IPPORT_RESERVED))) { - vput(*vpp); - nd->nd_repstat = (NFSERR_AUTHERR | AUTH_TOOWEAK); - } + struct sockaddr_in *saddr; + struct sockaddr_in6 *saddr6; + + saddr = NFSSOCKADDR(nd->nd_nam, struct sockaddr_in *); + saddr6 = NFSSOCKADDR(nd->nd_nam, struct sockaddr_in6 *); + if (!(nd->nd_flag & ND_NFSV4) && + ((saddr->sin_family == AF_INET && + ntohs(saddr->sin_port) >= IPPORT_RESERVED) || + (saddr6->sin6_family == AF_INET6 && + ntohs(saddr6->sin6_port) >= IPPORT_RESERVED))) { + vput(*vpp); + nd->nd_repstat = (NFSERR_AUTHERR | AUTH_TOOWEAK); + } } #endif /* NFS_REQRSVPORT */ @@ -2598,7 +2612,7 @@ fp_getfvp(struct thread *p, int fd, stru } /* - * Called from newnfssvc() to update the exports list. Just call + * Called from nfssvc() to update the exports list. Just call * vfs_export(). This has to be done, since the v4 root fake fs isn't * in the mount list. */ @@ -2610,11 +2624,6 @@ nfsrv_v4rootexport(void *argp, struct uc struct nameidata nd; fhandle_t fh; - /* - * Until newmountd is using the secflavor fields, just make - * sure it's 0. - */ - nfsexargp->export.ex_numsecflavors = 0; error = vfs_export(&nfsv4root_mnt, &nfsexargp->export); if ((nfsexargp->export.ex_flags & MNT_DELEXPORT)) { nfs_rootfhset = 0; @@ -2843,16 +2852,24 @@ int nfsvno_v4rootexport(struct nfsrv_descript *nd) { struct ucred *credanon; - int exflags, error; + int exflags, error, numsecflavor, *secflavors, i; error = vfs_stdcheckexp(&nfsv4root_mnt, nd->nd_nam, &exflags, - &credanon, NULL, NULL); + &credanon, &numsecflavor, &secflavors); if (error) return (NFSERR_PROGUNAVAIL); - if ((exflags & MNT_EXGSSONLY)) - nd->nd_flag |= ND_EXGSSONLY; if (credanon != NULL) crfree(credanon); + for (i = 0; i < numsecflavor; i++) { + if (secflavors[i] == AUTH_SYS) + nd->nd_flag |= ND_EXAUTHSYS; + else if (secflavors[i] == RPCSEC_GSS_KRB5) + nd->nd_flag |= ND_EXGSS; + else if (secflavors[i] == RPCSEC_GSS_KRB5I) + nd->nd_flag |= ND_EXGSSINTEGRITY; + else if (secflavors[i] == RPCSEC_GSS_KRB5P) + nd->nd_flag |= ND_EXGSSPRIVACY; + } return (0); } @@ -2985,6 +3002,45 @@ nfssvc_srvcall(struct thread *p, struct return (error); } +/* + * Check exports. + * Returns 0 if ok, 1 otherwise. + */ +int +nfsvno_testexp(struct nfsrv_descript *nd, struct nfsexstuff *exp) +{ + int i; + + /* + * This seems odd, but allow the case where the security flavor + * list is empty. This happens when NFSv4 is traversing non-exported + * file systems. Exported file systems should always have a non-empty + * security flavor list. + */ + if (exp->nes_numsecflavor == 0) + return (0); + + for (i = 0; i < exp->nes_numsecflavor; i++) { + /* + * The tests for privacy and integrity must be first, + * since ND_GSS is set for everything but AUTH_SYS. + */ + if (exp->nes_secflavors[i] == RPCSEC_GSS_KRB5P && + (nd->nd_flag & ND_GSSPRIVACY)) + return (0); + if (exp->nes_secflavors[i] == RPCSEC_GSS_KRB5I && + (nd->nd_flag & ND_GSSINTEGRITY)) + return (0); + if (exp->nes_secflavors[i] == RPCSEC_GSS_KRB5 && + (nd->nd_flag & ND_GSS)) + return (0); + if (exp->nes_secflavors[i] == AUTH_SYS && + (nd->nd_flag & ND_GSS) == 0) + return (0); + } + return (1); +} + extern int (*nfsd_call_nfsd)(struct thread *, struct nfssvc_args *); /* Modified: head/sys/fs/nfsserver/nfs_nfsdserv.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdserv.c Thu May 14 21:27:03 2009 (r192120) +++ head/sys/fs/nfsserver/nfs_nfsdserv.c Thu May 14 21:39:08 2009 (r192121) @@ -3090,7 +3090,6 @@ nfsrvd_secinfo(struct nfsrv_descript *nd retnes.nes_vfslocked = exp->nes_vfslocked; vput(vp); savflag = nd->nd_flag; - nd->nd_flag |= ND_GSS; /* so nfsd_fhtovp() won't reply Wrongsec */ if (!nd->nd_repstat) { nfsd_fhtovp(nd, &fh, &vp, &retnes, &mp, 0, p); if (vp) @@ -3106,20 +3105,39 @@ nfsrvd_secinfo(struct nfsrv_descript *nd */ len = 0; NFSM_BUILD(sizp, u_int32_t *, NFSX_UNSIGNED); - if (!NFSVNO_EXGSSONLY(&retnes)) { - NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); - *tl = txdr_unsigned(RPCAUTH_UNIX); - len++; - } - for (i = RPCAUTHGSS_SVCNONE; i <= RPCAUTHGSS_SVCPRIVACY; i++) { - NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); - *tl++ = txdr_unsigned(RPCAUTH_GSS); - (void) nfsm_strtom(nd, nfsgss_mechlist[KERBV_MECH].str, - nfsgss_mechlist[KERBV_MECH].len); - NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); - *tl++ = txdr_unsigned(GSS_KERBV_QOP); - *tl = txdr_unsigned(i); - len++; + for (i = 0; i < retnes.nes_numsecflavor; i++) { + if (retnes.nes_secflavors[i] == AUTH_SYS) { + NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); + *tl = txdr_unsigned(RPCAUTH_UNIX); + len++; + } else if (retnes.nes_secflavors[i] == RPCSEC_GSS_KRB5) { + NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); + *tl++ = txdr_unsigned(RPCAUTH_GSS); + (void) nfsm_strtom(nd, nfsgss_mechlist[KERBV_MECH].str, + nfsgss_mechlist[KERBV_MECH].len); + NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); + *tl++ = txdr_unsigned(GSS_KERBV_QOP); + *tl = txdr_unsigned(RPCAUTHGSS_SVCNONE); + len++; + } else if (retnes.nes_secflavors[i] == RPCSEC_GSS_KRB5I) { + NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); + *tl++ = txdr_unsigned(RPCAUTH_GSS); + (void) nfsm_strtom(nd, nfsgss_mechlist[KERBV_MECH].str, + nfsgss_mechlist[KERBV_MECH].len); + NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); + *tl++ = txdr_unsigned(GSS_KERBV_QOP); + *tl = txdr_unsigned(RPCAUTHGSS_SVCINTEGRITY); + len++; + } else if (retnes.nes_secflavors[i] == RPCSEC_GSS_KRB5P) { + NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); + *tl++ = txdr_unsigned(RPCAUTH_GSS); + (void) nfsm_strtom(nd, nfsgss_mechlist[KERBV_MECH].str, + nfsgss_mechlist[KERBV_MECH].len); + NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); + *tl++ = txdr_unsigned(GSS_KERBV_QOP); + *tl = txdr_unsigned(RPCAUTHGSS_SVCPRIVACY); + len++; + } } *sizp = txdr_unsigned(len); return (0); @@ -3141,7 +3159,7 @@ nfsrvd_setclientid(struct nfsrv_descript nfsquad_t clientid, confirm; if ((!nfs_rootfhset && !nfsv4root_set) || - (nd->nd_flag & (ND_GSS | ND_EXGSSONLY)) == ND_EXGSSONLY) { + nfsd_checkrootexp(nd)) { nd->nd_repstat = NFSERR_WRONGSEC; return (0); } @@ -3250,7 +3268,7 @@ nfsrvd_setclientidcfrm(struct nfsrv_desc nfsquad_t clientid, confirm; if ((!nfs_rootfhset && !nfsv4root_set) || - (nd->nd_flag & (ND_GSS | ND_EXGSSONLY)) == ND_EXGSSONLY) { + nfsd_checkrootexp(nd)) { nd->nd_repstat = NFSERR_WRONGSEC; return (0); } Modified: head/sys/fs/nfsserver/nfs_nfsdsocket.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdsocket.c Thu May 14 21:27:03 2009 (r192120) +++ head/sys/fs/nfsserver/nfs_nfsdsocket.c Thu May 14 21:39:08 2009 (r192121) @@ -819,8 +819,7 @@ nfsrvd_compound(struct nfsrv_descript *n op != NFSV4OP_GETFH && op != NFSV4OP_SECINFO) nd->nd_repstat = NFSERR_NOFILEHANDLE; - else if (NFSVNO_EXGSSONLY(&vpnes) && - !(nd->nd_flag & ND_GSS) && + else if (nfsvno_testexp(nd, &vpnes) && op != NFSV4OP_LOOKUP && op != NFSV4OP_GETFH && op != NFSV4OP_GETATTR && Modified: head/sys/fs/nfsserver/nfs_nfsdsubs.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdsubs.c Thu May 14 21:27:03 2009 (r192120) +++ head/sys/fs/nfsserver/nfs_nfsdsubs.c Thu May 14 21:39:08 2009 (r192121) @@ -2019,3 +2019,25 @@ nfsd_init(void) NFSBZERO(nfs_v2pubfh, NFSX_V2FH); } +/* + * Check the v4 root exports. + * Return 0 if ok, 1 otherwise. + */ +int +nfsd_checkrootexp(struct nfsrv_descript *nd) +{ + + if ((nd->nd_flag & (ND_GSS | ND_EXAUTHSYS)) == ND_EXAUTHSYS) + return (0); + if ((nd->nd_flag & (ND_GSSINTEGRITY | ND_EXGSSINTEGRITY)) == + (ND_GSSINTEGRITY | ND_EXGSSINTEGRITY)) + return (0); + if ((nd->nd_flag & (ND_GSSPRIVACY | ND_EXGSSPRIVACY)) == + (ND_GSSPRIVACY | ND_EXGSSPRIVACY)) + return (0); + if ((nd->nd_flag & (ND_GSS | ND_GSSINTEGRITY | ND_GSSPRIVACY | + ND_EXGSS)) == (ND_GSS | ND_EXGSS)) + return (0); + return (1); +} + From owner-svn-src-head@FreeBSD.ORG Thu May 14 21:53:35 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EAA441065677; Thu, 14 May 2009 21:53:35 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D049B8FC1D; Thu, 14 May 2009 21:53:35 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4ELrZJR003483; Thu, 14 May 2009 21:53:35 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4ELrZPE003481; Thu, 14 May 2009 21:53:35 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200905142153.n4ELrZPE003481@svn.freebsd.org> From: John Baldwin Date: Thu, 14 May 2009 21:53:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192122 - in head/sys: amd64/conf i386/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 21:53:36 -0000 Author: jhb Date: Thu May 14 21:53:35 2009 New Revision: 192122 URL: http://svn.freebsd.org/changeset/base/192122 Log: Trim the default set of device hints on i386 and amd64: - Remove vga0 and the disabled uart2/uart3 hints from both platforms. - Remove hints for ISA adv0, bt0, aha0, aic0, ed0, cs0, sn0, ie0, fe0, and le0 from i386. All these hints were marked 'disabled' and thus already did not work "out of the box". Discussed with: imp Modified: head/sys/amd64/conf/GENERIC.hints head/sys/i386/conf/GENERIC.hints Modified: head/sys/amd64/conf/GENERIC.hints ============================================================================== --- head/sys/amd64/conf/GENERIC.hints Thu May 14 21:39:08 2009 (r192121) +++ head/sys/amd64/conf/GENERIC.hints Thu May 14 21:53:35 2009 (r192122) @@ -13,7 +13,6 @@ hint.atkbd.0.at="atkbdc" hint.atkbd.0.irq="1" hint.psm.0.at="atkbdc" hint.psm.0.irq="12" -hint.vga.0.at="isa" hint.sc.0.at="isa" hint.sc.0.flags="0x100" hint.uart.0.at="isa" @@ -23,13 +22,5 @@ hint.uart.0.irq="4" hint.uart.1.at="isa" hint.uart.1.port="0x2F8" hint.uart.1.irq="3" -hint.uart.2.at="isa" -hint.uart.2.disabled="1" -hint.uart.2.port="0x3E8" -hint.uart.2.irq="5" -hint.uart.3.at="isa" -hint.uart.3.disabled="1" -hint.uart.3.port="0x2E8" -hint.uart.3.irq="9" hint.ppc.0.at="isa" hint.ppc.0.irq="7" Modified: head/sys/i386/conf/GENERIC.hints ============================================================================== --- head/sys/i386/conf/GENERIC.hints Thu May 14 21:39:08 2009 (r192121) +++ head/sys/i386/conf/GENERIC.hints Thu May 14 21:53:35 2009 (r192122) @@ -13,21 +13,12 @@ hint.ata.0.irq="14" hint.ata.1.at="isa" hint.ata.1.port="0x170" hint.ata.1.irq="15" -hint.adv.0.at="isa" -hint.adv.0.disabled="1" -hint.bt.0.at="isa" -hint.bt.0.disabled="1" -hint.aha.0.at="isa" -hint.aha.0.disabled="1" -hint.aic.0.at="isa" -hint.aic.0.disabled="1" hint.atkbdc.0.at="isa" hint.atkbdc.0.port="0x060" hint.atkbd.0.at="atkbdc" hint.atkbd.0.irq="1" hint.psm.0.at="atkbdc" hint.psm.0.irq="12" -hint.vga.0.at="isa" hint.sc.0.at="isa" hint.sc.0.flags="0x100" hint.apm.0.disabled="1" @@ -39,41 +30,8 @@ hint.uart.0.irq="4" hint.uart.1.at="isa" hint.uart.1.port="0x2F8" hint.uart.1.irq="3" -hint.uart.2.at="isa" -hint.uart.2.disabled="1" -hint.uart.2.port="0x3E8" -hint.uart.2.irq="5" -hint.uart.3.at="isa" -hint.uart.3.disabled="1" -hint.uart.3.port="0x2E8" -hint.uart.3.irq="9" hint.ppc.0.at="isa" hint.ppc.0.irq="7" -hint.ed.0.at="isa" -hint.ed.0.disabled="1" -hint.ed.0.port="0x280" -hint.ed.0.irq="10" -hint.ed.0.maddr="0xd8000" -hint.cs.0.at="isa" -hint.cs.0.disabled="1" -hint.cs.0.port="0x300" -hint.sn.0.at="isa" -hint.sn.0.disabled="1" -hint.sn.0.port="0x300" -hint.sn.0.irq="10" -hint.ie.0.at="isa" -hint.ie.0.disabled="1" -hint.ie.0.port="0x300" -hint.ie.0.irq="10" -hint.ie.0.maddr="0xd0000" -hint.fe.0.at="isa" -hint.fe.0.disabled="1" -hint.fe.0.port="0x300" -hint.le.0.at="isa" -hint.le.0.disabled="1" -hint.le.0.port="0x280" -hint.le.0.irq="10" -hint.le.0.drq="0" hint.atrtc.0.at="isa" hint.atrtc.0.port="0x70" hint.atrtc.0.irq="8" From owner-svn-src-head@FreeBSD.ORG Thu May 14 22:01:33 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 31D06106568E; Thu, 14 May 2009 22:01:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 049F18FC1B; Thu, 14 May 2009 22:01:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4EM1WpO003828; Thu, 14 May 2009 22:01:32 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4EM1WaA003827; Thu, 14 May 2009 22:01:32 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200905142201.n4EM1WaA003827@svn.freebsd.org> From: John Baldwin Date: Thu, 14 May 2009 22:01:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192125 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 22:01:35 -0000 Author: jhb Date: Thu May 14 22:01:32 2009 New Revision: 192125 URL: http://svn.freebsd.org/changeset/base/192125 Log: - Use a separate sx lock to try to limit the number of concurrent userland sysctl requests to avoid wiring too much user memory. Only grab this lock if the user's old buffer is larger than a page as a tradeoff to allow more concurrency for common small requests. - Just use a shared lock on the sysctl tree for user sysctl requests now. MFC after: 1 week Modified: head/sys/kern/kern_sysctl.c Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Thu May 14 22:01:14 2009 (r192124) +++ head/sys/kern/kern_sysctl.c Thu May 14 22:01:32 2009 (r192125) @@ -77,11 +77,12 @@ static MALLOC_DEFINE(M_SYSCTLTMP, "sysct * API rather than using the dynamic API. Use of the dynamic API is * strongly encouraged for most code. * - * This lock is also used to serialize userland sysctl requests. Some - * sysctls wire user memory, and serializing the requests limits the - * amount of wired user memory in use. + * The sysctlmemlock is used to limit the amount of user memory wired for + * sysctl requests. This is implemented by serializing any userland + * sysctl requests larger than a single page via an exclusive lock. */ static struct sx sysctllock; +static struct sx sysctlmemlock; #define SYSCTL_SLOCK() sx_slock(&sysctllock) #define SYSCTL_SUNLOCK() sx_sunlock(&sysctllock) @@ -543,6 +544,7 @@ sysctl_register_all(void *arg) { struct sysctl_oid **oidp; + sx_init(&sysctlmemlock, "sysctl mem"); SYSCTL_INIT(); SYSCTL_XLOCK(); SET_FOREACH(oidp, sysctl_set) @@ -1565,7 +1567,7 @@ userland_sysctl(struct thread *td, int * size_t *oldlenp, int inkernel, void *new, size_t newlen, size_t *retval, int flags) { - int error = 0; + int error = 0, memlocked; struct sysctl_req req; bzero(&req, sizeof req); @@ -1605,14 +1607,20 @@ userland_sysctl(struct thread *td, int * if (KTRPOINT(curthread, KTR_SYSCTL)) ktrsysctl(name, namelen); #endif - - SYSCTL_XLOCK(); + + if (req.oldlen > PAGE_SIZE) { + memlocked = 1; + sx_xlock(&sysctlmemlock); + } else + memlocked = 0; CURVNET_SET(TD_TO_VNET(curthread)); for (;;) { req.oldidx = 0; req.newidx = 0; + SYSCTL_SLOCK(); error = sysctl_root(0, name, namelen, &req); + SYSCTL_SUNLOCK(); if (error != EAGAIN) break; uio_yield(); @@ -1622,7 +1630,8 @@ userland_sysctl(struct thread *td, int * if (req.lock == REQ_WIRED && req.validlen > 0) vsunlock(req.oldptr, req.validlen); - SYSCTL_XUNLOCK(); + if (memlocked) + sx_xunlock(&sysctlmemlock); if (error && error != ENOMEM) return (error); From owner-svn-src-head@FreeBSD.ORG Thu May 14 22:33:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2E0CC106566C; Thu, 14 May 2009 22:33:38 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1CF5D8FC1A; Thu, 14 May 2009 22:33:38 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4EMXco5004581; Thu, 14 May 2009 22:33:38 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4EMXbc5004580; Thu, 14 May 2009 22:33:37 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200905142233.n4EMXbc5004580@svn.freebsd.org> From: Xin LI Date: Thu, 14 May 2009 22:33:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192127 - head/sys/dev/bge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 22:33:38 -0000 Author: delphij Date: Thu May 14 22:33:37 2009 New Revision: 192127 URL: http://svn.freebsd.org/changeset/base/192127 Log: Try to workaround a race where bge_stop() may sneak in when bge_rxeof() drops and re-grabs the softc mutex in the middle, resulting in kernel trap 12. This may happen when a lot of traffic is being hammered on one bge(4) interface while the system is shutting down. Reported by: Alexander Sack PR: kern/134548 MFC After: 2 weeks Modified: head/sys/dev/bge/if_bge.c Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Thu May 14 22:13:17 2009 (r192126) +++ head/sys/dev/bge/if_bge.c Thu May 14 22:33:37 2009 (r192127) @@ -3193,6 +3193,9 @@ bge_rxeof(struct bge_softc *sc) BGE_UNLOCK(sc); (*ifp->if_input)(ifp, m); BGE_LOCK(sc); + + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) + return; } if (stdcnt > 0) @@ -3301,6 +3304,10 @@ bge_poll(struct ifnet *ifp, enum poll_cm sc->rxcycles = count; bge_rxeof(sc); + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { + BGE_UNLOCK(sc); + return; + } bge_txeof(sc); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) bge_start_locked(ifp); @@ -3370,7 +3377,9 @@ bge_intr(void *xsc) if (ifp->if_drv_flags & IFF_DRV_RUNNING) { /* Check RX return ring producer/consumer. */ bge_rxeof(sc); + } + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { /* Check TX ring producer/consumer. */ bge_txeof(sc); } From owner-svn-src-head@FreeBSD.ORG Thu May 14 22:36:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 159DB106568A; Thu, 14 May 2009 22:36:57 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0441B8FC08; Thu, 14 May 2009 22:36:57 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4EMauga004678; Thu, 14 May 2009 22:36:56 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4EMauXV004677; Thu, 14 May 2009 22:36:56 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200905142236.n4EMauXV004677@svn.freebsd.org> From: Xin LI Date: Thu, 14 May 2009 22:36:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192128 - head/sys/dev/bge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 22:36:57 -0000 Author: delphij Date: Thu May 14 22:36:56 2009 New Revision: 192128 URL: http://svn.freebsd.org/changeset/base/192128 Log: Some comment/space changes (FALLTHRU -> FALLTHROUGH, space after while). Modified: head/sys/dev/bge/if_bge.c Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Thu May 14 22:33:37 2009 (r192127) +++ head/sys/dev/bge/if_bge.c Thu May 14 22:36:56 2009 (r192128) @@ -2441,14 +2441,14 @@ bge_attach(device_t dev) case BGE_ASICREV_BCM5780: case BGE_ASICREV_BCM5714: sc->bge_flags |= BGE_FLAG_5714_FAMILY /* | BGE_FLAG_JUMBO */; - /* FALLTHRU */ + /* FALLTHROUGH */ case BGE_ASICREV_BCM5750: case BGE_ASICREV_BCM5752: case BGE_ASICREV_BCM5755: case BGE_ASICREV_BCM5787: case BGE_ASICREV_BCM5906: sc->bge_flags |= BGE_FLAG_575X_PLUS; - /* FALLTHRU */ + /* FALLTHROUGH */ case BGE_ASICREV_BCM5705: sc->bge_flags |= BGE_FLAG_5705_PLUS; break; @@ -3073,7 +3073,7 @@ bge_rxeof(struct bge_softc *sc) bus_dmamap_sync(sc->bge_cdata.bge_rx_jumbo_ring_tag, sc->bge_cdata.bge_rx_jumbo_ring_map, BUS_DMASYNC_POSTREAD); - while(sc->bge_rx_saved_considx != + while (sc->bge_rx_saved_considx != sc->bge_ldata.bge_status_block->bge_idx[0].bge_rx_prod_idx) { struct bge_rx_bd *cur_rx; uint32_t rxidx; From owner-svn-src-head@FreeBSD.ORG Thu May 14 22:49:30 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 35A371065673; Thu, 14 May 2009 22:49:30 +0000 (UTC) (envelope-from peterjeremy@optushome.com.au) Received: from mail12.syd.optusnet.com.au (mail12.syd.optusnet.com.au [211.29.132.193]) by mx1.freebsd.org (Postfix) with ESMTP id 9ECC18FC1D; Thu, 14 May 2009 22:49:29 +0000 (UTC) (envelope-from peterjeremy@optushome.com.au) Received: from server.vk2pj.dyndns.org (c122-106-216-167.belrs3.nsw.optusnet.com.au [122.106.216.167]) by mail12.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n4EMnQxh024327 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 15 May 2009 08:49:27 +1000 X-Bogosity: Ham, spamicity=0.000000 Received: from server.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1]) by server.vk2pj.dyndns.org (8.14.3/8.14.3) with ESMTP id n4EMnQ0T057853; Fri, 15 May 2009 08:49:26 +1000 (EST) (envelope-from peter@server.vk2pj.dyndns.org) Received: (from peter@localhost) by server.vk2pj.dyndns.org (8.14.3/8.14.3/Submit) id n4EMnQhk057852; Fri, 15 May 2009 08:49:26 +1000 (EST) (envelope-from peter) Date: Fri, 15 May 2009 08:49:26 +1000 From: Peter Jeremy To: Warner Losh Message-ID: <20090514224925.GB57001@server.vk2pj.dyndns.org> References: <200905030401.n4341h9W003803@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="PmA2V3Z32TCmWXqI" Content-Disposition: inline In-Reply-To: <200905030401.n4341h9W003803@svn.freebsd.org> X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc User-Agent: Mutt/1.5.19 (2009-01-05) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191762 - in head/sys: conf dev/bwi modules/bwi X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 22:49:30 -0000 --PmA2V3Z32TCmWXqI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2009-May-03 04:01:43 +0000, Warner Losh wrote: > Bring in Andrew Thompson's port of Sepherosa Ziehau's bwi driver for > Broadcom BCM43xx chipsets. Thanks for this. Is there a particular reason why it is not connected to the build via either NOTES or modules/Makefile? --=20 Peter Jeremy --PmA2V3Z32TCmWXqI Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.11 (FreeBSD) iEYEARECAAYFAkoMn/UACgkQ/opHv/APuId43gCfe/+tqKdAFKCVays8aKg+YhOi r3cAni8q4JKPeKygtrzgyIGThcbY+Ukk =lo+H -----END PGP SIGNATURE----- --PmA2V3Z32TCmWXqI-- From owner-svn-src-head@FreeBSD.ORG Thu May 14 23:09:33 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B6CA0106568B; Thu, 14 May 2009 23:09:33 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 89BAB8FC21; Thu, 14 May 2009 23:09:33 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4EN9XEu005318; Thu, 14 May 2009 23:09:33 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4EN9XdU005317; Thu, 14 May 2009 23:09:33 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200905142309.n4EN9XdU005317@svn.freebsd.org> From: Xin LI Date: Thu, 14 May 2009 23:09:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192129 - head/lib/libc/gen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 23:09:37 -0000 Author: delphij Date: Thu May 14 23:09:33 2009 New Revision: 192129 URL: http://svn.freebsd.org/changeset/base/192129 Log: As the comment says, close() frees the variable, record. So we obtain the length by evaluating the value from the copy, cbuf instead. This fixes a crash caused by previous commit (use-after-free) Submitted by: Dimitry Andric Pointy hat to: delphij Modified: head/lib/libc/gen/getcap.c Modified: head/lib/libc/gen/getcap.c ============================================================================== --- head/lib/libc/gen/getcap.c Thu May 14 22:36:56 2009 (r192128) +++ head/lib/libc/gen/getcap.c Thu May 14 23:09:33 2009 (r192129) @@ -260,7 +260,7 @@ getent(char **cap, u_int *len, char **db errno = ENOMEM; return (-2); } - *len = strlen(record); + *len = strlen(cbuf); *cap = cbuf; return (retval); } else { From owner-svn-src-head@FreeBSD.ORG Fri May 15 00:18:32 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5FA9A1065673; Fri, 15 May 2009 00:18:32 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4CBCF8FC18; Fri, 15 May 2009 00:18:32 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4F0IVID006629; Fri, 15 May 2009 00:18:31 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4F0IVwb006628; Fri, 15 May 2009 00:18:31 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <200905150018.n4F0IVwb006628@svn.freebsd.org> From: Colin Percival Date: Fri, 15 May 2009 00:18:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192130 - head/usr.sbin/sysinstall X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 00:18:32 -0000 Author: cperciva Date: Fri May 15 00:18:31 2009 New Revision: 192130 URL: http://svn.freebsd.org/changeset/base/192130 Log: Allow a comma-separated list of network interfaces to be specified via the netDev option in install.cfg. Submitted by: randi MFC after: 1 week Modified: head/usr.sbin/sysinstall/tcpip.c Modified: head/usr.sbin/sysinstall/tcpip.c ============================================================================== --- head/usr.sbin/sysinstall/tcpip.c Thu May 14 23:09:33 2009 (r192129) +++ head/usr.sbin/sysinstall/tcpip.c Fri May 15 00:18:31 2009 (r192130) @@ -642,11 +642,26 @@ tcpDeviceSelect(void) { DMenu *menu; Device **devs, *rval; + char *dev, *network_dev; int cnt; + rval = NULL; + + if (variable_get(VAR_NONINTERACTIVE) && variable_get(VAR_NETWORK_DEVICE)) { + network_dev = variable_get(VAR_NETWORK_DEVICE); + + while ((dev = strsep(&network_dev, ",")) != NULL) { + devs = deviceFind(dev, DEVICE_TYPE_NETWORK); + cnt = deviceCount(devs); + if (cnt) { + if (DITEM_STATUS(tcpOpenDialog(devs[0]) == DITEM_SUCCESS)) + return(devs[0]); + } + } + } + devs = deviceFind(variable_get(VAR_NETWORK_DEVICE), DEVICE_TYPE_NETWORK); cnt = deviceCount(devs); - rval = NULL; if (!cnt) { msgConfirm("No network devices available!"); @@ -660,14 +675,6 @@ tcpDeviceSelect(void) if (DITEM_STATUS(tcpOpenDialog(devs[0]) == DITEM_SUCCESS)) rval = devs[0]; } - else if (variable_get(VAR_NONINTERACTIVE) && variable_get(VAR_NETWORK_DEVICE)) { - devs = deviceFind(variable_get(VAR_NETWORK_DEVICE), DEVICE_TYPE_NETWORK); - cnt = deviceCount(devs); - if (cnt) { - if (DITEM_STATUS(tcpOpenDialog(devs[0]) == DITEM_SUCCESS)) - rval = devs[0]; - } - } else { int status; From owner-svn-src-head@FreeBSD.ORG Fri May 15 02:14:49 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D05541065678 for ; Fri, 15 May 2009 02:14:49 +0000 (UTC) (envelope-from qingli@speakeasy.net) Received: from mail6.sea5.speakeasy.net (mail6.sea5.speakeasy.net [69.17.117.8]) by mx1.freebsd.org (Postfix) with ESMTP id A9EDB8FC1C for ; Fri, 15 May 2009 02:14:49 +0000 (UTC) (envelope-from qingli@speakeasy.net) Received: (qmail 539 invoked from network); 15 May 2009 02:14:49 -0000 Received: from dsl081-051-194.sfo1.dsl.speakeasy.net (HELO qm8nwm5acsx) ([64.81.51.194]) (envelope-sender ) by mail6.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 15 May 2009 02:14:48 -0000 From: "Qing Li" To: "'George Neville-Neil'" , "'Qing Li'" Date: Thu, 14 May 2009 19:14:52 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 In-Reply-To: <9CCFD49C-C5B3-4C45-BA74-AC29CF1F0EDA@neville-neil.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 Thread-Index: AcnUo3e2wyY/NGUUT0iiy76ZD0rmIAAXvOkg Message-Id: <20090515021449.A9EDB8FC1C@mx1.freebsd.org> Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: RE: svn commit: r192085 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 02:14:50 -0000 > -----Original Message----- > From: George Neville-Neil [mailto:gnn@neville-neil.com] > Sent: Thursday, May 14, 2009 7:36 AM > To: Qing Li > Cc: src-committers@FreeBSD.org; svn-src-all@FreeBSD.org; > svn-src-head@FreeBSD.org > Subject: Re: svn commit: r192085 - head/sys/netinet > > > On May 13, 2009, at 22:27 , Qing Li wrote: > > > Author: qingli > > Date: Thu May 14 05:27:09 2009 > > New Revision: 192085 > > URL: http://svn.freebsd.org/changeset/base/192085 > > > > Log: > > Ignore the INADDR_ANY address inserted/deleted by DHCP when > > installing a loopback route to the interface address. > > > > > Can you give more detail as to the purpose of this change? > I'm a bit confused by it. Does this fix any of the recent > problems seen with DHCP and PXE or is this unrelated? > The DHCP client code adds a 0.0.0.0 address and then deletes it once the server assign the node a real IP. It's easily Observed by running dhclient followed by netstat. I had to take care of this DHCP related bits before, e.g., not creating an ARP entry for it. That's really it. Exactly which part is confusing you ? -- Qing From owner-svn-src-head@FreeBSD.ORG Fri May 15 03:41:18 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07C95106564A; Fri, 15 May 2009 03:41:18 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id A42EB8FC13; Fri, 15 May 2009 03:41:17 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id n4F3b4AU046227; Thu, 14 May 2009 21:37:04 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Thu, 14 May 2009 21:37:12 -0600 (MDT) Message-Id: <20090514.213712.-404854369.imp@bsdimp.com> To: stas@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <200905122114.n4CLEag9033208@svn.freebsd.org> References: <200905122114.n4CLEag9033208@svn.freebsd.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r192027 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 03:41:18 -0000 In message: <200905122114.n4CLEag9033208@svn.freebsd.org> Stanislav Sedov writes: : @@ -926,6 +937,7 @@ atestart_locked(struct ifnet *ifp) : * tell the hardware to xmit the packet. : */ : WR4(sc, ETH_TAR, segs[0].ds_addr); : + BARRIER(sc, ETH_TAR, 8, BUS_SPACE_BARRIER_WRITE); : WR4(sc, ETH_TCR, segs[0].ds_len); Why is a barrier needed here? Warner From owner-svn-src-head@FreeBSD.ORG Fri May 15 03:46:53 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6BA711065676; Fri, 15 May 2009 03:46:53 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 006B08FC1F; Fri, 15 May 2009 03:46:52 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id n4F3iI2B046705; Thu, 14 May 2009 21:44:18 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Thu, 14 May 2009 21:44:26 -0600 (MDT) Message-Id: <20090514.214426.446350911.imp@bsdimp.com> To: stas@freebsd.org From: "M. Warner Losh" In-Reply-To: <20090514002555.f56ba38b.stas@FreeBSD.org> References: <200905131842.n4DIgnnu064429@svn.freebsd.org> <20090514002555.f56ba38b.stas@FreeBSD.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, gonzo@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r192059 - in head/sys: arm/at91 dev/spibus X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 03:46:54 -0000 In message: <20090514002555.f56ba38b.stas@FreeBSD.org> Stanislav Sedov writes: : On Wed, 13 May 2009 18:42:49 +0000 (UTC) : Oleksandr Tymoshenko mentioned: : : > Author: gonzo : > Date: Wed May 13 18:42:49 2009 : > New Revision: 192059 : > URL: http://svn.freebsd.org/changeset/base/192059 : > : > Log: : > - Make SPI bus bridge be non-arch dependent by using more generic : > name : > : > Reviewed by: imp : > : > Modified: : > head/sys/arm/at91/at91_spi.c : > head/sys/dev/spibus/spibus.c : > : > Modified: head/sys/arm/at91/at91_spi.c : > ============================================================================== : > --- head/sys/arm/at91/at91_spi.c Wed May 13 18:31:28 2009 (r192058) : > +++ head/sys/arm/at91/at91_spi.c Wed May 13 18:42:49 2009 (r192059) : > @@ -297,7 +297,7 @@ static device_method_t at91_spi_methods[ : > }; : > : > static driver_t at91_spi_driver = { : > - "at91_spi", : > + "spi", : > at91_spi_methods, : > sizeof(struct at91_spi_softc), : > }; : > : > Modified: head/sys/dev/spibus/spibus.c : > ============================================================================== : > --- head/sys/dev/spibus/spibus.c Wed May 13 18:31:28 2009 (r192058) : > +++ head/sys/dev/spibus/spibus.c Wed May 13 18:42:49 2009 (r192059) : > @@ -194,5 +194,5 @@ static driver_t spibus_driver = { : > : > devclass_t spibus_devclass; : > : > -DRIVER_MODULE(spibus, at91_spi, spibus_driver, spibus_devclass, 0, 0); : > +DRIVER_MODULE(spibus, spi, spibus_driver, spibus_devclass, 0, 0); : > MODULE_VERSION(spibus, 1); : > : : On the other hand this driver appears to be machine-specific. What if one : would like to have a kernel with several SPI bus drivers included for devices : that doesn't support enumeration? In this case it will be impossible to : diffirentiate these drivers in the hints file. The driver is machine specific. However, there's almost certainly only ever going to be one of these drivers that attaches to a given bus. It is little different from the variety pci bridge drivers we have, for example, that all have the same name. Unlike the i2c case we had recently (which is about devices that attach to i2c), this driver is a controller for the spi bus. Warner From owner-svn-src-head@FreeBSD.ORG Fri May 15 04:01:24 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DAF391065672; Fri, 15 May 2009 04:01:24 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 755248FC22; Fri, 15 May 2009 04:01:24 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id n4F3xZxL048504; Thu, 14 May 2009 21:59:35 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Thu, 14 May 2009 21:59:43 -0600 (MDT) Message-Id: <20090514.215943.846952119.imp@bsdimp.com> To: peterjeremy@optushome.com.au From: "M. Warner Losh" In-Reply-To: <20090514224925.GB57001@server.vk2pj.dyndns.org> References: <200905030401.n4341h9W003803@svn.freebsd.org> <20090514224925.GB57001@server.vk2pj.dyndns.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r191762 - in head/sys: conf dev/bwi modules/bwi X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 04:01:25 -0000 In message: <20090514224925.GB57001@server.vk2pj.dyndns.org> Peter Jeremy writes: : On 2009-May-03 04:01:43 +0000, Warner Losh wrote: : > Bring in Andrew Thompson's port of Sepherosa Ziehau's bwi driver for : > Broadcom BCM43xx chipsets. : : Thanks for this. Is there a particular reason why it is not connected : to the build via either NOTES or modules/Makefile? I haven't gotten around to it. :) There's no man page either. And maybe a couple of other things missing... Warner From owner-svn-src-head@FreeBSD.ORG Fri May 15 04:33:36 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 31BE21065672; Fri, 15 May 2009 04:33:36 +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 050098FC0A; Fri, 15 May 2009 04:33:36 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4F4XZHY012126; Fri, 15 May 2009 04:33:35 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4F4XZRj012123; Fri, 15 May 2009 04:33:35 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200905150433.n4F4XZRj012123@svn.freebsd.org> From: Alan Cox Date: Fri, 15 May 2009 04:33:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192134 - in head/sys: fs/smbfs nfsclient vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 04:33:36 -0000 Author: alc Date: Fri May 15 04:33:35 2009 New Revision: 192134 URL: http://svn.freebsd.org/changeset/base/192134 Log: Eliminate unnecessary clearing of the page's dirty mask from various getpages functions. Eliminate a stale comment. Modified: head/sys/fs/smbfs/smbfs_io.c head/sys/nfsclient/nfs_bio.c head/sys/vm/vnode_pager.c Modified: head/sys/fs/smbfs/smbfs_io.c ============================================================================== --- head/sys/fs/smbfs/smbfs_io.c Fri May 15 01:54:32 2009 (r192133) +++ head/sys/fs/smbfs/smbfs_io.c Fri May 15 04:33:35 2009 (r192134) @@ -524,7 +524,9 @@ smbfs_getpages(ap) * Read operation filled a partial page. */ m->valid = 0; - vm_page_set_validclean(m, 0, size - toff); + vm_page_set_valid(m, 0, size - toff); + KASSERT((m->dirty & vm_page_bits(0, size - toff)) == 0, + ("smbfs_getpages: page %p is dirty", m)); } else { /* * Read operation was short. If no error occured Modified: head/sys/nfsclient/nfs_bio.c ============================================================================== --- head/sys/nfsclient/nfs_bio.c Fri May 15 01:54:32 2009 (r192133) +++ head/sys/nfsclient/nfs_bio.c Fri May 15 04:33:35 2009 (r192134) @@ -216,7 +216,9 @@ nfs_getpages(struct vop_getpages_args *a * Read operation filled a partial page. */ m->valid = 0; - vm_page_set_validclean(m, 0, size - toff); + vm_page_set_valid(m, 0, size - toff); + KASSERT((m->dirty & vm_page_bits(0, size - toff)) == 0, + ("nfs_getpages: page %p is dirty", m)); } else { /* * Read operation was short. If no error occured Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Fri May 15 01:54:32 2009 (r192133) +++ head/sys/vm/vnode_pager.c Fri May 15 04:33:35 2009 (r192134) @@ -939,17 +939,18 @@ vnode_pager_generic_getpages(vp, m, byte mt)); } else { /* - * Read did not fill up entire page. Since this - * is getpages, the page may be mapped, so we have - * to zero the invalid portions of the page even - * though we aren't setting them valid. + * Read did not fill up entire page. * * Currently we do not set the entire page valid, * we just try to clear the piece that we couldn't * read. */ - vm_page_set_validclean(mt, 0, + vm_page_set_valid(mt, 0, object->un_pager.vnp.vnp_size - tfoff); + KASSERT((mt->dirty & vm_page_bits(0, + object->un_pager.vnp.vnp_size - tfoff)) == 0, + ("vnode_pager_generic_getpages: page %p is dirty", + mt)); } if (i != reqpage) { From owner-svn-src-head@FreeBSD.ORG Fri May 15 04:49:22 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4A83E106566C; Fri, 15 May 2009 04:49:22 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 395138FC16; Fri, 15 May 2009 04:49:22 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4F4nMUg012551; Fri, 15 May 2009 04:49:22 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4F4nLDx012550; Fri, 15 May 2009 04:49:21 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200905150449.n4F4nLDx012550@svn.freebsd.org> From: Warner Losh Date: Fri, 15 May 2009 04:49:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192135 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 04:49:22 -0000 Author: imp Date: Fri May 15 04:49:20 2009 New Revision: 192135 URL: http://svn.freebsd.org/changeset/base/192135 Log: Fix name for driver to assign to the SPI device. Modified: head/sys/arm/at91/at91.c Modified: head/sys/arm/at91/at91.c ============================================================================== --- head/sys/arm/at91/at91.c Fri May 15 04:33:35 2009 (r192134) +++ head/sys/arm/at91/at91.c Fri May 15 04:49:20 2009 (r192135) @@ -409,7 +409,7 @@ struct cpu_devs at91rm9200_devs[] = AT91RM92_IRQ_SSC2 }, { - "at91_spi", 0, + "spi", 0, AT91RM92_BASE + AT91RM92_SPI_BASE, AT91RM92_SPI_SIZE, AT91RM92_IRQ_SPI }, From owner-svn-src-head@FreeBSD.ORG Fri May 15 05:21:42 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90346106566C for ; Fri, 15 May 2009 05:21:42 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from mx0.deglitch.com (backbone.deglitch.com [IPv6:2001:16d8:fffb:4::abba]) by mx1.freebsd.org (Postfix) with ESMTP id 428ED8FC24 for ; Fri, 15 May 2009 05:21:42 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from DSPAM-Daemon (localhost [127.0.0.1]) by mx0.deglitch.com (Postfix) with SMTP id 477168FC52 for ; Fri, 15 May 2009 09:21:41 +0400 (MSD) Received: from orion.SpringDaemons.com (unknown [77.232.3.143]) by mx0.deglitch.com (Postfix) with ESMTPA id 1482C8FC18; Fri, 15 May 2009 09:21:36 +0400 (MSD) Received: from orion (localhost [127.0.0.1]) by orion.SpringDaemons.com (Postfix) with SMTP id 6B8E13982B; Fri, 15 May 2009 09:22:05 +0400 (MSD) Date: Fri, 15 May 2009 09:22:05 +0400 From: Stanislav Sedov To: "M. Warner Losh" Message-Id: <20090515092205.6f6d06fa.stas@FreeBSD.org> In-Reply-To: <20090514.213712.-404854369.imp@bsdimp.com> References: <200905122114.n4CLEag9033208@svn.freebsd.org> <20090514.213712.-404854369.imp@bsdimp.com> Organization: The FreeBSD Project X-XMPP: ssedov@jabber.ru X-Voice: +7 916 849 20 23 X-PGP-Fingerprint: F21E D6CC 5626 9609 6CE2 A385 2BF5 5993 EB26 9581 X-Mailer: carrier-pigeon Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-DSPAM-Result: Innocent X-DSPAM-Processed: Fri May 15 09:21:40 2009 X-DSPAM-Confidence: 0.9899 X-DSPAM-Improbability: 1 in 9809 chance of being spam X-DSPAM-Probability: 0.0000 X-DSPAM-Signature: 4a0cfbe4994291152178454 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r192027 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 05:21:42 -0000 On Thu, 14 May 2009 21:37:12 -0600 (MDT) "M. Warner Losh" mentioned: > In message: <200905122114.n4CLEag9033208@svn.freebsd.org> > Stanislav Sedov writes: > : @@ -926,6 +937,7 @@ atestart_locked(struct ifnet *ifp) > : * tell the hardware to xmit the packet. > : */ > : WR4(sc, ETH_TAR, segs[0].ds_addr); > : + BARRIER(sc, ETH_TAR, 8, BUS_SPACE_BARRIER_WRITE); > : WR4(sc, ETH_TCR, segs[0].ds_len); > > Why is a barrier needed here? > Writing the TCR register triggers the transmit, so it had to be written strongly after the TAR register. That's why I added the barrier here. -- Stanislav Sedov ST4096-RIPE !DSPAM:4a0cfbe4994291152178454! From owner-svn-src-head@FreeBSD.ORG Fri May 15 05:37:37 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3FE5C106566C; Fri, 15 May 2009 05:37:37 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id F40618FC26; Fri, 15 May 2009 05:37:36 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id n4F5ZSBh057956; Thu, 14 May 2009 23:35:28 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Thu, 14 May 2009 23:35:36 -0600 (MDT) Message-Id: <20090514.233536.1299798630.imp@bsdimp.com> To: stas@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <20090515092205.6f6d06fa.stas@FreeBSD.org> References: <200905122114.n4CLEag9033208@svn.freebsd.org> <20090514.213712.-404854369.imp@bsdimp.com> <20090515092205.6f6d06fa.stas@FreeBSD.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r192027 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 05:37:37 -0000 In message: <20090515092205.6f6d06fa.stas@FreeBSD.org> Stanislav Sedov writes: : On Thu, 14 May 2009 21:37:12 -0600 (MDT) : "M. Warner Losh" mentioned: : : > In message: <200905122114.n4CLEag9033208@svn.freebsd.org> : > Stanislav Sedov writes: : > : @@ -926,6 +937,7 @@ atestart_locked(struct ifnet *ifp) : > : * tell the hardware to xmit the packet. : > : */ : > : WR4(sc, ETH_TAR, segs[0].ds_addr); : > : + BARRIER(sc, ETH_TAR, 8, BUS_SPACE_BARRIER_WRITE); : > : WR4(sc, ETH_TCR, segs[0].ds_len); : > : > Why is a barrier needed here? : > : Writing the TCR register triggers the transmit, so it had to be written : strongly after the TAR register. That's why I added the barrier here. Then shouldn't the barrier be after TCR write? Or does this ensure that the write is before TCR? Warner From owner-svn-src-head@FreeBSD.ORG Fri May 15 07:02:40 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 880471065670; Fri, 15 May 2009 07:02:40 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id 26E178FC18; Fri, 15 May 2009 07:02:40 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id 4404A1D15D; Fri, 15 May 2009 09:02:39 +0200 (CEST) Date: Fri, 15 May 2009 09:02:39 +0200 From: Ed Schouten To: Konstantin Belousov Message-ID: <20090515070239.GQ58540@hoeg.nl> References: <200905141054.n4EAsvp1088977@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="KqDMOJtxr760r6Zu" Content-Disposition: inline In-Reply-To: <200905141054.n4EAsvp1088977@svn.freebsd.org> User-Agent: Mutt/1.5.19 (2009-01-05) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r192094 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 07:02:40 -0000 --KqDMOJtxr760r6Zu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Kostik, * Konstantin Belousov wrote: > Log: > Do not advance req->oldidx when sysctl_old_user returning an > error due to copyout failure or short buffer. > =20 > The later breaks the usermode iterators of the sysctl results that pack > arbitrary number of variable-sized structures. Iterator expects that > kernel filled exactly oldlen bytes, and tries to interpret half-filled > or garbage structure at the end of the buffer. In particular, > kinfo_getfile(3) segfaulted. > =20 > Reported and tested by: pho > MFC after: 3 weeks Is it possible that this change introduces a regression? Right now `pstat -t' gets stuck in an infinite loop. I've added the following printf: | Index: pstat.c | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D | --- pstat.c (revision 192128) | +++ pstat.c (working copy) | @@ -263,6 +263,7 @@ | if (errno !=3D ENOMEM) | err(1, "sysctlbyname()"); | len *=3D 2; | + printf("Going to %zu\n", len); | if ((xttys =3D realloc(xttys, len)) =3D=3D NULL) | err(1, "realloc()"); | } pstat on -CURRENT prints: | LINE INQ CAN LIN LOW OUTQ USE LOW COL SESS PGID STATE | Going to 0 | Going to 0 | Going to 0 | ... If I use the same patch on RELENG_6, I get the expected result: | LINE RAW CAN OUT IHIWT ILOWT OHWT LWT COL STATE SESS PGID = DISC | Going to 272 | Going to 544 | Going to 1088 | Going to 2176 | Going to 4352 | Going to 8704 | sysmouse 0 0 0 0 0 0 0 0 - 0 0 = term | ... So the problem is that sysctl overwrites the len argument with 0, even if it returns back to userspace with ENOMEM. I see we have two changes in sysctl. In theory it could also be related to jhb@'s changes to sysctl locking, but I suspect it's less likely. --=20 Ed Schouten WWW: http://80386.nl/ --KqDMOJtxr760r6Zu Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkoNE48ACgkQ52SDGA2eCwUaEwCbBX5Nb09/6Y1n09wBL4QAB18C j24AnRhGs34TjIAWSJDlXfigNOapL2WN =nh0e -----END PGP SIGNATURE----- --KqDMOJtxr760r6Zu-- From owner-svn-src-head@FreeBSD.ORG Fri May 15 07:43:27 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5452710656B8; Fri, 15 May 2009 07:43:27 +0000 (UTC) (envelope-from flo@kasimir.com) Received: from mail.solomo.de (mail.solomo.de [85.214.49.72]) by mx1.freebsd.org (Postfix) with ESMTP id 09D2B8FC0A; Fri, 15 May 2009 07:43:26 +0000 (UTC) (envelope-from flo@kasimir.com) Received: from localhost (localhost [127.0.0.1]) by mail.solomo.de (Postfix) with ESMTP id 543353F4EE; Fri, 15 May 2009 09:28:55 +0200 (CEST) X-Virus-Scanned: amavisd-new at vistream.de Received: from mail.solomo.de ([127.0.0.1]) by localhost (mail.solomo.de [127.0.0.1]) (amavisd-new, port 10024) with LMTP id DAtAmtZoUVF1; Fri, 15 May 2009 09:28:52 +0200 (CEST) Received: from nibbler.vistream.local (relay3.vistream.de [87.139.10.28]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mail.solomo.de (Postfix) with ESMTPSA id C4AC43F4D1; Fri, 15 May 2009 09:28:52 +0200 (CEST) Message-ID: <4A0D19B3.3070007@kasimir.com> Date: Fri, 15 May 2009 09:28:51 +0200 From: Florian Smeets User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1b5pre) Gecko/20090514 Shredder/3.0b3pre MIME-Version: 1.0 To: Ed Schouten References: <200905141054.n4EAsvp1088977@svn.freebsd.org> <20090515070239.GQ58540@hoeg.nl> In-Reply-To: <20090515070239.GQ58540@hoeg.nl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Konstantin Belousov Subject: Re: svn commit: r192094 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 07:43:27 -0000 On 15.05.09 09:02, Ed Schouten wrote: > Hi Kostik, > > * Konstantin Belousov wrote: >> Log: >> Do not advance req->oldidx when sysctl_old_user returning an >> error due to copyout failure or short buffer. >> >> The later breaks the usermode iterators of the sysctl results that pack >> arbitrary number of variable-sized structures. Iterator expects that >> kernel filled exactly oldlen bytes, and tries to interpret half-filled >> or garbage structure at the end of the buffer. In particular, >> kinfo_getfile(3) segfaulted. >> >> Reported and tested by: pho >> MFC after: 3 weeks > > Is it possible that this change introduces a regression? Right now > `pstat -t' gets stuck in an infinite loop. I've added the following > printf: > > > So the problem is that sysctl overwrites the len argument with 0, even > if it returns back to userspace with ENOMEM. > > I see we have two changes in sysctl. In theory it could also be related > to jhb@'s changes to sysctl locking, but I suspect it's less likely. > I'm seeing problems with vmstat -i hanging and taking 100% of one of 4 cores. A ktrace of the process shows this repeatedly 13521 vmstat RET __sysctl 0 13521 vmstat CALL __sysctl(0x7fffffffe1f0,0x2,0x800d0e10c,0x7fffffffe2e8,0,0) 13521 vmstat SCTL "hw.intrcnt" 13521 vmstat RET __sysctl -1 errno 12 Cannot allocate memory 13521 vmstat CALL __sysctl(0x7fffffffe260,0x2,0x7fffffffe1f0,0x7fffffffe258,0x40492b,0xa) 13521 vmstat SCTL "sysctl.name2oid" I did csup before jhb@'s patch. Cheers, Florian From owner-svn-src-head@FreeBSD.ORG Fri May 15 08:32:58 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6192A1065673 for ; Fri, 15 May 2009 08:32:58 +0000 (UTC) (envelope-from pho@holm.cc) Received: from relay03.pair.com (relay03.pair.com [209.68.5.17]) by mx1.freebsd.org (Postfix) with SMTP id 130378FC18 for ; Fri, 15 May 2009 08:32:57 +0000 (UTC) (envelope-from pho@holm.cc) Received: (qmail 71388 invoked from network); 15 May 2009 08:06:14 -0000 Received: from 87.58.145.190 (HELO x2.osted.lan) (87.58.145.190) by relay03.pair.com with SMTP; 15 May 2009 08:06:14 -0000 X-pair-Authenticated: 87.58.145.190 Received: from x2.osted.lan (localhost.osted.lan [127.0.0.1]) by x2.osted.lan (8.14.2/8.14.2) with ESMTP id n4F86DHs027793; Fri, 15 May 2009 10:06:13 +0200 (CEST) (envelope-from pho@x2.osted.lan) Received: (from pho@localhost) by x2.osted.lan (8.14.2/8.14.2/Submit) id n4F86D1f027792; Fri, 15 May 2009 10:06:13 +0200 (CEST) (envelope-from pho) Date: Fri, 15 May 2009 10:06:13 +0200 From: Peter Holm To: Ed Schouten Message-ID: <20090515080613.GA27593@x2.osted.lan> References: <200905141054.n4EAsvp1088977@svn.freebsd.org> <20090515070239.GQ58540@hoeg.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090515070239.GQ58540@hoeg.nl> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Konstantin Belousov Subject: Re: svn commit: r192094 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 08:32:59 -0000 On Fri, May 15, 2009 at 09:02:39AM +0200, Ed Schouten wrote: > Hi Kostik, > > * Konstantin Belousov wrote: > > Log: > > Do not advance req->oldidx when sysctl_old_user returning an > > error due to copyout failure or short buffer. > > > > The later breaks the usermode iterators of the sysctl results that pack > > arbitrary number of variable-sized structures. Iterator expects that > > kernel filled exactly oldlen bytes, and tries to interpret half-filled > > or garbage structure at the end of the buffer. In particular, > > kinfo_getfile(3) segfaulted. > > > > Reported and tested by: pho > > MFC after: 3 weeks > > Is it possible that this change introduces a regression? Right now > `pstat -t' gets stuck in an infinite loop. I've added the following > printf: > > | Index: pstat.c > | =================================================================== > | --- pstat.c (revision 192128) > | +++ pstat.c (working copy) > | @@ -263,6 +263,7 @@ > | if (errno != ENOMEM) > | err(1, "sysctlbyname()"); > | len *= 2; > | + printf("Going to %zu\n", len); > | if ((xttys = realloc(xttys, len)) == NULL) > | err(1, "realloc()"); > | } > > pstat on -CURRENT prints: > > | LINE INQ CAN LIN LOW OUTQ USE LOW COL SESS PGID STATE > | Going to 0 > | Going to 0 > | Going to 0 > | ... > > If I use the same patch on RELENG_6, I get the expected result: > > | LINE RAW CAN OUT IHIWT ILOWT OHWT LWT COL STATE SESS PGID DISC > | Going to 272 > | Going to 544 > | Going to 1088 > | Going to 2176 > | Going to 4352 > | Going to 8704 > | sysmouse 0 0 0 0 0 0 0 0 - 0 0 term > | ... > > So the problem is that sysctl overwrites the len argument with 0, even > if it returns back to userspace with ENOMEM. > > I see we have two changes in sysctl. In theory it could also be related > to jhb@'s changes to sysctl locking, but I suspect it's less likely. > I can confirm that it is r192094 that triggers the loop. - Peter > -- > Ed Schouten > WWW: http://80386.nl/ > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (FreeBSD) > > iEYEARECAAYFAkoNE48ACgkQ52SDGA2eCwUaEwCbBX5Nb09/6Y1n09wBL4QAB18C > j24AnRhGs34TjIAWSJDlXfigNOapL2WN > =nh0e > -----END PGP SIGNATURE----- From owner-svn-src-head@FreeBSD.ORG Fri May 15 09:48:58 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 29768106566C; Fri, 15 May 2009 09:48:58 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id AFD188FC13; Fri, 15 May 2009 09:48:57 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1M4u2B-0004OF-6p; Fri, 15 May 2009 12:48:55 +0300 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id n4F9mq0l050553 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 15 May 2009 12:48:52 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id n4F9mq5i065684; Fri, 15 May 2009 12:48:52 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id n4F9mq5L065683; Fri, 15 May 2009 12:48:52 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 15 May 2009 12:48:52 +0300 From: Kostik Belousov To: Peter Holm Message-ID: <20090515094852.GC1927@deviant.kiev.zoral.com.ua> References: <200905141054.n4EAsvp1088977@svn.freebsd.org> <20090515070239.GQ58540@hoeg.nl> <20090515080613.GA27593@x2.osted.lan> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="3siQDZowHQqNOShm" Content-Disposition: inline In-Reply-To: <20090515080613.GA27593@x2.osted.lan> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.1 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1M4u2B-0004OF-6p ee6a6dc4e3c95b9f9712c95f5ee59bbd X-Terabit: YES Cc: svn-src-head@freebsd.org, Ed Schouten , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r192094 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 09:48:58 -0000 --3siQDZowHQqNOShm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, May 15, 2009 at 10:06:13AM +0200, Peter Holm wrote: > On Fri, May 15, 2009 at 09:02:39AM +0200, Ed Schouten wrote: > > Hi Kostik, > >=20 > > * Konstantin Belousov wrote: > > > Log: > > > Do not advance req->oldidx when sysctl_old_user returning an > > > error due to copyout failure or short buffer. > > > =20 > > > The later breaks the usermode iterators of the sysctl results that = pack > > > arbitrary number of variable-sized structures. Iterator expects that > > > kernel filled exactly oldlen bytes, and tries to interpret half-fil= led > > > or garbage structure at the end of the buffer. In particular, > > > kinfo_getfile(3) segfaulted. > > > =20 > > > Reported and tested by: pho > > > MFC after: 3 weeks > >=20 > > Is it possible that this change introduces a regression? Right now > > `pstat -t' gets stuck in an infinite loop. I've added the following > > printf: > >=20 > > | Index: pstat.c > > | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > | --- pstat.c (revision 192128) > > | +++ pstat.c (working copy) > > | @@ -263,6 +263,7 @@ > > | if (errno !=3D ENOMEM) > > | err(1, "sysctlbyname()"); > > | len *=3D 2; > > | + printf("Going to %zu\n", len); > > | if ((xttys =3D realloc(xttys, len)) =3D=3D NULL) > > | err(1, "realloc()"); > > | } > >=20 > > pstat on -CURRENT prints: > >=20 > > | LINE INQ CAN LIN LOW OUTQ USE LOW COL SESS PGID STA= TE > > | Going to 0 > > | Going to 0 > > | Going to 0 > > | ... > >=20 > > If I use the same patch on RELENG_6, I get the expected result: > >=20 > > | LINE RAW CAN OUT IHIWT ILOWT OHWT LWT COL STATE SESS P= GID DISC > > | Going to 272 > > | Going to 544 > > | Going to 1088 > > | Going to 2176 > > | Going to 4352 > > | Going to 8704 > > | sysmouse 0 0 0 0 0 0 0 0 - 0 = 0 term > > | ... > >=20 > > So the problem is that sysctl overwrites the len argument with 0, even > > if it returns back to userspace with ENOMEM. > >=20 > > I see we have two changes in sysctl. In theory it could also be related > > to jhb@'s changes to sysctl locking, but I suspect it's less likely. > >=20 >=20 > I can confirm that it is r192094 that triggers the loop. Yes, this is what I mean when talked about a breakage. Below is the reversal of r192094 + the change to keep the old, ugly behaviour of sysctl kern.proc.filedesc to return 0 on ENOMEM, but with oldlen chopped at the end of the last completely written struct kern_info instead of the middle of partially-written one. Peter, could you, please, retest ? --3siQDZowHQqNOShm Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkoNOjsACgkQC3+MBN1Mb4h46gCfZws0t7w9YRKFgQtyb8uJYAN2 3NMAniP+hi02OVqqgKivzcPov5V1OSa6 =BBiN -----END PGP SIGNATURE----- --3siQDZowHQqNOShm-- From owner-svn-src-head@FreeBSD.ORG Fri May 15 10:06:33 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C01BE106566B; Fri, 15 May 2009 10:06:33 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AE0F38FC0A; Fri, 15 May 2009 10:06:33 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4FA6XVt019024; Fri, 15 May 2009 10:06:33 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4FA6XrV019023; Fri, 15 May 2009 10:06:33 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <200905151006.n4FA6XrV019023@svn.freebsd.org> From: Christian Brueffer Date: Fri, 15 May 2009 10:06:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192138 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 10:06:34 -0000 Author: brueffer Date: Fri May 15 10:06:33 2009 New Revision: 192138 URL: http://svn.freebsd.org/changeset/base/192138 Log: Sort SEE ALSO section, remove trailing dot. Modified: head/share/man/man4/ath.4 Modified: head/share/man/man4/ath.4 ============================================================================== --- head/share/man/man4/ath.4 Fri May 15 09:47:10 2009 (r192137) +++ head/share/man/man4/ath.4 Fri May 15 10:06:33 2009 (r192138) @@ -266,8 +266,8 @@ This should not happen. .El .Sh SEE ALSO .Xr ath_hal 4 , -.Xr intro 4 , .Xr cardbus 4 , +.Xr intro 4 , .Xr pcic 4 , .Xr wlan 4 , .Xr wlan_ccmp 4 , @@ -276,7 +276,7 @@ This should not happen. .Xr wlan_xauth 4 , .Xr hostapd 8 , .Xr ifconfig 8 , -.Xr wpa_supplicant 8 . +.Xr wpa_supplicant 8 .Sh HISTORY The .Nm From owner-svn-src-head@FreeBSD.ORG Fri May 15 10:11:55 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B8A8106567B; Fri, 15 May 2009 10:11:55 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 094118FC2A; Fri, 15 May 2009 10:11:55 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4FABs9W019163; Fri, 15 May 2009 10:11:54 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4FABsp3019162; Fri, 15 May 2009 10:11:54 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <200905151011.n4FABsp3019162@svn.freebsd.org> From: Christian Brueffer Date: Fri, 15 May 2009 10:11:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192139 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 10:11:55 -0000 Author: brueffer Date: Fri May 15 10:11:54 2009 New Revision: 192139 URL: http://svn.freebsd.org/changeset/base/192139 Log: Xref missing wlan drivers. Modified: head/share/man/man4/wlan.4 Modified: head/share/man/man4/wlan.4 ============================================================================== --- head/share/man/man4/wlan.4 Fri May 15 10:06:33 2009 (r192138) +++ head/share/man/man4/wlan.4 Fri May 15 10:11:54 2009 (r192139) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 26, 2009 +.Dd May 15, 2009 .Dt WLAN 4 .Os .Sh NAME @@ -164,6 +164,7 @@ was used to be compatible with .Sh SEE ALSO .Xr an 4 , .Xr ath 4 , +.Xr bwi 4 , .Xr ipw 4 , .Xr iwi 4 , .Xr iwn 4 , @@ -171,7 +172,10 @@ was used to be compatible with .Xr netintro 4 , .Xr ral 4 , .Xr rum 4 , +.Xr uath 4 , +.Xr upgt 4 , .Xr ural 4 , +.Xr urtw 4 , .Xr wi 4 , .Xr wlan_acl 4 , .Xr wlan_ccmp 4 , From owner-svn-src-head@FreeBSD.ORG Fri May 15 10:13:37 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F0C621065687 for ; Fri, 15 May 2009 10:13:37 +0000 (UTC) (envelope-from pho@holm.cc) Received: from relay00.pair.com (relay00.pair.com [209.68.5.9]) by mx1.freebsd.org (Postfix) with SMTP id B24F08FC1D for ; Fri, 15 May 2009 10:13:37 +0000 (UTC) (envelope-from pho@holm.cc) Received: (qmail 171 invoked from network); 15 May 2009 10:13:35 -0000 Received: from 87.58.145.190 (HELO x2.osted.lan) (87.58.145.190) by relay00.pair.com with SMTP; 15 May 2009 10:13:35 -0000 X-pair-Authenticated: 87.58.145.190 Received: from x2.osted.lan (localhost.osted.lan [127.0.0.1]) by x2.osted.lan (8.14.2/8.14.2) with ESMTP id n4FADZxU031440; Fri, 15 May 2009 12:13:35 +0200 (CEST) (envelope-from pho@x2.osted.lan) Received: (from pho@localhost) by x2.osted.lan (8.14.2/8.14.2/Submit) id n4FADZ9f031439; Fri, 15 May 2009 12:13:35 +0200 (CEST) (envelope-from pho) Date: Fri, 15 May 2009 12:13:35 +0200 From: Peter Holm To: Kostik Belousov Message-ID: <20090515101335.GA31378@x2.osted.lan> References: <200905141054.n4EAsvp1088977@svn.freebsd.org> <20090515070239.GQ58540@hoeg.nl> <20090515080613.GA27593@x2.osted.lan> <20090515094852.GC1927@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090515094852.GC1927@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, Ed Schouten , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r192094 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 10:13:38 -0000 On Fri, May 15, 2009 at 12:48:52PM +0300, Kostik Belousov wrote: > On Fri, May 15, 2009 at 10:06:13AM +0200, Peter Holm wrote: > > On Fri, May 15, 2009 at 09:02:39AM +0200, Ed Schouten wrote: > > > Hi Kostik, > > > > > > * Konstantin Belousov wrote: > > > > Log: > > > > Do not advance req->oldidx when sysctl_old_user returning an > > > > error due to copyout failure or short buffer. > > > > > > > > The later breaks the usermode iterators of the sysctl results that pack > > > > arbitrary number of variable-sized structures. Iterator expects that > > > > kernel filled exactly oldlen bytes, and tries to interpret half-filled > > > > or garbage structure at the end of the buffer. In particular, > > > > kinfo_getfile(3) segfaulted. > > > > > > > > Reported and tested by: pho > > > > MFC after: 3 weeks > > > > > > Is it possible that this change introduces a regression? Right now > > > `pstat -t' gets stuck in an infinite loop. I've added the following > > > printf: > > > > > > | Index: pstat.c > > > | =================================================================== > > > | --- pstat.c (revision 192128) > > > | +++ pstat.c (working copy) > > > | @@ -263,6 +263,7 @@ > > > | if (errno != ENOMEM) > > > | err(1, "sysctlbyname()"); > > > | len *= 2; > > > | + printf("Going to %zu\n", len); > > > | if ((xttys = realloc(xttys, len)) == NULL) > > > | err(1, "realloc()"); > > > | } > > > > > > pstat on -CURRENT prints: > > > > > > | LINE INQ CAN LIN LOW OUTQ USE LOW COL SESS PGID STATE > > > | Going to 0 > > > | Going to 0 > > > | Going to 0 > > > | ... > > > > > > If I use the same patch on RELENG_6, I get the expected result: > > > > > > | LINE RAW CAN OUT IHIWT ILOWT OHWT LWT COL STATE SESS PGID DISC > > > | Going to 272 > > > | Going to 544 > > > | Going to 1088 > > > | Going to 2176 > > > | Going to 4352 > > > | Going to 8704 > > > | sysmouse 0 0 0 0 0 0 0 0 - 0 0 term > > > | ... > > > > > > So the problem is that sysctl overwrites the len argument with 0, even > > > if it returns back to userspace with ENOMEM. > > > > > > I see we have two changes in sysctl. In theory it could also be related > > > to jhb@'s changes to sysctl locking, but I suspect it's less likely. > > > > > > > I can confirm that it is r192094 that triggers the loop. > > Yes, this is what I mean when talked about a breakage. > > Below is the reversal of r192094 + the change to keep the old, ugly > behaviour of sysctl kern.proc.filedesc to return 0 on ENOMEM, but with > oldlen chopped at the end of the last completely written struct kern_info > instead of the middle of partially-written one. > > Peter, could you, please, retest ? Right away. - Peter From owner-svn-src-head@FreeBSD.ORG Fri May 15 10:38:59 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 85AF1106564A; Fri, 15 May 2009 10:38:59 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id CC0978FC08; Fri, 15 May 2009 10:38:58 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1M4uoa-0009FN-FG; Fri, 15 May 2009 13:38:56 +0300 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id n4FAcrxR054266 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 15 May 2009 13:38:53 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id n4FAcruh066312; Fri, 15 May 2009 13:38:53 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id n4FAcrLG066311; Fri, 15 May 2009 13:38:53 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 15 May 2009 13:38:53 +0300 From: Kostik Belousov To: Peter Holm Message-ID: <20090515103853.GE1927@deviant.kiev.zoral.com.ua> References: <200905141054.n4EAsvp1088977@svn.freebsd.org> <20090515070239.GQ58540@hoeg.nl> <20090515080613.GA27593@x2.osted.lan> <20090515094852.GC1927@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="G6nVm6DDWH/FONJq" Content-Disposition: inline In-Reply-To: <20090515094852.GC1927@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.1 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1M4uoa-0009FN-FG f54ff79d2976c55b1d44e7b1e917e4a9 X-Terabit: YES Cc: svn-src-head@freebsd.org, Ed Schouten , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r192094 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 10:39:00 -0000 --G6nVm6DDWH/FONJq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, May 15, 2009 at 12:48:52PM +0300, Kostik Belousov wrote: > On Fri, May 15, 2009 at 10:06:13AM +0200, Peter Holm wrote: > > On Fri, May 15, 2009 at 09:02:39AM +0200, Ed Schouten wrote: > > > Hi Kostik, > > >=20 > > > * Konstantin Belousov wrote: > > > > Log: > > > > Do not advance req->oldidx when sysctl_old_user returning an > > > > error due to copyout failure or short buffer. > > > > =20 > > > > The later breaks the usermode iterators of the sysctl results tha= t pack > > > > arbitrary number of variable-sized structures. Iterator expects t= hat > > > > kernel filled exactly oldlen bytes, and tries to interpret half-f= illed > > > > or garbage structure at the end of the buffer. In particular, > > > > kinfo_getfile(3) segfaulted. > > > > =20 > > > > Reported and tested by: pho > > > > MFC after: 3 weeks > > >=20 > > > Is it possible that this change introduces a regression? Right now > > > `pstat -t' gets stuck in an infinite loop. I've added the following > > > printf: > > >=20 > > > | Index: pstat.c > > > | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > | --- pstat.c (revision 192128) > > > | +++ pstat.c (working copy) > > > | @@ -263,6 +263,7 @@ > > > | if (errno !=3D ENOMEM) > > > | err(1, "sysctlbyname()"); > > > | len *=3D 2; > > > | + printf("Going to %zu\n", len); > > > | if ((xttys =3D realloc(xttys, len)) =3D=3D NULL) > > > | err(1, "realloc()"); > > > | } > > >=20 > > > pstat on -CURRENT prints: > > >=20 > > > | LINE INQ CAN LIN LOW OUTQ USE LOW COL SESS PGID S= TATE > > > | Going to 0 > > > | Going to 0 > > > | Going to 0 > > > | ... > > >=20 > > > If I use the same patch on RELENG_6, I get the expected result: > > >=20 > > > | LINE RAW CAN OUT IHIWT ILOWT OHWT LWT COL STATE SESS = PGID DISC > > > | Going to 272 > > > | Going to 544 > > > | Going to 1088 > > > | Going to 2176 > > > | Going to 4352 > > > | Going to 8704 > > > | sysmouse 0 0 0 0 0 0 0 0 - 0 = 0 term > > > | ... > > >=20 > > > So the problem is that sysctl overwrites the len argument with 0, even > > > if it returns back to userspace with ENOMEM. > > >=20 > > > I see we have two changes in sysctl. In theory it could also be relat= ed > > > to jhb@'s changes to sysctl locking, but I suspect it's less likely. > > >=20 > >=20 > > I can confirm that it is r192094 that triggers the loop. >=20 > Yes, this is what I mean when talked about a breakage. >=20 > Below is the reversal of r192094 + the change to keep the old, ugly > behaviour of sysctl kern.proc.filedesc to return 0 on ENOMEM, but with > oldlen chopped at the end of the last completely written struct kern_info > instead of the middle of partially-written one. >=20 > Peter, could you, please, retest ? Err, the patch. diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index f29b0eb..e0008e6 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -2883,6 +2883,7 @@ sysctl_kern_proc_filedesc(SYSCTL_HANDLER_ARGS) struct proc *p; struct tty *tp; int vfslocked; + size_t oldidx; =20 name =3D (int *)arg1; if ((p =3D pfind((pid_t)name[0])) =3D=3D NULL) @@ -3061,14 +3062,26 @@ sysctl_kern_proc_filedesc(SYSCTL_HANDLER_ARGS) strlen(kif->kf_path) + 1; kif->kf_structsize =3D roundup(kif->kf_structsize, sizeof(uint64_t)); + oldidx =3D req->oldidx; error =3D SYSCTL_OUT(req, kif, kif->kf_structsize); - if (error) + if (error) { + if (error =3D=3D ENOMEM) { + /* + * The hack to keep the ABI of sysctl + * kern.proc.filedesc intact, but not + * to account a partially copied + * kinfo_file into the oldidx. + */ + req->oldidx =3D oldidx; + error =3D 0; + } break; + } } FILEDESC_SUNLOCK(fdp); fddrop(fdp); free(kif, M_TEMP); - return (0); + return (error); } =20 static SYSCTL_NODE(_kern_proc, KERN_PROC_FILEDESC, filedesc, CTLFLAG_RD, diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index bf539be..0a8a096 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -1223,9 +1223,9 @@ sysctl_old_kernel(struct sysctl_req *req, const void = *p, size_t l) if (i > 0) bcopy(p, (char *)req->oldptr + req->oldidx, i); } + req->oldidx +=3D l; if (req->oldptr && i !=3D l) return (ENOMEM); - req->oldidx +=3D l; return (0); } =20 @@ -1322,10 +1322,9 @@ sysctl_old_user(struct sysctl_req *req, const void *= p, size_t l) size_t i, len, origidx; =20 origidx =3D req->oldidx; - if (req->oldptr =3D=3D NULL) { - req->oldidx +=3D l; + req->oldidx +=3D l; + if (req->oldptr =3D=3D NULL) return (0); - } /* * If we have not wired the user supplied buffer and we are currently * holding locks, drop a witness warning, as it's possible that @@ -1347,7 +1346,6 @@ sysctl_old_user(struct sysctl_req *req, const void *p= , size_t l) return (error); if (i < l) return (ENOMEM); - req->oldidx +=3D l; return (0); } =20 --G6nVm6DDWH/FONJq Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkoNRjwACgkQC3+MBN1Mb4iNVwCgxEsXB7aKNdZq+YnSK30UT0C6 24AAn1IaZdSk7cbb5fn9TUp+N2WIhqnt =vaye -----END PGP SIGNATURE----- --G6nVm6DDWH/FONJq-- From owner-svn-src-head@FreeBSD.ORG Fri May 15 13:20:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B4E21065676; Fri, 15 May 2009 13:20:38 +0000 (UTC) (envelope-from flo@kasimir.com) Received: from mail.solomo.de (mail.solomo.de [85.214.49.72]) by mx1.freebsd.org (Postfix) with ESMTP id A37618FC19; Fri, 15 May 2009 13:20:36 +0000 (UTC) (envelope-from flo@kasimir.com) Received: from localhost (localhost [127.0.0.1]) by mail.solomo.de (Postfix) with ESMTP id 6B96E3F4EB; Fri, 15 May 2009 15:20:35 +0200 (CEST) X-Virus-Scanned: amavisd-new at vistream.de Received: from mail.solomo.de ([127.0.0.1]) by localhost (mail.solomo.de [127.0.0.1]) (amavisd-new, port 10024) with LMTP id cjbgDBYk2+9T; Fri, 15 May 2009 15:20:33 +0200 (CEST) Received: from nibbler.vistream.local (relay3.vistream.de [87.139.10.28]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mail.solomo.de (Postfix) with ESMTPSA id F3B003F4B0; Fri, 15 May 2009 15:20:32 +0200 (CEST) Message-ID: <4A0D6C20.3050908@kasimir.com> Date: Fri, 15 May 2009 15:20:32 +0200 From: Florian Smeets User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1b5pre) Gecko/20090515 Shredder/3.0b3pre MIME-Version: 1.0 To: Kostik Belousov References: <200905141054.n4EAsvp1088977@svn.freebsd.org> <20090515070239.GQ58540@hoeg.nl> <20090515080613.GA27593@x2.osted.lan> <20090515094852.GC1927@deviant.kiev.zoral.com.ua> <20090515103853.GE1927@deviant.kiev.zoral.com.ua> In-Reply-To: <20090515103853.GE1927@deviant.kiev.zoral.com.ua> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, Peter Holm , svn-src-all@freebsd.org, src-committers@freebsd.org, Ed Schouten Subject: Re: svn commit: r192094 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 13:20:38 -0000 On 15.05.09 12:38, Kostik Belousov wrote: > On Fri, May 15, 2009 at 12:48:52PM +0300, Kostik Belousov wrote: >> On Fri, May 15, 2009 at 10:06:13AM +0200, Peter Holm wrote: >>> On Fri, May 15, 2009 at 09:02:39AM +0200, Ed Schouten wrote: >>>> Hi Kostik, >>>> >>>> * Konstantin Belousov wrote: >>>>> Log: >>>>> Do not advance req->oldidx when sysctl_old_user returning an >>>>> error due to copyout failure or short buffer. >>>>> >>>>> The later breaks the usermode iterators of the sysctl results that pack >>>>> arbitrary number of variable-sized structures. Iterator expects that >>>>> kernel filled exactly oldlen bytes, and tries to interpret half-filled >>>>> or garbage structure at the end of the buffer. In particular, >>>>> kinfo_getfile(3) segfaulted. >>>>> >>>>> Reported and tested by: pho >>>>> MFC after: 3 weeks >>>> >>>> Is it possible that this change introduces a regression? Right now >>>> `pstat -t' gets stuck in an infinite loop. I've added the following >>>> printf: >>>> >>>> | Index: pstat.c >>>> | =================================================================== >>>> | --- pstat.c (revision 192128) >>>> | +++ pstat.c (working copy) >>>> | @@ -263,6 +263,7 @@ >>>> | if (errno != ENOMEM) >>>> | err(1, "sysctlbyname()"); >>>> | len *= 2; >>>> | + printf("Going to %zu\n", len); >>>> | if ((xttys = realloc(xttys, len)) == NULL) >>>> | err(1, "realloc()"); >>>> | } >>>> >>>> pstat on -CURRENT prints: >>>> >>>> | LINE INQ CAN LIN LOW OUTQ USE LOW COL SESS PGID STATE >>>> | Going to 0 >>>> | Going to 0 >>>> | Going to 0 >>>> | ... >>>> >>>> If I use the same patch on RELENG_6, I get the expected result: >>>> >>>> | LINE RAW CAN OUT IHIWT ILOWT OHWT LWT COL STATE SESS PGID DISC >>>> | Going to 272 >>>> | Going to 544 >>>> | Going to 1088 >>>> | Going to 2176 >>>> | Going to 4352 >>>> | Going to 8704 >>>> | sysmouse 0 0 0 0 0 0 0 0 - 0 0 term >>>> | ... >>>> >>>> So the problem is that sysctl overwrites the len argument with 0, even >>>> if it returns back to userspace with ENOMEM. >>>> >>>> I see we have two changes in sysctl. In theory it could also be related >>>> to jhb@'s changes to sysctl locking, but I suspect it's less likely. >>>> >>> >>> I can confirm that it is r192094 that triggers the loop. >> >> Yes, this is what I mean when talked about a breakage. >> >> Below is the reversal of r192094 + the change to keep the old, ugly >> behaviour of sysctl kern.proc.filedesc to return 0 on ENOMEM, but with >> oldlen chopped at the end of the last completely written struct kern_info >> instead of the middle of partially-written one. >> >> Peter, could you, please, retest ? > > Err, the patch. > [snip patch] The patch fixes my problems. Thanks, Florian From owner-svn-src-head@FreeBSD.ORG Fri May 15 13:26:55 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48D05106566C; Fri, 15 May 2009 13:26:55 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 36B598FC1B; Fri, 15 May 2009 13:26:55 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4FDQtWC024683; Fri, 15 May 2009 13:26:55 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4FDQtTb024682; Fri, 15 May 2009 13:26:55 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <200905151326.n4FDQtTb024682@svn.freebsd.org> From: Christian Brueffer Date: Fri, 15 May 2009 13:26:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192141 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 13:26:55 -0000 Author: brueffer Date: Fri May 15 13:26:54 2009 New Revision: 192141 URL: http://svn.freebsd.org/changeset/base/192141 Log: This driver can be loaded as a module now. MFC after: 3 days Modified: head/share/man/man4/uchcom.4 Modified: head/share/man/man4/uchcom.4 ============================================================================== --- head/share/man/man4/uchcom.4 Fri May 15 10:45:52 2009 (r192140) +++ head/share/man/man4/uchcom.4 Fri May 15 13:26:54 2009 (r192141) @@ -36,7 +36,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 1, 2008 +.Dd May 15, 2009 .Dt UCHCOM 4 .Os .Sh NAME @@ -50,13 +50,13 @@ kernel configuration file: .Cd "device uchcom" .Cd "device ucom" .Ed -.\".Pp -.\"Alternatively, to load the driver as a -.\"module at boot time, place the following line in -.\".Xr loader.conf 5 : -.\".Bd -literal -offset indent -.\"uchcom_load="YES" -.\".Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +uchcom_load="YES" +.Ed .Sh DESCRIPTION The .Nm From owner-svn-src-head@FreeBSD.ORG Fri May 15 14:16:40 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 435C71065674 for ; Fri, 15 May 2009 14:16:40 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from mx0.deglitch.com (backbone.deglitch.com [IPv6:2001:16d8:fffb:4::abba]) by mx1.freebsd.org (Postfix) with ESMTP id EAD088FC26 for ; Fri, 15 May 2009 14:16:39 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from DSPAM-Daemon (localhost [127.0.0.1]) by mx0.deglitch.com (Postfix) with SMTP id F32258FC51 for ; Fri, 15 May 2009 18:16:38 +0400 (MSD) Received: from localhost (dhcp170-225-red.yandex.net [95.108.170.225]) by mx0.deglitch.com (Postfix) with ESMTPSA id 2413A8FC18; Fri, 15 May 2009 18:16:35 +0400 (MSD) Date: Fri, 15 May 2009 14:16:42 +0400 From: Stanislav Sedov To: "M. Warner Losh" Message-Id: <20090515141642.ebc06b59.stas@FreeBSD.org> In-Reply-To: <20090514.233536.1299798630.imp@bsdimp.com> References: <200905122114.n4CLEag9033208@svn.freebsd.org> <20090514.213712.-404854369.imp@bsdimp.com> <20090515092205.6f6d06fa.stas@FreeBSD.org> <20090514.233536.1299798630.imp@bsdimp.com> Organization: The FreeBSD Project X-Mailer: Sylpheed 2.6.0 (GTK+ 2.16.1; amd64-portbld-freebsd7.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-DSPAM-Result: Innocent X-DSPAM-Processed: Fri May 15 18:16:38 2009 X-DSPAM-Confidence: 0.9899 X-DSPAM-Improbability: 1 in 9809 chance of being spam X-DSPAM-Probability: 0.0000 X-DSPAM-Signature: 4a0d7946994291610616987 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r192027 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 14:16:40 -0000 On Thu, 14 May 2009 23:35:36 -0600 (MDT) "M. Warner Losh" mentioned: > In message: <20090515092205.6f6d06fa.stas@FreeBSD.org> > Stanislav Sedov writes: > : On Thu, 14 May 2009 21:37:12 -0600 (MDT) > : "M. Warner Losh" mentioned: > : > : > In message: <200905122114.n4CLEag9033208@svn.freebsd.org> > : > Stanislav Sedov writes: > : > : @@ -926,6 +937,7 @@ atestart_locked(struct ifnet *ifp) > : > : * tell the hardware to xmit the packet. > : > : */ > : > : WR4(sc, ETH_TAR, segs[0].ds_addr); > : > : + BARRIER(sc, ETH_TAR, 8, BUS_SPACE_BARRIER_WRITE); > : > : WR4(sc, ETH_TCR, segs[0].ds_len); > : > > : > Why is a barrier needed here? > : > > : Writing the TCR register triggers the transmit, so it had to be written > : strongly after the TAR register. That's why I added the barrier here. > > Then shouldn't the barrier be after TCR write? Or does this ensure > that the write is before TCR? > Yeah, this barrier is to ensure that the TCR register gets written after the TAR register has been written, not before. I don't think an additional barrier is needed after the TCR write. -- Stanislav Sedov ST4096-RIPE !DSPAM:4a0d7946994291610616987! From owner-svn-src-head@FreeBSD.ORG Fri May 15 14:30:37 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6869C1065673; Fri, 15 May 2009 14:30:37 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 561AA8FC25; Fri, 15 May 2009 14:30:37 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4FEUbsF026077; Fri, 15 May 2009 14:30:37 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4FEUbjF026076; Fri, 15 May 2009 14:30:37 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200905151430.n4FEUbjF026076@svn.freebsd.org> From: Ed Schouten Date: Fri, 15 May 2009 14:30:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192143 - head/sys/dev/syscons X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 14:30:38 -0000 Author: ed Date: Fri May 15 14:30:37 2009 New Revision: 192143 URL: http://svn.freebsd.org/changeset/base/192143 Log: Turn consolectl into a simple device node, not a TTY. Apart from the 16 virtual terminals, Syscons allocates two device nodes that should not really be TTYs, even though they are. One of them is consolectl. In RELENG_7 and before, these device nodes are used in single user mode. After I simplified input path, we only use this device node to call ioctl() on (moused, Xorg, vidcontrol). When you call ioctl() on consolectl, it will behave the same as being called on the first window. Modified: head/sys/dev/syscons/syscons.c Modified: head/sys/dev/syscons/syscons.c ============================================================================== --- head/sys/dev/syscons/syscons.c Fri May 15 13:58:45 2009 (r192142) +++ head/sys/dev/syscons/syscons.c Fri May 15 14:30:37 2009 (r192143) @@ -207,7 +207,7 @@ static int save_kbd_state(scr_stat *scp) static int update_kbd_state(scr_stat *scp, int state, int mask); static int update_kbd_leds(scr_stat *scp, int which); static timeout_t blink_screen; -static struct tty *sc_alloc_tty(int, const char *, ...) __printflike(2, 3); +static struct tty *sc_alloc_tty(int, int); static cn_probe_t sc_cnprobe; static cn_init_t sc_cninit; @@ -224,11 +224,6 @@ static tsw_ioctl_t sctty_ioctl; static tsw_mmap_t sctty_mmap; static struct ttydevsw sc_ttydevsw = { - /* - * XXX: we should use the prefix, but this doesn't work for - * consolectl. - */ - .tsw_flags = TF_NOPREFIX, .tsw_open = sctty_open, .tsw_close = sctty_close, .tsw_outwakeup = sctty_outwakeup, @@ -236,6 +231,15 @@ static struct ttydevsw sc_ttydevsw = { .tsw_mmap = sctty_mmap, }; +static d_ioctl_t consolectl_ioctl; + +static struct cdevsw consolectl_devsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, + .d_ioctl = consolectl_ioctl, + .d_name = "consolectl", +}; + int sc_probe_unit(int unit, int flags) { @@ -321,14 +325,10 @@ sctty_outwakeup(struct tty *tp) } static struct tty * -sc_alloc_tty(int index, const char *fmt, ...) +sc_alloc_tty(int index, int devnum) { - va_list ap; struct sc_ttysoftc *stc; struct tty *tp; - char name[11]; /* "consolectl" */ - - va_start(ap, fmt); /* Allocate TTY object and softc to store unit number. */ stc = malloc(sizeof(struct sc_ttysoftc), M_DEVBUF, M_WAITOK); @@ -337,10 +337,7 @@ sc_alloc_tty(int index, const char *fmt, tp = tty_alloc(&sc_ttydevsw, stc, &Giant); /* Create device node. */ - va_start(ap, fmt); - vsnrprintf(name, sizeof name, 32, fmt, ap); - va_end(ap); - tty_makedev(tp, NULL, "%s", name); + tty_makedev(tp, NULL, "v%r", devnum); return (tp); } @@ -354,7 +351,7 @@ sc_attach_unit(int unit, int flags) video_info_t info; #endif int vc; - struct tty *tp; + struct cdev *dev; flags &= ~SC_KERNEL_CONSOLE; @@ -425,7 +422,7 @@ sc_attach_unit(int unit, int flags) for (vc = 0; vc < sc->vtys; vc++) { if (sc->dev[vc] == NULL) { - sc->dev[vc] = sc_alloc_tty(vc, "ttyv%r", vc + unit * MAXCONS); + sc->dev[vc] = sc_alloc_tty(vc, vc + unit * MAXCONS); if (vc == 0 && sc->dev == main_devs) SC_STAT(sc->dev[0]) = &main_console; } @@ -436,8 +433,9 @@ sc_attach_unit(int unit, int flags) */ } - tp = sc_alloc_tty(0, "consolectl"); - SC_STAT(tp) = sc_console; + dev = make_dev(&consolectl_devsw, 0, UID_ROOT, GID_WHEEL, 0600, + "consolectl"); + dev->si_drv1 = sc->dev[0]; return 0; } @@ -1428,6 +1426,14 @@ sctty_ioctl(struct tty *tp, u_long cmd, return (ENOIOCTL); } +static int +consolectl_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, + struct thread *td) +{ + + return sctty_ioctl(dev->si_drv1, cmd, data, td); +} + static void sc_cnprobe(struct consdev *cp) { @@ -2728,7 +2734,7 @@ scinit(int unit, int flags) /* assert(sc_malloc) */ sc->dev = malloc(sizeof(struct tty *)*sc->vtys, M_DEVBUF, M_WAITOK|M_ZERO); - sc->dev[0] = sc_alloc_tty(0, "ttyv%r", unit * MAXCONS); + sc->dev[0] = sc_alloc_tty(0, unit * MAXCONS); scp = alloc_scp(sc, sc->first_vty); SC_STAT(sc->dev[0]) = scp; } From owner-svn-src-head@FreeBSD.ORG Fri May 15 14:31:51 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BD2201065670; Fri, 15 May 2009 14:31:51 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id 826B08FC1B; Fri, 15 May 2009 14:31:51 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id E41021CF2A; Fri, 15 May 2009 16:31:50 +0200 (CEST) Date: Fri, 15 May 2009 16:31:50 +0200 From: Ed Schouten To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <20090515143150.GT58540@hoeg.nl> References: <200905151430.n4FEUbjF026076@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="GkKDMoQVTmdw7ke1" Content-Disposition: inline In-Reply-To: <200905151430.n4FEUbjF026076@svn.freebsd.org> User-Agent: Mutt/1.5.19 (2009-01-05) Cc: Subject: Re: svn commit: r192143 - head/sys/dev/syscons X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 14:31:52 -0000 --GkKDMoQVTmdw7ke1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Ed Schouten wrote: > Author: ed > Date: Fri May 15 14:30:37 2009 > New Revision: 192143 > URL: http://svn.freebsd.org/changeset/base/192143 >=20 > Log: > Turn consolectl into a simple device node, not a TTY. > =20 > Woops! Forgot to mention: Tested by: Alexey Shuvaev --=20 Ed Schouten WWW: http://80386.nl/ --GkKDMoQVTmdw7ke1 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkoNfNYACgkQ52SDGA2eCwUj4wCfQKfJtWBfWeeSiPZYvxHhLL5z BdAAnRd5b0VVUS5HudKanBcYrkXRmUFR =4EeA -----END PGP SIGNATURE----- --GkKDMoQVTmdw7ke1-- From owner-svn-src-head@FreeBSD.ORG Fri May 15 14:41:45 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B0E061065670; Fri, 15 May 2009 14:41:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 84BCA8FC0A; Fri, 15 May 2009 14:41:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4FEfjsu026330; Fri, 15 May 2009 14:41:45 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4FEfjvC026328; Fri, 15 May 2009 14:41:45 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200905151441.n4FEfjvC026328@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 15 May 2009 14:41:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192144 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 14:41:46 -0000 Author: kib Date: Fri May 15 14:41:44 2009 New Revision: 192144 URL: http://svn.freebsd.org/changeset/base/192144 Log: Revert r192094. The revision caused problems for sysctl(3) consumers that expect that oldlen is filled with required buffer length even when supplied buffer is too short and returned error is ENOMEM. Redo the fix for kern.proc.filedesc, by reverting the req->oldidx when remaining buffer space is too short for the current kinfo_file structure. Also, only ignore ENOMEM. We have to convert ENOMEM to no error condition to keep existing interface for the sysctl, though. Reported by: ed, Florian Smeets Tested by: pho Modified: head/sys/kern/kern_descrip.c head/sys/kern/kern_sysctl.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Fri May 15 14:30:37 2009 (r192143) +++ head/sys/kern/kern_descrip.c Fri May 15 14:41:44 2009 (r192144) @@ -2883,6 +2883,7 @@ sysctl_kern_proc_filedesc(SYSCTL_HANDLER struct proc *p; struct tty *tp; int vfslocked; + size_t oldidx; name = (int *)arg1; if ((p = pfind((pid_t)name[0])) == NULL) @@ -3061,14 +3062,26 @@ sysctl_kern_proc_filedesc(SYSCTL_HANDLER strlen(kif->kf_path) + 1; kif->kf_structsize = roundup(kif->kf_structsize, sizeof(uint64_t)); + oldidx = req->oldidx; error = SYSCTL_OUT(req, kif, kif->kf_structsize); - if (error) + if (error) { + if (error == ENOMEM) { + /* + * The hack to keep the ABI of sysctl + * kern.proc.filedesc intact, but not + * to account a partially copied + * kinfo_file into the oldidx. + */ + req->oldidx = oldidx; + error = 0; + } break; + } } FILEDESC_SUNLOCK(fdp); fddrop(fdp); free(kif, M_TEMP); - return (0); + return (error); } static SYSCTL_NODE(_kern_proc, KERN_PROC_FILEDESC, filedesc, CTLFLAG_RD, Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Fri May 15 14:30:37 2009 (r192143) +++ head/sys/kern/kern_sysctl.c Fri May 15 14:41:44 2009 (r192144) @@ -1223,9 +1223,9 @@ sysctl_old_kernel(struct sysctl_req *req if (i > 0) bcopy(p, (char *)req->oldptr + req->oldidx, i); } + req->oldidx += l; if (req->oldptr && i != l) return (ENOMEM); - req->oldidx += l; return (0); } @@ -1322,10 +1322,9 @@ sysctl_old_user(struct sysctl_req *req, size_t i, len, origidx; origidx = req->oldidx; - if (req->oldptr == NULL) { - req->oldidx += l; + req->oldidx += l; + if (req->oldptr == NULL) return (0); - } /* * If we have not wired the user supplied buffer and we are currently * holding locks, drop a witness warning, as it's possible that @@ -1347,7 +1346,6 @@ sysctl_old_user(struct sysctl_req *req, return (error); if (i < l) return (ENOMEM); - req->oldidx += l; return (0); } From owner-svn-src-head@FreeBSD.ORG Fri May 15 15:09:44 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 729771065672; Fri, 15 May 2009 15:09:44 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 2E3458FC19; Fri, 15 May 2009 15:09:44 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id n4FF5MZZ066676; Fri, 15 May 2009 09:05:22 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Fri, 15 May 2009 09:05:31 -0600 (MDT) Message-Id: <20090515.090531.932035381.imp@bsdimp.com> To: stas@freebsd.org From: "M. Warner Losh" In-Reply-To: <20090515141642.ebc06b59.stas@FreeBSD.org> References: <20090515092205.6f6d06fa.stas@FreeBSD.org> <20090514.233536.1299798630.imp@bsdimp.com> <20090515141642.ebc06b59.stas@FreeBSD.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r192027 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 15:09:45 -0000 In message: <20090515141642.ebc06b59.stas@FreeBSD.org> Stanislav Sedov writes: : On Thu, 14 May 2009 23:35:36 -0600 (MDT) : "M. Warner Losh" mentioned: : : > In message: <20090515092205.6f6d06fa.stas@FreeBSD.org> : > Stanislav Sedov writes: : > : On Thu, 14 May 2009 21:37:12 -0600 (MDT) : > : "M. Warner Losh" mentioned: : > : : > : > In message: <200905122114.n4CLEag9033208@svn.freebsd.org> : > : > Stanislav Sedov writes: : > : > : @@ -926,6 +937,7 @@ atestart_locked(struct ifnet *ifp) : > : > : * tell the hardware to xmit the packet. : > : > : */ : > : > : WR4(sc, ETH_TAR, segs[0].ds_addr); : > : > : + BARRIER(sc, ETH_TAR, 8, BUS_SPACE_BARRIER_WRITE); : > : > : WR4(sc, ETH_TCR, segs[0].ds_len); : > : > : > : > Why is a barrier needed here? : > : > : > : Writing the TCR register triggers the transmit, so it had to be written : > : strongly after the TAR register. That's why I added the barrier here. : > : > Then shouldn't the barrier be after TCR write? Or does this ensure : > that the write is before TCR? : > : : Yeah, this barrier is to ensure that the TCR register gets written after the : TAR register has been written, not before. I don't think an additional barrier : is needed after the TCR write. Did this fix an observed bug, or is it theoretical? None of Atmel's code does this, but maybe we turn on some flag that reorders writes. On the other hand, I've seen some minor flakiness from time to time that could be explained by reordering.... There's likely a bunch of other places where something like this may be needed. The PDC has size/address information, followed by an enable bit. The MCI device has some similar weirdness as well... Warner From owner-svn-src-head@FreeBSD.ORG Fri May 15 16:03:12 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0B4C51065687; Fri, 15 May 2009 16:03:12 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EC1458FC2F; Fri, 15 May 2009 16:03:11 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4FG3BUP027989; Fri, 15 May 2009 16:03:11 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4FG3B4q027987; Fri, 15 May 2009 16:03:11 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200905151603.n4FG3B4q027987@svn.freebsd.org> From: Rick Macklem Date: Fri, 15 May 2009 16:03:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192145 - head/sys/fs/nfsclient X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 16:03:12 -0000 Author: rmacklem Date: Fri May 15 16:03:11 2009 New Revision: 192145 URL: http://svn.freebsd.org/changeset/base/192145 Log: Modify the diskless booting code in sys/fs/nfsclient to be compatible with what is in sys/nfsclient, so that it will at least build now. Approved by: kib (mentor) Modified: head/sys/fs/nfsclient/nfs.h head/sys/fs/nfsclient/nfs_clvfsops.c Modified: head/sys/fs/nfsclient/nfs.h ============================================================================== --- head/sys/fs/nfsclient/nfs.h Fri May 15 14:41:44 2009 (r192144) +++ head/sys/fs/nfsclient/nfs.h Fri May 15 16:03:11 2009 (r192145) @@ -87,7 +87,7 @@ int ncl_fsinfo(struct nfsmount *, struct struct thread *); int ncl_init(struct vfsconf *); int ncl_uninit(struct vfsconf *); -int ncl_mountroot(struct mount *, struct thread *); +int ncl_mountroot(struct mount *); int ncl_nfsiodnew(void); #endif /* _KERNEL */ Modified: head/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvfsops.c Fri May 15 14:41:44 2009 (r192144) +++ head/sys/fs/nfsclient/nfs_clvfsops.c Fri May 15 16:03:11 2009 (r192145) @@ -135,14 +135,15 @@ struct nfsv3_diskless newnfsv3_diskless int newnfs_diskless_valid = 0; SYSCTL_INT(_vfs_newnfs, OID_AUTO, diskless_valid, CTLFLAG_RD, - &newnfs_diskless_valid, 0, ""); + &newnfs_diskless_valid, 0, + "Has the diskless struct been filled correctly"); SYSCTL_STRING(_vfs_newnfs, OID_AUTO, diskless_rootpath, CTLFLAG_RD, - newnfsv3_diskless.root_hostnam, 0, ""); + newnfsv3_diskless.root_hostnam, 0, "Path to nfs root"); SYSCTL_OPAQUE(_vfs_newnfs, OID_AUTO, diskless_rootaddr, CTLFLAG_RD, - &newnfsv3_diskless.root_saddr, sizeof newnfsv3_diskless.root_saddr, - "%Ssockaddr_in", ""); + &newnfsv3_diskless.root_saddr, sizeof newnfsv3_diskless.root_saddr, + "%Ssockaddr_in", "Diskless root nfs address"); void newnfsargs_ntoh(struct nfs_args *); @@ -220,23 +221,27 @@ nfs_convert_diskless(void) { bcopy(&newnfs_diskless.myif, &newnfsv3_diskless.myif, - sizeof(struct ifaliasreq)); + sizeof (struct ifaliasreq)); bcopy(&newnfs_diskless.mygateway, &newnfsv3_diskless.mygateway, - sizeof(struct sockaddr_in)); - nfs_convert_oargs(&newnfsv3_diskless.root_args,&newnfs_diskless.root_args); + sizeof (struct sockaddr_in)); + nfs_convert_oargs(&newnfsv3_diskless.root_args, + &newnfs_diskless.root_args); if (newnfsv3_diskless.root_args.flags & NFSMNT_NFSV3) { newnfsv3_diskless.root_fhsize = NFSX_MYFH; - bcopy(newnfs_diskless.root_fh, newnfsv3_diskless.root_fh, NFSX_MYFH); + bcopy(newnfs_diskless.root_fh, newnfsv3_diskless.root_fh, + NFSX_MYFH); } else { newnfsv3_diskless.root_fhsize = NFSX_V2FH; - bcopy(newnfs_diskless.root_fh, newnfsv3_diskless.root_fh, NFSX_V2FH); + bcopy(newnfs_diskless.root_fh, newnfsv3_diskless.root_fh, + NFSX_V2FH); } bcopy(&newnfs_diskless.root_saddr,&newnfsv3_diskless.root_saddr, - sizeof(struct sockaddr_in)); - bcopy(newnfs_diskless.root_hostnam, newnfsv3_diskless.root_hostnam, MNAMELEN); + sizeof(struct sockaddr_in)); + bcopy(newnfs_diskless.root_hostnam, newnfsv3_diskless.root_hostnam, + MNAMELEN); newnfsv3_diskless.root_time = newnfs_diskless.root_time; bcopy(newnfs_diskless.my_hostnam, newnfsv3_diskless.my_hostnam, - MAXHOSTNAMELEN); + MAXHOSTNAMELEN); newnfs_diskless_valid = 3; } @@ -355,12 +360,14 @@ ncl_fsinfo(struct nfsmount *nmp, struct * * It is assumed to be safe to read, modify, and write the nfsv3_diskless * structure, as well as other global NFS client variables here, as - * ncl_mountroot() will be called once in the boot before any other NFS + * nfs_mountroot() will be called once in the boot before any other NFS * client activity occurs. */ int -ncl_mountroot(struct mount *mp, struct thread *td) +ncl_mountroot(struct mount *mp) { + struct thread *td = curthread; + INIT_VPROCG(TD_TO_VPROCG(td)); struct nfsv3_diskless *nd = &newnfsv3_diskless; struct socket *so; struct vnode *vp; @@ -371,13 +378,11 @@ ncl_mountroot(struct mount *mp, struct t char *cp; #if defined(BOOTP_NFSROOT) && defined(BOOTP) - bootpc_init(); /* use bootp to get newnfs_diskless filled in */ + bootpc_init(); /* use bootp to get nfs_diskless filled in */ #elif defined(NFS_ROOT) nfs_setup_diskless(); #endif - nfscl_init(); - if (newnfs_diskless_valid == 0) return (-1); if (newnfs_diskless_valid == 1) @@ -395,7 +400,7 @@ ncl_mountroot(struct mount *mp, struct t error = socreate(nd->myif.ifra_addr.sa_family, &so, nd->root_args.sotype, 0, td->td_ucred, td); if (error) - panic("ncl_mountroot: socreate(%04x): %d", + panic("nfs_mountroot: socreate(%04x): %d", nd->myif.ifra_addr.sa_family, error); #if 0 /* XXX Bad idea */ @@ -416,14 +421,14 @@ ncl_mountroot(struct mount *mp, struct t #endif error = ifioctl(so, SIOCAIFADDR, (caddr_t)&nd->myif, td); if (error) - panic("ncl_mountroot: SIOCAIFADDR: %d", error); + panic("nfs_mountroot: SIOCAIFADDR: %d", error); if ((cp = getenv("boot.netif.mtu")) != NULL) { ir.ifr_mtu = strtol(cp, NULL, 10); bcopy(nd->myif.ifra_name, ir.ifr_name, IFNAMSIZ); freeenv(cp); error = ifioctl(so, SIOCSIFMTU, (caddr_t)&ir, td); if (error) - printf("ncl_mountroot: SIOCSIFMTU: %d", error); + printf("nfs_mountroot: SIOCSIFMTU: %d", error); } soclose(so); @@ -441,12 +446,13 @@ ncl_mountroot(struct mount *mp, struct t sin = mask; sin.sin_family = AF_INET; sin.sin_len = sizeof(sin); + /* XXX MRT use table 0 for this sort of thing */ error = rtrequest(RTM_ADD, (struct sockaddr *)&sin, (struct sockaddr *)&nd->mygateway, (struct sockaddr *)&mask, RTF_UP | RTF_GATEWAY, NULL); if (error) - panic("ncl_mountroot: RTM_ADD: %d", error); + panic("nfs_mountroot: RTM_ADD: %d", error); } /* @@ -459,6 +465,7 @@ ncl_mountroot(struct mount *mp, struct t (l >> 24) & 0xff, (l >> 16) & 0xff, (l >> 8) & 0xff, (l >> 0) & 0xff, nd->root_hostnam); printf("NFS ROOT: %s\n", buf); + nd->root_args.hostname = buf; if ((error = nfs_mountdiskless(buf, &nd->root_saddr, &nd->root_args, td, &vp, mp)) != 0) { return (error); @@ -469,11 +476,13 @@ ncl_mountroot(struct mount *mp, struct t * set hostname here and then let the "/etc/rc.xxx" files * mount the right /var based upon its preset value. */ - bcopy(nd->my_hostnam, hostname, MAXHOSTNAMELEN); - hostname[MAXHOSTNAMELEN - 1] = '\0'; + mtx_lock(&hostname_mtx); + bcopy(nd->my_hostnam, V_hostname, MAXHOSTNAMELEN); + V_hostname[MAXHOSTNAMELEN - 1] = '\0'; for (i = 0; i < MAXHOSTNAMELEN; i++) - if (hostname[i] == '\0') + if (V_hostname[i] == '\0') break; + mtx_unlock(&hostname_mtx); inittodr(ntohl(nd->root_time)); return (0); } @@ -492,7 +501,7 @@ nfs_mountdiskless(char *path, nam = sodupsockaddr((struct sockaddr *)sin, M_WAITOK); if ((error = mountnfs(args, mp, nam, path, NULL, NULL, NULL, vpp, td->td_ucred, td)) != 0) { - printf("ncl_mountroot: mount %s on /: %d\n", path, error); + printf("nfs_mountroot: mount %s on /: %d\n", path, error); return (error); } return (0); @@ -704,7 +713,7 @@ nfs_mount(struct mount *mp) td = curthread; if ((mp->mnt_flag & (MNT_ROOTFS | MNT_UPDATE)) == MNT_ROOTFS) { - error = ncl_mountroot(mp, td); + error = ncl_mountroot(mp); goto out; } From owner-svn-src-head@FreeBSD.ORG Fri May 15 16:38:43 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 40ECD10656C9; Fri, 15 May 2009 16:38:43 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2ED218FC20; Fri, 15 May 2009 16:38:43 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4FGcga9028651; Fri, 15 May 2009 16:38:42 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4FGcgwT028650; Fri, 15 May 2009 16:38:42 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200905151638.n4FGcgwT028650@svn.freebsd.org> From: Warner Losh Date: Fri, 15 May 2009 16:38:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192146 - head/sys/dev/bwi X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 16:38:43 -0000 Author: imp Date: Fri May 15 16:38:42 2009 New Revision: 192146 URL: http://svn.freebsd.org/changeset/base/192146 Log: Cleanup module declarations: Use "bwi" consistently No need to have separate cardbus attachment No need to declare a module version Modified: head/sys/dev/bwi/if_bwi_pci.c Modified: head/sys/dev/bwi/if_bwi_pci.c ============================================================================== --- head/sys/dev/bwi/if_bwi_pci.c Fri May 15 16:03:11 2009 (r192145) +++ head/sys/dev/bwi/if_bwi_pci.c Fri May 15 16:38:42 2009 (r192146) @@ -245,9 +245,7 @@ static driver_t bwi_driver = { sizeof (struct bwi_pci_softc) }; static devclass_t bwi_devclass; -DRIVER_MODULE(if_bwi, pci, bwi_driver, bwi_devclass, 0, 0); -DRIVER_MODULE(bwi, cardbus, bwi_driver, bwi_devclass, 0, 0); -MODULE_VERSION(if_bwi, 1); -MODULE_DEPEND(if_bwi, wlan, 1, 1, 1); /* 802.11 media layer */ -MODULE_DEPEND(if_bwi, firmware, 1, 1, 1); /* firmware support */ -MODULE_DEPEND(if_bwi, wlan_amrr, 1, 1, 1); +DRIVER_MODULE(bwi, pci, bwi_driver, bwi_devclass, 0, 0); +MODULE_DEPEND(bwi, wlan, 1, 1, 1); /* 802.11 media layer */ +MODULE_DEPEND(bwi, firmware, 1, 1, 1); /* firmware support */ +MODULE_DEPEND(bwi, wlan_amrr, 1, 1, 1); From owner-svn-src-head@FreeBSD.ORG Fri May 15 17:02:11 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 995AF106566B; Fri, 15 May 2009 17:02:11 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7CE348FC1A; Fri, 15 May 2009 17:02:11 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4FH2B2p029197; Fri, 15 May 2009 17:02:11 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4FH2BX3029193; Fri, 15 May 2009 17:02:11 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200905151702.n4FH2BX3029193@svn.freebsd.org> From: Warner Losh Date: Fri, 15 May 2009 17:02:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192147 - in head/sys/dev: ath ixgb lmc malo X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 17:02:12 -0000 Author: imp Date: Fri May 15 17:02:11 2009 New Revision: 192147 URL: http://svn.freebsd.org/changeset/base/192147 Log: The module name convention is foo, not if_foo. Modified: head/sys/dev/ath/if_ath_pci.c head/sys/dev/ixgb/if_ixgb.c head/sys/dev/lmc/if_lmc.c head/sys/dev/malo/if_malo_pci.c Modified: head/sys/dev/ath/if_ath_pci.c ============================================================================== --- head/sys/dev/ath/if_ath_pci.c Fri May 15 16:38:42 2009 (r192146) +++ head/sys/dev/ath/if_ath_pci.c Fri May 15 17:02:11 2009 (r192147) @@ -250,6 +250,6 @@ static driver_t ath_pci_driver = { sizeof (struct ath_pci_softc) }; static devclass_t ath_devclass; -DRIVER_MODULE(if_ath, pci, ath_pci_driver, ath_devclass, 0, 0); -MODULE_VERSION(if_ath, 1); -MODULE_DEPEND(if_ath, wlan, 1, 1, 1); /* 802.11 media layer */ +DRIVER_MODULE(ath, pci, ath_pci_driver, ath_devclass, 0, 0); +MODULE_VERSION(ath, 1); +MODULE_DEPEND(ath, wlan, 1, 1, 1); /* 802.11 media layer */ Modified: head/sys/dev/ixgb/if_ixgb.c ============================================================================== --- head/sys/dev/ixgb/if_ixgb.c Fri May 15 16:38:42 2009 (r192146) +++ head/sys/dev/ixgb/if_ixgb.c Fri May 15 17:02:11 2009 (r192147) @@ -167,10 +167,10 @@ static driver_t ixgb_driver = { }; static devclass_t ixgb_devclass; -DRIVER_MODULE(if_ixgb, pci, ixgb_driver, ixgb_devclass, 0, 0); +DRIVER_MODULE(ixgb, pci, ixgb_driver, ixgb_devclass, 0, 0); -MODULE_DEPEND(if_ixgb, pci, 1, 1, 1); -MODULE_DEPEND(if_ixgb, ether, 1, 1, 1); +MODULE_DEPEND(ixgb, pci, 1, 1, 1); +MODULE_DEPEND(ixgb, ether, 1, 1, 1); /* some defines for controlling descriptor fetches in h/w */ #define RXDCTL_PTHRESH_DEFAULT 128 /* chip considers prefech below this */ Modified: head/sys/dev/lmc/if_lmc.c ============================================================================== --- head/sys/dev/lmc/if_lmc.c Fri May 15 16:38:42 2009 (r192146) +++ head/sys/dev/lmc/if_lmc.c Fri May 15 17:02:11 2009 (r192147) @@ -5751,14 +5751,14 @@ static driver_t driver = static devclass_t devclass; -DRIVER_MODULE(if_lmc, pci, driver, devclass, 0, 0); -MODULE_VERSION(if_lmc, 2); -MODULE_DEPEND(if_lmc, pci, 1, 1, 1); +DRIVER_MODULE(lmc, pci, driver, devclass, 0, 0); +MODULE_VERSION(lmc, 2); +MODULE_DEPEND(lmc, pci, 1, 1, 1); # if NETGRAPH -MODULE_DEPEND(if_lmc, netgraph, NG_ABI_VERSION, NG_ABI_VERSION, NG_ABI_VERSION); +MODULE_DEPEND(lmc, netgraph, NG_ABI_VERSION, NG_ABI_VERSION, NG_ABI_VERSION); # endif # if NSPPP -MODULE_DEPEND(if_lmc, sppp, 1, 1, 1); +MODULE_DEPEND(lmc, sppp, 1, 1, 1); # endif #endif /* __FreeBSD__ */ Modified: head/sys/dev/malo/if_malo_pci.c ============================================================================== --- head/sys/dev/malo/if_malo_pci.c Fri May 15 16:38:42 2009 (r192146) +++ head/sys/dev/malo/if_malo_pci.c Fri May 15 17:02:11 2009 (r192147) @@ -368,7 +368,7 @@ static driver_t malo_pci_driver = { }; static devclass_t malo_devclass; -DRIVER_MODULE(if_malo, pci, malo_pci_driver, malo_devclass, 0, 0); -MODULE_VERSION(if_malo, 1); -MODULE_DEPEND(if_malo, wlan, 1, 1, 1); /* 802.11 media layer */ -MODULE_DEPEND(if_malo, malofw_fw, 1, 1, 1); +DRIVER_MODULE(malo, pci, malo_pci_driver, malo_devclass, 0, 0); +MODULE_VERSION(malo, 1); +MODULE_DEPEND(malo, wlan, 1, 1, 1); /* 802.11 media layer */ +MODULE_DEPEND(malo, malofw_fw, 1, 1, 1); From owner-svn-src-head@FreeBSD.ORG Fri May 15 17:10:06 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EA99B1065670; Fri, 15 May 2009 17:10:06 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id BD3208FC0C; Fri, 15 May 2009 17:10:06 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 7207646B0D; Fri, 15 May 2009 13:10:06 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 4853E8A026; Fri, 15 May 2009 13:10:05 -0400 (EDT) From: John Baldwin To: Warner Losh Date: Fri, 15 May 2009 13:09:38 -0400 User-Agent: KMail/1.9.7 References: <200905151638.n4FGcgwT028650@svn.freebsd.org> In-Reply-To: <200905151638.n4FGcgwT028650@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200905151309.38633.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Fri, 15 May 2009 13:10:05 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r192146 - head/sys/dev/bwi X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 17:10:07 -0000 On Friday 15 May 2009 12:38:42 pm Warner Losh wrote: > Author: imp > Date: Fri May 15 16:38:42 2009 > New Revision: 192146 > URL: http://svn.freebsd.org/changeset/base/192146 > > Log: > Cleanup module declarations: > Use "bwi" consistently > No need to have separate cardbus attachment > No need to declare a module version This breaks having 'ifconfig bwi0' autoload if_bwi.ko. It assumes that all network interface modules start with 'if_'. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Fri May 15 18:00:07 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3192D1065676; Fri, 15 May 2009 18:00:07 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id E57CC8FC24; Fri, 15 May 2009 18:00:06 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id n4FHv8xs068738; Fri, 15 May 2009 11:57:09 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Fri, 15 May 2009 11:57:18 -0600 (MDT) Message-Id: <20090515.115718.259815739.imp@bsdimp.com> To: jhb@freebsd.org From: "M. Warner Losh" In-Reply-To: <200905151309.38633.jhb@freebsd.org> References: <200905151638.n4FGcgwT028650@svn.freebsd.org> <200905151309.38633.jhb@freebsd.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r192146 - head/sys/dev/bwi X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 18:00:08 -0000 In message: <200905151309.38633.jhb@freebsd.org> John Baldwin writes: : On Friday 15 May 2009 12:38:42 pm Warner Losh wrote: : > Author: imp : > Date: Fri May 15 16:38:42 2009 : > New Revision: 192146 : > URL: http://svn.freebsd.org/changeset/base/192146 : > : > Log: : > Cleanup module declarations: : > Use "bwi" consistently : > No need to have separate cardbus attachment : > No need to declare a module version : : This breaks having 'ifconfig bwi0' autoload if_bwi.ko. It assumes that all : network interface modules start with 'if_'. As discussed in IRC, this doesn't break it since we look for a module that's named foo/XXXX or if_foo/XXX. Warner From owner-svn-src-head@FreeBSD.ORG Fri May 15 18:25:44 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 67D181065670; Fri, 15 May 2009 18:25:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5720B8FC1A; Fri, 15 May 2009 18:25:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4FIPiMK030829; Fri, 15 May 2009 18:25:44 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4FIPi2J030828; Fri, 15 May 2009 18:25:44 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200905151825.n4FIPi2J030828@svn.freebsd.org> From: John Baldwin Date: Fri, 15 May 2009 18:25:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192148 - head/lib/libmemstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 18:25:44 -0000 Author: jhb Date: Fri May 15 18:25:44 2009 New Revision: 192148 URL: http://svn.freebsd.org/changeset/base/192148 Log: Update the KVM backend for malloc stats to catch up to the internal structure BI change from the addition of DTrace malloc(9) probes. Submitted by: Ben Kelly ben of wanderview dot com Modified: head/lib/libmemstat/memstat_malloc.c Modified: head/lib/libmemstat/memstat_malloc.c ============================================================================== --- head/lib/libmemstat/memstat_malloc.c Fri May 15 17:02:11 2009 (r192147) +++ head/lib/libmemstat/memstat_malloc.c Fri May 15 18:25:44 2009 (r192148) @@ -296,6 +296,7 @@ memstat_kvm_malloc(struct memory_type_li int hint_dontsearch, j, mp_maxcpus, ret; char name[MEMTYPE_MAXNAME]; struct malloc_type_stats mts[MEMSTAT_MAXCPU], *mtsp; + struct malloc_type_internal *mtip; struct malloc_type type, *typep; kvm_t *kvm; @@ -349,13 +350,11 @@ memstat_kvm_malloc(struct memory_type_li } /* - * Take advantage of explicit knowledge that - * malloc_type_internal is simply an array of statistics - * structures of number MAXCPU. Since our compile-time - * value for MAXCPU may differ from the kernel's, we - * populate our own array. + * Since our compile-time value for MAXCPU may differ from the + * kernel's, we populate our own array. */ - ret = kread(kvm, type.ks_handle, mts, mp_maxcpus * + mtip = type.ks_handle; + ret = kread(kvm, mtip->mti_stats, mts, mp_maxcpus * sizeof(struct malloc_type_stats), 0); if (ret != 0) { _memstat_mtl_empty(list); From owner-svn-src-head@FreeBSD.ORG Fri May 15 19:19:35 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 972AA106568D for ; Fri, 15 May 2009 19:19:35 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from mx0.deglitch.com (backbone.deglitch.com [IPv6:2001:16d8:fffb:4::abba]) by mx1.freebsd.org (Postfix) with ESMTP id 177F78FC28 for ; Fri, 15 May 2009 19:19:34 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from DSPAM-Daemon (localhost [127.0.0.1]) by mx0.deglitch.com (Postfix) with SMTP id A3F6E8FC53 for ; Fri, 15 May 2009 23:19:30 +0400 (MSD) Received: from localhost (dhcp170-225-red.yandex.net [95.108.170.225]) by mx0.deglitch.com (Postfix) with ESMTPSA id 8D0DE8FC1D; Fri, 15 May 2009 23:19:24 +0400 (MSD) Date: Fri, 15 May 2009 23:19:22 +0400 From: Stanislav Sedov To: "M. Warner Losh" Message-Id: <20090515231922.fb760af4.stas@FreeBSD.org> In-Reply-To: <20090515.090531.932035381.imp@bsdimp.com> References: <20090515092205.6f6d06fa.stas@FreeBSD.org> <20090514.233536.1299798630.imp@bsdimp.com> <20090515141642.ebc06b59.stas@FreeBSD.org> <20090515.090531.932035381.imp@bsdimp.com> Organization: The FreeBSD Project X-Mailer: Sylpheed 2.6.0 (GTK+ 2.16.1; amd64-portbld-freebsd7.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-DSPAM-Result: Whitelisted X-DSPAM-Processed: Fri May 15 23:19:30 2009 X-DSPAM-Confidence: 0.9899 X-DSPAM-Improbability: 1 in 9809 chance of being spam X-DSPAM-Probability: 0.0000 X-DSPAM-Signature: 4a0dc042994291521116252 Cc: stas@freebsd.org, svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r192027 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 19:19:36 -0000 On Fri, 15 May 2009 09:05:31 -0600 (MDT) "M. Warner Losh" mentioned: > In message: <20090515141642.ebc06b59.stas@FreeBSD.org> > Stanislav Sedov writes: > : On Thu, 14 May 2009 23:35:36 -0600 (MDT) > : "M. Warner Losh" mentioned: > : > : > In message: <20090515092205.6f6d06fa.stas@FreeBSD.org> > : > Stanislav Sedov writes: > : > : On Thu, 14 May 2009 21:37:12 -0600 (MDT) > : > : "M. Warner Losh" mentioned: > : > : > : > : > In message: <200905122114.n4CLEag9033208@svn.freebsd.org> > : > : > Stanislav Sedov writes: > : > : > : @@ -926,6 +937,7 @@ atestart_locked(struct ifnet *ifp) > : > : > : * tell the hardware to xmit the packet. > : > : > : */ > : > : > : WR4(sc, ETH_TAR, segs[0].ds_addr); > : > : > : + BARRIER(sc, ETH_TAR, 8, BUS_SPACE_BARRIER_WRITE); > : > : > : WR4(sc, ETH_TCR, segs[0].ds_len); > : > : > > : > : > Why is a barrier needed here? > : > : > > : > : Writing the TCR register triggers the transmit, so it had to be written > : > : strongly after the TAR register. That's why I added the barrier here. > : > > : > Then shouldn't the barrier be after TCR write? Or does this ensure > : > that the write is before TCR? > : > > : > : Yeah, this barrier is to ensure that the TCR register gets written after the > : TAR register has been written, not before. I don't think an additional barrier > : is needed after the TCR write. > > Did this fix an observed bug, or is it theoretical? None of Atmel's > code does this, but maybe we turn on some flag that reorders writes. > On the other hand, I've seen some minor flakiness from time to time > that could be explained by reordering.... > > There's likely a bunch of other places where something like this may > be needed. The PDC has size/address information, followed by an > enable bit. The MCI device has some similar weirdness as well... > I don't think there're any reordering possible on at91 platform, though I need to check first. The bus_space_barrier call is currently a no-op on arm platforms, so this modifications were mostly to make the code more correct theoretically then fixing any possible real-world issues. PDC is the entirely another thing, so it need to be checked separately. EMAC doesn't use PDC but a real DMA implementation. -- Stanislav Sedov ST4096-RIPE !DSPAM:4a0dc042994291521116252! From owner-svn-src-head@FreeBSD.ORG Fri May 15 19:23:06 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D1FD1065673; Fri, 15 May 2009 19:23:06 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0C8308FC19; Fri, 15 May 2009 19:23:06 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4FJN5Vl032202; Fri, 15 May 2009 19:23:05 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4FJN50N032201; Fri, 15 May 2009 19:23:05 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200905151923.n4FJN50N032201@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 15 May 2009 19:23:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192151 - head/sys/fs/devfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 19:23:06 -0000 Author: kib Date: Fri May 15 19:23:05 2009 New Revision: 192151 URL: http://svn.freebsd.org/changeset/base/192151 Log: Devfs replaces file ops vector with devfs-specific one in devfs_open(), before the struct file is fully initialized in vn_open(), in particular, fp->f_vnode is NULL. Other thread calling file operation before f_vnode is set results in NULL pointer dereference in devvn_refthread(). Initialize f_vnode before calling d_fdopen() cdevsw method, that might set file ops too. Reported and tested by: Chris Timmons (RELENG_7 version) MFC after: 3 days Modified: head/sys/fs/devfs/devfs_vnops.c Modified: head/sys/fs/devfs/devfs_vnops.c ============================================================================== --- head/sys/fs/devfs/devfs_vnops.c Fri May 15 19:19:27 2009 (r192150) +++ head/sys/fs/devfs/devfs_vnops.c Fri May 15 19:23:05 2009 (r192151) @@ -942,8 +942,10 @@ devfs_open(struct vop_open_args *ap) fpop = td->td_fpop; td->td_fpop = fp; - if (fp != NULL) + if (fp != NULL) { fp->f_data = dev; + fp->f_vnode = vp; + } if (dsw->d_fdopen != NULL) error = dsw->d_fdopen(dev, ap->a_mode, td, fp); else From owner-svn-src-head@FreeBSD.ORG Fri May 15 19:31:13 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A9E11065676; Fri, 15 May 2009 19:31:13 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id BC7098FC23; Fri, 15 May 2009 19:31:12 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id n4FJT9xZ069926; Fri, 15 May 2009 13:29:09 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Fri, 15 May 2009 13:29:18 -0600 (MDT) Message-Id: <20090515.132918.833254741.imp@bsdimp.com> To: stas@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <20090515231922.fb760af4.stas@FreeBSD.org> References: <20090515141642.ebc06b59.stas@FreeBSD.org> <20090515.090531.932035381.imp@bsdimp.com> <20090515231922.fb760af4.stas@FreeBSD.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r192027 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 19:31:13 -0000 In message: <20090515231922.fb760af4.stas@FreeBSD.org> Stanislav Sedov writes: : On Fri, 15 May 2009 09:05:31 -0600 (MDT) : "M. Warner Losh" mentioned: : : > In message: <20090515141642.ebc06b59.stas@FreeBSD.org> : > Stanislav Sedov writes: : > : On Thu, 14 May 2009 23:35:36 -0600 (MDT) : > : "M. Warner Losh" mentioned: : > : : > : > In message: <20090515092205.6f6d06fa.stas@FreeBSD.org> : > : > Stanislav Sedov writes: : > : > : On Thu, 14 May 2009 21:37:12 -0600 (MDT) : > : > : "M. Warner Losh" mentioned: : > : > : : > : > : > In message: <200905122114.n4CLEag9033208@svn.freebsd.org> : > : > : > Stanislav Sedov writes: : > : > : > : @@ -926,6 +937,7 @@ atestart_locked(struct ifnet *ifp) : > : > : > : * tell the hardware to xmit the packet. : > : > : > : */ : > : > : > : WR4(sc, ETH_TAR, segs[0].ds_addr); : > : > : > : + BARRIER(sc, ETH_TAR, 8, BUS_SPACE_BARRIER_WRITE); : > : > : > : WR4(sc, ETH_TCR, segs[0].ds_len); : > : > : > : > : > : > Why is a barrier needed here? : > : > : > : > : > : Writing the TCR register triggers the transmit, so it had to be written : > : > : strongly after the TAR register. That's why I added the barrier here. : > : > : > : > Then shouldn't the barrier be after TCR write? Or does this ensure : > : > that the write is before TCR? : > : > : > : : > : Yeah, this barrier is to ensure that the TCR register gets written after the : > : TAR register has been written, not before. I don't think an additional barrier : > : is needed after the TCR write. : > : > Did this fix an observed bug, or is it theoretical? None of Atmel's : > code does this, but maybe we turn on some flag that reorders writes. : > On the other hand, I've seen some minor flakiness from time to time : > that could be explained by reordering.... : > : > There's likely a bunch of other places where something like this may : > be needed. The PDC has size/address information, followed by an : > enable bit. The MCI device has some similar weirdness as well... : > : : I don't think there're any reordering possible on at91 platform, : though I need to check first. The bus_space_barrier call is currently : a no-op on arm platforms, so this modifications were mostly to make : the code more correct theoretically then fixing any possible real-world : issues. True. : PDC is the entirely another thing, so it need to be checked separately. : EMAC doesn't use PDC but a real DMA implementation. Yes. Understood. Just thinking of other places this might matter. Any idea if this matters on the AVR32? Then again, the built-in devices are mapped into uncached memory, so maybe it just doesn't matter :). Warner From owner-svn-src-head@FreeBSD.ORG Fri May 15 19:33:59 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A91C6106564A; Fri, 15 May 2009 19:33:59 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 976368FC19; Fri, 15 May 2009 19:33:59 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4FJXxVA032452; Fri, 15 May 2009 19:33:59 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4FJXxGv032449; Fri, 15 May 2009 19:33:59 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200905151933.n4FJXxGv032449@svn.freebsd.org> From: Rick Macklem Date: Fri, 15 May 2009 19:33:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192152 - head/sys/fs/nfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 19:34:00 -0000 Author: rmacklem Date: Fri May 15 19:33:59 2009 New Revision: 192152 URL: http://svn.freebsd.org/changeset/base/192152 Log: Move the nfsstat structure and proc/op number definitions on the experimental nfs subsystem from sys/fs/nfs/nfs.h and sys/fs/nfs/nfsproto.h to sys/fs/nfs/nfsport.h and rename nfsstat to ext_nfsstat. This was done so that src/usr.bin/nfsstat.c could use it alongside the regular nfs include files and struct nfsstat. Approved by: kib (mentor) Modified: head/sys/fs/nfs/nfs.h head/sys/fs/nfs/nfsport.h head/sys/fs/nfs/nfsproto.h Modified: head/sys/fs/nfs/nfs.h ============================================================================== --- head/sys/fs/nfs/nfs.h Fri May 15 19:23:05 2009 (r192151) +++ head/sys/fs/nfs/nfs.h Fri May 15 19:33:59 2009 (r192152) @@ -325,61 +325,6 @@ struct nfsreferral { #define NFSID_DELGROUPNAME 0x0100 /* - * Stats structure - */ -struct nfsstats { - int attrcache_hits; - int attrcache_misses; - int lookupcache_hits; - int lookupcache_misses; - int direofcache_hits; - int direofcache_misses; - int accesscache_hits; - int accesscache_misses; - int biocache_reads; - int read_bios; - int read_physios; - int biocache_writes; - int write_bios; - int write_physios; - int biocache_readlinks; - int readlink_bios; - int biocache_readdirs; - int readdir_bios; - int rpccnt[NFS_NPROCS]; - int rpcretries; - int srvrpccnt[NFSV4OP_NOPS + NFSV4OP_FAKENOPS]; - int srvrpc_errs; - int srv_errs; - int rpcrequests; - int rpctimeouts; - int rpcunexpected; - int rpcinvalid; - int srvcache_inproghits; - int srvcache_idemdonehits; - int srvcache_nonidemdonehits; - int srvcache_misses; - int srvcache_tcppeak; - int srvcache_size; - int srvclients; - int srvopenowners; - int srvopens; - int srvlockowners; - int srvlocks; - int srvdelegates; - int cbrpccnt[NFSV4OP_CBNOPS]; - int clopenowners; - int clopens; - int cllockowners; - int cllocks; - int cldelegates; - int cllocalopenowners; - int cllocalopens; - int cllocallockowners; - int cllocallocks; -}; - -/* * fs.nfs sysctl(3) identifiers */ #define NFS_NFSSTATS 1 /* struct: struct nfsstats */ Modified: head/sys/fs/nfs/nfsport.h ============================================================================== --- head/sys/fs/nfs/nfsport.h Fri May 15 19:23:05 2009 (r192151) +++ head/sys/fs/nfs/nfsport.h Fri May 15 19:33:59 2009 (r192152) @@ -186,6 +186,182 @@ */ #define NFSMUTEX_T struct mtx +#endif /* _KERNEL */ + +/* + * NFSv4 Operation numbers. + */ +#define NFSV4OP_ACCESS 3 +#define NFSV4OP_CLOSE 4 +#define NFSV4OP_COMMIT 5 +#define NFSV4OP_CREATE 6 +#define NFSV4OP_DELEGPURGE 7 +#define NFSV4OP_DELEGRETURN 8 +#define NFSV4OP_GETATTR 9 +#define NFSV4OP_GETFH 10 +#define NFSV4OP_LINK 11 +#define NFSV4OP_LOCK 12 +#define NFSV4OP_LOCKT 13 +#define NFSV4OP_LOCKU 14 +#define NFSV4OP_LOOKUP 15 +#define NFSV4OP_LOOKUPP 16 +#define NFSV4OP_NVERIFY 17 +#define NFSV4OP_OPEN 18 +#define NFSV4OP_OPENATTR 19 +#define NFSV4OP_OPENCONFIRM 20 +#define NFSV4OP_OPENDOWNGRADE 21 +#define NFSV4OP_PUTFH 22 +#define NFSV4OP_PUTPUBFH 23 +#define NFSV4OP_PUTROOTFH 24 +#define NFSV4OP_READ 25 +#define NFSV4OP_READDIR 26 +#define NFSV4OP_READLINK 27 +#define NFSV4OP_REMOVE 28 +#define NFSV4OP_RENAME 29 +#define NFSV4OP_RENEW 30 +#define NFSV4OP_RESTOREFH 31 +#define NFSV4OP_SAVEFH 32 +#define NFSV4OP_SECINFO 33 +#define NFSV4OP_SETATTR 34 +#define NFSV4OP_SETCLIENTID 35 +#define NFSV4OP_SETCLIENTIDCFRM 36 +#define NFSV4OP_VERIFY 37 +#define NFSV4OP_WRITE 38 +#define NFSV4OP_RELEASELCKOWN 39 + +/* + * Must be one greater than the last Operation#. + */ +#define NFSV4OP_NOPS 40 + +/* + * Fake NFSV4OP_xxx used for nfsstat. Start at NFSV4OP_NOPS. + */ +#define NFSV4OP_SYMLINK (NFSV4OP_NOPS) +#define NFSV4OP_MKDIR (NFSV4OP_NOPS + 1) +#define NFSV4OP_RMDIR (NFSV4OP_NOPS + 2) +#define NFSV4OP_READDIRPLUS (NFSV4OP_NOPS + 3) +#define NFSV4OP_MKNOD (NFSV4OP_NOPS + 4) +#define NFSV4OP_FSSTAT (NFSV4OP_NOPS + 5) +#define NFSV4OP_FSINFO (NFSV4OP_NOPS + 6) +#define NFSV4OP_PATHCONF (NFSV4OP_NOPS + 7) +#define NFSV4OP_V3CREATE (NFSV4OP_NOPS + 8) + +/* + * This is the count of the fake operations listed above. + */ +#define NFSV4OP_FAKENOPS 9 + +/* + * and the Callback OPs + */ +#define NFSV4OP_CBGETATTR 3 +#define NFSV4OP_CBRECALL 4 + +/* + * Must be one greater than the last Callback Operation#. + */ +#define NFSV4OP_CBNOPS 5 + +/* + * The lower numbers -> 21 are used by NFSv2 and v3. These define higher + * numbers used by NFSv4. + * NFS_V3NPROCS is one greater than the last V3 op and NFS_NPROCS is + * one greater than the last number. + */ +#define NFS_V3NPROCS 22 + +#define NFSPROC_LOOKUPP 22 +#define NFSPROC_SETCLIENTID 23 +#define NFSPROC_SETCLIENTIDCFRM 24 +#define NFSPROC_LOCK 25 +#define NFSPROC_LOCKU 26 +#define NFSPROC_OPEN 27 +#define NFSPROC_CLOSE 28 +#define NFSPROC_OPENCONFIRM 29 +#define NFSPROC_LOCKT 30 +#define NFSPROC_OPENDOWNGRADE 31 +#define NFSPROC_RENEW 32 +#define NFSPROC_PUTROOTFH 33 +#define NFSPROC_RELEASELCKOWN 34 +#define NFSPROC_DELEGRETURN 35 +#define NFSPROC_RETDELEGREMOVE 36 +#define NFSPROC_RETDELEGRENAME1 37 +#define NFSPROC_RETDELEGRENAME2 38 +#define NFSPROC_GETACL 39 +#define NFSPROC_SETACL 40 + +/* + * Must be defined as one higher than the last Proc# above. + */ +#define NFSV4_NPROCS 41 + +/* + * Stats structure + */ +struct ext_nfsstats { + int attrcache_hits; + int attrcache_misses; + int lookupcache_hits; + int lookupcache_misses; + int direofcache_hits; + int direofcache_misses; + int accesscache_hits; + int accesscache_misses; + int biocache_reads; + int read_bios; + int read_physios; + int biocache_writes; + int write_bios; + int write_physios; + int biocache_readlinks; + int readlink_bios; + int biocache_readdirs; + int readdir_bios; + int rpccnt[NFSV4_NPROCS]; + int rpcretries; + int srvrpccnt[NFSV4OP_NOPS + NFSV4OP_FAKENOPS]; + int srvrpc_errs; + int srv_errs; + int rpcrequests; + int rpctimeouts; + int rpcunexpected; + int rpcinvalid; + int srvcache_inproghits; + int srvcache_idemdonehits; + int srvcache_nonidemdonehits; + int srvcache_misses; + int srvcache_tcppeak; + int srvcache_size; + int srvclients; + int srvopenowners; + int srvopens; + int srvlockowners; + int srvlocks; + int srvdelegates; + int cbrpccnt[NFSV4OP_CBNOPS]; + int clopenowners; + int clopens; + int cllockowners; + int cllocks; + int cldelegates; + int cllocalopenowners; + int cllocalopens; + int cllocallockowners; + int cllocallocks; +}; + +#ifdef _KERNEL +/* + * Define the ext_nfsstats as nfsstats for the kernel code. + */ +#define nfsstats ext_nfsstats + +/* + * Define NFS_NPROCS as NFSV4_NPROCS for the experimental kernel code. + */ +#define NFS_NPROCS NFSV4_NPROCS + #include #include #include Modified: head/sys/fs/nfs/nfsproto.h ============================================================================== --- head/sys/fs/nfs/nfsproto.h Fri May 15 19:23:05 2009 (r192151) +++ head/sys/fs/nfs/nfsproto.h Fri May 15 19:33:59 2009 (r192152) @@ -218,36 +218,6 @@ #define NFSPROC_COMMIT 21 /* - * These cover all the procedures for V2 and 3. The higher numbers are - * used to reference other V4 ops. - * NFS_V3NPROCS is one greater than the last V3 op and NFS_NPROCS is - * one greater than the last number. - */ -#define NFS_V3NPROCS 22 - -#define NFSPROC_LOOKUPP 22 -#define NFSPROC_SETCLIENTID 23 -#define NFSPROC_SETCLIENTIDCFRM 24 -#define NFSPROC_LOCK 25 -#define NFSPROC_LOCKU 26 -#define NFSPROC_OPEN 27 -#define NFSPROC_CLOSE 28 -#define NFSPROC_OPENCONFIRM 29 -#define NFSPROC_LOCKT 30 -#define NFSPROC_OPENDOWNGRADE 31 -#define NFSPROC_RENEW 32 -#define NFSPROC_PUTROOTFH 33 -#define NFSPROC_RELEASELCKOWN 34 -#define NFSPROC_DELEGRETURN 35 -#define NFSPROC_RETDELEGREMOVE 36 -#define NFSPROC_RETDELEGRENAME1 37 -#define NFSPROC_RETDELEGRENAME2 38 -#define NFSPROC_GETACL 39 -#define NFSPROC_SETACL 40 - -#define NFS_NPROCS 41 - -/* * NFSPROC_NOOP is a fake op# that can't be the same as any V2/3/4 Procedure * or Operation#. Since the NFS V4 Op #s go higher, use NFSV4OP_NOPS, which * is one greater than the highest Op#. @@ -276,78 +246,12 @@ #define NFSV2PROC_STATFS 17 /* - * V4 Procedure and suboperation numbers + * V4 Procedure numbers */ #define NFSV4PROC_COMPOUND 1 #define NFSV4PROC_CBNULL 0 #define NFSV4PROC_CBCOMPOUND 1 -#define NFSV4OP_ACCESS 3 -#define NFSV4OP_CLOSE 4 -#define NFSV4OP_COMMIT 5 -#define NFSV4OP_CREATE 6 -#define NFSV4OP_DELEGPURGE 7 -#define NFSV4OP_DELEGRETURN 8 -#define NFSV4OP_GETATTR 9 -#define NFSV4OP_GETFH 10 -#define NFSV4OP_LINK 11 -#define NFSV4OP_LOCK 12 -#define NFSV4OP_LOCKT 13 -#define NFSV4OP_LOCKU 14 -#define NFSV4OP_LOOKUP 15 -#define NFSV4OP_LOOKUPP 16 -#define NFSV4OP_NVERIFY 17 -#define NFSV4OP_OPEN 18 -#define NFSV4OP_OPENATTR 19 -#define NFSV4OP_OPENCONFIRM 20 -#define NFSV4OP_OPENDOWNGRADE 21 -#define NFSV4OP_PUTFH 22 -#define NFSV4OP_PUTPUBFH 23 -#define NFSV4OP_PUTROOTFH 24 -#define NFSV4OP_READ 25 -#define NFSV4OP_READDIR 26 -#define NFSV4OP_READLINK 27 -#define NFSV4OP_REMOVE 28 -#define NFSV4OP_RENAME 29 -#define NFSV4OP_RENEW 30 -#define NFSV4OP_RESTOREFH 31 -#define NFSV4OP_SAVEFH 32 -#define NFSV4OP_SECINFO 33 -#define NFSV4OP_SETATTR 34 -#define NFSV4OP_SETCLIENTID 35 -#define NFSV4OP_SETCLIENTIDCFRM 36 -#define NFSV4OP_VERIFY 37 -#define NFSV4OP_WRITE 38 -#define NFSV4OP_RELEASELCKOWN 39 - -/* - * and the Callback OPs - */ -#define NFSV4OP_CBGETATTR 3 -#define NFSV4OP_CBRECALL 4 - -/* - * NFSV4OP_NOPS is one greater than the largest V4 Op#. (Used for sizing - * arrays, etc.) - */ -#define NFSV4OP_NOPS 40 -#define NFSV4OP_CBNOPS 5 - -/* - * Fake NFSV4OP_xxx used for nfsstat. Start at NFSV4OP_NOPS. - */ -#define NFSV4OP_SYMLINK (NFSV4OP_NOPS) -#define NFSV4OP_MKDIR (NFSV4OP_NOPS + 1) -#define NFSV4OP_RMDIR (NFSV4OP_NOPS + 2) -#define NFSV4OP_READDIRPLUS (NFSV4OP_NOPS + 3) -#define NFSV4OP_MKNOD (NFSV4OP_NOPS + 4) -#define NFSV4OP_FSSTAT (NFSV4OP_NOPS + 5) -#define NFSV4OP_FSINFO (NFSV4OP_NOPS + 6) -#define NFSV4OP_PATHCONF (NFSV4OP_NOPS + 7) -#define NFSV4OP_V3CREATE (NFSV4OP_NOPS + 8) - -#define NFSV4OP_FAKENOPS 9 - /* * Constants used by the Version 3 and 4 protocols for various RPCs */ From owner-svn-src-head@FreeBSD.ORG Fri May 15 19:41:11 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 52C771065672; Fri, 15 May 2009 19:41:11 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 37D458FC1A; Fri, 15 May 2009 19:41:11 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4FJfBxY032642; Fri, 15 May 2009 19:41:11 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4FJfA4d032632; Fri, 15 May 2009 19:41:10 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200905151941.n4FJfA4d032632@svn.freebsd.org> From: Xin LI Date: Fri, 15 May 2009 19:41:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192153 - head/usr.bin/truss X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 19:41:11 -0000 Author: delphij Date: Fri May 15 19:41:10 2009 New Revision: 192153 URL: http://svn.freebsd.org/changeset/base/192153 Log: Reduce diff against my local version: replace malloc+memset() cases to calloc(). Modified: head/usr.bin/truss/amd64-fbsd.c head/usr.bin/truss/amd64-fbsd32.c head/usr.bin/truss/amd64-linux32.c head/usr.bin/truss/i386-fbsd.c head/usr.bin/truss/i386-linux.c head/usr.bin/truss/ia64-fbsd.c head/usr.bin/truss/main.c head/usr.bin/truss/mips-fbsd.c head/usr.bin/truss/powerpc-fbsd.c head/usr.bin/truss/sparc64-fbsd.c Modified: head/usr.bin/truss/amd64-fbsd.c ============================================================================== --- head/usr.bin/truss/amd64-fbsd.c Fri May 15 19:33:59 2009 (r192152) +++ head/usr.bin/truss/amd64-fbsd.c Fri May 15 19:41:10 2009 (r192153) @@ -191,8 +191,7 @@ amd64_syscall_entry(struct trussinfo *tr fsc.nargs = nargs; } - fsc.s_args = malloc((1+fsc.nargs) * sizeof(char*)); - memset(fsc.s_args, 0, fsc.nargs * sizeof(char*)); + fsc.s_args = calloc(1, (1+fsc.nargs) * sizeof(char*)); fsc.sc = sc; /* Modified: head/usr.bin/truss/amd64-fbsd32.c ============================================================================== --- head/usr.bin/truss/amd64-fbsd32.c Fri May 15 19:33:59 2009 (r192152) +++ head/usr.bin/truss/amd64-fbsd32.c Fri May 15 19:41:10 2009 (r192153) @@ -194,8 +194,7 @@ amd64_fbsd32_syscall_entry(struct trussi fsc.nargs = nargs; } - fsc.s_args = malloc((1+fsc.nargs) * sizeof(char*)); - memset(fsc.s_args, 0, fsc.nargs * sizeof(char*)); + fsc.s_args = calloc(1, (1+fsc.nargs) * sizeof(char*)); fsc.sc = sc; /* Modified: head/usr.bin/truss/amd64-linux32.c ============================================================================== --- head/usr.bin/truss/amd64-linux32.c Fri May 15 19:33:59 2009 (r192152) +++ head/usr.bin/truss/amd64-linux32.c Fri May 15 19:41:10 2009 (r192153) @@ -164,8 +164,7 @@ amd64_linux32_syscall_entry(struct truss fsc.nargs = nargs; } - fsc.s_args = malloc((1+fsc.nargs) * sizeof(char*)); - memset(fsc.s_args, 0, fsc.nargs * sizeof(char*)); + fsc.s_args = calloc(1, (1+fsc.nargs) * sizeof(char*)); fsc.sc = sc; /* Modified: head/usr.bin/truss/i386-fbsd.c ============================================================================== --- head/usr.bin/truss/i386-fbsd.c Fri May 15 19:33:59 2009 (r192152) +++ head/usr.bin/truss/i386-fbsd.c Fri May 15 19:41:10 2009 (r192153) @@ -184,8 +184,7 @@ i386_syscall_entry(struct trussinfo *tru fsc.nargs = nargs; } - fsc.s_args = malloc((1+fsc.nargs) * sizeof(char*)); - memset(fsc.s_args, 0, fsc.nargs * sizeof(char*)); + fsc.s_args = calloc(1, (1+fsc.nargs) * sizeof(char*)); fsc.sc = sc; /* Modified: head/usr.bin/truss/i386-linux.c ============================================================================== --- head/usr.bin/truss/i386-linux.c Fri May 15 19:33:59 2009 (r192152) +++ head/usr.bin/truss/i386-linux.c Fri May 15 19:41:10 2009 (r192153) @@ -164,8 +164,7 @@ i386_linux_syscall_entry(struct trussinf fsc.nargs = nargs; } - fsc.s_args = malloc((1+fsc.nargs) * sizeof(char*)); - memset(fsc.s_args, 0, fsc.nargs * sizeof(char*)); + fsc.s_args = calloc(1, (1+fsc.nargs) * sizeof(char*)); fsc.sc = sc; /* Modified: head/usr.bin/truss/ia64-fbsd.c ============================================================================== --- head/usr.bin/truss/ia64-fbsd.c Fri May 15 19:33:59 2009 (r192152) +++ head/usr.bin/truss/ia64-fbsd.c Fri May 15 19:41:10 2009 (r192153) @@ -166,8 +166,7 @@ ia64_syscall_entry(struct trussinfo *tru fsc.nargs = nargs; } - fsc.s_args = malloc((1+fsc.nargs) * sizeof(char*)); - memset(fsc.s_args, 0, fsc.nargs * sizeof(char*)); + fsc.s_args = calloc(1, (1+fsc.nargs) * sizeof(char*)); fsc.sc = sc; /* Modified: head/usr.bin/truss/main.c ============================================================================== --- head/usr.bin/truss/main.c Fri May 15 19:33:59 2009 (r192152) +++ head/usr.bin/truss/main.c Fri May 15 19:41:10 2009 (r192153) @@ -179,11 +179,10 @@ main(int ac, char **av) initial_open = 1; /* Initialize the trussinfo struct */ - trussinfo = (struct trussinfo *)malloc(sizeof(struct trussinfo)); + trussinfo = (struct trussinfo *)calloc(1, sizeof(struct trussinfo)); if (trussinfo == NULL) - errx(1, "malloc() failed"); - bzero(trussinfo, sizeof(struct trussinfo)); - + errx(1, "calloc() failed"); + trussinfo->outfile = stderr; trussinfo->strsize = 32; trussinfo->pr_why = S_NONE; Modified: head/usr.bin/truss/mips-fbsd.c ============================================================================== --- head/usr.bin/truss/mips-fbsd.c Fri May 15 19:33:59 2009 (r192152) +++ head/usr.bin/truss/mips-fbsd.c Fri May 15 19:41:10 2009 (r192153) @@ -211,8 +211,7 @@ mips_syscall_entry(struct trussinfo *tru fsc.nargs = nargs; } - fsc.s_args = malloc((1+fsc.nargs) * sizeof(char*)); - memset(fsc.s_args, 0, fsc.nargs * sizeof(char*)); + fsc.s_args = calloc(1, (1+fsc.nargs) * sizeof(char*)); fsc.sc = sc; /* Modified: head/usr.bin/truss/powerpc-fbsd.c ============================================================================== --- head/usr.bin/truss/powerpc-fbsd.c Fri May 15 19:33:59 2009 (r192152) +++ head/usr.bin/truss/powerpc-fbsd.c Fri May 15 19:41:10 2009 (r192153) @@ -193,8 +193,7 @@ powerpc_syscall_entry(struct trussinfo * fsc.nargs = nargs; } - fsc.s_args = malloc((1+fsc.nargs) * sizeof(char*)); - memset(fsc.s_args, 0, fsc.nargs * sizeof(char*)); + fsc.s_args = calloc(1, (1+fsc.nargs) * sizeof(char*)); fsc.sc = sc; /* Modified: head/usr.bin/truss/sparc64-fbsd.c ============================================================================== --- head/usr.bin/truss/sparc64-fbsd.c Fri May 15 19:33:59 2009 (r192152) +++ head/usr.bin/truss/sparc64-fbsd.c Fri May 15 19:41:10 2009 (r192153) @@ -209,8 +209,7 @@ sparc64_syscall_entry(struct trussinfo * fsc.nargs = nargs; } - fsc.s_args = malloc((1+fsc.nargs) * sizeof(char*)); - memset(fsc.s_args, 0, fsc.nargs * sizeof(char*)); + fsc.s_args = calloc(1, (1+fsc.nargs) * sizeof(char*)); fsc.sc = sc; /* From owner-svn-src-head@FreeBSD.ORG Fri May 15 21:06:29 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 45399106564A; Fri, 15 May 2009 21:06:29 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 345AB8FC13; Fri, 15 May 2009 21:06:29 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4FL6TPL034554; Fri, 15 May 2009 21:06:29 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4FL6TJ1034553; Fri, 15 May 2009 21:06:29 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <200905152106.n4FL6TJ1034553@svn.freebsd.org> From: Christian Brueffer Date: Fri, 15 May 2009 21:06:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192158 - head/sys/dev/ep X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 21:06:29 -0000 Author: brueffer Date: Fri May 15 21:06:28 2009 New Revision: 192158 URL: http://svn.freebsd.org/changeset/base/192158 Log: Add a missing break in a switch statement. Found with: Coverity Prevent(tm) CID: 4302 MFC after: 2 weeks Modified: head/sys/dev/ep/if_ep.c Modified: head/sys/dev/ep/if_ep.c ============================================================================== --- head/sys/dev/ep/if_ep.c Fri May 15 20:58:52 2009 (r192157) +++ head/sys/dev/ep/if_ep.c Fri May 15 21:06:28 2009 (r192158) @@ -915,6 +915,7 @@ ep_ifmedia_sts(struct ifnet *ifp, struct } else { ifmr->ifm_active = IFM_ETHER | IFM_NONE; } + break; default: ifmr->ifm_active = sc->ifmedia.ifm_media; break; From owner-svn-src-head@FreeBSD.ORG Fri May 15 21:07:00 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 87B931065675; Fri, 15 May 2009 21:07:00 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 5BB538FC1A; Fri, 15 May 2009 21:07:00 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 1103B46C2C; Fri, 15 May 2009 17:07:00 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id F0C408A028; Fri, 15 May 2009 17:06:58 -0400 (EDT) From: John Baldwin To: src-committers@freebsd.org Date: Fri, 15 May 2009 17:05:56 -0400 User-Agent: KMail/1.9.7 References: <200905142153.n4ELrZPE003481@svn.freebsd.org> In-Reply-To: <200905142153.n4ELrZPE003481@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200905151705.57071.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Fri, 15 May 2009 17:06:59 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r192122 - in head/sys: amd64/conf i386/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 21:07:01 -0000 On Thursday 14 May 2009 5:53:35 pm John Baldwin wrote: > Author: jhb > Date: Thu May 14 21:53:35 2009 > New Revision: 192122 > URL: http://svn.freebsd.org/changeset/base/192122 > > Log: > Trim the default set of device hints on i386 and amd64: > - Remove vga0 and the disabled uart2/uart3 hints from both platforms. > - Remove hints for ISA adv0, bt0, aha0, aic0, ed0, cs0, sn0, ie0, fe0, and > le0 from i386. All these hints were marked 'disabled' and thus already > did not work "out of the box". > > Discussed with: imp For 9.0 the plan is to not install GENERIC.hints into /boot/device.hints by default (at least for x86 platforms). i386 and amd64 can now boot without any hints (sc0 will be the console in that case) in 7.x and 8.0. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Fri May 15 21:34:58 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7AEF81065670; Fri, 15 May 2009 21:34:58 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6A43C8FC0A; Fri, 15 May 2009 21:34:58 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4FLYwZt035342; Fri, 15 May 2009 21:34:58 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4FLYwPq035341; Fri, 15 May 2009 21:34:58 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200905152134.n4FLYwPq035341@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Fri, 15 May 2009 21:34:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192160 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 21:34:58 -0000 Author: des Date: Fri May 15 21:34:58 2009 New Revision: 192160 URL: http://svn.freebsd.org/changeset/base/192160 Log: Remove do-nothing code that was required to dirty the old buffer on Alpha. Coverity ID: 838 Approved by: jhb, alc Modified: head/sys/kern/kern_sysctl.c Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Fri May 15 21:12:10 2009 (r192159) +++ head/sys/kern/kern_sysctl.c Fri May 15 21:34:58 2009 (r192160) @@ -1373,8 +1373,7 @@ int sysctl_wire_old_buffer(struct sysctl_req *req, size_t len) { int ret; - size_t i, wiredlen; - char *cp, dummy; + size_t wiredlen; wiredlen = (len > 0 && len < req->oldlen) ? len : req->oldlen; ret = 0; @@ -1387,16 +1386,6 @@ sysctl_wire_old_buffer(struct sysctl_req return (ret); wiredlen = 0; } - /* - * Touch all the wired pages to avoid PTE modified - * bit emulation traps on Alpha while holding locks - * in the sysctl handler. - */ - for (i = (wiredlen + PAGE_SIZE - 1) / PAGE_SIZE, - cp = req->oldptr; i > 0; i--, cp += PAGE_SIZE) { - copyin(cp, &dummy, 1); - copyout(&dummy, cp, 1); - } } req->lock = REQ_WIRED; req->validlen = wiredlen; From owner-svn-src-head@FreeBSD.ORG Fri May 15 22:38:24 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 583AB1065672; Fri, 15 May 2009 22:38:24 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: from mail-ew0-f159.google.com (mail-ew0-f159.google.com [209.85.219.159]) by mx1.freebsd.org (Postfix) with ESMTP id 625D88FC15; Fri, 15 May 2009 22:38:22 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: by ewy3 with SMTP id 3so2667145ewy.43 for ; Fri, 15 May 2009 15:38:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:from:date:x-google-sender-auth:message-id:subject:to:cc :content-type:content-transfer-encoding; bh=H/hn3B/4D70FNPkBY4pF4NWo4K/CSYwsX5dJxYDLNM8=; b=i2Sdlx/Pr3aok77/AeWBQWVRKj/kN3KqaMcMDk5BvoxPnXBXhh+LniEty+rGXdBahT GuMjNPPlIQ/NZl8sEaqfYANfVOa5UcmVKTnGgO0V3fwu7Vkr6z0CGnInwjs6m47ma0x7 zNsuf4ECG8o9vKbRpnSRSdEZcr06D0QFkr11w= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; b=B12XrTLsAs1mQFfnAytJNcBKAjqu4WsckzJzG4Wd23Atglilhl9lNzr9x6NftvN7BZ P+O8htUvl8yD0AwZv1phev3KyYcQzz1ucEHcLaHAdv1Iv6nGKfO1t2N6xmPv80QNE0B8 4yVrVw3NMGsaL2TQziTn+y+duYCJ2+/cybj94= MIME-Version: 1.0 Sender: ivoras@gmail.com Received: by 10.210.126.18 with SMTP id y18mr1502738ebc.12.1242427102216; Fri, 15 May 2009 15:38:22 -0700 (PDT) In-Reply-To: <200905142153.n4ELrZPE003481@svn.freebsd.org> References: <200905142153.n4ELrZPE003481@svn.freebsd.org> From: Ivan Voras Date: Sat, 16 May 2009 00:38:02 +0200 X-Google-Sender-Auth: 6386c26743c00494 Message-ID: <9bbcef730905151538w1d1dbd45oc44004115d6b5d66@mail.gmail.com> To: John Baldwin Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r192122 - in head/sys: amd64/conf i386/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2009 22:38:24 -0000 2009/5/14 John Baldwin : > Author: jhb > Date: Thu May 14 21:53:35 2009 > New Revision: 192122 > URL: http://svn.freebsd.org/changeset/base/192122 > > Log: > =C2=A0Trim the default set of device hints on i386 and amd64: > =C2=A0- Remove vga0 and the disabled uart2/uart3 hints from both platform= s. > =C2=A0- Remove hints for ISA adv0, bt0, aha0, aic0, ed0, cs0, sn0, ie0, f= e0, and > =C2=A0 =C2=A0le0 from i386. =C2=A0All these hints were marked 'disabled' = and thus already > =C2=A0 =C2=A0did not work "out of the box". > -hint.le.0.at=3D"isa" > -hint.le.0.disabled=3D"1" > -hint.le.0.port=3D"0x280" > -hint.le.0.irq=3D"10" > -hint.le.0.drq=3D"0" Heh, this will again change the behaviour under virtualization hosts that emulate this hardware. Sometime before 7.0 the addition of this hint caused all leX devices to be renamed le(X+1) because le0 was taken and disabled. Restoring this will cause the same thing in reverse. Unless someone actually has this hardware (as opposed to its emulation) and needs the hint for something, I'd suggest these particular lines be removed before 8.0 to restore the original behaviour quickly. Obviously, they cannot be MFC-ed to 7-STABLE From owner-svn-src-head@FreeBSD.ORG Sat May 16 03:12:56 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B4F3D1065687; Sat, 16 May 2009 03:12:56 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 87CC08FC1C; Sat, 16 May 2009 03:12:56 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4G3CuAf042784; Sat, 16 May 2009 03:12:56 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4G3CuCw042782; Sat, 16 May 2009 03:12:56 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200905160312.n4G3CuCw042782@svn.freebsd.org> From: Rick Macklem Date: Sat, 16 May 2009 03:12:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192181 - in head/sys/fs: nfs nfsserver X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2009 03:12:57 -0000 Author: rmacklem Date: Sat May 16 03:12:55 2009 New Revision: 192181 URL: http://svn.freebsd.org/changeset/base/192181 Log: Fixed the Null callback RPCs so that they work with the new krpc. This required two changes: setting the program and version numbers before connect and fixing the handling of the Null Rpc case in newnfs_request(). Approved by: kib (mentor) Modified: head/sys/fs/nfs/nfs_commonkrpc.c head/sys/fs/nfsserver/nfs_nfsdstate.c Modified: head/sys/fs/nfs/nfs_commonkrpc.c ============================================================================== --- head/sys/fs/nfs/nfs_commonkrpc.c Sat May 16 02:49:05 2009 (r192180) +++ head/sys/fs/nfs/nfs_commonkrpc.c Sat May 16 03:12:55 2009 (r192181) @@ -456,7 +456,9 @@ newnfs_request(struct nfsrv_descript *nd if (nrp->nr_client == NULL) newnfs_connect(nmp, nrp, cred, td, 0); - if (usegssname) + if (nd->nd_procnum == NFSPROC_NULL) + auth = authnone_create(); + else if (usegssname) auth = nfs_getauth(nrp, secflavour, nmp->nm_krbname, srv_principal, NULL, cred); else @@ -475,7 +477,7 @@ newnfs_request(struct nfsrv_descript *nd procnum = nd->nd_procnum; if ((nd->nd_flag & ND_NFSV4) && - nd->nd_procnum != NFSV4PROC_CBNULL && + nd->nd_procnum != NFSPROC_NULL && nd->nd_procnum != NFSV4PROC_CBCOMPOUND) procnum = NFSV4PROC_COMPOUND; @@ -672,14 +674,13 @@ tryagain: rep != NULL && (rep->r_flags & R_DONTRECOVER)) nd->nd_repstat = NFSERR_STALEDONTRECOVER; } - - m_freem(nd->nd_mreq); - AUTH_DESTROY(auth); - if (rep != NULL) - FREE((caddr_t)rep, M_NFSDREQ); - return (0); } - error = EPROTONOSUPPORT; + + m_freem(nd->nd_mreq); + AUTH_DESTROY(auth); + if (rep != NULL) + FREE((caddr_t)rep, M_NFSDREQ); + return (0); nfsmout: mbuf_freem(nd->nd_mrep); mbuf_freem(nd->nd_mreq); Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdstate.c Sat May 16 02:49:05 2009 (r192180) +++ head/sys/fs/nfsserver/nfs_nfsdstate.c Sat May 16 03:12:55 2009 (r192181) @@ -3560,6 +3560,14 @@ nfsrv_docallback(struct nfsclient *clp, panic("docallb"); } clp->lc_cbref++; + + /* + * Fill the callback program# and version into the request + * structure for newnfs_connect() to use. + */ + clp->lc_req.nr_prog = clp->lc_program; + clp->lc_req.nr_vers = NFSV4_CBVERS; + /* * First, fill in some of the fields of nd and cr. */ From owner-svn-src-head@FreeBSD.ORG Sat May 16 10:42:00 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DEEBE106568B; Sat, 16 May 2009 10:42:00 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CA5768FC0C; Sat, 16 May 2009 10:42:00 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4GAg0gZ056894; Sat, 16 May 2009 10:42:00 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4GAg05J056892; Sat, 16 May 2009 10:42:00 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <200905161042.n4GAg05J056892@svn.freebsd.org> From: Christian Brueffer Date: Sat, 16 May 2009 10:42:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192193 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2009 10:42:01 -0000 Author: brueffer Date: Sat May 16 10:42:00 2009 New Revision: 192193 URL: http://svn.freebsd.org/changeset/base/192193 Log: Add a manpage for the bwi(4) driver. Added: head/share/man/man4/bwi.4 (contents, props changed) Modified: head/share/man/man4/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Sat May 16 08:27:23 2009 (r192192) +++ head/share/man/man4/Makefile Sat May 16 10:42:00 2009 (r192193) @@ -51,6 +51,7 @@ MAN= aac.4 \ blackhole.4 \ bpf.4 \ bt.4 \ + bwi.4 \ cardbus.4 \ carp.4 \ ccd.4 \ @@ -465,6 +466,7 @@ MLINKS+=bce.4 if_bce.4 MLINKS+=bfe.4 if_bfe.4 MLINKS+=bge.4 if_bge.4 MLINKS+=bktr.4 brooktree.4 +MLINKS+=bwi.4 if_bwi.4 MLINKS+=crypto.4 cryptodev.4 MLINKS+=cue.4 if_cue.4 MLINKS+=dc.4 if_dc.4 Added: head/share/man/man4/bwi.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/bwi.4 Sat May 16 10:42:00 2009 (r192193) @@ -0,0 +1,134 @@ +.\" Copyright (c) 2009 Christian Brueffer +.\" 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$ +.\" +.Dd May 16, 2009 +.Dt BWI 4 +.Os +.Sh NAME +.Nm bwi +.Nd Broadcom BCM43xx IEEE 802.11b/g wireless network driver +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device bwi" +.Cd "device wlan" +.Cd "device wlan_amrr" +.Cd "device firmware" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +if_bwi_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for Broadcom BCM43xx based +PCI/CardBus network adapters. +.Pp +It supports +.Cm station +and +.Cm monitor +mode operation. +Only one virtual interface may be configured at any time. +For more information on configuring this device, see +.Xr ifconfig 8 . +.Pp +This driver requires firmware to be loaded before it will work. +The +.Pa ports/net/bwi-firmware-kmod +port needs to be installed before +.Xr ifconfig 8 +will work. +.Sh HARDWARE +The +.Nm +driver supports Broadcom BCM43xx based wireless devices, including: +.Pp +.Bl -column -compact "Apple Airport Extreme" "BCM4306" "Mini PCI" "a/b/g" -offset 6n +.It Em "Card Chip Bus Standard" +.It "Apple Airport Extreme BCM4306 PCI b/g" +.It "Apple Airport Extreme BCM4318 PCI b/g" +.It "ASUS WL-138g BCM4318 PCI b/g" +.It "Buffalo WLI-CB-G54S BCM4318 CardBus b/g" +.It "Buffalo WLI-PCI-G54S BCM4306 PCI b/g" +.It "Compaq R4035 onboard BCM4306 PCI b/g" +.It "Dell Wireless 1470 BCM4318 Mini PCI b/g" +.It "Dell Truemobile 1400 BCM4309 Mini PCI b/g" +.It "HP nx6125 BCM4319 PCI b/g" +.It "Linksys WPC54G Ver 3 BCM4318 CardBus b/g" +.It "Linksys WPC54GS Ver 2 BCM4318 CardBus b/g" +.It "TRENDnet TEW-401PCplus BCM4306 CardBus b/g" +.It "US Robotics 5411 BCM4318 CardBus b/g" +.El +.Sh EXAMPLES +Join an existing BSS network (i.e., connect to an access point): +.Pp +.Bd -literal -offset indent +ifconfig wlan create wlandev bwi0 inet 192.168.0.20 \e + netmask 0xffffff00 +.Ed +.Pp +Join a specific BSS network with network name +.Dq Li my_net : +.Pp +.Dl "ifconfig wlan create wlandev bwi0 ssid my_net up" +.Pp +Join a specific BSS network with 64-bit WEP encryption: +.Bd -literal -offset indent +ifconfig wlan create wlandev bwi0 ssid my_net \e + wepmode on wepkey 0x1234567890 weptxkey 1 up +.Ed +.Sh SEE ALSO +.Xr arp 4 , +.Xr cardbus 4 , +.Xr intro 4 , +.Xr pci 4 , +.Xr wlan 4 , +.Xr wlan_amrr 4 , +.Xr ifconfig 8 , +.Xr wpa_supplicant 8 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 8.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written for DragonFly BSD by +.An Sepherosa Ziehau +and subsequently ported to +.Fx . +.Sh BUGS +Some card based on the BCM4306 and BCM4309 chips do not work properly +on channel 1, 2 and 3. From owner-svn-src-head@FreeBSD.ORG Sat May 16 10:48:21 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D93161065674; Sat, 16 May 2009 10:48:20 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C440A8FC1D; Sat, 16 May 2009 10:48:20 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4GAmK5B057127; Sat, 16 May 2009 10:48:20 GMT (envelope-from dfr@svn.freebsd.org) Received: (from dfr@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4GAmKRh057122; Sat, 16 May 2009 10:48:20 GMT (envelope-from dfr@svn.freebsd.org) Message-Id: <200905161048.n4GAmKRh057122@svn.freebsd.org> From: Doug Rabson Date: Sat, 16 May 2009 10:48:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192194 - in head/sys: boot/i386/zfsboot boot/zfs cddl/boot/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2009 10:48:22 -0000 Author: dfr Date: Sat May 16 10:48:20 2009 New Revision: 192194 URL: http://svn.freebsd.org/changeset/base/192194 Log: Add support for booting from raidz1 and raidz2 pools. Modified: head/sys/boot/i386/zfsboot/zfsboot.c head/sys/boot/zfs/zfsimpl.c head/sys/cddl/boot/zfs/README head/sys/cddl/boot/zfs/zfsimpl.h head/sys/cddl/boot/zfs/zfssubr.c Modified: head/sys/boot/i386/zfsboot/zfsboot.c ============================================================================== --- head/sys/boot/i386/zfsboot/zfsboot.c Sat May 16 10:42:00 2009 (r192193) +++ head/sys/boot/i386/zfsboot/zfsboot.c Sat May 16 10:48:20 2009 (r192194) @@ -413,6 +413,20 @@ int13probe(int drive) return(0); } +/* + * We call this when we find a ZFS vdev - ZFS consumes the dsk + * structure so we must make a new one. + */ +static struct dsk * +copy_dsk(struct dsk *dsk) +{ + struct dsk *newdsk; + + newdsk = malloc(sizeof(struct dsk)); + *newdsk = *dsk; + return (newdsk); +} + static void probe_drive(struct dsk *dsk, spa_t **spap) { @@ -426,9 +440,6 @@ probe_drive(struct dsk *dsk, spa_t **spa char *sec; unsigned i; - if (!int13probe(dsk->drive)) - return; - /* * If we find a vdev on the whole disk, stop here. Otherwise dig * out the MBR and probe each slice in turn for a vdev. @@ -473,7 +484,7 @@ probe_drive(struct dsk *dsk, spa_t **spa if (vdev_probe(vdev_read, dsk, spap) == 0) { /* * We record the first pool we find (we will try - * to boot from that one. + * to boot from that one). */ spap = 0; @@ -481,10 +492,7 @@ probe_drive(struct dsk *dsk, spa_t **spa * This slice had a vdev. We need a new dsk * structure now since the vdev now owns this one. */ - struct dsk *newdsk; - newdsk = malloc(sizeof(struct dsk)); - *newdsk = *dsk; - dsk = newdsk; + dsk = copy_dsk(dsk); } break; } @@ -514,10 +522,7 @@ trymbr: * This slice had a vdev. We need a new dsk structure now * since the vdev now owns this one. */ - struct dsk *newdsk; - newdsk = malloc(sizeof(struct dsk)); - *newdsk = *dsk; - dsk = newdsk; + dsk = copy_dsk(dsk); } } } @@ -569,10 +574,13 @@ main(void) * will find any other available pools and it may fill in missing * vdevs for the boot pool. */ - for (i = 0; i < 4; i++) { + for (i = 0; i < 128; i++) { if ((i | DRV_HARD) == *(uint8_t *)PTOV(ARGS)) continue; + if (!int13probe(i | DRV_HARD)) + break; + dsk = malloc(sizeof(struct dsk)); dsk->drive = i | DRV_HARD; dsk->type = dsk->drive & TYPE_AD; @@ -944,7 +952,7 @@ static int drvread(struct dsk *dsk, void *buf, unsigned lba, unsigned nblk) { #ifdef GPT - static unsigned c = 0x2d5c7c2f; + static unsigned c = 0x2d5c7c2f; if (!OPT_CHECK(RBX_QUIET)) printf("%c\b", c = c << 8 | c >> 24); Modified: head/sys/boot/zfs/zfsimpl.c ============================================================================== --- head/sys/boot/zfs/zfsimpl.c Sat May 16 10:42:00 2009 (r192193) +++ head/sys/boot/zfs/zfsimpl.c Sat May 16 10:48:20 2009 (r192194) @@ -45,16 +45,13 @@ static vdev_list_t zfs_vdevs; static spa_list_t zfs_pools; static uint64_t zfs_crc64_table[256]; -static char *zfs_decomp_buf; static const dnode_phys_t *dnode_cache_obj = 0; static uint64_t dnode_cache_bn; static char *dnode_cache_buf; static char *zap_scratch; +static char *zfs_temp_buf, *zfs_temp_end, *zfs_temp_ptr; -/* - * Forward declarations. - */ -static int zio_read_phys(vdev_t *vdev, const blkptr_t *bp, void *buf, off_t offset); +#define TEMP_SIZE (1*SPA_MAXBLOCKSIZE) static void zfs_init(void) @@ -62,13 +59,37 @@ zfs_init(void) STAILQ_INIT(&zfs_vdevs); STAILQ_INIT(&zfs_pools); - zfs_decomp_buf = malloc(128*1024); - dnode_cache_buf = malloc(128*1024); - zap_scratch = malloc(128*1024); + zfs_temp_buf = malloc(TEMP_SIZE); + zfs_temp_end = zfs_temp_buf + TEMP_SIZE; + zfs_temp_ptr = zfs_temp_buf; + dnode_cache_buf = malloc(SPA_MAXBLOCKSIZE); + zap_scratch = malloc(SPA_MAXBLOCKSIZE); zfs_init_crc(); } +static char * +zfs_alloc_temp(size_t sz) +{ + char *p; + + if (zfs_temp_ptr + sz > zfs_temp_end) { + printf("ZFS: out of temporary buffer space\n"); + for (;;) ; + } + p = zfs_temp_ptr; + zfs_temp_ptr += sz; + + return (p); +} + +static void +zfs_reset_temp(void) +{ + + zfs_temp_ptr = zfs_temp_buf; +} + static int xdr_int(const unsigned char **xdr, int *ip) { @@ -299,7 +320,41 @@ nvlist_print(const unsigned char *nvlist #endif static int -vdev_mirror_read(vdev_t *vdev, void *priv, off_t offset, void *buf, size_t size) +vdev_read_phys(vdev_t *vdev, const blkptr_t *bp, void *buf, + off_t offset, size_t size) +{ + size_t psize; + int rc; + + if (bp) { + psize = BP_GET_PSIZE(bp); + } else { + psize = size; + } + + /*printf("ZFS: reading %d bytes at 0x%llx to %p\n", psize, offset, buf);*/ + rc = vdev->v_phys_read(vdev, vdev->v_read_priv, offset, buf, psize); + if (rc) + return (rc); + if (bp && zio_checksum_error(bp, buf)) + return (EIO); + + return (0); +} + +static int +vdev_disk_read(vdev_t *vdev, const blkptr_t *bp, void *buf, + off_t offset, size_t bytes) +{ + + return (vdev_read_phys(vdev, bp, buf, + offset + VDEV_LABEL_START_SIZE, bytes)); +} + + +static int +vdev_mirror_read(vdev_t *vdev, const blkptr_t *bp, void *buf, + off_t offset, size_t bytes) { vdev_t *kid; int rc; @@ -308,7 +363,7 @@ vdev_mirror_read(vdev_t *vdev, void *pri STAILQ_FOREACH(kid, &vdev->v_children, v_childlink) { if (kid->v_state != VDEV_STATE_HEALTHY) continue; - rc = kid->v_read(kid, kid->v_read_priv, offset, buf, size); + rc = kid->v_read(kid, bp, buf, offset, bytes); if (!rc) return (0); } @@ -329,7 +384,7 @@ vdev_find(uint64_t guid) } static vdev_t * -vdev_create(uint64_t guid, vdev_read_t *read, void *read_priv) +vdev_create(uint64_t guid, vdev_read_t *read) { vdev_t *vdev; @@ -339,7 +394,8 @@ vdev_create(uint64_t guid, vdev_read_t * vdev->v_guid = guid; vdev->v_state = VDEV_STATE_OFFLINE; vdev->v_read = read; - vdev->v_read_priv = read_priv; + vdev->v_phys_read = 0; + vdev->v_read_priv = 0; STAILQ_INSERT_TAIL(&zfs_vdevs, vdev, v_alllink); return (vdev); @@ -349,7 +405,7 @@ static int vdev_init_from_nvlist(const unsigned char *nvlist, vdev_t **vdevp) { int rc; - uint64_t guid, id; + uint64_t guid, id, ashift, nparity; const char *type; const char *path; vdev_t *vdev, *kid; @@ -378,17 +434,30 @@ vdev_init_from_nvlist(const unsigned cha } if (strcmp(type, VDEV_TYPE_MIRROR) - && strcmp(type, VDEV_TYPE_DISK)) { - printf("ZFS: can only boot from disk or mirror vdevs\n"); + && strcmp(type, VDEV_TYPE_DISK) + && strcmp(type, VDEV_TYPE_RAIDZ)) { + printf("ZFS: can only boot from disk, mirror or raidz vdevs\n"); return (EIO); } if (!strcmp(type, VDEV_TYPE_MIRROR)) - vdev = vdev_create(guid, vdev_mirror_read, 0); + vdev = vdev_create(guid, vdev_mirror_read); + else if (!strcmp(type, VDEV_TYPE_RAIDZ)) + vdev = vdev_create(guid, vdev_raidz_read); else - vdev = vdev_create(guid, 0, 0); - + vdev = vdev_create(guid, vdev_disk_read); + vdev->v_id = id; + if (nvlist_find(nvlist, ZPOOL_CONFIG_ASHIFT, + DATA_TYPE_UINT64, 0, &ashift) == 0) + vdev->v_ashift = ashift; + else + vdev->v_ashift = 0; + if (nvlist_find(nvlist, ZPOOL_CONFIG_NPARITY, + DATA_TYPE_UINT64, 0, &nparity) == 0) + vdev->v_nparity = nparity; + else + vdev->v_nparity = 0; if (nvlist_find(nvlist, ZPOOL_CONFIG_PATH, DATA_TYPE_STRING, 0, &path) == 0) { if (strlen(path) > 5 @@ -400,15 +469,22 @@ vdev_init_from_nvlist(const unsigned cha path += 5; vdev->v_name = strdup(path); } else { - vdev->v_name = strdup(type); + if (!strcmp(type, "raidz")) { + if (vdev->v_nparity == 1) + vdev->v_name = "raidz1"; + else + vdev->v_name = "raidz2"; + } else { + vdev->v_name = strdup(type); + } } - vdev->v_id = id; rc = nvlist_find(nvlist, ZPOOL_CONFIG_CHILDREN, DATA_TYPE_NVLIST_ARRAY, &nkids, &kids); /* * Its ok if we don't have any kids. */ if (rc == 0) { + vdev->v_nchildren = nkids; for (i = 0; i < nkids; i++) { rc = vdev_init_from_nvlist(kids, &kid); if (rc) @@ -416,6 +492,8 @@ vdev_init_from_nvlist(const unsigned cha STAILQ_INSERT_TAIL(&vdev->v_children, kid, v_childlink); kids = nvlist_next(kids); } + } else { + vdev->v_nchildren = 0; } if (vdevp) @@ -431,11 +509,10 @@ vdev_set_state(vdev_t *vdev) int bad_kids; /* - * We assume that if we have kids, we are a mirror. A mirror - * is healthy if all its kids are healthy. Its degraded (but - * working) if at least one kid is healty. + * A mirror or raidz is healthy if all its kids are healthy. A + * mirror is degraded if any of its kids is healthy; a raidz + * is degraded if at most nparity kids are offline. */ - if (STAILQ_FIRST(&vdev->v_children)) { good_kids = 0; bad_kids = 0; @@ -445,13 +522,22 @@ vdev_set_state(vdev_t *vdev) else bad_kids++; } - if (good_kids) { - if (!bad_kids && good_kids) - vdev->v_state = VDEV_STATE_HEALTHY; - else - vdev->v_state = VDEV_STATE_DEGRADED; + if (bad_kids == 0) { + vdev->v_state = VDEV_STATE_HEALTHY; } else { - vdev->v_state = VDEV_STATE_OFFLINE; + if (vdev->v_read == vdev_mirror_read) { + if (good_kids) { + vdev->v_state = VDEV_STATE_DEGRADED; + } else { + vdev->v_state = VDEV_STATE_OFFLINE; + } + } else if (vdev->v_read == vdev_raidz_read) { + if (bad_kids > vdev->v_nparity) { + vdev->v_state = VDEV_STATE_OFFLINE; + } else { + vdev->v_state = VDEV_STATE_DEGRADED; + } + } } } } @@ -609,7 +695,7 @@ spa_all_status(void) } static int -vdev_probe(vdev_read_t *read, void *read_priv, spa_t **spap) +vdev_probe(vdev_phys_read_t *read, void *read_priv, spa_t **spap) { vdev_t vtmp; vdev_phys_t *vdev_label = (vdev_phys_t *) zap_scratch; @@ -632,7 +718,7 @@ vdev_probe(vdev_read_t *read, void *read * uberblock is most current. */ memset(&vtmp, 0, sizeof(vtmp)); - vtmp.v_read = read; + vtmp.v_phys_read = read; vtmp.v_read_priv = read_priv; off = offsetof(vdev_label_t, vl_vdev_phys); BP_ZERO(&bp); @@ -641,7 +727,7 @@ vdev_probe(vdev_read_t *read, void *read BP_SET_CHECKSUM(&bp, ZIO_CHECKSUM_LABEL); BP_SET_COMPRESS(&bp, ZIO_COMPRESS_OFF); ZIO_SET_CHECKSUM(&bp.blk_cksum, off, 0, 0, 0); - if (zio_read_phys(&vtmp, &bp, vdev_label, off)) + if (vdev_read_phys(&vtmp, &bp, vdev_label, off, 0)) return (EIO); if (vdev_label->vp_nvlist[0] != NV_ENCODE_XDR) { @@ -668,6 +754,7 @@ vdev_probe(vdev_read_t *read, void *read return (EIO); } +#ifndef TEST if (val != POOL_STATE_ACTIVE) { /* * Don't print a message here. If we happen to reboot @@ -677,6 +764,7 @@ vdev_probe(vdev_read_t *read, void *read /*printf("ZFS: pool is not active\n");*/ return (EIO); } +#endif if (nvlist_find(nvlist, ZPOOL_CONFIG_POOL_TXG, @@ -687,7 +775,11 @@ vdev_probe(vdev_read_t *read, void *read || nvlist_find(nvlist, ZPOOL_CONFIG_POOL_NAME, DATA_TYPE_STRING, 0, &pool_name)) { - printf("ZFS: can't find pool details\n"); + /* + * Cache and spare devices end up here - just ignore + * them. + */ + /*printf("ZFS: can't find pool details\n");*/ return (EIO); } @@ -742,7 +834,7 @@ vdev_probe(vdev_read_t *read, void *read */ vdev = vdev_find(guid); if (vdev) { - vdev->v_read = read; + vdev->v_phys_read = read; vdev->v_read_priv = read_priv; vdev->v_state = VDEV_STATE_HEALTHY; } else { @@ -772,7 +864,7 @@ vdev_probe(vdev_read_t *read, void *read BP_SET_CHECKSUM(&bp, ZIO_CHECKSUM_LABEL); BP_SET_COMPRESS(&bp, ZIO_COMPRESS_OFF); ZIO_SET_CHECKSUM(&bp.blk_cksum, off, 0, 0, 0); - if (zio_read_phys(vdev, &bp, upbuf, off)) + if (vdev_read_phys(vdev, &bp, upbuf, off, 0)) continue; up = (const struct uberblock *) upbuf; @@ -805,39 +897,20 @@ ilog2(int n) } static int -zio_read_phys(vdev_t *vdev, const blkptr_t *bp, void *buf, off_t offset) +zio_read(spa_t *spa, const blkptr_t *bp, void *buf) { int cpfunc = BP_GET_COMPRESS(bp); size_t lsize = BP_GET_LSIZE(bp); size_t psize = BP_GET_PSIZE(bp); - int rc; - - /*printf("ZFS: reading %d bytes at 0x%llx to %p\n", psize, offset, buf);*/ - if (cpfunc != ZIO_COMPRESS_OFF) { - rc = vdev->v_read(vdev, vdev->v_read_priv, offset, zfs_decomp_buf, psize); - if (rc) - return (rc); - if (zio_checksum_error(bp, zfs_decomp_buf)) - return (EIO); - if (zio_decompress_data(cpfunc, zfs_decomp_buf, psize, - buf, lsize)) - return (EIO); - } else { - rc = vdev->v_read(vdev, vdev->v_read_priv, offset, buf, psize); - if (rc) - return (rc); - - if (zio_checksum_error(bp, buf)) - return (EIO); - } - return (0); -} - -static int -zio_read(spa_t *spa, const blkptr_t *bp, void *buf) -{ + void *pbuf; int i; + zfs_reset_temp(); + if (cpfunc != ZIO_COMPRESS_OFF) + pbuf = zfs_alloc_temp(psize); + else + pbuf = buf; + for (i = 0; i < SPA_DVAS_PER_BP; i++) { const dva_t *dva = &bp->blk_dva[i]; vdev_t *vdev; @@ -848,15 +921,21 @@ zio_read(spa_t *spa, const blkptr_t *bp, continue; vdevid = DVA_GET_VDEV(dva); - offset = DVA_GET_OFFSET(dva) + VDEV_LABEL_START_SIZE; + offset = DVA_GET_OFFSET(dva); STAILQ_FOREACH(vdev, &spa->spa_vdevs, v_childlink) if (vdev->v_id == vdevid) break; if (!vdev || !vdev->v_read) continue; - if (zio_read_phys(vdev, bp, buf, offset)) + if (vdev->v_read(vdev, bp, pbuf, offset, psize)) continue; + if (cpfunc != ZIO_COMPRESS_OFF) { + if (zio_decompress_data(cpfunc, pbuf, psize, + buf, lsize)) + return (EIO); + } + return (0); } printf("ZFS: i/o error - all block copies unavailable\n"); Modified: head/sys/cddl/boot/zfs/README ============================================================================== --- head/sys/cddl/boot/zfs/README Sat May 16 10:42:00 2009 (r192193) +++ head/sys/cddl/boot/zfs/README Sat May 16 10:48:20 2009 (r192194) @@ -6,7 +6,7 @@ are used by the ZFS bootstrap: fletcher.c checksum support sha256.c checksum support lzjb.c compression support - zfssubr.c mostly checksum and compression support + zfssubr.c checksum, compression and raidz support zfsimpl.h mostly describing the physical layout The files fletcher.c, lzjb.c and sha256.c are largely identical to the Modified: head/sys/cddl/boot/zfs/zfsimpl.h ============================================================================== --- head/sys/cddl/boot/zfs/zfsimpl.h Sat May 16 10:42:00 2009 (r192193) +++ head/sys/cddl/boot/zfs/zfsimpl.h Sat May 16 10:48:20 2009 (r192194) @@ -1137,7 +1137,10 @@ typedef struct znode_phys { * In-core vdev representation. */ struct vdev; -typedef int vdev_read_t(struct vdev *vdev, void *priv, off_t offset, void *buf, size_t bytes); +typedef int vdev_phys_read_t(struct vdev *vdev, void *priv, + off_t offset, void *buf, size_t bytes); +typedef int vdev_read_t(struct vdev *vdev, const blkptr_t *bp, + void *buf, off_t offset, size_t bytes); typedef STAILQ_HEAD(vdev_list, vdev) vdev_list_t; @@ -1148,8 +1151,12 @@ typedef struct vdev { char *v_name; /* vdev name */ uint64_t v_guid; /* vdev guid */ int v_id; /* index in parent */ + int v_ashift; /* offset to block shift */ + int v_nparity; /* # parity for raidz */ + int v_nchildren; /* # children */ vdev_state_t v_state; /* current state */ - vdev_read_t *v_read; /* function to read from this vdev */ + vdev_phys_read_t *v_phys_read; /* read from raw leaf vdev */ + vdev_read_t *v_read; /* read from vdev */ void *v_read_priv; /* private data for read function */ } vdev_t; Modified: head/sys/cddl/boot/zfs/zfssubr.c ============================================================================== --- head/sys/cddl/boot/zfs/zfssubr.c Sat May 16 10:42:00 2009 (r192193) +++ head/sys/cddl/boot/zfs/zfssubr.c Sat May 16 10:48:20 2009 (r192194) @@ -191,3 +191,735 @@ zap_hash(uint64_t salt, const char *name return (crc); } + +static char *zfs_alloc_temp(size_t sz); + +typedef struct raidz_col { + uint64_t rc_devidx; /* child device index for I/O */ + uint64_t rc_offset; /* device offset */ + uint64_t rc_size; /* I/O size */ + void *rc_data; /* I/O data */ + int rc_error; /* I/O error for this device */ + uint8_t rc_tried; /* Did we attempt this I/O column? */ + uint8_t rc_skipped; /* Did we skip this I/O column? */ +} raidz_col_t; + +#define VDEV_RAIDZ_P 0 +#define VDEV_RAIDZ_Q 1 + +static void +vdev_raidz_reconstruct_p(raidz_col_t *cols, int nparity, int acols, int x) +{ + uint64_t *dst, *src, xcount, ccount, count, i; + int c; + + xcount = cols[x].rc_size / sizeof (src[0]); + //ASSERT(xcount <= cols[VDEV_RAIDZ_P].rc_size / sizeof (src[0])); + //ASSERT(xcount > 0); + + src = cols[VDEV_RAIDZ_P].rc_data; + dst = cols[x].rc_data; + for (i = 0; i < xcount; i++, dst++, src++) { + *dst = *src; + } + + for (c = nparity; c < acols; c++) { + src = cols[c].rc_data; + dst = cols[x].rc_data; + + if (c == x) + continue; + + ccount = cols[c].rc_size / sizeof (src[0]); + count = MIN(ccount, xcount); + + for (i = 0; i < count; i++, dst++, src++) { + *dst ^= *src; + } + } +} + +/* + * These two tables represent powers and logs of 2 in the Galois field defined + * above. These values were computed by repeatedly multiplying by 2 as above. + */ +static const uint8_t vdev_raidz_pow2[256] = { + 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, + 0x1d, 0x3a, 0x74, 0xe8, 0xcd, 0x87, 0x13, 0x26, + 0x4c, 0x98, 0x2d, 0x5a, 0xb4, 0x75, 0xea, 0xc9, + 0x8f, 0x03, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, + 0x9d, 0x27, 0x4e, 0x9c, 0x25, 0x4a, 0x94, 0x35, + 0x6a, 0xd4, 0xb5, 0x77, 0xee, 0xc1, 0x9f, 0x23, + 0x46, 0x8c, 0x05, 0x0a, 0x14, 0x28, 0x50, 0xa0, + 0x5d, 0xba, 0x69, 0xd2, 0xb9, 0x6f, 0xde, 0xa1, + 0x5f, 0xbe, 0x61, 0xc2, 0x99, 0x2f, 0x5e, 0xbc, + 0x65, 0xca, 0x89, 0x0f, 0x1e, 0x3c, 0x78, 0xf0, + 0xfd, 0xe7, 0xd3, 0xbb, 0x6b, 0xd6, 0xb1, 0x7f, + 0xfe, 0xe1, 0xdf, 0xa3, 0x5b, 0xb6, 0x71, 0xe2, + 0xd9, 0xaf, 0x43, 0x86, 0x11, 0x22, 0x44, 0x88, + 0x0d, 0x1a, 0x34, 0x68, 0xd0, 0xbd, 0x67, 0xce, + 0x81, 0x1f, 0x3e, 0x7c, 0xf8, 0xed, 0xc7, 0x93, + 0x3b, 0x76, 0xec, 0xc5, 0x97, 0x33, 0x66, 0xcc, + 0x85, 0x17, 0x2e, 0x5c, 0xb8, 0x6d, 0xda, 0xa9, + 0x4f, 0x9e, 0x21, 0x42, 0x84, 0x15, 0x2a, 0x54, + 0xa8, 0x4d, 0x9a, 0x29, 0x52, 0xa4, 0x55, 0xaa, + 0x49, 0x92, 0x39, 0x72, 0xe4, 0xd5, 0xb7, 0x73, + 0xe6, 0xd1, 0xbf, 0x63, 0xc6, 0x91, 0x3f, 0x7e, + 0xfc, 0xe5, 0xd7, 0xb3, 0x7b, 0xf6, 0xf1, 0xff, + 0xe3, 0xdb, 0xab, 0x4b, 0x96, 0x31, 0x62, 0xc4, + 0x95, 0x37, 0x6e, 0xdc, 0xa5, 0x57, 0xae, 0x41, + 0x82, 0x19, 0x32, 0x64, 0xc8, 0x8d, 0x07, 0x0e, + 0x1c, 0x38, 0x70, 0xe0, 0xdd, 0xa7, 0x53, 0xa6, + 0x51, 0xa2, 0x59, 0xb2, 0x79, 0xf2, 0xf9, 0xef, + 0xc3, 0x9b, 0x2b, 0x56, 0xac, 0x45, 0x8a, 0x09, + 0x12, 0x24, 0x48, 0x90, 0x3d, 0x7a, 0xf4, 0xf5, + 0xf7, 0xf3, 0xfb, 0xeb, 0xcb, 0x8b, 0x0b, 0x16, + 0x2c, 0x58, 0xb0, 0x7d, 0xfa, 0xe9, 0xcf, 0x83, + 0x1b, 0x36, 0x6c, 0xd8, 0xad, 0x47, 0x8e, 0x01 +}; +static const uint8_t vdev_raidz_log2[256] = { + 0x00, 0x00, 0x01, 0x19, 0x02, 0x32, 0x1a, 0xc6, + 0x03, 0xdf, 0x33, 0xee, 0x1b, 0x68, 0xc7, 0x4b, + 0x04, 0x64, 0xe0, 0x0e, 0x34, 0x8d, 0xef, 0x81, + 0x1c, 0xc1, 0x69, 0xf8, 0xc8, 0x08, 0x4c, 0x71, + 0x05, 0x8a, 0x65, 0x2f, 0xe1, 0x24, 0x0f, 0x21, + 0x35, 0x93, 0x8e, 0xda, 0xf0, 0x12, 0x82, 0x45, + 0x1d, 0xb5, 0xc2, 0x7d, 0x6a, 0x27, 0xf9, 0xb9, + 0xc9, 0x9a, 0x09, 0x78, 0x4d, 0xe4, 0x72, 0xa6, + 0x06, 0xbf, 0x8b, 0x62, 0x66, 0xdd, 0x30, 0xfd, + 0xe2, 0x98, 0x25, 0xb3, 0x10, 0x91, 0x22, 0x88, + 0x36, 0xd0, 0x94, 0xce, 0x8f, 0x96, 0xdb, 0xbd, + 0xf1, 0xd2, 0x13, 0x5c, 0x83, 0x38, 0x46, 0x40, + 0x1e, 0x42, 0xb6, 0xa3, 0xc3, 0x48, 0x7e, 0x6e, + 0x6b, 0x3a, 0x28, 0x54, 0xfa, 0x85, 0xba, 0x3d, + 0xca, 0x5e, 0x9b, 0x9f, 0x0a, 0x15, 0x79, 0x2b, + 0x4e, 0xd4, 0xe5, 0xac, 0x73, 0xf3, 0xa7, 0x57, + 0x07, 0x70, 0xc0, 0xf7, 0x8c, 0x80, 0x63, 0x0d, + 0x67, 0x4a, 0xde, 0xed, 0x31, 0xc5, 0xfe, 0x18, + 0xe3, 0xa5, 0x99, 0x77, 0x26, 0xb8, 0xb4, 0x7c, + 0x11, 0x44, 0x92, 0xd9, 0x23, 0x20, 0x89, 0x2e, + 0x37, 0x3f, 0xd1, 0x5b, 0x95, 0xbc, 0xcf, 0xcd, + 0x90, 0x87, 0x97, 0xb2, 0xdc, 0xfc, 0xbe, 0x61, + 0xf2, 0x56, 0xd3, 0xab, 0x14, 0x2a, 0x5d, 0x9e, + 0x84, 0x3c, 0x39, 0x53, 0x47, 0x6d, 0x41, 0xa2, + 0x1f, 0x2d, 0x43, 0xd8, 0xb7, 0x7b, 0xa4, 0x76, + 0xc4, 0x17, 0x49, 0xec, 0x7f, 0x0c, 0x6f, 0xf6, + 0x6c, 0xa1, 0x3b, 0x52, 0x29, 0x9d, 0x55, 0xaa, + 0xfb, 0x60, 0x86, 0xb1, 0xbb, 0xcc, 0x3e, 0x5a, + 0xcb, 0x59, 0x5f, 0xb0, 0x9c, 0xa9, 0xa0, 0x51, + 0x0b, 0xf5, 0x16, 0xeb, 0x7a, 0x75, 0x2c, 0xd7, + 0x4f, 0xae, 0xd5, 0xe9, 0xe6, 0xe7, 0xad, 0xe8, + 0x74, 0xd6, 0xf4, 0xea, 0xa8, 0x50, 0x58, 0xaf, +}; + +/* + * Multiply a given number by 2 raised to the given power. + */ +static uint8_t +vdev_raidz_exp2(uint8_t a, int exp) +{ + if (a == 0) + return (0); + + //ASSERT(exp >= 0); + //ASSERT(vdev_raidz_log2[a] > 0 || a == 1); + + exp += vdev_raidz_log2[a]; + if (exp > 255) + exp -= 255; + + return (vdev_raidz_pow2[exp]); +} + +static void +vdev_raidz_generate_parity_pq(raidz_col_t *cols, int nparity, int acols) +{ + uint64_t *q, *p, *src, pcount, ccount, mask, i; + int c; + + pcount = cols[VDEV_RAIDZ_P].rc_size / sizeof (src[0]); + //ASSERT(cols[VDEV_RAIDZ_P].rc_size == cols[VDEV_RAIDZ_Q].rc_size); + + for (c = nparity; c < acols; c++) { + src = cols[c].rc_data; + p = cols[VDEV_RAIDZ_P].rc_data; + q = cols[VDEV_RAIDZ_Q].rc_data; + ccount = cols[c].rc_size / sizeof (src[0]); + + if (c == nparity) { + //ASSERT(ccount == pcount || ccount == 0); + for (i = 0; i < ccount; i++, p++, q++, src++) { + *q = *src; + *p = *src; + } + for (; i < pcount; i++, p++, q++, src++) { + *q = 0; + *p = 0; + } + } else { + //ASSERT(ccount <= pcount); + + /* + * Rather than multiplying each byte + * individually (as described above), we are + * able to handle 8 at once by generating a + * mask based on the high bit in each byte and + * using that to conditionally XOR in 0x1d. + */ + for (i = 0; i < ccount; i++, p++, q++, src++) { + mask = *q & 0x8080808080808080ULL; + mask = (mask << 1) - (mask >> 7); + *q = ((*q << 1) & 0xfefefefefefefefeULL) ^ + (mask & 0x1d1d1d1d1d1d1d1dULL); + *q ^= *src; + *p ^= *src; + } + + /* + * Treat short columns as though they are full of 0s. + */ + for (; i < pcount; i++, q++) { + mask = *q & 0x8080808080808080ULL; + mask = (mask << 1) - (mask >> 7); + *q = ((*q << 1) & 0xfefefefefefefefeULL) ^ + (mask & 0x1d1d1d1d1d1d1d1dULL); + } + } + } +} + +static void +vdev_raidz_reconstruct_q(raidz_col_t *cols, int nparity, int acols, int x) +{ + uint64_t *dst, *src, xcount, ccount, count, mask, i; + uint8_t *b; + int c, j, exp; + + xcount = cols[x].rc_size / sizeof (src[0]); + //ASSERT(xcount <= cols[VDEV_RAIDZ_Q].rc_size / sizeof (src[0])); + + for (c = nparity; c < acols; c++) { + src = cols[c].rc_data; + dst = cols[x].rc_data; + + if (c == x) + ccount = 0; + else + ccount = cols[c].rc_size / sizeof (src[0]); + + count = MIN(ccount, xcount); + + if (c == nparity) { + for (i = 0; i < count; i++, dst++, src++) { + *dst = *src; + } + for (; i < xcount; i++, dst++) { + *dst = 0; + } + + } else { + /* + * For an explanation of this, see the comment in + * vdev_raidz_generate_parity_pq() above. + */ + for (i = 0; i < count; i++, dst++, src++) { + mask = *dst & 0x8080808080808080ULL; + mask = (mask << 1) - (mask >> 7); + *dst = ((*dst << 1) & 0xfefefefefefefefeULL) ^ + (mask & 0x1d1d1d1d1d1d1d1dULL); + *dst ^= *src; + } + + for (; i < xcount; i++, dst++) { + mask = *dst & 0x8080808080808080ULL; + mask = (mask << 1) - (mask >> 7); + *dst = ((*dst << 1) & 0xfefefefefefefefeULL) ^ + (mask & 0x1d1d1d1d1d1d1d1dULL); + } + } + } + + src = cols[VDEV_RAIDZ_Q].rc_data; + dst = cols[x].rc_data; + exp = 255 - (acols - 1 - x); + + for (i = 0; i < xcount; i++, dst++, src++) { + *dst ^= *src; + for (j = 0, b = (uint8_t *)dst; j < 8; j++, b++) { + *b = vdev_raidz_exp2(*b, exp); + } + } +} + + +static void +vdev_raidz_reconstruct_pq(raidz_col_t *cols, int nparity, int acols, + int x, int y) +{ + uint8_t *p, *q, *pxy, *qxy, *xd, *yd, tmp, a, b, aexp, bexp; + void *pdata, *qdata; + uint64_t xsize, ysize, i; + + //ASSERT(x < y); + //ASSERT(x >= nparity); + //ASSERT(y < acols); + + //ASSERT(cols[x].rc_size >= cols[y].rc_size); + + /* + * Move the parity data aside -- we're going to compute parity as + * though columns x and y were full of zeros -- Pxy and Qxy. We want to + * reuse the parity generation mechanism without trashing the actual + * parity so we make those columns appear to be full of zeros by + * setting their lengths to zero. + */ + pdata = cols[VDEV_RAIDZ_P].rc_data; + qdata = cols[VDEV_RAIDZ_Q].rc_data; + xsize = cols[x].rc_size; + ysize = cols[y].rc_size; + + cols[VDEV_RAIDZ_P].rc_data = + zfs_alloc_temp(cols[VDEV_RAIDZ_P].rc_size); + cols[VDEV_RAIDZ_Q].rc_data = + zfs_alloc_temp(cols[VDEV_RAIDZ_Q].rc_size); + cols[x].rc_size = 0; + cols[y].rc_size = 0; + + vdev_raidz_generate_parity_pq(cols, nparity, acols); + + cols[x].rc_size = xsize; + cols[y].rc_size = ysize; + + p = pdata; + q = qdata; + pxy = cols[VDEV_RAIDZ_P].rc_data; + qxy = cols[VDEV_RAIDZ_Q].rc_data; + xd = cols[x].rc_data; + yd = cols[y].rc_data; + + /* + * We now have: + * Pxy = P + D_x + D_y + * Qxy = Q + 2^(ndevs - 1 - x) * D_x + 2^(ndevs - 1 - y) * D_y + * + * We can then solve for D_x: + * D_x = A * (P + Pxy) + B * (Q + Qxy) + * where + * A = 2^(x - y) * (2^(x - y) + 1)^-1 + * B = 2^(ndevs - 1 - x) * (2^(x - y) + 1)^-1 + * + * With D_x in hand, we can easily solve for D_y: + * D_y = P + Pxy + D_x + */ + + a = vdev_raidz_pow2[255 + x - y]; + b = vdev_raidz_pow2[255 - (acols - 1 - x)]; + tmp = 255 - vdev_raidz_log2[a ^ 1]; + + aexp = vdev_raidz_log2[vdev_raidz_exp2(a, tmp)]; + bexp = vdev_raidz_log2[vdev_raidz_exp2(b, tmp)]; + + for (i = 0; i < xsize; i++, p++, q++, pxy++, qxy++, xd++, yd++) { + *xd = vdev_raidz_exp2(*p ^ *pxy, aexp) ^ + vdev_raidz_exp2(*q ^ *qxy, bexp); + + if (i < ysize) + *yd = *p ^ *pxy ^ *xd; + } + + /* + * Restore the saved parity data. + */ + cols[VDEV_RAIDZ_P].rc_data = pdata; + cols[VDEV_RAIDZ_Q].rc_data = qdata; +} + +static int +vdev_raidz_read(vdev_t *vdev, const blkptr_t *bp, void *buf, + off_t offset, size_t bytes) +{ + size_t psize = BP_GET_PSIZE(bp); + vdev_t *kid; + int unit_shift = vdev->v_ashift; + int dcols = vdev->v_nchildren; + int nparity = vdev->v_nparity; + int missingdata, missingparity; + int parity_errors, data_errors, unexpected_errors, total_errors; + int parity_untried; + uint64_t b = offset >> unit_shift; + uint64_t s = psize >> unit_shift; + uint64_t f = b % dcols; + uint64_t o = (b / dcols) << unit_shift; + int q, r, c, c1, bc, col, acols, coff, devidx, asize, n; + static raidz_col_t cols[16]; + raidz_col_t *rc, *rc1; + + q = s / (dcols - nparity); + r = s - q * (dcols - nparity); + bc = (r == 0 ? 0 : r + nparity); + + acols = (q == 0 ? bc : dcols); + asize = 0; + + for (c = 0; c < acols; c++) { + col = f + c; + coff = o; + if (col >= dcols) { + col -= dcols; + coff += 1ULL << unit_shift; + } + cols[c].rc_devidx = col; + cols[c].rc_offset = coff; + cols[c].rc_size = (q + (c < bc)) << unit_shift; + cols[c].rc_data = NULL; + cols[c].rc_error = 0; + cols[c].rc_tried = 0; + cols[c].rc_skipped = 0; + asize += cols[c].rc_size; + } + + asize = roundup(asize, (nparity + 1) << unit_shift); + + for (c = 0; c < nparity; c++) { + cols[c].rc_data = zfs_alloc_temp(cols[c].rc_size); + } + + cols[c].rc_data = buf; + + for (c = c + 1; c < acols; c++) + cols[c].rc_data = (char *)cols[c - 1].rc_data + + cols[c - 1].rc_size; + + /* + * If all data stored spans all columns, there's a danger that + * parity will always be on the same device and, since parity + * isn't read during normal operation, that that device's I/O + * bandwidth won't be used effectively. We therefore switch + * the parity every 1MB. + * + * ... at least that was, ostensibly, the theory. As a + * practical matter unless we juggle the parity between all + * devices evenly, we won't see any benefit. Further, + * occasional writes that aren't a multiple of the LCM of the + * number of children and the minimum stripe width are + * sufficient to avoid pessimal behavior. Unfortunately, this + * decision created an implicit on-disk format requirement + * that we need to support for all eternity, but only for + * single-parity RAID-Z. + */ + //ASSERT(acols >= 2); + //ASSERT(cols[0].rc_size == cols[1].rc_size); + + if (nparity == 1 && (offset & (1ULL << 20))) { + devidx = cols[0].rc_devidx; + o = cols[0].rc_offset; + cols[0].rc_devidx = cols[1].rc_devidx; + cols[0].rc_offset = cols[1].rc_offset; + cols[1].rc_devidx = devidx; + cols[1].rc_offset = o; + } + + /* + * Iterate over the columns in reverse order so that we hit + * the parity last -- any errors along the way will force us + * to read the parity data. + */ + missingdata = 0; + missingparity = 0; + for (c = acols - 1; c >= 0; c--) { + rc = &cols[c]; + devidx = rc->rc_devidx; + STAILQ_FOREACH(kid, &vdev->v_children, v_childlink) + if (kid->v_id == devidx) + break; + if (kid == NULL || kid->v_state != VDEV_STATE_HEALTHY) { + if (c >= nparity) + missingdata++; + else + missingparity++; + rc->rc_error = ENXIO; + rc->rc_tried = 1; /* don't even try */ + rc->rc_skipped = 1; + continue; + } +#if 0 + /* + * Too hard for the bootcode + */ + if (vdev_dtl_contains(&cvd->vdev_dtl_map, bp->blk_birth, 1)) { + if (c >= nparity) + rm->rm_missingdata++; + else + rm->rm_missingparity++; + rc->rc_error = ESTALE; + rc->rc_skipped = 1; + continue; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sat May 16 12:11:06 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E85611065695; Sat, 16 May 2009 12:11:06 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D44EB8FC0C; Sat, 16 May 2009 12:11:06 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4GCB6Ch058706; Sat, 16 May 2009 12:11:06 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4GCB6sn058705; Sat, 16 May 2009 12:11:06 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <200905161211.n4GCB6sn058705@svn.freebsd.org> From: Christian Brueffer Date: Sat, 16 May 2009 12:11:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192195 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2009 12:11:07 -0000 Author: brueffer Date: Sat May 16 12:11:06 2009 New Revision: 192195 URL: http://svn.freebsd.org/changeset/base/192195 Log: Make the HARDWARE section ready for the automatic hardware notes generation, fix the date format. Modified: head/share/man/man4/urtw.4 Modified: head/share/man/man4/urtw.4 ============================================================================== --- head/share/man/man4/urtw.4 Sat May 16 10:48:20 2009 (r192194) +++ head/share/man/man4/urtw.4 Sat May 16 12:11:06 2009 (r192195) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 15 2008 $ +.Dd November 15, 2008 .Dt URTW 4 .Os .Sh NAME @@ -64,13 +64,15 @@ Only one virtual interface may be config For more information on configuring this device, see .Xr ifconfig 8 . .Sh HARDWARE -The following adapters should work: +The +.Nm +driver supports Realtek RTL8187L based wireless network devices, including: .Pp -.Bl -column "Card " "Radio " "Bus" -compact -offset 6n +.Bl -column "Shuttle XPC Accessory PN20" "RTL8225" "USB" -compact -offset 6n .It Em "Card Radio Bus" -.It Li "Netgear WG111v2" Ta RTL8225 Ta USB -.It Li "Safehome WLG-1500SMA5" Ta RTL8225 Ta USB -.It Li "Shuttle XPC Accessory PN20" Ta RTL8225 Ta USB +.It "Netgear WG111v2 RTL8225 USB" +.It "Safehome WLG-1500SMA5 RTL8225 USB" +.It "Shuttle XPC Accessory PN20 RTL8225 USB" .El .Sh EXAMPLES Join an existing BSS network (i.e., connect to an access point): From owner-svn-src-head@FreeBSD.ORG Sat May 16 12:12:31 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 776E91065670; Sat, 16 May 2009 12:12:31 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 63E3E8FC28; Sat, 16 May 2009 12:12:31 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4GCCV9e058775; Sat, 16 May 2009 12:12:31 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4GCCVfc058774; Sat, 16 May 2009 12:12:31 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <200905161212.n4GCCVfc058774@svn.freebsd.org> From: Christian Brueffer Date: Sat, 16 May 2009 12:12:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192196 - head/release/doc/en_US.ISO8859-1/hardware X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2009 12:12:31 -0000 Author: brueffer Date: Sat May 16 12:12:31 2009 New Revision: 192196 URL: http://svn.freebsd.org/changeset/base/192196 Log: Add bwi(4) and urtw(4). Modified: head/release/doc/en_US.ISO8859-1/hardware/article.sgml Modified: head/release/doc/en_US.ISO8859-1/hardware/article.sgml ============================================================================== --- head/release/doc/en_US.ISO8859-1/hardware/article.sgml Sat May 16 12:11:06 2009 (r192195) +++ head/release/doc/en_US.ISO8859-1/hardware/article.sgml Sat May 16 12:12:31 2009 (r192196) @@ -898,6 +898,8 @@ &hwlist.ath; + &hwlist.bwi; + [&arch.i386;, &arch.amd64;] Intel PRO/Wireless 2100 MiniPCI network adapter (&man.ipw.4; driver) @@ -922,6 +924,8 @@ &hwlist.ural; + &hwlist.urtw; + [&arch.amd64;, &arch.i386;, &arch.pc98;] Lucent Technologies WaveLAN/IEEE 802.11b wireless network adapters and workalikes using the Lucent Hermes, Intersil PRISM-II, From owner-svn-src-head@FreeBSD.ORG Sat May 16 15:12:56 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9BF61106566B; Sat, 16 May 2009 15:12:56 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 892D38FC12; Sat, 16 May 2009 15:12:56 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4GFCuF3062531; Sat, 16 May 2009 15:12:56 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4GFCufF062530; Sat, 16 May 2009 15:12:56 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <200905161512.n4GFCufF062530@svn.freebsd.org> From: Maxim Konovalov Date: Sat, 16 May 2009 15:12:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192198 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2009 15:12:57 -0000 Author: maxim Date: Sat May 16 15:12:56 2009 New Revision: 192198 URL: http://svn.freebsd.org/changeset/base/192198 Log: o Add missed semicolon in action script. PR: conf/134579 Submitted by: Lucius Windschuh MFC after: 1 week Modified: head/etc/devd.conf Modified: head/etc/devd.conf ============================================================================== --- head/etc/devd.conf Sat May 16 14:30:08 2009 (r192197) +++ head/etc/devd.conf Sat May 16 15:12:56 2009 (r192198) @@ -132,7 +132,7 @@ attach 100 { match "vendor" "0x1645"; match "product" "0x8001"; match "release" "0x0101"; - action "if ! kldstat -n usio > /dev/null 2>&1 ; then kldload usio; fi /usr/sbin/ezdownload -v -f /usr/share/usb/firmware/1645.8001.0101 /dev/$device-name"; + action "if ! kldstat -n usio > /dev/null 2>&1 ; then kldload usio; fi; /usr/sbin/ezdownload -v -f /usr/share/usb/firmware/1645.8001.0101 /dev/$device-name"; }; # This entry starts the ColdSync tool in daemon mode. Make sure you have an up From owner-svn-src-head@FreeBSD.ORG Sat May 16 15:21:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8760E106564A; Sat, 16 May 2009 15:21:08 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 74B148FC15; Sat, 16 May 2009 15:21:08 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4GFL88v062725; Sat, 16 May 2009 15:21:08 GMT (envelope-from lulf@svn.freebsd.org) Received: (from lulf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4GFL81o062724; Sat, 16 May 2009 15:21:08 GMT (envelope-from lulf@svn.freebsd.org) Message-Id: <200905161521.n4GFL81o062724@svn.freebsd.org> From: Ulf Lilleengen Date: Sat, 16 May 2009 15:21:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192199 - head/sys/mips/mips X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2009 15:21:09 -0000 Author: lulf Date: Sat May 16 15:21:08 2009 New Revision: 192199 URL: http://svn.freebsd.org/changeset/base/192199 Log: - Fix spelling. Modified: head/sys/mips/mips/pm_machdep.c Modified: head/sys/mips/mips/pm_machdep.c ============================================================================== --- head/sys/mips/mips/pm_machdep.c Sat May 16 15:12:56 2009 (r192198) +++ head/sys/mips/mips/pm_machdep.c Sat May 16 15:21:08 2009 (r192199) @@ -130,7 +130,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sfp = (struct sigframe *)((vm_offset_t)(regs->sp - sizeof(struct sigframe)) & ~(sizeof(__int64_t) - 1)); - /* Translate the signal is appropriate */ + /* Translate the signal if appropriate */ if (p->p_sysent->sv_sigtbl) { if (sig <= p->p_sysent->sv_sigsize) sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)]; From owner-svn-src-head@FreeBSD.ORG Sat May 16 18:35:29 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A7CBE106566C; Sat, 16 May 2009 18:35:29 +0000 (UTC) (envelope-from ken@mthelicon.com) Received: from hercules.mthelicon.com (hercules.mthelicon.com [IPv6:2001:49f0:2023::2]) by mx1.freebsd.org (Postfix) with ESMTP id 7848C8FC2B; Sat, 16 May 2009 18:35:29 +0000 (UTC) (envelope-from ken@mthelicon.com) Received: from feathers.peganest.com (feathers.peganest.com [78.33.110.3]) (authenticated bits=0) by hercules.mthelicon.com (8.14.3/8.14.3) with ESMTP id n4GIZRpg090702 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES256-SHA bits=256 verify=NO); Sat, 16 May 2009 18:35:28 GMT (envelope-from ken@mthelicon.com) From: Pegasus Mc Cleaft Organization: Feathers To: svn-src-all@freebsd.org Date: Sat, 16 May 2009 18:35:25 +0000 User-Agent: KMail/1.11.2 (FreeBSD/8.0-CURRENT; KDE/4.2.3; amd64; ; ) References: <200905161048.n4GAmKRh057122@svn.freebsd.org> In-Reply-To: <200905161048.n4GAmKRh057122@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200905161835.26281.ken@mthelicon.com> Cc: svn-src-head@freebsd.org, Doug Rabson , src-committers@freebsd.org Subject: Re: svn commit: r192194 - in head/sys: boot/i386/zfsboot boot/zfs cddl/boot/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2009 18:35:30 -0000 On Saturday 16 May 2009 10:48:20 Doug Rabson wrote: > Author: dfr > Date: Sat May 16 10:48:20 2009 > New Revision: 192194 > URL: http://svn.freebsd.org/changeset/base/192194 > > Log: > Add support for booting from raidz1 and raidz2 pools. > > Modified: > head/sys/boot/i386/zfsboot/zfsboot.c > head/sys/boot/zfs/zfsimpl.c > head/sys/cddl/boot/zfs/README > head/sys/cddl/boot/zfs/zfsimpl.h > head/sys/cddl/boot/zfs/zfssubr.c > I think there may be a bug when you boot the machine from a drive that is a member of a zfs-mirror and you have raidz pools elsewhere. On reboot, I would get message saying there was no bootable kernel and dropped me down to the "OK" prompt. At that point, lsdev would show all the pools (both zfs-mirror and zraid's) and "ls" would return an error saying there were to many open files. I was able to work around the problem by pulling all the drives in the zraid pool into single user, attach all the drives and use atacontrol attach to bring them online before going to multi-user and hitting /etc/rc.d/zfs start. The only thing I haven't tried, and may be the key to the problem is reloading the boot-strap on the bootable drives. Would that make any difference? Peg From owner-svn-src-head@FreeBSD.ORG Sat May 16 18:42:18 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BCD16106566C; Sat, 16 May 2009 18:42:18 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 918F98FC1E; Sat, 16 May 2009 18:42:18 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4GIgIQo066614; Sat, 16 May 2009 18:42:18 GMT (envelope-from dchagin@svn.freebsd.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4GIgIbY066612; Sat, 16 May 2009 18:42:18 GMT (envelope-from dchagin@svn.freebsd.org) Message-Id: <200905161842.n4GIgIbY066612@svn.freebsd.org> From: Dmitry Chagin Date: Sat, 16 May 2009 18:42:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192203 - head/sys/compat/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2009 18:42:19 -0000 Author: dchagin Date: Sat May 16 18:42:18 2009 New Revision: 192203 URL: http://svn.freebsd.org/changeset/base/192203 Log: Emulate SO_PEERCRED socket option. Temporarily use 0 for pid member as the FreeBSD does not cache remote UNIX domain socket peer pid. PR: kern/102956 Reviewed by: rwatson Approved by: kib (mentor) MFC after: 1 month Modified: head/sys/compat/linux/linux_socket.c head/sys/compat/linux/linux_socket.h Modified: head/sys/compat/linux/linux_socket.c ============================================================================== --- head/sys/compat/linux/linux_socket.c Sat May 16 18:08:28 2009 (r192202) +++ head/sys/compat/linux/linux_socket.c Sat May 16 18:42:18 2009 (r192203) @@ -1354,7 +1354,9 @@ linux_getsockopt(struct thread *td, stru } */ bsd_args; l_timeval linux_tv; struct timeval tv; - socklen_t tv_len; + socklen_t tv_len, xulen; + struct xucred xu; + struct l_ucred lxu; int error, name; bsd_args.s = args->s; @@ -1377,6 +1379,23 @@ linux_getsockopt(struct thread *td, stru sizeof(linux_tv))); /* NOTREACHED */ break; + case LOCAL_PEERCRED: + if (args->optlen != sizeof(lxu)) + return (EINVAL); + xulen = sizeof(xu); + error = kern_getsockopt(td, args->s, bsd_args.level, + name, &xu, UIO_SYSSPACE, &xulen); + if (error) + return (error); + /* + * XXX Use 0 for pid as the FreeBSD does not cache peer pid. + */ + lxu.pid = 0; + lxu.uid = xu.cr_uid; + lxu.gid = xu.cr_gid; + return (copyout(&lxu, PTRIN(args->optval), sizeof(lxu))); + /* NOTREACHED */ + break; default: break; } Modified: head/sys/compat/linux/linux_socket.h ============================================================================== --- head/sys/compat/linux/linux_socket.h Sat May 16 18:08:28 2009 (r192202) +++ head/sys/compat/linux/linux_socket.h Sat May 16 18:42:18 2009 (r192203) @@ -90,4 +90,10 @@ #define LINUX_AF_APPLETALK 5 #define LINUX_AF_INET6 10 +struct l_ucred { + uint32_t pid; + uint32_t uid; + uint32_t gid; +}; + #endif /* _LINUX_SOCKET_H_ */ From owner-svn-src-head@FreeBSD.ORG Sat May 16 18:44:56 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DAD02106566C; Sat, 16 May 2009 18:44:56 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CA00A8FC1E; Sat, 16 May 2009 18:44:56 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4GIiuwW066711; Sat, 16 May 2009 18:44:56 GMT (envelope-from dchagin@svn.freebsd.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4GIiu4X066710; Sat, 16 May 2009 18:44:56 GMT (envelope-from dchagin@svn.freebsd.org) Message-Id: <200905161844.n4GIiu4X066710@svn.freebsd.org> From: Dmitry Chagin Date: Sat, 16 May 2009 18:44:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192204 - head/sys/compat/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2009 18:44:57 -0000 Author: dchagin Date: Sat May 16 18:44:56 2009 New Revision: 192204 URL: http://svn.freebsd.org/changeset/base/192204 Log: Use the protocol family constants for the domain argument validation. Return immediately when the socket() failed. Approved by: kib (mentor) MFC after: 1 month Modified: head/sys/compat/linux/linux_socket.c Modified: head/sys/compat/linux/linux_socket.c ============================================================================== --- head/sys/compat/linux/linux_socket.c Sat May 16 18:42:18 2009 (r192203) +++ head/sys/compat/linux/linux_socket.c Sat May 16 18:44:56 2009 (r192204) @@ -602,10 +602,12 @@ linux_socket(struct thread *td, struct l return (EAFNOSUPPORT); retval_socket = socket(td, &bsd_args); + if (retval_socket) + return (retval_socket); + if (bsd_args.type == SOCK_RAW && (bsd_args.protocol == IPPROTO_RAW || bsd_args.protocol == 0) - && bsd_args.domain == AF_INET - && retval_socket >= 0) { + && bsd_args.domain == PF_INET) { /* It's a raw IP socket: set the IP_HDRINCL option. */ int hdrincl; @@ -620,7 +622,7 @@ linux_socket(struct thread *td, struct l * default and some apps depend on this. So, set V6ONLY to 0 * for Linux apps if the sysctl value is set to 1. */ - if (bsd_args.domain == PF_INET6 && retval_socket >= 0 + if (bsd_args.domain == PF_INET6 #ifndef KLD_MODULE /* * XXX: Avoid undefined symbol error with an IPv4 only From owner-svn-src-head@FreeBSD.ORG Sat May 16 18:46:52 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2FD76106566C; Sat, 16 May 2009 18:46:52 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1F1B58FC17; Sat, 16 May 2009 18:46:52 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4GIkqk7066786; Sat, 16 May 2009 18:46:52 GMT (envelope-from dchagin@svn.freebsd.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4GIkpdZ066784; Sat, 16 May 2009 18:46:51 GMT (envelope-from dchagin@svn.freebsd.org) Message-Id: <200905161846.n4GIkpdZ066784@svn.freebsd.org> From: Dmitry Chagin Date: Sat, 16 May 2009 18:46:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192205 - head/sys/compat/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2009 18:46:52 -0000 Author: dchagin Date: Sat May 16 18:46:51 2009 New Revision: 192205 URL: http://svn.freebsd.org/changeset/base/192205 Log: Return EINVAL in case when the incorrect or unsupported type argument is specified. Do not map type argument value as its Linux values are identical to FreeBSD values. Approved by: kib (mentor) Modified: head/sys/compat/linux/linux_socket.c head/sys/compat/linux/linux_socket.h Modified: head/sys/compat/linux/linux_socket.c ============================================================================== --- head/sys/compat/linux/linux_socket.c Sat May 16 18:44:56 2009 (r192204) +++ head/sys/compat/linux/linux_socket.c Sat May 16 18:46:51 2009 (r192205) @@ -597,6 +597,8 @@ linux_socket(struct thread *td, struct l bsd_args.protocol = args->protocol; bsd_args.type = args->type; + if (bsd_args.type < 0 || bsd_args.type > LINUX_SOCK_MAX) + return (EINVAL); bsd_args.domain = linux_to_bsd_domain(args->domain); if (bsd_args.domain == -1) return (EAFNOSUPPORT); Modified: head/sys/compat/linux/linux_socket.h ============================================================================== --- head/sys/compat/linux/linux_socket.h Sat May 16 18:44:56 2009 (r192204) +++ head/sys/compat/linux/linux_socket.h Sat May 16 18:46:51 2009 (r192205) @@ -90,6 +90,16 @@ #define LINUX_AF_APPLETALK 5 #define LINUX_AF_INET6 10 +/* Supported socket types */ + +#define LINUX_SOCK_STREAM 1 +#define LINUX_SOCK_DGRAM 2 +#define LINUX_SOCK_RAW 3 +#define LINUX_SOCK_RDM 4 +#define LINUX_SOCK_SEQPACKET 5 + +#define LINUX_SOCK_MAX LINUX_SOCK_SEQPACKET + struct l_ucred { uint32_t pid; uint32_t uid; From owner-svn-src-head@FreeBSD.ORG Sat May 16 18:47:48 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8C4931065670; Sat, 16 May 2009 18:47:48 +0000 (UTC) (envelope-from dfr@rabson.org) Received: from itchy.rabson.org (router.rabson.org [80.177.232.241]) by mx1.freebsd.org (Postfix) with ESMTP id 3E3028FC0C; Sat, 16 May 2009 18:47:47 +0000 (UTC) (envelope-from dfr@rabson.org) Received: from [IPv6:2001:470:909f:1:225:ff:feed:9426] (unknown [IPv6:2001:470:909f:1:225:ff:feed:9426]) by itchy.rabson.org (Postfix) with ESMTP id 9EA4E5C39; Sat, 16 May 2009 19:48:09 +0100 (BST) Message-Id: <6971FF74-A53E-4354-A7F5-9139A5F8E5D9@rabson.org> From: Doug Rabson To: Pegasus Mc Cleaft In-Reply-To: <200905161835.26281.ken@mthelicon.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.4) Date: Sat, 16 May 2009 19:47:16 +0100 References: <200905161048.n4GAmKRh057122@svn.freebsd.org> <200905161835.26281.ken@mthelicon.com> X-Mailer: Apple Mail (2.930.4) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Doug Rabson Subject: Re: svn commit: r192194 - in head/sys: boot/i386/zfsboot boot/zfs cddl/boot/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2009 18:47:49 -0000 On 16 May 2009, at 19:35, Pegasus Mc Cleaft wrote: > On Saturday 16 May 2009 10:48:20 Doug Rabson wrote: >> Author: dfr >> Date: Sat May 16 10:48:20 2009 >> New Revision: 192194 >> URL: http://svn.freebsd.org/changeset/base/192194 >> >> Log: >> Add support for booting from raidz1 and raidz2 pools. >> >> Modified: >> head/sys/boot/i386/zfsboot/zfsboot.c >> head/sys/boot/zfs/zfsimpl.c >> head/sys/cddl/boot/zfs/README >> head/sys/cddl/boot/zfs/zfsimpl.h >> head/sys/cddl/boot/zfs/zfssubr.c >> > I think there may be a bug when you boot the machine from a drive > that is a > member of a zfs-mirror and you have raidz pools elsewhere. > > On reboot, I would get message saying there was no bootable kernel > and > dropped me down to the "OK" prompt. At that point, lsdev would show > all the > pools (both zfs-mirror and zraid's) and "ls" would return an error > saying > there were to many open files. > > I was able to work around the problem by pulling all the drives in > the zraid > pool into single user, attach all the drives and use atacontrol > attach to > bring them online before going to multi-user and hitting /etc/rc.d/ > zfs start. > > The only thing I haven't tried, and may be the key to the problem is > reloading the boot-strap on the bootable drives. Would that make any > difference? I'm not sure but it can't hurt. The part of the bootstrap that runs before /boot/loader (e.g. gptzfsboot) also has access to all the pools in the system (at least the ones where the drives are visible to the BIOS). It should figure out which pool contains the drive that was actually booted and load /boot/loader from that. It should also pass the identity of that pool down to /boot/loader so that the process continues with the correct pool. From owner-svn-src-head@FreeBSD.ORG Sat May 16 18:48:42 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 70CF0106567F; Sat, 16 May 2009 18:48:42 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5EFD68FC1E; Sat, 16 May 2009 18:48:42 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4GImgXl066858; Sat, 16 May 2009 18:48:42 GMT (envelope-from dchagin@svn.freebsd.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4GImgKJ066854; Sat, 16 May 2009 18:48:42 GMT (envelope-from dchagin@svn.freebsd.org) Message-Id: <200905161848.n4GImgKJ066854@svn.freebsd.org> From: Dmitry Chagin Date: Sat, 16 May 2009 18:48:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192206 - in head/sys: amd64/linux32 compat/linux i386/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2009 18:48:43 -0000 Author: dchagin Date: Sat May 16 18:48:41 2009 New Revision: 192206 URL: http://svn.freebsd.org/changeset/base/192206 Log: Somewhere between 2.6.23 and 2.6.27, Linux added SOCK_CLOEXEC and SOCK_NONBLOCK flags, that allow to save fcntl() calls. Implement a variation of the socket() syscall which takes a flags in addition to the type argument. Approved by: kib (mentor) MFC after: 1 month Modified: head/sys/amd64/linux32/linux.h head/sys/compat/linux/linux_socket.c head/sys/compat/linux/linux_socket.h head/sys/i386/linux/linux.h Modified: head/sys/amd64/linux32/linux.h ============================================================================== --- head/sys/amd64/linux32/linux.h Sat May 16 18:46:51 2009 (r192205) +++ head/sys/amd64/linux32/linux.h Sat May 16 18:48:41 2009 (r192206) @@ -571,6 +571,7 @@ int linux_ioctl_unregister_handler(struc #define LINUX_O_DIRECTORY 00200000 /* Must be a directory */ #define LINUX_O_NOFOLLOW 00400000 /* Do not follow links */ #define LINUX_O_NOATIME 01000000 +#define LINUX_O_CLOEXEC 02000000 #define LINUX_F_DUPFD 0 #define LINUX_F_GETFD 1 Modified: head/sys/compat/linux/linux_socket.c ============================================================================== --- head/sys/compat/linux/linux_socket.c Sat May 16 18:46:51 2009 (r192205) +++ head/sys/compat/linux/linux_socket.c Sat May 16 18:48:41 2009 (r192206) @@ -593,10 +593,13 @@ linux_socket(struct thread *td, struct l int type; int protocol; } */ bsd_args; - int retval_socket; + int retval_socket, socket_flags; bsd_args.protocol = args->protocol; - bsd_args.type = args->type; + socket_flags = args->type & ~LINUX_SOCK_TYPE_MASK; + if (socket_flags & ~(LINUX_SOCK_CLOEXEC | LINUX_SOCK_NONBLOCK)) + return (EINVAL); + bsd_args.type = args->type & LINUX_SOCK_TYPE_MASK; if (bsd_args.type < 0 || bsd_args.type > LINUX_SOCK_MAX) return (EINVAL); bsd_args.domain = linux_to_bsd_domain(args->domain); @@ -607,6 +610,23 @@ linux_socket(struct thread *td, struct l if (retval_socket) return (retval_socket); + if (socket_flags & LINUX_SOCK_NONBLOCK) { + retval_socket = kern_fcntl(td, td->td_retval[0], + F_SETFL, O_NONBLOCK); + if (retval_socket) { + (void)kern_close(td, td->td_retval[0]); + goto out; + } + } + if (socket_flags & LINUX_SOCK_CLOEXEC) { + retval_socket = kern_fcntl(td, td->td_retval[0], + F_SETFD, FD_CLOEXEC); + if (retval_socket) { + (void)kern_close(td, td->td_retval[0]); + goto out; + } + } + if (bsd_args.type == SOCK_RAW && (bsd_args.protocol == IPPROTO_RAW || bsd_args.protocol == 0) && bsd_args.domain == PF_INET) { @@ -642,6 +662,7 @@ linux_socket(struct thread *td, struct l } #endif +out: return (retval_socket); } Modified: head/sys/compat/linux/linux_socket.h ============================================================================== --- head/sys/compat/linux/linux_socket.h Sat May 16 18:46:51 2009 (r192205) +++ head/sys/compat/linux/linux_socket.h Sat May 16 18:48:41 2009 (r192206) @@ -100,6 +100,13 @@ #define LINUX_SOCK_MAX LINUX_SOCK_SEQPACKET +#define LINUX_SOCK_TYPE_MASK 0xf + +/* Flags for socket, socketpair, accept4 */ + +#define LINUX_SOCK_CLOEXEC LINUX_O_CLOEXEC +#define LINUX_SOCK_NONBLOCK LINUX_O_NONBLOCK + struct l_ucred { uint32_t pid; uint32_t uid; Modified: head/sys/i386/linux/linux.h ============================================================================== --- head/sys/i386/linux/linux.h Sat May 16 18:46:51 2009 (r192205) +++ head/sys/i386/linux/linux.h Sat May 16 18:48:41 2009 (r192206) @@ -547,6 +547,7 @@ int linux_ioctl_unregister_handler(struc #define LINUX_O_DIRECTORY 00200000 /* Must be a directory */ #define LINUX_O_NOFOLLOW 00400000 /* Do not follow links */ #define LINUX_O_NOATIME 01000000 +#define LINUX_O_CLOEXEC 02000000 #define LINUX_F_DUPFD 0 #define LINUX_F_GETFD 1 From owner-svn-src-head@FreeBSD.ORG Sat May 16 19:01:11 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B2E711065672 for ; Sat, 16 May 2009 19:01:11 +0000 (UTC) (envelope-from alc@cs.rice.edu) Received: from mail.cs.rice.edu (mail.cs.rice.edu [128.42.1.31]) by mx1.freebsd.org (Postfix) with ESMTP id 7F8BF8FC18 for ; Sat, 16 May 2009 19:01:11 +0000 (UTC) (envelope-from alc@cs.rice.edu) Received: from mail.cs.rice.edu (localhost.localdomain [127.0.0.1]) by mail.cs.rice.edu (Postfix) with ESMTP id F1DDA2C2A81; Sat, 16 May 2009 13:39:33 -0500 (CDT) X-Virus-Scanned: by amavis-2.4.0 at mail.cs.rice.edu Received: from mail.cs.rice.edu ([127.0.0.1]) by mail.cs.rice.edu (mail.cs.rice.edu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id KEjew2GLRVkG; Sat, 16 May 2009 13:39:26 -0500 (CDT) Received: from adsl-216-63-78-18.dsl.hstntx.swbell.net (adsl-216-63-78-18.dsl.hstntx.swbell.net [216.63.78.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.cs.rice.edu (Postfix) with ESMTP id 2A1072C2A7E; Sat, 16 May 2009 13:39:26 -0500 (CDT) Message-ID: <4A0F085D.6000202@cs.rice.edu> Date: Sat, 16 May 2009 13:39:25 -0500 From: Alan Cox User-Agent: Thunderbird 2.0.0.21 (X11/20090404) MIME-Version: 1.0 To: John Baldwin References: <200905131753.n4DHr4YL063065@svn.freebsd.org> In-Reply-To: <200905131753.n4DHr4YL063065@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r192050 - in head/sys: amd64/amd64 amd64/include conf i386/i386 i386/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2009 19:01:11 -0000 John Baldwin wrote: > Author: jhb > Date: Wed May 13 17:53:04 2009 > New Revision: 192050 > URL: http://svn.freebsd.org/changeset/base/192050 > > Log: > Implement simple machine check support for amd64 and i386. > - For CPUs that only support MCE (the machine check exception) but not MCA > (i.e. Pentium), all this does is print out the value of the machine check > registers and then panic when a machine check exception occurs. > - For CPUs that support MCA (the machine check architecture), the support is > a bit more involved. > - First, there is limited support for decoding the CPU-independent MCA > error codes in the kernel, and the kernel uses this to output a short > description of any machine check events that occur. > - When a machine check exception occurs, all of the MCx banks on the > current CPU are scanned and any events are reported to the console > before panic'ing. > - To catch events for correctable errors, a periodic timer kicks off a > task which scans the MCx banks on all CPUs. The frequency of these > checks is controlled via the "hw.mca.interval" sysctl. > - Userland can request an immediate scan of the MCx banks by writing > a non-zero value to "hw.mca.force_scan". > - If any correctable events are encountered, the appropriate details > are stored in a 'struct mca_record' (defined in ). > The "hw.mca.count" is a count of such records and each record may > be queried via the "hw.mca.records" tree by specifying the record > index (0 .. count - 1) as the next name in the MIB similar to using > PIDs with the kern.proc.* sysctls. The idea is to export machine > check events to userland for more detailed processing. > - The periodic timer and hw.mca sysctls are only present if the CPU > supports MCA. > > Discussed with: emaste (briefly) > MFC after: 1 month > > Added: > head/sys/amd64/amd64/mca.c (contents, props changed) > head/sys/amd64/include/mca.h (contents, props changed) > head/sys/i386/i386/mca.c (contents, props changed) > head/sys/i386/include/mca.h (contents, props changed) > Modified: > head/sys/amd64/amd64/machdep.c > head/sys/amd64/amd64/mp_machdep.c > head/sys/amd64/amd64/trap.c > head/sys/amd64/include/specialreg.h > head/sys/conf/files.amd64 > head/sys/conf/files.i386 > head/sys/i386/i386/machdep.c > head/sys/i386/i386/mp_machdep.c > head/sys/i386/i386/trap.c > head/sys/i386/include/specialreg.h > After this change my Phenom II locks up hard within minutes of booting. There are no messages, and I am unable to break into the debugger from a serial console. The same exact kernel is running fine on a Core 2 Quad. Regards, Alan From owner-svn-src-head@FreeBSD.ORG Sat May 16 19:17:15 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F00FB106566C; Sat, 16 May 2009 19:17:15 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DEA048FC18; Sat, 16 May 2009 19:17:15 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4GJHFc2067444; Sat, 16 May 2009 19:17:15 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4GJHFrQ067441; Sat, 16 May 2009 19:17:15 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905161917.n4GJHFrQ067441@svn.freebsd.org> From: Kip Macy Date: Sat, 16 May 2009 19:17:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192207 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2009 19:17:16 -0000 Author: kmacy Date: Sat May 16 19:17:15 2009 New Revision: 192207 URL: http://svn.freebsd.org/changeset/base/192207 Log: apply band-aid to x86_64 systems with more physical memory than kmem by allocating from the direct map Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c head/sys/vm/vm_contig.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat May 16 18:48:41 2009 (r192206) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat May 16 19:17:15 2009 (r192207) @@ -172,6 +172,7 @@ uint64_t zfs_arc_max; uint64_t zfs_arc_min; uint64_t zfs_arc_meta_limit = 0; int zfs_mdcomp_disable = 0; +int arc_large_memory_enabled = 0; TUNABLE_QUAD("vfs.zfs.arc_max", &zfs_arc_max); TUNABLE_QUAD("vfs.zfs.arc_min", &zfs_arc_min); @@ -3429,17 +3430,13 @@ arc_init(void) arc_min_prefetch_lifespan = 1 * hz; /* Start out with 1/8 of all memory */ +#if defined(_KERNEL) && (__amd64__) + arc_c = physmem*PAGE_SIZE / 8; + if (physmem*PAGE_SIZE > kmem_size()) + arc_large_memory_enabled = 1; +#else arc_c = kmem_size() / 8; -#if 0 -#ifdef _KERNEL - /* - * On architectures where the physical memory can be larger - * than the addressable space (intel in 32-bit mode), we may - * need to limit the cache to 1/8 of VM size. - */ - arc_c = MIN(arc_c, vmem_size(heap_arena, VMEM_ALLOC | VMEM_FREE) / 8); -#endif -#endif +#endif /* set min cache to 1/32 of all memory, or 16MB, whichever is more */ arc_c_min = MAX(arc_c / 4, 64<<18); /* set max to 1/2 of all memory, or all but 1GB, whichever is more */ @@ -3453,8 +3450,13 @@ arc_init(void) * Allow the tunables to override our calculations if they are * reasonable (ie. over 16MB) */ +#if defined(_KERNEL) && defined(__amd64__) + if (zfs_arc_max >= 64<<18) + arc_c_max = zfs_arc_max; +#else if (zfs_arc_max >= 64<<18 && zfs_arc_max < kmem_size()) arc_c_max = zfs_arc_max; +#endif if (zfs_arc_min >= 64<<18 && zfs_arc_min <= arc_c_max) arc_c_min = zfs_arc_min; #endif Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Sat May 16 18:48:41 2009 (r192206) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Sat May 16 19:17:15 2009 (r192207) @@ -33,6 +33,9 @@ #include #include +#if defined(_KERNEL) && defined(__amd64__) +#include +#endif /* * ========================================================================== * I/O priority table @@ -85,6 +88,8 @@ extern vmem_t *zio_alloc_arena; #define IO_IS_ALLOCATING(zio) \ ((zio)->io_orig_pipeline & (1U << ZIO_STAGE_DVA_ALLOCATE)) +extern int arc_large_memory_enabled; + void zio_init(void) { @@ -205,6 +210,80 @@ zio_buf_alloc(size_t size) #endif } +#if defined(_KERNEL) && defined(__amd64__) +extern int vm_contig_launder(int queue); + +static void * +zio_large_malloc(size_t size) +{ + void *ret; + vm_page_t pages; + unsigned long npgs; + int actl, actmax, inactl, inactmax, tries; + int flags = M_WAITOK; + vm_paddr_t low = (1UL<<29); /* leave lower 512MB untouched */ + vm_paddr_t high = ~(vm_paddr_t)0; + unsigned long alignment = 1; + unsigned long boundary = 0; + + npgs = round_page(size) >> PAGE_SHIFT; + tries = 0; +retry: + pages = vm_phys_alloc_contig(npgs, low, high, alignment, boundary); + if (pages == NULL) { + if (tries < ((flags & M_NOWAIT) != 0 ? 1 : 3)) { + vm_page_lock_queues(); + inactl = 0; + inactmax = tries < 1 ? 0 : cnt.v_inactive_count; + actl = 0; + actmax = tries < 2 ? 0 : cnt.v_active_count; +again: + if (inactl < inactmax && + vm_contig_launder(PQ_INACTIVE)) { + inactl++; + goto again; + } + if (actl < actmax && + vm_contig_launder(PQ_ACTIVE)) { + actl++; + goto again; + } + vm_page_unlock_queues(); + tries++; + goto retry; + } + + ret = NULL; + } else { + int i; + + vm_page_lock_queues(); + for (i = 0; i < npgs; i++) + vm_page_wire(&pages[i]); + vm_page_unlock_queues(); + + return (void *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(pages)); + } + return (ret); +} + +static void +zio_large_free(void *buf, size_t size) +{ + int npgs = round_page(size) >> PAGE_SHIFT; + int i; + vm_page_t m; + + m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)buf)); + vm_page_lock_queues(); + for (i = 0; i < npgs; i++, m++) { + vm_page_unwire(m, 0); + vm_page_free(m); + } + vm_page_unlock_queues(); +} +#endif + /* * Use zio_data_buf_alloc to allocate data. The data will not appear in a * crashdump if the kernel panics. This exists so that we will limit the amount @@ -221,7 +300,12 @@ zio_data_buf_alloc(size_t size) return (kmem_cache_alloc(zio_data_buf_cache[c], KM_PUSHPAGE)); #else - return (kmem_alloc(size, KM_SLEEP)); +#if defined(_KERNEL) && defined(__amd64__) + if (arc_large_memory_enabled && (size > PAGE_SIZE)) + return (zio_large_malloc(size)); + else +#endif + return (kmem_alloc(size, KM_SLEEP)); #endif } @@ -249,7 +333,12 @@ zio_data_buf_free(void *buf, size_t size kmem_cache_free(zio_data_buf_cache[c], buf); #else - kmem_free(buf, size); +#if defined (_KERNEL) && defined(__amd64__) + if (arc_large_memory_enabled && (size > PAGE_SIZE)) + zio_large_free(buf, size); + else +#endif + kmem_free(buf, size); #endif } Modified: head/sys/vm/vm_contig.c ============================================================================== --- head/sys/vm/vm_contig.c Sat May 16 18:48:41 2009 (r192206) +++ head/sys/vm/vm_contig.c Sat May 16 19:17:15 2009 (r192207) @@ -87,6 +87,11 @@ __FBSDID("$FreeBSD$"); #include #include +/* + * Only available as a band-aid to ZFS + */ +int vm_contig_launder(int queue); + static int vm_contig_launder_page(vm_page_t m, vm_page_t *next) { @@ -146,7 +151,7 @@ vm_contig_launder_page(vm_page_t m, vm_p return (0); } -static int +int vm_contig_launder(int queue) { vm_page_t m, next; From owner-svn-src-head@FreeBSD.ORG Sat May 16 20:09:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B4571065714; Sat, 16 May 2009 20:09:07 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 99BFE8FC18; Sat, 16 May 2009 20:09:07 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4GK97fW001057; Sat, 16 May 2009 20:09:07 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4GK972k001056; Sat, 16 May 2009 20:09:07 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905162009.n4GK972k001056@svn.freebsd.org> From: Kip Macy Date: Sat, 16 May 2009 20:09:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192209 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2009 20:09:08 -0000 Author: kmacy Date: Sat May 16 20:09:07 2009 New Revision: 192209 URL: http://svn.freebsd.org/changeset/base/192209 Log: only use direct map if system has more than 2GB Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat May 16 19:18:13 2009 (r192208) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat May 16 20:09:07 2009 (r192209) @@ -3432,7 +3432,7 @@ arc_init(void) /* Start out with 1/8 of all memory */ #if defined(_KERNEL) && (__amd64__) arc_c = physmem*PAGE_SIZE / 8; - if (physmem*PAGE_SIZE > kmem_size()) + if (physmem*PAGE_SIZE > kmem_size() && (physmem > (1UL<<31))) arc_large_memory_enabled = 1; #else arc_c = kmem_size() / 8; From owner-svn-src-head@FreeBSD.ORG Sat May 16 20:26:01 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C95D106566C; Sat, 16 May 2009 20:26:01 +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 6D4188FC12; Sat, 16 May 2009 20:26:01 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4GKQ1VF001470; Sat, 16 May 2009 20:26:01 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4GKQ1WB001469; Sat, 16 May 2009 20:26:01 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200905162026.n4GKQ1WB001469@svn.freebsd.org> From: Doug Barton Date: Sat, 16 May 2009 20:26:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192210 - head/etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2009 20:26:01 -0000 Author: dougb Date: Sat May 16 20:26:01 2009 New Revision: 192210 URL: http://svn.freebsd.org/changeset/base/192210 Log: Trim trailing whitespace from the end of a line Modified: head/etc/rc.d/named Modified: head/etc/rc.d/named ============================================================================== --- head/etc/rc.d/named Sat May 16 20:09:07 2009 (r192209) +++ head/etc/rc.d/named Sat May 16 20:26:01 2009 (r192210) @@ -79,7 +79,7 @@ chroot_autoupdate() fi fi - # Copy and/or update key files to the chroot /etc + # Copy and/or update key files to the chroot /etc # for file in localtime protocols services; do if [ -r /etc/$file ]; then From owner-svn-src-head@FreeBSD.ORG Sat May 16 20:31:29 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 740FF106566B; Sat, 16 May 2009 20:31:29 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 2D81C8FC12; Sat, 16 May 2009 20:31:29 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id n4GKUmUu087606; Sat, 16 May 2009 14:30:48 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Sat, 16 May 2009 14:30:59 -0600 (MDT) Message-Id: <20090516.143059.154578167.imp@bsdimp.com> To: ivoras@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <9bbcef730905151538w1d1dbd45oc44004115d6b5d66@mail.gmail.com> References: <200905142153.n4ELrZPE003481@svn.freebsd.org> <9bbcef730905151538w1d1dbd45oc44004115d6b5d66@mail.gmail.com> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, jhb@FreeBSD.org Subject: Re: svn commit: r192122 - in head/sys: amd64/conf i386/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2009 20:31:29 -0000 In message: <9bbcef730905151538w1d1dbd45oc44004115d6b5d66@mail.gmail.co= m> Ivan Voras writes: : 2009/5/14 John Baldwin : : > Author: jhb : > Date: Thu May 14 21:53:35 2009 : > New Revision: 192122 : > URL: http://svn.freebsd.org/changeset/base/192122 : > : > Log: : > =A0Trim the default set of device hints on i386 and amd64: : > =A0- Remove vga0 and the disabled uart2/uart3 hints from both platf= orms. : > =A0- Remove hints for ISA adv0, bt0, aha0, aic0, ed0, cs0, sn0, ie0= , fe0, and : > =A0 =A0le0 from i386. =A0All these hints were marked 'disabled' and= thus already : > =A0 =A0did not work "out of the box". : = : > -hint.le.0.at=3D"isa" : > -hint.le.0.disabled=3D"1" : > -hint.le.0.port=3D"0x280" : > -hint.le.0.irq=3D"10" : > -hint.le.0.drq=3D"0" : = : Heh, this will again change the behaviour under virtualization hosts : that emulate this hardware. Sometime before 7.0 the addition of this : hint caused all leX devices to be renamed le(X+1) because le0 was : taken and disabled. Restoring this will cause the same thing in : reverse. Unless someone actually has this hardware (as opposed to its= : emulation) and needs the hint for something, I'd suggest these : particular lines be removed before 8.0 to restore the original : behaviour quickly. Obviously, they cannot be MFC-ed to 7-STABLE Generically, this has been the case since: r61640 | peter | 2000-06-13 16:28:50 -0600 (Tue, 13 Jun 2000) | 47 line= s Warner From owner-svn-src-head@FreeBSD.ORG Sat May 16 20:33:14 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 072DC106564A; Sat, 16 May 2009 20:33:14 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EB1DB8FC14; Sat, 16 May 2009 20:33:13 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4GKXDAJ001703; Sat, 16 May 2009 20:33:13 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4GKXDpI001702; Sat, 16 May 2009 20:33:13 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905162033.n4GKXDpI001702@svn.freebsd.org> From: Kip Macy Date: Sat, 16 May 2009 20:33:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192211 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2009 20:33:14 -0000 Author: kmacy Date: Sat May 16 20:33:13 2009 New Revision: 192211 URL: http://svn.freebsd.org/changeset/base/192211 Log: - allow forced unmounts - don't assume snapshot was auto-mounted Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sat May 16 20:26:01 2009 (r192210) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sat May 16 20:33:13 2009 (r192211) @@ -967,8 +967,7 @@ zfs_umount(vfs_t *vfsp, int fflag) if (fflag & MS_FORCE) { /* TODO: Force unmount is not well implemented yet, so deny it. */ - ZFS_LOG(0, "Force unmount is not supported, removing FORCE flag."); - fflag &= ~MS_FORCE; + ZFS_LOG(0, "Force unmount is experimental - report any problems."); } ret = secpolicy_fs_unmount(cr, vfsp); @@ -1070,8 +1069,9 @@ zfs_umount(vfs_t *vfsp, int fflag) if (zfsvfs->z_issnap) { vnode_t *svp = vfsp->mnt_vnodecovered; - ASSERT(svp->v_count == 2); - VN_RELE(svp); + ASSERT(svp->v_count == 2 || svp->v_count == 1); + if (svp->v_count == 2) + VN_RELE(svp); } zfs_freevfs(vfsp); From owner-svn-src-head@FreeBSD.ORG Sat May 16 20:55:29 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 016F3106566B; Sat, 16 May 2009 20:55:29 +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 E48628FC17; Sat, 16 May 2009 20:55:28 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4GKtSQk002320; Sat, 16 May 2009 20:55:28 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4GKtSIM002316; Sat, 16 May 2009 20:55:28 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200905162055.n4GKtSIM002316@svn.freebsd.org> From: Doug Barton Date: Sat, 16 May 2009 20:55:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192215 - in head: etc/defaults etc/namedb etc/rc.d share/man/man5 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2009 20:55:29 -0000 Author: dougb Date: Sat May 16 20:55:28 2009 New Revision: 192215 URL: http://svn.freebsd.org/changeset/base/192215 Log: 1. New feature; option to have the script loop until a specified hostname (localhost by default) can be successfully looked up. Off by default. 2. New feature: option to create a forwarder configuration file based on the contents of /etc/resolv.conf. This allows you to utilize a local resolver for better performance, less network traffic, custom zones, etc. while still relying on the benefits of your local network resolver. Off by default. 3. Add named-checkconf into the startup routine. This will prevent named from trying to start in a situation where it would not be possible to do so. Modified: head/etc/defaults/rc.conf head/etc/namedb/named.conf head/etc/rc.d/named head/share/man/man5/rc.conf.5 Modified: head/etc/defaults/rc.conf ============================================================================== --- head/etc/defaults/rc.conf Sat May 16 20:51:28 2009 (r192214) +++ head/etc/defaults/rc.conf Sat May 16 20:55:28 2009 (r192215) @@ -247,6 +247,7 @@ inetd_flags="-wW -C 60" # Optional flag # named_enable="NO" # Run named, the DNS server (or NO). named_program="/usr/sbin/named" # Path to named, if you want a different one. +named_conf="/etc/namedb/named.conf" # Path to the configuration file #named_flags="-c /etc/namedb/named.conf" # Uncomment for named not in /usr/sbin named_pidfile="/var/run/named/pid" # Must set this in named.conf as well named_uid="bind" # User to run named as @@ -254,6 +255,10 @@ named_chrootdir="/var/named" # Chroot di named_chroot_autoupdate="YES" # Automatically install/update chrooted # components of named. See /etc/rc.d/named. named_symlink_enable="YES" # Symlink the chrooted pid file +named_wait="NO" # Wait for working name service before exiting +named_wait_host="localhost" # Hostname to check if named_wait is enabled +named_auto_forward="NO" # Set up forwarders from /etc/resolv.conf +named_auto_forward_only="NO" # Do "forward only" instead of "forward first" # # kerberos. Do not run the admin daemons on slave servers Modified: head/etc/namedb/named.conf ============================================================================== --- head/etc/namedb/named.conf Sat May 16 20:51:28 2009 (r192214) +++ head/etc/namedb/named.conf Sat May 16 20:55:28 2009 (r192215) @@ -31,12 +31,6 @@ options { disable-empty-zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6.ARPA"; disable-empty-zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6.ARPA"; -// In addition to the "forwarders" clause, you can force your name -// server to never initiate queries of its own, but always ask its -// forwarders only, by enabling the following line: -// -// forward only; - // If you've got a DNS server around at your upstream provider, enter // its IP address here, and enable the line below. This will make you // benefit from its cache, thus reduce overall DNS traffic in the Internet. @@ -45,6 +39,20 @@ options { 127.0.0.1; }; */ + +// If the 'forwarders' clause is not empty the default is to 'forward first' +// which will fall back to sending a query from your local server if the name +// servers in 'forwarders' do not have the answer. Alternatively you can +// force your name server to never initiate queries of its own by enabling the +// following line: +// forward only; + +// If you wish to have forwarding configured automatically based on +// the entries in /etc/resolv.conf, uncomment the following line and +// set named_auto_forward=yes in /etc/rc.conf. You can also enable +// named_auto_forward_only (the effect of which is described above). +// include "/etc/namedb/auto_forward.conf"; + /* Modern versions of BIND use a random UDP port for each outgoing query by default in order to dramatically reduce the possibility Modified: head/etc/rc.d/named ============================================================================== --- head/etc/rc.d/named Sat May 16 20:51:28 2009 (r192214) +++ head/etc/rc.d/named Sat May 16 20:55:28 2009 (r192215) @@ -16,7 +16,7 @@ command="/usr/sbin/named" extra_commands="reload" start_precmd="named_precmd" -start_postcmd="make_symlinks" +start_postcmd="named_poststart" reload_cmd="named_reload" stop_cmd="named_stop" stop_postcmd="named_poststop" @@ -97,6 +97,17 @@ make_symlinks() ln -fs "${named_chrootdir}${pidfile}" ${pidfile} } +named_poststart () { + make_symlinks + + if checkyesno named_wait; then + until ${command%/sbin/named}/bin/host $named_wait_host >/dev/null 2>&1; do + echo " Waiting for nameserver to resolve $named_wait_host" + sleep 1 + done + fi +} + named_reload() { ${command%/named}/rndc reload @@ -135,8 +146,19 @@ named_poststop() fi } +create_file () { + if [ -e "$1" ]; then + unlink $1 + fi + > $1 + chown root:wheel $1 + chmod 644 $1 +} + named_precmd() { + local line nsip firstns + # Is the user using a sandbox? # if [ -n "$named_chrootdir" ]; then @@ -161,6 +183,80 @@ named_precmd() else $confgen_command fi + + # Create a forwarder configuration based on /etc/resolv.conf + if checkyesno named_auto_forward; then + if [ ! -s /etc/resolv.conf ]; then + warn "named_auto_forward enabled, but no /etc/resolv.conf" + + # Empty the file in case it is included in named.conf + [ -s "${named_chrootdir}/etc/namedb/auto_forward.conf" ] && + create_file ${named_chrootdir}/etc/namedb/auto_forward.conf + + ${command%/named}/named-checkconf $named_conf || + err 3 'named-checkconf for $named_conf failed' + return + fi + + create_file /var/run/naf-resolv.conf + create_file /var/run/auto_forward.conf + + echo ' forwarders {' > /var/run/auto_forward.conf + + while read line; do + case "$line" in + 'nameserver '*|'nameserver '*) + nsip=${line##nameserver[ ]} + + if [ -z "$firstns" ]; then + if [ ! "$nsip" = '127.0.0.1' ]; then + echo 'nameserver 127.0.0.1' + echo " ${nsip};" >> /var/run/auto_forward.conf + fi + + firstns=1 + else + [ "$nsip" = '127.0.0.1' ] && continue + echo " ${nsip};" >> /var/run/auto_forward.conf + fi + ;; + esac + + echo $line + done < /etc/resolv.conf > /var/run/naf-resolv.conf + + echo ' };' >> /var/run/auto_forward.conf + echo '' >> /var/run/auto_forward.conf + if checkyesno named_auto_forward_only; then + echo " forward only;" >> /var/run/auto_forward.conf + else + echo " forward first;" >> /var/run/auto_forward.conf + fi + + if cmp -s /etc/resolv.conf /var/run/naf-resolv.conf; then + unlink /var/run/naf-resolv.conf + else + [ -e /etc/resolv.conf ] && unlink /etc/resolv.conf + mv /var/run/naf-resolv.conf /etc/resolv.conf + fi + + if cmp -s ${named_chrootdir}/etc/namedb/auto_forward.conf \ + /var/run/auto_forward.conf; then + unlink /var/run/auto_forward.conf + else + [ -e "${named_chrootdir}/etc/namedb/auto_forward.conf" ] && + unlink ${named_chrootdir}/etc/namedb/auto_forward.conf + mv /var/run/auto_forward.conf \ + ${named_chrootdir}/etc/namedb/auto_forward.conf + fi + else + # Empty the file in case it is included in named.conf + [ -s "${named_chrootdir}/etc/namedb/auto_forward.conf" ] && + create_file ${named_chrootdir}/etc/namedb/auto_forward.conf + fi + + ${command%/named}/named-checkconf $named_conf || + err 3 'named-checkconf for $named_conf failed' } load_rc_config $name Modified: head/share/man/man5/rc.conf.5 ============================================================================== --- head/share/man/man5/rc.conf.5 Sat May 16 20:51:28 2009 (r192214) +++ head/share/man/man5/rc.conf.5 Sat May 16 20:55:28 2009 (r192215) @@ -1631,6 +1631,12 @@ Path to .Xr named 8 (default .Pa /usr/sbin/named ) . +.It Va named_conf +.Pq Vt str +Path to +.Xr named 8 +configuration file, (default +.Pa /etc/namedb/named.conf ) . .It Va named_flags .Pq Vt str If @@ -1678,6 +1684,26 @@ daemon's PID file into the .Xr chroot 8 environment. +.It Va named_wait +.Pq Vt bool +Set to have +.Pa /etc/rc.d/named +loop until working name service is established. +.It Va named_wait_host +.Pq Vt str +Name of host to lookup for the named_wait option. +(Default localhost) +.It Va named_auto_forward +.Pq Vt bool +Set to enable automatic creation of a forwarder +configuration file derived from +.Pa /etc/resolv.conf . +.It Va named_auto_forward_only +.Pq Vt bool +Set to change the default forwarder configuration from +.Dq forward first +to +.Dq forward only . .It Va kerberos5_server_enable .Pq Vt bool Set to From owner-svn-src-head@FreeBSD.ORG Sat May 16 20:57:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF64C106564A; Sat, 16 May 2009 20:57:08 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E029C8FC1A; Sat, 16 May 2009 20:57:08 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4GKv8qF002393; Sat, 16 May 2009 20:57:08 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4GKv8ek002392; Sat, 16 May 2009 20:57:08 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905162057.n4GKv8ek002392@svn.freebsd.org> From: Kip Macy Date: Sat, 16 May 2009 20:57:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192216 - head/sys/amd64/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2009 20:57:09 -0000 Author: kmacy Date: Sat May 16 20:57:08 2009 New Revision: 192216 URL: http://svn.freebsd.org/changeset/base/192216 Log: Increase default kernel map to 512GB I briefly discussed this with alc. It could lead to problems for greater than 64GB. However, that seems unlikely in practice. Modified: head/sys/amd64/include/vmparam.h Modified: head/sys/amd64/include/vmparam.h ============================================================================== --- head/sys/amd64/include/vmparam.h Sat May 16 20:55:28 2009 (r192215) +++ head/sys/amd64/include/vmparam.h Sat May 16 20:57:08 2009 (r192216) @@ -155,7 +155,7 @@ * 0xffff804020101000 - 0xfffffeffffffffff unused * 0xffffff0000000000 - 0xffffff7fffffffff 512GB direct map mappings * 0xffffff8000000000 - 0xfffffffe3fffffff unused (505GB) - * 0xfffffffe40000000 - 0xffffffffffffffff 7GB kernel map + * 0xfffffffe40000000 - 0xffffffffffffffff 512GB kernel map * * Within the kernel map: * @@ -163,7 +163,7 @@ */ #define VM_MAX_KERNEL_ADDRESS KVADDR(KPML4I, NPDPEPG-1, NPDEPG-1, NPTEPG-1) -#define VM_MIN_KERNEL_ADDRESS KVADDR(KPML4I, NPDPEPG-7, 0, 0) +#define VM_MIN_KERNEL_ADDRESS KVADDR(KPML4I, NPDPEPG-512, 0, 0) #define DMAP_MIN_ADDRESS KVADDR(DMPML4I, 0, 0, 0) #define DMAP_MAX_ADDRESS KVADDR(DMPML4I+1, 0, 0, 0) From owner-svn-src-head@FreeBSD.ORG Sat May 16 21:32:10 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0545C106564A; Sat, 16 May 2009 21:32:10 +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 E9E308FC1A; Sat, 16 May 2009 21:32:09 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4GLW9ET004552; Sat, 16 May 2009 21:32:09 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4GLW91H004551; Sat, 16 May 2009 21:32:09 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200905162132.n4GLW91H004551@svn.freebsd.org> From: Doug Barton Date: Sat, 16 May 2009 21:32:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192219 - head/usr.sbin/mergemaster X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2009 21:32:10 -0000 Author: dougb Date: Sat May 16 21:32:09 2009 New Revision: 192219 URL: http://svn.freebsd.org/changeset/base/192219 Log: Add -L to the mtree invocation to chase symbolic links that are present in "Service jails." Submitted by: Jeremie Le Hen Modified: head/usr.sbin/mergemaster/mergemaster.sh Modified: head/usr.sbin/mergemaster/mergemaster.sh ============================================================================== --- head/usr.sbin/mergemaster/mergemaster.sh Sat May 16 21:08:32 2009 (r192218) +++ head/usr.sbin/mergemaster/mergemaster.sh Sat May 16 21:32:09 2009 (r192219) @@ -461,7 +461,7 @@ MM_MAKE="make ${ARCHSTRING} -m ${SOURCED # CHANGED= if [ -n "${AUTO_UPGRADE}" -a -f "${DESTDIR}${MTREEFILE}" ]; then - for file in `mtree -eq -f ${DESTDIR}${MTREEFILE} -p ${DESTDIR}/ \ + for file in `mtree -eqL -f ${DESTDIR}${MTREEFILE} -p ${DESTDIR}/ \ 2>/dev/null | awk '($2 == "changed") {print $1}'`; do if [ -f "${DESTDIR}/$file" ]; then CHANGED="${CHANGED} ${DESTDIR}/$file" From owner-svn-src-head@FreeBSD.ORG Sat May 16 21:38:55 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 84CC11065672; Sat, 16 May 2009 21:38:55 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5A9208FC19; Sat, 16 May 2009 21:38:55 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4GLct50004723; Sat, 16 May 2009 21:38:55 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4GLct4l004722; Sat, 16 May 2009 21:38:55 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <200905162138.n4GLct4l004722@svn.freebsd.org> From: Christian Brueffer Date: Sat, 16 May 2009 21:38:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192220 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2009 21:38:55 -0000 Author: brueffer Date: Sat May 16 21:38:55 2009 New Revision: 192220 URL: http://svn.freebsd.org/changeset/base/192220 Log: Sync up to rev. 1.25 from OpenBSD: 1.19: nop 1.20: nop 1.21: nop 1.22: typo fixed 1.23: license clauses 3 and 4 nuked 1.24: nop 1.25: Sun Crypto Accelerator 1000 has a 5821 chip on it Obtained from: OpenBSD MFC after: 3 days Modified: head/share/man/man4/ubsec.4 Modified: head/share/man/man4/ubsec.4 ============================================================================== --- head/share/man/man4/ubsec.4 Sat May 16 21:32:09 2009 (r192219) +++ head/share/man/man4/ubsec.4 Sat May 16 21:38:55 2009 (r192220) @@ -1,4 +1,4 @@ -.\" $OpenBSD: ubsec.4,v 1.18 2002/09/26 07:55:41 miod Exp $ +.\" $OpenBSD: ubsec.4,v 1.25 2003/08/12 19:42:46 jason Exp $ .\" .\" Copyright (c) 2000 Jason L. Wright (jason@thought.net) .\" All rights reserved. @@ -11,11 +11,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 Jason L. Wright -.\" 4. The name of the author may not be used to endorse or promote products -.\" derived from this software without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED @@ -31,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 1, 2006 +.Dd May 16, 2009 .Dt UBSEC 4 .Os .Sh NAME @@ -84,7 +79,7 @@ driver supports cards containing any of .It Bluesteel 5501 The original chipset, no longer made. This extremely rare unit -was not very fast, lacked a RNG, and had a number of other bugs. +was not very fast, lacked an RNG, and had a number of other bugs. .It Bluesteel 5601 A faster and fixed version of the original, with a random number unit and large number engine added. @@ -98,6 +93,7 @@ Faster version of Bluesteel 5601. 64 bit version of the chip, and significantly more advanced. .It Broadcom BCM5821 Faster version of the BCM5820. +This is the chip found on the Sun Crypto Accelerator 1000. .It Broadcom BCM5822 Faster version of the BCM5820. .It Broadcom BCM5823 From owner-svn-src-head@FreeBSD.ORG Sat May 16 22:00:14 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36B75106566C; Sat, 16 May 2009 22:00:14 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 274F98FC0A; Sat, 16 May 2009 22:00:14 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4GM0ElY005300; Sat, 16 May 2009 22:00:14 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4GM0Eg2005299; Sat, 16 May 2009 22:00:14 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905162200.n4GM0Eg2005299@svn.freebsd.org> From: Kip Macy Date: Sat, 16 May 2009 22:00:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192224 - head/sys/amd64/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2009 22:00:14 -0000 Author: kmacy Date: Sat May 16 22:00:13 2009 New Revision: 192224 URL: http://svn.freebsd.org/changeset/base/192224 Log: update vm map comment pointed out by Larry Rosenman Modified: head/sys/amd64/include/vmparam.h Modified: head/sys/amd64/include/vmparam.h ============================================================================== --- head/sys/amd64/include/vmparam.h Sat May 16 21:59:31 2009 (r192223) +++ head/sys/amd64/include/vmparam.h Sat May 16 22:00:13 2009 (r192224) @@ -154,7 +154,6 @@ * 0xffff800000000000 - 0xffff804020100fff recursive page table (512GB slot) * 0xffff804020101000 - 0xfffffeffffffffff unused * 0xffffff0000000000 - 0xffffff7fffffffff 512GB direct map mappings - * 0xffffff8000000000 - 0xfffffffe3fffffff unused (505GB) * 0xfffffffe40000000 - 0xffffffffffffffff 512GB kernel map * * Within the kernel map: From owner-svn-src-head@FreeBSD.ORG Sat May 16 22:08:01 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B3BB1065704; Sat, 16 May 2009 22:08:01 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0BB5E8FC12; Sat, 16 May 2009 22:08:01 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4GM80A3005560; Sat, 16 May 2009 22:08:00 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4GM80Dm005559; Sat, 16 May 2009 22:08:00 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905162208.n4GM80Dm005559@svn.freebsd.org> From: Kip Macy Date: Sat, 16 May 2009 22:08:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192227 - head/sys/amd64/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2009 22:08:01 -0000 Author: kmacy Date: Sat May 16 22:08:00 2009 New Revision: 192227 URL: http://svn.freebsd.org/changeset/base/192227 Log: correct range in comment pointed out by alc Modified: head/sys/amd64/include/vmparam.h Modified: head/sys/amd64/include/vmparam.h ============================================================================== --- head/sys/amd64/include/vmparam.h Sat May 16 22:07:41 2009 (r192226) +++ head/sys/amd64/include/vmparam.h Sat May 16 22:08:00 2009 (r192227) @@ -154,7 +154,7 @@ * 0xffff800000000000 - 0xffff804020100fff recursive page table (512GB slot) * 0xffff804020101000 - 0xfffffeffffffffff unused * 0xffffff0000000000 - 0xffffff7fffffffff 512GB direct map mappings - * 0xfffffffe40000000 - 0xffffffffffffffff 512GB kernel map + * 0xffffff8000000000 - 0xffffffffffffffff 512GB kernel map * * Within the kernel map: * From owner-svn-src-head@FreeBSD.ORG Sat May 16 22:18:59 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4990E106566C; Sat, 16 May 2009 22:18:59 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 39BD88FC17; Sat, 16 May 2009 22:18:59 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4GMIxEw005797; Sat, 16 May 2009 22:18:59 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4GMIxLM005796; Sat, 16 May 2009 22:18:59 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <200905162218.n4GMIxLM005796@svn.freebsd.org> From: Christian Brueffer Date: Sat, 16 May 2009 22:18:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192228 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2009 22:18:59 -0000 Author: brueffer Date: Sat May 16 22:18:58 2009 New Revision: 192228 URL: http://svn.freebsd.org/changeset/base/192228 Log: Drop clause 3 of the license as per rev. 1.35 from OpenBSD. Obtained from: OpenBSD MFC after: 3 days Modified: head/share/man/man4/hifn.4 Modified: head/share/man/man4/hifn.4 ============================================================================== --- head/share/man/man4/hifn.4 Sat May 16 22:08:00 2009 (r192227) +++ head/share/man/man4/hifn.4 Sat May 16 22:18:58 2009 (r192228) @@ -11,8 +11,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. The name of the author may not be used to endorse or promote products -.\" derived from this software without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED From owner-svn-src-head@FreeBSD.ORG Sat May 16 22:22:31 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E5CCD106566B; Sat, 16 May 2009 22:22:31 +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 D58958FC12; Sat, 16 May 2009 22:22:31 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4GMMV6D005950; Sat, 16 May 2009 22:22:31 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4GMMVhP005949; Sat, 16 May 2009 22:22:31 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200905162222.n4GMMVhP005949@svn.freebsd.org> From: Doug Barton Date: Sat, 16 May 2009 22:22:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192230 - head/usr.sbin/mergemaster X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2009 22:22:32 -0000 Author: dougb Date: Sat May 16 22:22:31 2009 New Revision: 192230 URL: http://svn.freebsd.org/changeset/base/192230 Log: Enhance the safety of the -U option: 1. In several places make sure that the mtree database is not empty using the -s argument to test instead of -f. (I thought I'd already changed this, but obviously not.) 2. When deriving the list of changed files use a colon-delimited list. 3. If the list of changed files is empty, unset the variable, and test for a non-empty CHANGED in diff_loop() before entering that routine. Enhance the speed of the -U option by using an internal case statement instead of echoing the variable to an external grep for every file. Fix indentation on one line. Modified: head/usr.sbin/mergemaster/mergemaster.sh Modified: head/usr.sbin/mergemaster/mergemaster.sh ============================================================================== --- head/usr.sbin/mergemaster/mergemaster.sh Sat May 16 22:20:42 2009 (r192229) +++ head/usr.sbin/mergemaster/mergemaster.sh Sat May 16 22:22:31 2009 (r192230) @@ -115,8 +115,10 @@ diff_loop () { while [ "${HANDLE_COMPFILE}" = "v" -o "${HANDLE_COMPFILE}" = "V" -o \ "${HANDLE_COMPFILE}" = "NOT V" ]; do if [ -f "${DESTDIR}${COMPFILE#.}" -a -f "${COMPFILE}" ]; then - if [ -n "${AUTO_UPGRADE}" ]; then - if echo "${CHANGED}" | grep -qsv ${DESTDIR}${COMPFILE#.}; then + if [ -n "${AUTO_UPGRADE}" -a -n "${CHANGED}" ]; then + case "${CHANGED}" in + *:${DESTDIR}${COMPFILE#.}:*) ;; # File has been modified + *) echo '' echo " *** ${COMPFILE} has not been user modified." echo '' @@ -128,10 +130,11 @@ diff_loop () { AUTO_UPGRADED_FILES="${AUTO_UPGRADED_FILES} ${DESTDIR}${COMPFILE#.} " else - echo " *** Problem upgrading ${COMPFILE}, it will remain to merge by hand" + echo " *** Problem upgrading ${COMPFILE}, it will remain to merge by hand" fi return - fi + ;; + esac fi if [ "${HANDLE_COMPFILE}" = "v" -o "${HANDLE_COMPFILE}" = "V" ]; then echo '' @@ -348,7 +351,7 @@ fi case "${AUTO_UPGRADE}" in '') ;; # If the option is not set no need to run the test or warn the user *) - if [ ! -f "${DESTDIR}${MTREEFILE}" ]; then + if [ ! -s "${DESTDIR}${MTREEFILE}" ]; then echo '' echo "*** Unable to find mtree database. Skipping auto-upgrade." echo '' @@ -459,14 +462,15 @@ MM_MAKE="make ${ARCHSTRING} -m ${SOURCED # Check DESTDIR against the mergemaster mtree database to see what # files the user changed from the reference files. # -CHANGED= -if [ -n "${AUTO_UPGRADE}" -a -f "${DESTDIR}${MTREEFILE}" ]; then +if [ -n "${AUTO_UPGRADE}" -a -s "${DESTDIR}${MTREEFILE}" ]; then + CHANGED=: for file in `mtree -eqL -f ${DESTDIR}${MTREEFILE} -p ${DESTDIR}/ \ 2>/dev/null | awk '($2 == "changed") {print $1}'`; do if [ -f "${DESTDIR}/$file" ]; then - CHANGED="${CHANGED} ${DESTDIR}/$file" + CHANGED="${CHANGED}${DESTDIR}/${file}:" fi done + [ "$CHANGED" = ':' ] && unset CHANGED fi # Check the width of the user's terminal @@ -1055,7 +1059,7 @@ done # This is for the for way up there echo '' echo "*** Comparison complete" -if [ -f "${MTREENEW}" ]; then +if [ -s "${MTREENEW}" ]; then echo "*** Saving mtree database for future upgrades" test -e "${DESTDIR}${MTREEFILE}" && unlink ${DESTDIR}${MTREEFILE} mv ${MTREENEW} ${DESTDIR}${MTREEFILE} From owner-svn-src-head@FreeBSD.ORG Sat May 16 22:31:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 564F6106566B; Sat, 16 May 2009 22:31:38 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 465F78FC14; Sat, 16 May 2009 22:31:38 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4GMVcAo006163; Sat, 16 May 2009 22:31:38 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4GMVcpL006162; Sat, 16 May 2009 22:31:38 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200905162231.n4GMVcpL006162@svn.freebsd.org> From: Rick Macklem Date: Sat, 16 May 2009 22:31:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192231 - head/sys/fs/nfsclient X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2009 22:31:38 -0000 Author: rmacklem Date: Sat May 16 22:31:38 2009 New Revision: 192231 URL: http://svn.freebsd.org/changeset/base/192231 Log: Changed sys/fs/nfs_clbio.c in the same way Alan Cox changed sys/nfsclient/nfs_bio.c for r192134, so that the sources stay in sync. Approved by: kib (mentor) Modified: head/sys/fs/nfsclient/nfs_clbio.c Modified: head/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clbio.c Sat May 16 22:22:31 2009 (r192230) +++ head/sys/fs/nfsclient/nfs_clbio.c Sat May 16 22:31:38 2009 (r192231) @@ -313,9 +313,9 @@ ncl_getpages(struct vop_getpages_args *a * Read operation filled a partial page. */ m->valid = 0; - vm_page_set_validclean(m, 0, size - toff); - /* handled by vm_fault now */ - /* vm_page_zero_invalid(m, TRUE); */ + vm_page_set_valid(m, 0, size - toff); + KASSERT((m->dirty & vm_page_bits(0, size - toff)) == 0, + ("nfs_getpages: page %p is dirty", m)); } else { /* * Read operation was short. If no error occured From owner-svn-src-head@FreeBSD.ORG Sat May 16 23:56:45 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9105106564A; Sat, 16 May 2009 23:56:45 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A18088FC08; Sat, 16 May 2009 23:56:45 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4GNujrT007967; Sat, 16 May 2009 23:56:45 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4GNujDB007965; Sat, 16 May 2009 23:56:45 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905162356.n4GNujDB007965@svn.freebsd.org> From: Kip Macy Date: Sat, 16 May 2009 23:56:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192234 - head/sys/cddl/compat/opensolaris/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2009 23:56:46 -0000 Author: kmacy Date: Sat May 16 23:56:45 2009 New Revision: 192234 URL: http://svn.freebsd.org/changeset/base/192234 Log: enable adaptive spinning on zfs locks Modified: head/sys/cddl/compat/opensolaris/sys/mutex.h head/sys/cddl/compat/opensolaris/sys/rwlock.h Modified: head/sys/cddl/compat/opensolaris/sys/mutex.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/mutex.h Sat May 16 23:33:07 2009 (r192233) +++ head/sys/cddl/compat/opensolaris/sys/mutex.h Sat May 16 23:56:45 2009 (r192234) @@ -47,9 +47,9 @@ typedef enum { typedef struct sx kmutex_t; #ifndef DEBUG -#define MUTEX_FLAGS (SX_DUPOK | SX_NOWITNESS) +#define MUTEX_FLAGS (SX_DUPOK | SX_NOWITNESS | SX_ADAPTIVESPIN) #else -#define MUTEX_FLAGS (SX_DUPOK) +#define MUTEX_FLAGS (SX_DUPOK | SX_ADAPTIVESPIN) #endif #define mutex_init(lock, desc, type, arg) do { \ Modified: head/sys/cddl/compat/opensolaris/sys/rwlock.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/rwlock.h Sat May 16 23:33:07 2009 (r192233) +++ head/sys/cddl/compat/opensolaris/sys/rwlock.h Sat May 16 23:56:45 2009 (r192234) @@ -49,9 +49,9 @@ typedef enum { typedef struct sx krwlock_t; #ifndef DEBUG -#define RW_FLAGS (SX_DUPOK | SX_NOWITNESS) +#define RW_FLAGS (SX_DUPOK | SX_NOWITNESS | SX_ADAPTIVESPIN) #else -#define RW_FLAGS (SX_DUPOK) +#define RW_FLAGS (SX_DUPOK | SX_ADAPTIVESPIN) #endif #define RW_READ_HELD(x) (rw_read_held((x)))