summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.inc123
-rw-r--r--bin/ed/POSIX4
-rw-r--r--bin/pax/ar_io.c18
-rw-r--r--bin/pax/ar_subs.c4
-rw-r--r--bin/pax/buf_subs.c28
-rw-r--r--bin/pax/cpio.c8
-rw-r--r--bin/pax/file_subs.c16
-rw-r--r--bin/pax/ftree.c4
-rw-r--r--bin/pax/options.c2
-rw-r--r--bin/pax/pat_rep.c2
-rw-r--r--bin/pax/pax.c2
-rw-r--r--bin/pax/sel_subs.c2
-rw-r--r--bin/pax/tables.c6
-rw-r--r--bin/pax/tar.c2
-rw-r--r--bin/ps/ps.14
-rw-r--r--bin/ps/ps.c2
-rw-r--r--bin/sh/cd.c25
-rw-r--r--bin/sh/eval.c15
-rw-r--r--bin/sh/main.c11
-rw-r--r--bin/sh/miscbltin.c4
-rw-r--r--bin/sh/mkinit.c2
-rw-r--r--bin/sh/mktokens1
-rw-r--r--bin/sh/parser.c30
-rw-r--r--bin/sh/parser.h1
-rw-r--r--bin/sh/sh.117
-rw-r--r--bin/sh/var.c11
-rw-r--r--contrib/binutils/binutils/objcopy.c3
-rw-r--r--contrib/binutils/binutils/readelf.c2
-rw-r--r--contrib/binutils/binutils/strings.c6
-rw-r--r--contrib/binutils/gas/read.h2
-rw-r--r--contrib/binutils/gas/write.c4
-rw-r--r--contrib/binutils/ld/ldlang.c9
-rw-r--r--contrib/gcc/combine.c2
-rw-r--r--contrib/gcc/emit-rtl.c11
-rw-r--r--contrib/gcc/function.c13
-rw-r--r--contrib/gcc/genattrtab.c2
-rw-r--r--contrib/gcc/genautomata.c26
-rw-r--r--contrib/gcc/gengtype-lex.l2
-rw-r--r--contrib/gcc/genmodes.c4
-rw-r--r--contrib/gcc/omp-low.c2
-rw-r--r--contrib/gcc/tree-cfg.c4
-rw-r--r--contrib/gcc/tree-vect-patterns.c2
-rw-r--r--contrib/gcclibs/libiberty/regex.c2
-rw-r--r--contrib/gperf/src/gen-perf.cc2
-rw-r--r--contrib/gperf/src/key-list.cc48
-rw-r--r--contrib/gperf/src/options.cc2
-rw-r--r--contrib/groff/src/devices/grohtml/post-html.cpp2
-rw-r--r--contrib/groff/src/libs/libdriver/input.cpp2
-rw-r--r--contrib/groff/src/roff/troff/mtsm.cpp6
-rw-r--r--contrib/groff/src/roff/troff/node.cpp2
-rw-r--r--contrib/groff/src/utils/hpftodit/hpftodit.cpp4
-rw-r--r--crypto/heimdal/lib/sl/slc-gram.y1
-rwxr-xr-xetc/rc.d/ipfilter2
-rwxr-xr-xetc/rc.d/pf2
-rw-r--r--games/fortune/datfiles/fortunes10
-rw-r--r--games/fortune/datfiles/fortunes-o.real4
-rw-r--r--games/fortune/datfiles/fortunes-o.sp.ok2
-rw-r--r--games/fortune/datfiles/fortunes.sp.ok51
-rw-r--r--games/fortune/datfiles/freebsd-tips.sp.ok1
-rw-r--r--games/fortune/datfiles/gerrold.limerick2
-rw-r--r--games/fortune/datfiles/limerick4
-rw-r--r--games/fortune/datfiles/limerick.sp.ok3
-rw-r--r--games/fortune/datfiles/startrek.sp.ok1
-rw-r--r--games/fortune/datfiles/zippy.sp.ok2
-rw-r--r--games/morse/morse.c40
-rw-r--r--gnu/usr.bin/Makefile6
-rw-r--r--lib/Makefile5
-rw-r--r--lib/clang/clang.build.mk2
-rw-r--r--lib/libc/sys/mq_setattr.24
-rw-r--r--lib/libpkg/Makefile47
-rw-r--r--lib/libpkg/pkgwrap.c90
-rw-r--r--lib/libprocstat/Makefile3
-rw-r--r--lib/libprocstat/Symbol.map16
-rw-r--r--lib/libprocstat/Versions.def5
-rw-r--r--lib/libprocstat/libprocstat.c3
-rw-r--r--lib/libsbuf/Makefile11
-rw-r--r--lib/libsbuf/Symbol.map24
-rw-r--r--lib/libsbuf/Version.def4
-rw-r--r--release/Makefile10
-rwxr-xr-xrelease/generate-release.sh1
-rw-r--r--sbin/atacontrol/atacontrol.82
-rw-r--r--sbin/atacontrol/atacontrol.c2
-rw-r--r--sbin/geom/class/part/geom_part.c99
-rw-r--r--sbin/hastctl/hastctl.c11
-rw-r--r--sbin/hastd/Makefile4
-rw-r--r--sbin/hastd/control.c17
-rw-r--r--sbin/hastd/hast.conf.533
-rw-r--r--sbin/hastd/hast.h38
-rw-r--r--sbin/hastd/hastd.c133
-rw-r--r--sbin/hastd/parse.y118
-rw-r--r--sbin/hastd/pjdlog.c33
-rw-r--r--sbin/hastd/primary.c11
-rw-r--r--sbin/hastd/proto_tcp.c (renamed from sbin/hastd/proto_tcp4.c)359
-rw-r--r--sbin/hastd/secondary.c15
-rw-r--r--sbin/hastd/subr.c8
-rw-r--r--sbin/hastd/token.l2
-rw-r--r--sbin/ifconfig/ifmedia.c6
-rw-r--r--sbin/ipfw/ipfw.84
-rw-r--r--sbin/mount_reiserfs/mount_reiserfs.82
-rw-r--r--sbin/mount_reiserfs/mount_reiserfs.c2
-rw-r--r--share/examples/diskless/README.TEMPLATING8
-rwxr-xr-xshare/examples/drivers/make_device_driver.sh2
-rw-r--r--share/examples/libvgl/demo.c23
-rw-r--r--share/examples/netgraph/ether.bridge2
-rw-r--r--share/examples/netgraph/frame_relay10
-rw-r--r--share/examples/netgraph/ngctl4
-rw-r--r--share/examples/netgraph/raw2
-rw-r--r--share/examples/netgraph/virtual.chain125
-rw-r--r--share/examples/netgraph/virtual.lan129
-rw-r--r--share/man/man4/ahci.420
-rw-r--r--share/man/man4/aio.42
-rw-r--r--share/man/man4/ata.42
-rw-r--r--share/man/man4/atkbd.47
-rw-r--r--share/man/man4/cc_hd.42
-rw-r--r--share/man/man4/coretemp.42
-rw-r--r--share/man/man4/geom_map.4130
-rw-r--r--share/man/man4/hpet.44
-rw-r--r--share/man/man4/ichwd.42
-rw-r--r--share/man/man4/man4.i386/Makefile1
-rw-r--r--share/man/man4/man4.i386/glxiic.4106
-rw-r--r--share/man/man4/msk.44
-rw-r--r--share/man/man4/pst.42
-rw-r--r--share/man/man4/ucycom.42
-rw-r--r--share/man/man4/xhci.49
-rw-r--r--share/man/man5/rc.conf.52
-rw-r--r--share/man/man5/reiserfs.52
-rw-r--r--share/man/man5/src.conf.532
-rw-r--r--share/man/man9/LOCK_PROFILING.92
-rw-r--r--share/man/man9/pseudofs.92
-rw-r--r--share/man/man9/sbuf.947
-rw-r--r--share/man/man9/zone.92
-rw-r--r--share/misc/bsd-family-tree2
-rw-r--r--share/misc/committers-src.dot4
-rw-r--r--share/misc/iso316635
-rw-r--r--share/mk/bsd.libnames.mk1
-rw-r--r--share/mk/bsd.own.mk5
-rw-r--r--sys/amd64/amd64/identcpu.c53
-rw-r--r--sys/amd64/include/specialreg.h13
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c6
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c8
-rw-r--r--sys/cddl/dev/cyclic/cyclic.c14
-rw-r--r--sys/cddl/dev/cyclic/i386/cyclic_machdep.c40
-rw-r--r--sys/conf/files.i3861
-rw-r--r--sys/conf/kern.mk7
-rw-r--r--sys/conf/kern.post.mk6
-rw-r--r--sys/conf/kmod.mk3
-rw-r--r--sys/conf/newvers.sh2
-rw-r--r--sys/dev/acpica/acpi_hpet.c2
-rw-r--r--sys/dev/acpica/acpi_timer.c2
-rw-r--r--sys/dev/ahci/ahci.c71
-rw-r--r--sys/dev/ahci/ahci.h12
-rw-r--r--sys/dev/alc/if_alcreg.h4
-rw-r--r--sys/dev/ale/if_alereg.h4
-rw-r--r--sys/dev/ath/ah_osdep.c6
-rw-r--r--sys/dev/ath/ath_hal/ah.c2
-rw-r--r--sys/dev/ath/ath_hal/ar5212/ar5212_misc.c2
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416_attach.c2
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416_cal.c2
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416_reset.c4
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c43
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416desc.h23
-rw-r--r--sys/dev/ath/ath_hal/ar9002/ar9280_attach.c2
-rw-r--r--sys/dev/ath/ath_rate/sample/sample.c34
-rw-r--r--sys/dev/ath/if_ath.c12
-rw-r--r--sys/dev/ath/if_ath_sysctl.c6
-rw-r--r--sys/dev/ath/if_athioctl.h17
-rw-r--r--sys/dev/atkbdc/atkbd.c3
-rw-r--r--sys/dev/atkbdc/atkbdreg.h1
-rw-r--r--sys/dev/bge/if_bge.c2
-rw-r--r--sys/dev/cfi/cfi_dev.c3
-rw-r--r--sys/dev/cxgbe/t4_main.c45
-rw-r--r--sys/dev/cxgbe/t4_sge.c37
-rw-r--r--sys/dev/gem/if_gem.c9
-rw-r--r--sys/dev/glxiic/glxiic.c1078
-rw-r--r--sys/dev/hwpmc/hwpmc_mod.c6
-rw-r--r--sys/dev/iwn/if_iwn.c10
-rw-r--r--sys/dev/mii/mii.c6
-rw-r--r--sys/dev/mk48txx/mk48txx.c4
-rw-r--r--sys/dev/mk48txx/mk48txxreg.h3
-rw-r--r--sys/dev/msk/if_msk.c170
-rw-r--r--sys/dev/msk/if_mskreg.h10
-rw-r--r--sys/dev/pci/pcireg.h1
-rw-r--r--sys/dev/puc/pucdata.c6
-rw-r--r--sys/dev/scc/scc_bfe_ebus.c3
-rw-r--r--sys/dev/sound/usb/uaudio.c7
-rw-r--r--sys/dev/uart/uart_cpu_sparc64.c3
-rw-r--r--sys/dev/usb/controller/xhci_pci.c2
-rw-r--r--sys/dev/usb/controller/xhcireg.h1
-rw-r--r--sys/dev/usb/input/uhid.c4
-rw-r--r--sys/dev/usb/input/ukbd.c4
-rw-r--r--sys/dev/usb/input/ums.c4
-rw-r--r--sys/dev/usb/storage/umass.c5
-rw-r--r--sys/dev/usb/storage/ustorage_fs.c6
-rw-r--r--sys/dev/usb/usb_device.c11
-rw-r--r--sys/dev/usb/usbdi.h1
-rw-r--r--sys/dev/vge/if_vge.c19
-rw-r--r--sys/fs/cd9660/cd9660_vfsops.c3
-rw-r--r--sys/fs/ext2fs/ext2_vfsops.c2
-rw-r--r--sys/fs/hpfs/hpfs_vfsops.c1
-rw-r--r--sys/fs/msdosfs/msdosfs_vfsops.c2
-rw-r--r--sys/fs/nfs/nfs_commonkrpc.c12
-rw-r--r--sys/fs/nfs/nfs_commonport.c10
-rw-r--r--sys/fs/nfsclient/nfs_clkrpc.c2
-rw-r--r--sys/fs/nfsclient/nfs_clnfsiod.c12
-rw-r--r--sys/fs/nfsclient/nfs_clsubs.c4
-rw-r--r--sys/fs/nfsclient/nfs_clvfsops.c46
-rw-r--r--sys/fs/nfsclient/nfs_clvnops.c19
-rw-r--r--sys/fs/nfsserver/nfs_nfsdport.c4
-rw-r--r--sys/fs/ntfs/ntfs_vfsops.c1
-rw-r--r--sys/fs/nullfs/null_vfsops.c6
-rw-r--r--sys/fs/tmpfs/tmpfs_vfsops.c6
-rw-r--r--sys/fs/udf/udf_vfsops.c2
-rw-r--r--sys/fs/unionfs/union_vfsops.c3
-rw-r--r--sys/geom/eli/g_eli_key_cache.c1
-rw-r--r--sys/geom/gate/g_gate.c3
-rw-r--r--sys/geom/part/g_part.c110
-rw-r--r--sys/geom/part/g_part_mbr.c3
-rw-r--r--sys/geom/part/g_part_pc98.c3
-rw-r--r--sys/gnu/fs/reiserfs/reiserfs_vfsops.c3
-rw-r--r--sys/gnu/fs/xfs/FreeBSD/support/kdb.c2
-rw-r--r--sys/gnu/fs/xfs/FreeBSD/xfs_mountops.c3
-rw-r--r--sys/i386/conf/NOTES6
-rw-r--r--sys/i386/i386/identcpu.c52
-rw-r--r--sys/i386/include/specialreg.h13
-rw-r--r--sys/i386/include/xen/xenvar.h1
-rw-r--r--sys/i386/xen/mp_machdep.c70
-rw-r--r--sys/kern/device_if.m20
-rw-r--r--sys/kern/kern_clocksource.c73
-rw-r--r--sys/kern/kern_conf.c3
-rw-r--r--sys/kern/kern_cpuset.c2
-rw-r--r--sys/kern/kern_environment.c8
-rw-r--r--sys/kern/kern_synch.c4
-rw-r--r--sys/kern/sched_4bsd.c40
-rw-r--r--sys/kern/subr_sbuf.c145
-rw-r--r--sys/kern/subr_smp.c110
-rw-r--r--sys/kern/vfs_bio.c2
-rw-r--r--sys/kern/vfs_default.c3
-rw-r--r--sys/kern/vfs_syscalls.c6
-rw-r--r--sys/mips/include/atomic.h61
-rw-r--r--sys/modules/Makefile2
-rw-r--r--sys/modules/glxiic/Makefile10
-rw-r--r--sys/modules/wlan/Makefile2
-rw-r--r--sys/net/if_epair.c41
-rw-r--r--sys/net/if_llatbl.c5
-rw-r--r--sys/net/if_llatbl.h5
-rw-r--r--sys/net/if_media.h25
-rw-r--r--sys/net/netisr.c282
-rw-r--r--sys/net/netisr.h19
-rw-r--r--sys/net/netisr_internal.h3
-rw-r--r--sys/net80211/ieee80211_var.h2
-rw-r--r--sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c9
-rw-r--r--sys/netgraph/ng_eiface.c71
-rw-r--r--sys/netinet/in.c40
-rw-r--r--sys/netinet/in_pcb.c186
-rw-r--r--sys/netinet/in_pcb.h63
-rw-r--r--sys/netinet/in_var.h2
-rw-r--r--sys/netinet/raw_ip.c9
-rw-r--r--sys/netinet/sctp_output.c48
-rw-r--r--sys/netinet/sctp_usrreq.c1
-rw-r--r--sys/netinet6/in6.c10
-rw-r--r--sys/netinet6/in6_pcb.c25
-rw-r--r--sys/netinet6/in6_src.c6
-rw-r--r--sys/nfs/nfs_common.c2
-rw-r--r--sys/nfsclient/nfs.h2
-rw-r--r--sys/nfsclient/nfs_krpc.c10
-rw-r--r--sys/nfsclient/nfs_nfsiod.c12
-rw-r--r--sys/nfsclient/nfs_subs.c4
-rw-r--r--sys/nfsclient/nfs_vfsops.c22
-rw-r--r--sys/nfsclient/nfs_vnops.c19
-rw-r--r--sys/nfsserver/nfs_srvsubs.c2
-rw-r--r--sys/nlm/nlm_prot_impl.c2
-rw-r--r--sys/powerpc/aim/mmu_oea64.c5
-rw-r--r--sys/powerpc/include/atomic.h520
-rw-r--r--sys/powerpc/powerpc/platform.c2
-rw-r--r--sys/powerpc/ps3/ps3bus.c34
-rw-r--r--sys/sparc64/sparc64/eeprom.c5
-rw-r--r--sys/sys/dtrace_bsd.h9
-rw-r--r--sys/sys/mount.h7
-rw-r--r--sys/sys/param.h2
-rw-r--r--sys/sys/proc.h28
-rw-r--r--sys/sys/sbuf.h12
-rw-r--r--sys/sys/smp.h5
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c5
-rw-r--r--sys/ufs/ufs/ufs_extern.h2
-rw-r--r--sys/ufs/ufs/ufs_vfsops.c5
-rw-r--r--sys/vm/uma_core.c23
-rw-r--r--sys/vm/uma_int.h8
-rw-r--r--tools/build/options/WITHOUT_BINUTILS7
-rw-r--r--tools/build/options/WITHOUT_GCC6
-rw-r--r--tools/build/options/WITHOUT_KERNEL_SYMBOLS5
-rw-r--r--tools/build/options/WITH_OFED4
-rw-r--r--tools/regression/bin/sh/builtins/cd3.021
-rw-r--r--tools/regression/bin/sh/builtins/cd4.038
-rw-r--r--tools/regression/bin/sh/builtins/dot4.012
-rw-r--r--tools/regression/bin/sh/parameters/positional1.013
-rw-r--r--tools/regression/bin/sh/parser/alias4.05
-rw-r--r--tools/regression/bin/sh/parser/alias5.05
-rw-r--r--tools/regression/bin/sh/parser/heredoc11.026
-rwxr-xr-xtools/tools/iso/check-iso3166.pl10
-rw-r--r--usr.bin/ar/acpyacc.y4
-rw-r--r--usr.bin/ar/ar.c2
-rw-r--r--usr.bin/ar/write.c10
-rw-r--r--usr.bin/gzip/Makefile2
-rw-r--r--usr.bin/gzip/gzip.18
-rw-r--r--usr.bin/gzip/gzip.c11
-rw-r--r--usr.bin/gzip/zdiff119
-rw-r--r--usr.bin/gzip/zdiff.159
-rw-r--r--usr.bin/gzip/zuncompress.c2
-rw-r--r--usr.bin/netstat/netisr.c65
-rw-r--r--usr.bin/nfsstat/nfsstat.c4
-rw-r--r--usr.bin/rpcgen/rpc_hout.c2
-rw-r--r--usr.bin/rpcgen/rpc_svcout.c2
-rw-r--r--usr.bin/rpcgen/rpc_tblout.c4
-rw-r--r--usr.bin/showmount/showmount.c2
-rw-r--r--usr.bin/top/machine.c1
-rw-r--r--usr.bin/truss/amd64-fbsd.c2
-rw-r--r--usr.bin/truss/amd64-fbsd32.c2
-rw-r--r--usr.bin/truss/i386-fbsd.c2
-rw-r--r--usr.bin/truss/ia64-fbsd.c2
-rw-r--r--usr.bin/truss/main.c2
-rw-r--r--usr.bin/truss/powerpc-fbsd.c2
-rw-r--r--usr.bin/truss/powerpc64-fbsd.c2
-rw-r--r--usr.bin/truss/sparc64-fbsd.c2
-rw-r--r--usr.sbin/ifmcstat/ifmcstat.84
-rw-r--r--usr.sbin/makefs/cd9660.c3
-rw-r--r--usr.sbin/makefs/cd9660.h1
-rw-r--r--usr.sbin/makefs/cd9660/cd9660_eltorito.c85
-rw-r--r--usr.sbin/makefs/makefs.83
-rw-r--r--usr.sbin/nfsd/nfsv4.446
-rwxr-xr-xusr.sbin/pc-sysinstall/backend/functions-disk.sh12
-rwxr-xr-xusr.sbin/pc-sysinstall/backend/functions-installcomponents.sh2
-rw-r--r--usr.sbin/pkg_install/Makefile4
-rw-r--r--usr.sbin/pkg_install/Makefile.inc13
-rw-r--r--usr.sbin/pkg_install/add/Makefile7
-rw-r--r--usr.sbin/pkg_install/add/extract.c2
-rw-r--r--usr.sbin/pkg_install/add/futil.c2
-rw-r--r--usr.sbin/pkg_install/add/main.c4
-rw-r--r--usr.sbin/pkg_install/add/perform.c2
-rw-r--r--usr.sbin/pkg_install/create/Makefile6
-rw-r--r--usr.sbin/pkg_install/create/main.c4
-rw-r--r--usr.sbin/pkg_install/create/perform.c2
-rw-r--r--usr.sbin/pkg_install/create/pl.c2
-rw-r--r--usr.sbin/pkg_install/delete/Makefile5
-rw-r--r--usr.sbin/pkg_install/delete/main.c4
-rw-r--r--usr.sbin/pkg_install/delete/perform.c2
-rw-r--r--usr.sbin/pkg_install/info/Makefile6
-rw-r--r--usr.sbin/pkg_install/info/info.h39
-rw-r--r--usr.sbin/pkg_install/info/main.c14
-rw-r--r--usr.sbin/pkg_install/info/perform.c2
-rw-r--r--usr.sbin/pkg_install/info/show.c2
-rw-r--r--usr.sbin/pkg_install/lib/Makefile11
-rw-r--r--usr.sbin/pkg_install/lib/deps.c (renamed from lib/libpkg/deps.c)2
-rw-r--r--usr.sbin/pkg_install/lib/exec.c (renamed from lib/libpkg/exec.c)2
-rw-r--r--usr.sbin/pkg_install/lib/file.c (renamed from lib/libpkg/file.c)2
-rw-r--r--usr.sbin/pkg_install/lib/global.c (renamed from lib/libpkg/global.c)2
-rw-r--r--usr.sbin/pkg_install/lib/lib.h (renamed from lib/libpkg/pkg.h)12
-rw-r--r--usr.sbin/pkg_install/lib/match.c (renamed from lib/libpkg/match.c)4
-rw-r--r--usr.sbin/pkg_install/lib/msg.c (renamed from lib/libpkg/msg.c)9
-rw-r--r--usr.sbin/pkg_install/lib/pen.c (renamed from lib/libpkg/pen.c)17
-rw-r--r--usr.sbin/pkg_install/lib/pkgwrap.c89
-rw-r--r--usr.sbin/pkg_install/lib/plist.c (renamed from lib/libpkg/plist.c)2
-rw-r--r--usr.sbin/pkg_install/lib/str.c (renamed from lib/libpkg/str.c)2
-rw-r--r--usr.sbin/pkg_install/lib/url.c (renamed from lib/libpkg/url.c)4
-rw-r--r--usr.sbin/pkg_install/lib/version.c (renamed from lib/libpkg/version.c)14
-rw-r--r--usr.sbin/pkg_install/updating/Makefile5
-rw-r--r--usr.sbin/pkg_install/updating/main.c4
-rw-r--r--usr.sbin/pkg_install/version/Makefile5
-rw-r--r--usr.sbin/pkg_install/version/main.c4
-rw-r--r--usr.sbin/pkg_install/version/perform.c2
-rw-r--r--usr.sbin/tzsetup/tzsetup.849
-rw-r--r--usr.sbin/tzsetup/tzsetup.c3
371 files changed, 5273 insertions, 2475 deletions
diff --git a/Makefile.inc1 b/Makefile.inc1
index 907cdce..9ebc1e3 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -1132,6 +1132,10 @@ _kgzip= usr.sbin/kgzip
.endif
.endif
+.if ${MK_BINUTILS} != "no"
+_binutils= gnu/usr.bin/binutils
+.endif
+
.if ${MK_CLANG} != "no"
.if ${CC:T:Mclang} == "clang"
_clang= usr.bin/clang
@@ -1139,12 +1143,16 @@ _clang_libs= lib/clang
.endif
.endif
+.if ${MK_GCC} != "no"
+_cc= gnu/usr.bin/cc
+.endif
+
cross-tools:
.for _tool in \
${_clang_libs} \
${_clang} \
- gnu/usr.bin/binutils \
- gnu/usr.bin/cc \
+ ${_binutils} \
+ ${_cc} \
usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
${_btxld} \
${_crunchide} \
@@ -1205,7 +1213,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} ${_kerberos5_lib_libheimntlm} \
${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
${_kerberos5_lib_libroken} \
lib/libbz2 lib/libcom_err lib/libcrypt \
- lib/libexpat lib/libfetch \
+ lib/libexpat \
${_lib_libgssapi} ${_lib_libipx} \
lib/libkiconv lib/libkvm lib/liblzma lib/libmd \
lib/ncurses/ncurses lib/ncurses/ncursesw \
@@ -1238,7 +1246,6 @@ _cddl_lib= cddl/lib
_secure_lib_libcrypto= secure/lib/libcrypto
_secure_lib_libssl= secure/lib/libssl
lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
-lib/libfetch__L: secure/lib/libcrypto__L secure/lib/libssl__L lib/libmd__L
.if ${MK_OPENSSH} != "no"
_secure_lib_libssh= secure/lib/libssh
secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
@@ -1274,7 +1281,7 @@ _lib_libypclnt= lib/libypclnt
.endif
.if ${MK_OPENSSL} == "no"
-lib/libfetch__L lib/libradius__L: lib/libmd__L
+lib/libradius__L: lib/libmd__L
.endif
.for _lib in ${_prereq_libs}
@@ -1553,7 +1560,8 @@ _xb-build-tools:
_xb-cross-tools:
.for _tool in \
gnu/usr.bin/binutils \
- gnu/usr.bin/cc
+ gnu/usr.bin/cc \
+ usr.bin/ar
${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \
cd ${.CURDIR}/${_tool}; \
${CDMAKE} DIRPRFX=${_tool}/ obj; \
@@ -1578,7 +1586,8 @@ _xi-cross-tools:
@echo "_xi-cross-tools"
.for _tool in \
gnu/usr.bin/binutils \
- gnu/usr.bin/cc
+ gnu/usr.bin/cc \
+ usr.bin/ar
${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \
cd ${.CURDIR}/${_tool}; \
${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR}
diff --git a/bin/ed/POSIX b/bin/ed/POSIX
index f81bb0c..dab1a2b 100644
--- a/bin/ed/POSIX
+++ b/bin/ed/POSIX
@@ -75,7 +75,7 @@ DEVIATIONS
2) Since the behavior of `u' (undo) within a `g' (global) command list is
not specified by POSIX, it follows the behavior of the SunOS ed:
undo forces a global command list to be executed only once, rather than
- for each line matching a global pattern. In addtion, each instance of
+ for each line matching a global pattern. In addition, each instance of
`u' within a global command undoes all previous commands (including
undo's) in the command list. This seems the best way, since the
alternatives are either too complicated to implement or too confusing
@@ -83,7 +83,7 @@ DEVIATIONS
The global/undo combination is useful for masking errors that
would otherwise cause a script to fail. For instance, an ed script
- to remove any occurences of either `censor1' or `censor2' might be
+ to remove any occurrences of either `censor1' or `censor2' might be
written as:
ed - file <<EOF
1g/.*/u\
diff --git a/bin/pax/ar_io.c b/bin/pax/ar_io.c
index 0946a88..c3b35a7 100644
--- a/bin/pax/ar_io.c
+++ b/bin/pax/ar_io.c
@@ -204,7 +204,7 @@ ar_open(const char *name)
/*
* set default blksz on read. APPNDs writes rdblksz on the last volume
* On all new archive volumes, we shift to wrblksz (if the user
- * specified one, otherwize we will continue to use rdblksz). We
+ * specified one, otherwise we will continue to use rdblksz). We
* must to set blocksize based on what kind of device the archive is
* stored.
*/
@@ -381,7 +381,7 @@ ar_close(void)
/*
* If we have not determined the format yet, we just say how many bytes
- * we have skipped over looking for a header to id. there is no way we
+ * we have skipped over looking for a header to id. There is no way we
* could have written anything yet.
*/
if (frmt == NULL) {
@@ -595,7 +595,7 @@ ar_read(char *buf, int cnt)
* Return:
* Number of bytes written. 0 indicates end of volume reached and with no
* flaws (as best that can be detected). A -1 indicates an unrecoverable
- * error in the archive occured.
+ * error in the archive occurred.
*/
int
@@ -679,7 +679,7 @@ ar_write(char *buf, int bsz)
* if this is a block aligned archive format, we may have a bad archive
* if the format wants the header to start at a BLKMULT boundary. While
* we can deal with the mis-aligned data, it violates spec and other
- * archive readers will likely fail. if the format is not block
+ * archive readers will likely fail. If the format is not block
* aligned, the user may be lucky (and the archive is ok).
*/
if (res >= 0) {
@@ -794,7 +794,7 @@ ar_rdsync(void)
/*
* ar_fow()
- * Move the I/O position within the archive foward the specified number of
+ * Move the I/O position within the archive forward the specified number of
* bytes as supported by the device. If we cannot move the requested
* number of bytes, return the actual number of bytes moved in skipped.
* Return:
@@ -813,7 +813,7 @@ ar_fow(off_t sksz, off_t *skipped)
return(0);
/*
- * we cannot move foward at EOF or error
+ * we cannot move forward at EOF or error
*/
if (lstrval <= 0)
return(lstrval);
@@ -822,7 +822,7 @@ ar_fow(off_t sksz, off_t *skipped)
* Safer to read forward on devices where it is hard to find the end of
* the media without reading to it. With tapes we cannot be sure of the
* number of physical blocks to skip (we do not know physical block
- * size at this point), so we must only read foward on tapes!
+ * size at this point), so we must only read forward on tapes!
*/
if (artyp != ISREG)
return(0);
@@ -907,7 +907,7 @@ ar_rev(off_t sksz)
/*
* we may try to go backwards past the start when the archive
- * is only a single record. If this hapens and we are on a
+ * is only a single record. If this happens and we are on a
* multi volume archive, we need to go to the end of the
* previous volume and continue our movement backwards from
* there.
@@ -1046,7 +1046,7 @@ get_phys(void)
}
/*
- * read foward to the file mark, then back up in front of the filemark
+ * read forward to the file mark, then back up in front of the filemark
* (this is a bit paranoid, but should be safe to do).
*/
while ((res = read(arfd, scbuf, sizeof(scbuf))) > 0)
diff --git a/bin/pax/ar_subs.c b/bin/pax/ar_subs.c
index da275c2d..bc808ab 100644
--- a/bin/pax/ar_subs.c
+++ b/bin/pax/ar_subs.c
@@ -854,7 +854,7 @@ copy(void)
}
/*
- * Non standard -Y and -Z flag. When the exisiting file is
+ * Non standard -Y and -Z flag. When the existing file is
* same age or newer skip
*/
if ((Yflag || Zflag) && ((lstat(arcn->name, &sb) == 0))) {
@@ -1096,7 +1096,7 @@ next_head(ARCHD *arcn)
}
/*
- * ok got a valid header, check for trailer if format encodes it in the
+ * ok got a valid header, check for trailer if format encodes it in
* the header.
*/
if (frmt->inhead && ((*frmt->trail_cpio)(arcn) == 0)) {
diff --git a/bin/pax/buf_subs.c b/bin/pax/buf_subs.c
index 1d01d4e..995e34c 100644
--- a/bin/pax/buf_subs.c
+++ b/bin/pax/buf_subs.c
@@ -145,7 +145,7 @@ rd_start(void)
}
if (wrblksz % BLKMULT) {
paxwarn(1, "Write block size %d is not a %d byte multiple",
- wrblksz, BLKMULT);
+ wrblksz, BLKMULT);
return(-1);
}
}
@@ -182,13 +182,13 @@ cp_start(void)
* the start of the header of the first file added to the archive. The
* format specific end read function tells us how many bytes to move
* backwards in the archive to be positioned BEFORE the trailer. Two
- * different postions have to be adjusted, the O.S. file offset (e.g. the
+ * different positions have to be adjusted, the O.S. file offset (e.g. the
* position of the tape head) and the write point within the data we have
* stored in the read (soon to become write) buffer. We may have to move
* back several records (the number depends on the size of the archive
* record and the size of the format trailer) to read up the record where
* the first byte of the trailer is recorded. Trailers may span (and
- * overlap) record boundries.
+ * overlap) record boundaries.
* We first calculate which record has the first byte of the trailer. We
* move the OS file offset back to the start of this record and read it
* up. We set the buffer write pointer to be at this byte (the byte where
@@ -196,10 +196,10 @@ cp_start(void)
* start of this record so a flush of this buffer will replace the record
* in the archive.
* A major problem is rewriting this last record. For archives stored
- * on disk files, this is trival. However, many devices are really picky
+ * on disk files, this is trivial. However, many devices are really picky
* about the conditions under which they will allow a write to occur.
* Often devices restrict the conditions where writes can be made writes,
- * so it may not be feasable to append archives stored on all types of
+ * so it may not be feasible to append archives stored on all types of
* devices.
* Return:
* 0 for success, -1 for failure
@@ -365,7 +365,7 @@ rd_sync(void)
* pback()
* push the data used during the archive id phase back into the I/O
* buffer. This is required as we cannot be sure that the header does NOT
- * overlap a block boundry (as in the case we are trying to recover a
+ * overlap a block boundary (as in the case we are trying to recover a
* flawed archived). This was not designed to be used for any other
* purpose. (What software engineering, HA!)
* WARNING: do not even THINK of pback greater than BLKMULT, unless the
@@ -382,7 +382,7 @@ pback(char *pt, int cnt)
/*
* rd_skip()
- * skip foward in the archive during an archive read. Used to get quickly
+ * skip forward in the archive during an archive read. Used to get quickly
* past file data and padding for files the user did NOT select.
* Return:
* 0 if ok, -1 failure, and 1 when EOF on the archive volume was detected.
@@ -396,7 +396,7 @@ rd_skip(off_t skcnt)
off_t skipped = 0;
/*
- * consume what data we have in the buffer. If we have to move foward
+ * consume what data we have in the buffer. If we have to move forward
* whole records, we call the low level skip function to see if we can
* move within the archive without doing the expensive reads on data we
* do not want.
@@ -453,7 +453,7 @@ rd_skip(off_t skcnt)
* wr_fin()
* flush out any data (and pad if required) the last block. We always pad
* with zero (even though we do not have to). Padding with 0 makes it a
- * lot easier to recover if the archive is damaged. zero paddding SHOULD
+ * lot easier to recover if the archive is damaged. zero padding SHOULD
* BE a requirement....
*/
@@ -530,7 +530,7 @@ rd_wrbuf(char *in, int cpcnt)
/*
* read error, return what we got (or the error if
* no data was copied). The caller must know that an
- * error occured and has the best knowledge what to
+ * error occurred and has the best knowledge what to
* do with it
*/
if ((res = cpcnt - incnt) > 0)
@@ -584,7 +584,7 @@ wr_skip(off_t skcnt)
/*
* wr_rdfile()
- * fill write buffer with the contents of a file. We are passed an open
+ * fill write buffer with the contents of a file. We are passed an open
* file descriptor to the file and the archive structure that describes the
* file we are storing. The variable "left" is modified to contain the
* number of bytes of the file we were NOT able to write to the archive.
@@ -671,7 +671,7 @@ rd_wrfile(ARCHD *arcn, int ofd, off_t *left)
int isem = 1;
int rem;
int sz = MINFBSZ;
- struct stat sb;
+ struct stat sb;
u_long crc = 0L;
/*
@@ -884,7 +884,7 @@ buf_flush(int bufcnt)
/*
* if we have reached the user specified byte count for each archive
- * volume, prompt for the next volume. (The non-standrad -R flag).
+ * volume, prompt for the next volume. (The non-standard -R flag).
* NOTE: If the wrlimit is smaller than wrcnt, we will always write
* at least one record. We always round limit UP to next blocksize.
*/
@@ -944,7 +944,7 @@ buf_flush(int bufcnt)
} else if (cnt > 0) {
/*
* Oh drat we got a partial write!
- * if format doesnt care about alignment let it go,
+ * if format doesn't care about alignment let it go,
* we warned the user in ar_write().... but this means
* the last record on this volume violates pax spec....
*/
diff --git a/bin/pax/cpio.c b/bin/pax/cpio.c
index 67602fa..0d9cc9f 100644
--- a/bin/pax/cpio.c
+++ b/bin/pax/cpio.c
@@ -627,7 +627,7 @@ vcpio_rd(ARCHD *arcn, char *buf)
return(-1);
/*
- * skip padding. header + filename is aligned to 4 byte boundries
+ * skip padding. header + filename is aligned to 4 byte boundaries
*/
if (rd_skip((off_t)(VCPIO_PAD(sizeof(HD_VCPIO) + nsz))) < 0)
return(-1);
@@ -942,7 +942,7 @@ bcpio_rd(ARCHD *arcn, char *buf)
return(-1);
/*
- * header + file name are aligned to 2 byte boundries, skip if needed
+ * header + file name are aligned to 2 byte boundaries, skip if needed
*/
if (rd_skip((off_t)(BCPIO_PAD(sizeof(HD_BCPIO) + nsz))) < 0)
return(-1);
@@ -989,8 +989,8 @@ bcpio_endrd(void)
* bcpio_wr()
* copy the data in the ARCHD to buffer in old binary cpio format
* There is a real chance of field overflow with this critter. So we
- * always check the conversion is ok. nobody in his their right mind
- * should write an achive in this format...
+ * always check that the conversion is ok. nobody in their right mind
+ * should write an archive in this format...
* Return
* 0 if file has data to be written after the header, 1 if file has NO
* data to write after the header, -1 if archive write failed
diff --git a/bin/pax/file_subs.c b/bin/pax/file_subs.c
index 0fad68e..5e4cce1 100644
--- a/bin/pax/file_subs.c
+++ b/bin/pax/file_subs.c
@@ -84,9 +84,9 @@ file_creat(ARCHD *arcn)
* works. We have to take special handling when the file does exist. To
* detect this, we use O_EXCL. For example when trying to create a
* file and a character device or fifo exists with the same name, we
- * can accidently open the device by mistake (or block waiting to open)
- * If we find that the open has failed, then figure spend the effort to
- * figure out why. This strategy was found to have better average
+ * can accidentally open the device by mistake (or block waiting to
+ * open). If we find that the open has failed, then spend the effort
+ * to figure out why. This strategy was found to have better average
* performance in common use than checking the file (and the path)
* first with lstat.
*/
@@ -559,7 +559,7 @@ chk_path( char *name, uid_t st_uid, gid_t st_gid)
for(;;) {
/*
- * work foward from the first / and check each part of the path
+ * work forward from the first / and check each part of the path
*/
spt = strchr(spt, '/');
if (spt == NULL)
@@ -600,7 +600,7 @@ chk_path( char *name, uid_t st_uid, gid_t st_gid)
(void)set_ids(name, st_uid, st_gid);
/*
- * make sure the user doen't have some strange umask that
+ * make sure the user doesn't have some strange umask that
* causes this newly created directory to be unusable. We fix
* the modes and restore them back to the creation default at
* the end of pax
@@ -716,11 +716,11 @@ set_pmode(char *fnm, mode_t mode)
* uses lseek whenever it detects the input data is all 0 within that
* file block. In more detail, the strategy is as follows:
* While the input is all zero keep doing an lseek. Keep track of when we
- * pass over file block boundries. Only write when we hit a non zero
+ * pass over file block boundaries. Only write when we hit a non zero
* input. once we have written a file block, we continue to write it to
* the end (we stop looking at the input). When we reach the start of the
* next file block, start checking for zero blocks again. Working on file
- * block boundries significantly reduces the overhead when copying files
+ * block boundaries significantly reduces the overhead when copying files
* that are NOT very sparse. This overhead (when compared to a write) is
* almost below the measurement resolution on many systems. Without it,
* files with holes cannot be safely copied. It does has a side effect as
@@ -923,7 +923,7 @@ set_crc(ARCHD *arcn, int fd)
/*
* safety check. we want to avoid archiving files that are active as
- * they can create inconsistant archive copies.
+ * they can create inconsistent archive copies.
*/
if (cpcnt != arcn->sb.st_size)
paxwarn(1, "File changed size %s", arcn->org_name);
diff --git a/bin/pax/ftree.c b/bin/pax/ftree.c
index 1fb06ac..9e07882 100644
--- a/bin/pax/ftree.c
+++ b/bin/pax/ftree.c
@@ -101,8 +101,8 @@ ftree_start(void)
/*
* optional user flags that effect file traversal
* -H command line symlink follow only (half follow)
- * -L follow sylinks (logical)
- * -P do not follow sylinks (physical). This is the default.
+ * -L follow symlinks (logical)
+ * -P do not follow symlinks (physical). This is the default.
* -X do not cross over mount points
* -t preserve access times on files read.
* -n select only the first member of a file tree when a match is found
diff --git a/bin/pax/options.c b/bin/pax/options.c
index 6f43940..5fd641f 100644
--- a/bin/pax/options.c
+++ b/bin/pax/options.c
@@ -887,7 +887,7 @@ tar_options(int argc, char **argv)
sawpat = 1;
}
/*
- * if patterns were added, we are doing chdir()
+ * if patterns were added, we are doing chdir()
* on a file-by-file basis, else, just one
* global chdir (if any) after opening input.
*/
diff --git a/bin/pax/pat_rep.c b/bin/pax/pat_rep.c
index 62539a2..7b07975 100644
--- a/bin/pax/pat_rep.c
+++ b/bin/pax/pat_rep.c
@@ -397,7 +397,7 @@ pat_sel(ARCHD *arcn)
/*
* should never happen....
*/
- paxwarn(1, "Pattern list inconsistant");
+ paxwarn(1, "Pattern list inconsistent");
return(-1);
}
*ppt = pt->fow;
diff --git a/bin/pax/pax.c b/bin/pax/pax.c
index cb19b99..040db74 100644
--- a/bin/pax/pax.c
+++ b/bin/pax/pax.c
@@ -372,7 +372,7 @@ gen_init(void)
/*
* signal handling to reset stored directory times and modes. Since
* we deal with broken pipes via failed writes we ignore it. We also
- * deal with any file size limit thorugh failed writes. Cpu time
+ * deal with any file size limit thorough failed writes. Cpu time
* limits are caught and a cleanup is forced.
*/
if ((sigemptyset(&s_mask) < 0) || (sigaddset(&s_mask, SIGTERM) < 0) ||
diff --git a/bin/pax/sel_subs.c b/bin/pax/sel_subs.c
index bd5c560..fe131f7 100644
--- a/bin/pax/sel_subs.c
+++ b/bin/pax/sel_subs.c
@@ -376,7 +376,7 @@ trng_add(char *str)
}
/*
- * by default we only will check file mtime, but usee can specify
+ * by default we only will check file mtime, but the user can specify
* mtime, ctime (inode change time) or both.
*/
if ((flgpt == NULL) || (*flgpt == '\0'))
diff --git a/bin/pax/tables.c b/bin/pax/tables.c
index 4e96fea..69273fe 100644
--- a/bin/pax/tables.c
+++ b/bin/pax/tables.c
@@ -209,7 +209,7 @@ chk_lnk(ARCHD *arcn)
* purg_lnk
* remove reference for a file that we may have added to the data base as
* a potential source for hard links. We ended up not using the file, so
- * we do not want to accidently point another file at it later on.
+ * we do not want to accidentally point another file at it later on.
*/
void
@@ -306,14 +306,14 @@ lnk_end(void)
* An append with an -u must read the archive and store the modification time
* for every file on that archive before starting the write phase. It is clear
* that this is one HUGE database. To save memory space, the actual file names
- * are stored in a scatch file and indexed by an in memory hash table. The
+ * are stored in a scratch file and indexed by an in memory hash table. The
* hash table is indexed by hashing the file path. The nodes in the table store
* the length of the filename and the lseek offset within the scratch file
* where the actual name is stored. Since there are never any deletions to this
* table, fragmentation of the scratch file is never an issue. Lookups seem to
* not exhibit any locality at all (files in the database are rarely
* looked up more than once...). So caching is just a waste of memory. The
- * only limitation is the amount of scatch file space available to store the
+ * only limitation is the amount of scratch file space available to store the
* path names.
*/
diff --git a/bin/pax/tar.c b/bin/pax/tar.c
index 05e8be5..4ee2786a8 100644
--- a/bin/pax/tar.c
+++ b/bin/pax/tar.c
@@ -291,7 +291,7 @@ tar_chksm(char *blk, int len)
/*
* tar_id()
* determine if a block given to us is a valid tar header (and not a USTAR
- * header). We have to be on the lookout for those pesky blocks of all
+ * header). We have to be on the lookout for those pesky blocks of all
* zero's.
* Return:
* 0 if a tar header, -1 otherwise
diff --git a/bin/ps/ps.1 b/bin/ps/ps.1
index bfafae0..2465df3 100644
--- a/bin/ps/ps.1
+++ b/bin/ps/ps.1
@@ -301,7 +301,7 @@ the include file
.It Dv "P_PPWAIT" Ta No "0x00010 Parent is waiting for child to exec/exit"
.It Dv "P_PROFIL" Ta No "0x00020 Has started profiling"
.It Dv "P_STOPPROF" Ta No "0x00040 Has thread in requesting to stop prof"
-.It Dv "P_HASTHREADS" Ta No "0x00080 Has had threads (no cleanup shortcuts)"
+.It Dv "P_HADTHREADS" Ta No "0x00080 Has had threads (no cleanup shortcuts)"
.It Dv "P_SUGID" Ta No "0x00100 Had set id privileges since last exec"
.It Dv "P_SYSTEM" Ta No "0x00200 System proc: no sigs, stats or swapping"
.It Dv "P_SINGLE_EXIT" Ta No "0x00400 Threads suspending should exit, not wait"
@@ -549,7 +549,7 @@ wait channel (as an address)
total blocks written (alias
.Cm oublock )
.It Cm paddr
-swap address
+process pointer
.It Cm pagein
pageins (same as majflt)
.It Cm pgid
diff --git a/bin/ps/ps.c b/bin/ps/ps.c
index 6bb94bf..fb2b752 100644
--- a/bin/ps/ps.c
+++ b/bin/ps/ps.c
@@ -219,7 +219,7 @@ main(int argc, char *argv[])
case 'A':
/*
* Exactly the same as `-ax'. This has been
- * added for compatability with SUSv3, but for
+ * added for compatibility with SUSv3, but for
* now it will not be described in the man page.
*/
nselectors++;
diff --git a/bin/sh/cd.c b/bin/sh/cd.c
index 041d6b4..776bdba 100644
--- a/bin/sh/cd.c
+++ b/bin/sh/cd.c
@@ -84,12 +84,16 @@ cdcmd(int argc, char **argv)
const char *path;
char *p;
struct stat statb;
- int ch, phys, print = 0;
+ int ch, phys, print = 0, getcwderr = 0;
+ int rc;
optreset = 1; optind = 1; opterr = 0; /* initialize getopt */
phys = Pflag;
- while ((ch = getopt(argc, argv, "LP")) != -1) {
+ while ((ch = getopt(argc, argv, "eLP")) != -1) {
switch (ch) {
+ case 'e':
+ getcwderr = 1;
+ break;
case 'L':
phys = 0;
break;
@@ -131,8 +135,9 @@ cdcmd(int argc, char **argv)
else
print = strcmp(p, dest);
}
- if (docd(p, print, phys) >= 0)
- return 0;
+ rc = docd(p, print, phys);
+ if (rc >= 0)
+ return getcwderr ? rc : 0;
}
}
error("can't cd to %s", dest);
@@ -148,17 +153,18 @@ cdcmd(int argc, char **argv)
static int
docd(char *dest, int print, int phys)
{
+ int rc;
TRACE(("docd(\"%s\", %d, %d) called\n", dest, print, phys));
/* If logical cd fails, fall back to physical. */
- if ((phys || cdlogical(dest) < 0) && cdphysical(dest) < 0)
+ if ((phys || (rc = cdlogical(dest)) < 0) && (rc = cdphysical(dest)) < 0)
return (-1);
if (print && iflag && curdir)
out1fmt("%s\n", curdir);
- return 0;
+ return (rc);
}
static int
@@ -216,6 +222,7 @@ static int
cdphysical(char *dest)
{
char *p;
+ int rc = 0;
INTOFF;
if (chdir(dest) < 0) {
@@ -223,11 +230,13 @@ cdphysical(char *dest)
return (-1);
}
p = findcwd(NULL);
- if (p == NULL)
+ if (p == NULL) {
warning("warning: failed to get name of current directory");
+ rc = 1;
+ }
updatepwd(p);
INTON;
- return (0);
+ return (rc);
}
/*
diff --git a/bin/sh/eval.c b/bin/sh/eval.c
index b0ee28e..a50c53f 100644
--- a/bin/sh/eval.c
+++ b/bin/sh/eval.c
@@ -552,7 +552,8 @@ evalpipe(union node *n)
if (prevfd >= 0)
close(prevfd);
prevfd = pip[0];
- close(pip[1]);
+ if (pip[1] != -1)
+ close(pip[1]);
}
INTON;
if (n->npipe.backgnd == 0) {
@@ -713,15 +714,9 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
oexitstatus = exitstatus;
exitstatus = 0;
for (argp = cmd->ncmd.args ; argp ; argp = argp->narg.next) {
- char *p = argp->narg.text;
- if (varflag && is_name(*p)) {
- do {
- p++;
- } while (is_in_name(*p));
- if (*p == '=') {
- expandarg(argp, &varlist, EXP_VARTILDE);
- continue;
- }
+ if (varflag && isassignment(argp->narg.text)) {
+ expandarg(argp, &varlist, EXP_VARTILDE);
+ continue;
}
expandarg(argp, &arglist, EXP_FULL | EXP_TILDE);
varflag = 0;
diff --git a/bin/sh/main.c b/bin/sh/main.c
index d962920..408d37c 100644
--- a/bin/sh/main.c
+++ b/bin/sh/main.c
@@ -281,7 +281,6 @@ readcmdfile(const char *name)
static char *
find_dot_file(char *basename)
{
- static char localname[FILENAME_MAX+1];
char *fullname;
const char *path = pathval();
struct stat statb;
@@ -291,10 +290,14 @@ find_dot_file(char *basename)
return basename;
while ((fullname = padvance(&path, basename)) != NULL) {
- strcpy(localname, fullname);
+ if ((stat(fullname, &statb) == 0) && S_ISREG(statb.st_mode)) {
+ /*
+ * Don't bother freeing here, since it will
+ * be freed by the caller.
+ */
+ return fullname;
+ }
stunalloc(fullname);
- if ((stat(fullname, &statb) == 0) && S_ISREG(statb.st_mode))
- return localname;
}
return basename;
}
diff --git a/bin/sh/miscbltin.c b/bin/sh/miscbltin.c
index dc200b6..fce13b5 100644
--- a/bin/sh/miscbltin.c
+++ b/bin/sh/miscbltin.c
@@ -465,7 +465,7 @@ ulimitcmd(int argc __unused, char **argv __unused)
"(-%c) ", l->option);
out1fmt("%-18s %18s ", l->name, optbuf);
if (val == RLIM_INFINITY)
- out1fmt("unlimited\n");
+ out1str("unlimited\n");
else
{
val /= l->factor;
@@ -491,7 +491,7 @@ ulimitcmd(int argc __unused, char **argv __unused)
val = limit.rlim_max;
if (val == RLIM_INFINITY)
- out1fmt("unlimited\n");
+ out1str("unlimited\n");
else
{
val /= l->factor;
diff --git a/bin/sh/mkinit.c b/bin/sh/mkinit.c
index 82f2a55..866b238 100644
--- a/bin/sh/mkinit.c
+++ b/bin/sh/mkinit.c
@@ -75,7 +75,7 @@ __FBSDID("$FreeBSD$");
/*
- * A text structure is basicly just a string that grows as more characters
+ * A text structure is basically just a string that grows as more characters
* are added onto the end of it. It is implemented as a linked list of
* blocks of characters. The routines addstr and addchar append a string
* or a single character, respectively, to a text structure. Writetext
diff --git a/bin/sh/mktokens b/bin/sh/mktokens
index bdc873e..b85c8cb9 100644
--- a/bin/sh/mktokens
+++ b/bin/sh/mktokens
@@ -50,7 +50,6 @@ TPIPE 0 "|"
TLP 0 "("
TRP 1 ")"
TENDCASE 1 ";;"
-TENDBQUOTE 1 "`"
TREDIR 0 redirection
TWORD 0 word
TIF 0 "if"
diff --git a/bin/sh/parser.c b/bin/sh/parser.c
index cc1860d..151970b 100644
--- a/bin/sh/parser.c
+++ b/bin/sh/parser.c
@@ -619,6 +619,7 @@ simplecmd(union node **rpp, union node *redir)
union node **orig_rpp = rpp;
union node *n = NULL;
int special;
+ int savecheckkwd;
/* If we don't have any redirections already, then we must reset */
/* rpp to be the address of the local redir variable. */
@@ -634,7 +635,10 @@ simplecmd(union node **rpp, union node *redir)
*/
orig_rpp = rpp;
+ savecheckkwd = CHKALIAS;
+
for (;;) {
+ checkkwd = savecheckkwd;
if (readtoken() == TWORD) {
n = (union node *)stalloc(sizeof (struct narg));
n->type = NARG;
@@ -642,6 +646,8 @@ simplecmd(union node **rpp, union node *redir)
n->narg.backquote = backquotelist;
*app = n;
app = &n->narg.next;
+ if (savecheckkwd != 0 && !isassignment(wordtext))
+ savecheckkwd = 0;
} else if (lasttoken == TREDIR) {
*rpp = n = redirnode;
rpp = &n->nfile.next;
@@ -1513,10 +1519,12 @@ checkend: {
p = line;
for (q = eofmark + 1 ; *q && *p == *q ; p++, q++);
- if (*p == '\n' && *q == '\0') {
+ if ((*p == '\0' || *p == '\n') && *q == '\0') {
c = PEOF;
- plinno++;
- needprompt = doprompt;
+ if (*p == '\n') {
+ plinno++;
+ needprompt = doprompt;
+ }
} else {
pushstring(line, strlen(line), NULL);
}
@@ -1857,6 +1865,22 @@ goodname(const char *name)
}
+int
+isassignment(const char *p)
+{
+ if (!is_name(*p))
+ return 0;
+ p++;
+ for (;;) {
+ if (*p == '=')
+ return 1;
+ else if (!is_in_name(*p))
+ return 0;
+ p++;
+ }
+}
+
+
/*
* Called when an unexpected token is read during the parse. The argument
* is the token that is expected, or -1 if more than one type of token can
diff --git a/bin/sh/parser.h b/bin/sh/parser.h
index dfbda86..e213e21 100644
--- a/bin/sh/parser.h
+++ b/bin/sh/parser.h
@@ -80,4 +80,5 @@ extern const char *const parsekwd[];
union node *parsecmd(int);
void fixredir(union node *, const char *, int);
int goodname(const char *);
+int isassignment(const char *);
char *getprompt(void *);
diff --git a/bin/sh/sh.1 b/bin/sh/sh.1
index 838cafe..42e55d3 100644
--- a/bin/sh/sh.1
+++ b/bin/sh/sh.1
@@ -32,7 +32,7 @@
.\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95
.\" $FreeBSD$
.\"
-.Dd May 8, 2011
+.Dd May 21, 2011
.Dt SH 1
.Os
.Sh NAME
@@ -506,8 +506,8 @@ The following are keywords:
An alias is a name and corresponding value set using the
.Ic alias
built-in command.
-Whenever a keyword may occur (see above),
-and after checking for keywords, the shell
+Wherever the command word of a simple command may occur,
+and after checking for keywords if a keyword may occur, the shell
checks the word to see if it matches an alias.
If it does, it replaces it in the input stream with its value.
For example, if there is an alias called
@@ -1729,7 +1729,7 @@ Execute the specified built-in command,
.Ar cmd .
This is useful when the user wishes to override a shell function
with the same name as a built-in command.
-.It Ic cd Oo Fl L | P Oc Op Ar directory
+.It Ic cd Oo Fl L | P Oc Oo Fl e Oc Op Ar directory
Switch to the specified
.Ar directory ,
or to the directory specified in the
@@ -1778,6 +1778,15 @@ option is specified,
.Pa ..
is handled logically.
This is the default.
+.Pp
+The
+.Fl e
+option causes
+.Ic cd
+to return exit status 1 if the full pathname of the new directory
+cannot be determined reliably or at all.
+Normally this is not considered an error,
+although a warning is printed.
.It Ic chdir
A synonym for the
.Ic cd
diff --git a/bin/sh/var.c b/bin/sh/var.c
index 84b6dea..f6d7fb1 100644
--- a/bin/sh/var.c
+++ b/bin/sh/var.c
@@ -681,14 +681,13 @@ exportcmd(int argc, char **argv)
out1str(cmdname);
out1c(' ');
}
- p = strchr(vp->text, '=');
if (values && !(vp->flags & VUNSET)) {
- p++;
- outbin(vp->text, p - vp->text,
- out1);
- out1qstr(p);
+ outbin(vp->text,
+ vp->name_len + 1, out1);
+ out1qstr(vp->text +
+ vp->name_len + 1);
} else
- outbin(vp->text, p - vp->text,
+ outbin(vp->text, vp->name_len,
out1);
out1c('\n');
}
diff --git a/contrib/binutils/binutils/objcopy.c b/contrib/binutils/binutils/objcopy.c
index 06e2946..23a0676 100644
--- a/contrib/binutils/binutils/objcopy.c
+++ b/contrib/binutils/binutils/objcopy.c
@@ -1542,7 +1542,8 @@ copy_object (bfd *ibfd, bfd *obfd)
/* Umm, not sure what to do in this case. */
debuglink_vma = 0x1000;
- bfd_set_section_vma (obfd, gnu_debuglink_section, debuglink_vma);
+ (void) bfd_set_section_vma (obfd, gnu_debuglink_section,
+ debuglink_vma);
}
}
diff --git a/contrib/binutils/binutils/readelf.c b/contrib/binutils/binutils/readelf.c
index 59a2090..a8c5ccc 100644
--- a/contrib/binutils/binutils/readelf.c
+++ b/contrib/binutils/binutils/readelf.c
@@ -9701,7 +9701,7 @@ process_archive (char *file_name, FILE *file)
}
if ((longnames_size & 1) != 0)
- getc (file);
+ (void) getc (file);
got = fread (&arhdr, 1, sizeof arhdr, file);
if (got != sizeof arhdr)
diff --git a/contrib/binutils/binutils/strings.c b/contrib/binutils/binutils/strings.c
index 2238574..386bac7 100644
--- a/contrib/binutils/binutils/strings.c
+++ b/contrib/binutils/binutils/strings.c
@@ -593,7 +593,7 @@ print_strings (const char *filename, FILE *stream, file_off address,
case 8:
#if __STDC_VERSION__ >= 199901L || (defined(__GNUC__) && __GNUC__ >= 2)
if (sizeof (start) > sizeof (long))
- printf ("%7Lo ", (unsigned long long) start);
+ printf ("%7llo ", (unsigned long long) start);
else
#else
# if !BFD_HOST_64BIT_LONG
@@ -608,7 +608,7 @@ print_strings (const char *filename, FILE *stream, file_off address,
case 10:
#if __STDC_VERSION__ >= 199901L || (defined(__GNUC__) && __GNUC__ >= 2)
if (sizeof (start) > sizeof (long))
- printf ("%7Ld ", (unsigned long long) start);
+ printf ("%7lld ", (unsigned long long) start);
else
#else
# if !BFD_HOST_64BIT_LONG
@@ -623,7 +623,7 @@ print_strings (const char *filename, FILE *stream, file_off address,
case 16:
#if __STDC_VERSION__ >= 199901L || (defined(__GNUC__) && __GNUC__ >= 2)
if (sizeof (start) > sizeof (long))
- printf ("%7Lx ", (unsigned long long) start);
+ printf ("%7llx ", (unsigned long long) start);
else
#else
# if !BFD_HOST_64BIT_LONG
diff --git a/contrib/binutils/gas/read.h b/contrib/binutils/gas/read.h
index 6ac153b..342a7e4 100644
--- a/contrib/binutils/gas/read.h
+++ b/contrib/binutils/gas/read.h
@@ -30,7 +30,7 @@ extern char *input_line_pointer; /* -> char we are parsing now. */
#ifdef PERMIT_WHITESPACE
#define SKIP_WHITESPACE() \
- ((*input_line_pointer == ' ') ? ++input_line_pointer : 0)
+ do { if (*input_line_pointer == ' ') ++input_line_pointer; } while (0)
#else
#define SKIP_WHITESPACE() know(*input_line_pointer != ' ' )
#endif
diff --git a/contrib/binutils/gas/write.c b/contrib/binutils/gas/write.c
index 29ea284..6b4af52 100644
--- a/contrib/binutils/gas/write.c
+++ b/contrib/binutils/gas/write.c
@@ -345,7 +345,7 @@ record_alignment (/* Segment to which alignment pertains. */
return;
if ((unsigned int) align > bfd_get_section_alignment (stdoutput, seg))
- bfd_set_section_alignment (stdoutput, seg, align);
+ (void) bfd_set_section_alignment (stdoutput, seg, align);
}
int
@@ -2247,7 +2247,7 @@ relax_segment (struct frag *segment_frag_root, segT segment, int pass)
newf = frag_alloc (ob);
obstack_blank_fast (ob, fragP->fr_var);
- obstack_finish (ob);
+ (void) obstack_finish (ob);
memcpy (newf, fragP, SIZEOF_STRUCT_FRAG);
memcpy (newf->fr_literal,
fragP->fr_literal + fragP->fr_fix,
diff --git a/contrib/binutils/ld/ldlang.c b/contrib/binutils/ld/ldlang.c
index 5c26974..191936f 100644
--- a/contrib/binutils/ld/ldlang.c
+++ b/contrib/binutils/ld/ldlang.c
@@ -4274,9 +4274,10 @@ lang_size_sections_1
" section %s\n"), os->name);
input = os->children.head->input_section.section;
- bfd_set_section_vma (os->bfd_section->owner,
- os->bfd_section,
- bfd_section_vma (input->owner, input));
+ (void) bfd_set_section_vma (os->bfd_section->owner,
+ os->bfd_section,
+ bfd_section_vma (input->owner,
+ input));
os->bfd_section->size = input->size;
break;
}
@@ -4361,7 +4362,7 @@ lang_size_sections_1
os->name, (unsigned long) (newdot - savedot));
}
- bfd_set_section_vma (0, os->bfd_section, newdot);
+ (void) bfd_set_section_vma (0, os->bfd_section, newdot);
os->bfd_section->output_offset = 0;
}
diff --git a/contrib/gcc/combine.c b/contrib/gcc/combine.c
index c5655ea..f44b246 100644
--- a/contrib/gcc/combine.c
+++ b/contrib/gcc/combine.c
@@ -12442,7 +12442,7 @@ distribute_notes (rtx notes, rtx from_insn, rtx i3, rtx i2, rtx elim_i2,
REG_N_DEATHS (REGNO (XEXP (note, 0)))++;
REG_NOTES (place2) = gen_rtx_fmt_ee (GET_CODE (note),
- REG_NOTE_KIND (note),
+ GET_MODE (note),
XEXP (note, 0),
REG_NOTES (place2));
}
diff --git a/contrib/gcc/emit-rtl.c b/contrib/gcc/emit-rtl.c
index 9607bf6..73ce0b4 100644
--- a/contrib/gcc/emit-rtl.c
+++ b/contrib/gcc/emit-rtl.c
@@ -3210,7 +3210,7 @@ try_split (rtx pat, rtx trial, int last)
{
if (CALL_P (insn))
REG_NOTES (insn)
- = gen_rtx_EXPR_LIST (REG_NOTE_KIND (note),
+ = gen_rtx_EXPR_LIST (GET_MODE (note),
XEXP (note, 0),
REG_NOTES (insn));
insn = PREV_INSN (insn);
@@ -3223,7 +3223,7 @@ try_split (rtx pat, rtx trial, int last)
{
if (JUMP_P (insn))
REG_NOTES (insn)
- = gen_rtx_EXPR_LIST (REG_NOTE_KIND (note),
+ = gen_rtx_EXPR_LIST (GET_MODE (note),
XEXP (note, 0),
REG_NOTES (insn));
insn = PREV_INSN (insn);
@@ -4589,7 +4589,8 @@ set_unique_reg_note (rtx insn, enum reg_note kind, rtx datum)
return note;
}
- REG_NOTES (insn) = gen_rtx_EXPR_LIST (kind, datum, REG_NOTES (insn));
+ REG_NOTES (insn) = gen_rtx_EXPR_LIST ((enum machine_mode) kind, datum,
+ REG_NOTES (insn));
return REG_NOTES (insn);
}
@@ -5344,12 +5345,12 @@ emit_copy_of_insn_after (rtx insn, rtx after)
{
if (GET_CODE (link) == EXPR_LIST)
REG_NOTES (new)
- = copy_insn_1 (gen_rtx_EXPR_LIST (REG_NOTE_KIND (link),
+ = copy_insn_1 (gen_rtx_EXPR_LIST (GET_MODE (link),
XEXP (link, 0),
REG_NOTES (new)));
else
REG_NOTES (new)
- = copy_insn_1 (gen_rtx_INSN_LIST (REG_NOTE_KIND (link),
+ = copy_insn_1 (gen_rtx_INSN_LIST (GET_MODE (link),
XEXP (link, 0),
REG_NOTES (new)));
}
diff --git a/contrib/gcc/function.c b/contrib/gcc/function.c
index 7549ec4..59970c4 100644
--- a/contrib/gcc/function.c
+++ b/contrib/gcc/function.c
@@ -4008,22 +4008,19 @@ stack_protect_epilogue (void)
/* Allow the target to compare Y with X without leaking either into
a register. */
- switch (HAVE_stack_protect_test != 0)
+ if (HAVE_stack_protect_test != 0)
{
- case 1:
tmp = gen_stack_protect_test (x, y, label);
if (tmp)
{
emit_insn (tmp);
- break;
+ goto done;
}
- /* FALLTHRU */
-
- default:
- emit_cmp_and_jump_insns (x, y, EQ, NULL_RTX, ptr_mode, 1, label);
- break;
}
+ emit_cmp_and_jump_insns (x, y, EQ, NULL_RTX, ptr_mode, 1, label);
+ done:
+
/* The noreturn predictor has been moved to the tree level. The rtl-level
predictors estimate this branch about 20%, which isn't enough to get
things moved out of line. Since this is the only extant case of adding
diff --git a/contrib/gcc/genattrtab.c b/contrib/gcc/genattrtab.c
index f11532f..2555e10 100644
--- a/contrib/gcc/genattrtab.c
+++ b/contrib/gcc/genattrtab.c
@@ -1652,7 +1652,7 @@ simplify_cond (rtx exp, int insn_code, int insn_index)
rtx ret;
/* This lets us free all storage allocated below, if appropriate. */
- obstack_finish (rtl_obstack);
+ (void) obstack_finish (rtl_obstack);
memcpy (tests, XVEC (exp, 0)->elem, len * sizeof (rtx));
diff --git a/contrib/gcc/genautomata.c b/contrib/gcc/genautomata.c
index fd8edeb..8434030 100644
--- a/contrib/gcc/genautomata.c
+++ b/contrib/gcc/genautomata.c
@@ -1099,7 +1099,7 @@ create_node (size_t size)
obstack_blank (&irp, size);
result = obstack_base (&irp);
- obstack_finish (&irp);
+ (void) obstack_finish (&irp);
/* Default values of members are NULL and zero. */
memset (result, 0, size);
return result;
@@ -1170,7 +1170,7 @@ next_sep_el (const char **pstr, int sep, int par_flag)
}
obstack_1grow (&irp, '\0');
out_str = obstack_base (&irp);
- obstack_finish (&irp);
+ (void) obstack_finish (&irp);
*pstr = p;
if (**pstr == sep)
@@ -1221,7 +1221,7 @@ get_str_vect (const char *str, int *els_num, int sep, int paren_p)
return NULL;
obstack_blank (&irp, sizeof (char *) * (*els_num + 1));
vect = (char **) obstack_base (&irp);
- obstack_finish (&irp);
+ (void) obstack_finish (&irp);
pstr = &str;
for (i = 0; i < *els_num; i++)
vect [i] = next_sep_el (pstr, sep, paren_p);
@@ -3343,7 +3343,7 @@ alloc_empty_reserv_sets (void)
obstack_blank (&irp, els_in_reservs * sizeof (set_el_t));
result = (reserv_sets_t) obstack_base (&irp);
- obstack_finish (&irp);
+ (void) obstack_finish (&irp);
memset (result, 0, els_in_reservs * sizeof (set_el_t));
return result;
}
@@ -4117,10 +4117,10 @@ initiate_excl_sets (void)
obstack_blank (&irp, els_in_cycle_reserv * sizeof (set_el_t));
excl_set = (reserv_sets_t) obstack_base (&irp);
- obstack_finish (&irp);
+ (void) obstack_finish (&irp);
obstack_blank (&irp, description->units_num * sizeof (reserv_sets_t));
unit_excl_set_table = (reserv_sets_t *) obstack_base (&irp);
- obstack_finish (&irp);
+ (void) obstack_finish (&irp);
/* Evaluate unit exclusion sets. */
for (i = 0; i < description->decls_num; i++)
{
@@ -4129,7 +4129,7 @@ initiate_excl_sets (void)
{
obstack_blank (&irp, els_in_cycle_reserv * sizeof (set_el_t));
unit_excl_set = (reserv_sets_t) obstack_base (&irp);
- obstack_finish (&irp);
+ (void) obstack_finish (&irp);
memset (unit_excl_set, 0, els_in_cycle_reserv * sizeof (set_el_t));
for (el = DECL_UNIT (decl)->excl_list;
el != NULL;
@@ -4224,16 +4224,16 @@ initiate_presence_absence_pattern_sets (void)
obstack_blank (&irp, description->units_num * sizeof (pattern_reserv_t));
unit_presence_set_table = (pattern_reserv_t *) obstack_base (&irp);
- obstack_finish (&irp);
+ (void) obstack_finish (&irp);
obstack_blank (&irp, description->units_num * sizeof (pattern_reserv_t));
unit_final_presence_set_table = (pattern_reserv_t *) obstack_base (&irp);
- obstack_finish (&irp);
+ (void) obstack_finish (&irp);
obstack_blank (&irp, description->units_num * sizeof (pattern_reserv_t));
unit_absence_set_table = (pattern_reserv_t *) obstack_base (&irp);
- obstack_finish (&irp);
+ (void) obstack_finish (&irp);
obstack_blank (&irp, description->units_num * sizeof (pattern_reserv_t));
unit_final_absence_set_table = (pattern_reserv_t *) obstack_base (&irp);
- obstack_finish (&irp);
+ (void) obstack_finish (&irp);
/* Evaluate unit presence/absence sets. */
for (i = 0; i < description->decls_num; i++)
{
@@ -4935,7 +4935,7 @@ store_alt_unit_usage (regexp_t regexp, regexp_t unit, int cycle,
obstack_blank (&unit_usages, sizeof (struct unit_usage));
unit_usage_ptr = (struct unit_usage *) obstack_base (&unit_usages);
- obstack_finish (&unit_usages);
+ (void) obstack_finish (&unit_usages);
unit_usage_ptr->unit_decl = unit_decl;
index = cycle * REGEXP_ONEOF (regexp)->regexps_num + alt_num;
unit_usage_ptr->next = VEC_index (unit_usage_t, cycle_alt_unit_usages, index);
@@ -8975,7 +8975,7 @@ initiate_automaton_gen (int argc, char **argv)
strlen (STANDARD_OUTPUT_DESCRIPTION_FILE_SUFFIX) + 1);
obstack_1grow (&irp, '\0');
output_description_file_name = obstack_base (&irp);
- obstack_finish (&irp);
+ (void) obstack_finish (&irp);
}
/* The following function checks existence at least one arc marked by
diff --git a/contrib/gcc/gengtype-lex.l b/contrib/gcc/gengtype-lex.l
index 51cd95a..ebe6667 100644
--- a/contrib/gcc/gengtype-lex.l
+++ b/contrib/gcc/gengtype-lex.l
@@ -590,7 +590,7 @@ macro_input (char *buffer, unsigned size)
void
yyerror (const char *s)
{
- error_at_line (&lexer_line, s);
+ error_at_line (&lexer_line, "%s", s);
}
void
diff --git a/contrib/gcc/genmodes.c b/contrib/gcc/genmodes.c
index 0a70dea..5a91a50 100644
--- a/contrib/gcc/genmodes.c
+++ b/contrib/gcc/genmodes.c
@@ -787,7 +787,7 @@ calc_wider_mode (void)
#define tagged_printf(FMT, ARG, TAG) do { \
int count_; \
- printf (" " FMT ",%n", ARG, &count_); \
+ count_ = printf (" " FMT ",", ARG); \
printf ("%*s/* %s */\n", 27 - count_, "", TAG); \
} while (0)
@@ -822,7 +822,7 @@ enum machine_mode\n{");
for (m = modes[c]; m; m = m->next)
{
int count_;
- printf (" %smode,%n", m->name, &count_);
+ count_ = printf (" %smode,", m->name);
printf ("%*s/* %s:%d */\n", 27 - count_, "",
trim_filename (m->file), m->line);
}
diff --git a/contrib/gcc/omp-low.c b/contrib/gcc/omp-low.c
index 3008a1b..49fb8c9 100644
--- a/contrib/gcc/omp-low.c
+++ b/contrib/gcc/omp-low.c
@@ -118,7 +118,7 @@ static tree maybe_lookup_decl_in_outer_ctx (tree, omp_context *);
/* Find an OpenMP clause of type KIND within CLAUSES. */
static tree
-find_omp_clause (tree clauses, enum tree_code kind)
+find_omp_clause (tree clauses, enum omp_clause_code kind)
{
for (; clauses ; clauses = OMP_CLAUSE_CHAIN (clauses))
if (OMP_CLAUSE_CODE (clauses) == kind)
diff --git a/contrib/gcc/tree-cfg.c b/contrib/gcc/tree-cfg.c
index 1c855b7..7573439 100644
--- a/contrib/gcc/tree-cfg.c
+++ b/contrib/gcc/tree-cfg.c
@@ -2854,7 +2854,7 @@ bsi_insert_before (block_stmt_iterator *i, tree t, enum bsi_iterator_update m)
{
set_bb_for_stmt (t, i->bb);
update_modified_stmts (t);
- tsi_link_before (&i->tsi, t, m);
+ tsi_link_before (&i->tsi, t, (enum tsi_iterator_update) m);
}
@@ -2867,7 +2867,7 @@ bsi_insert_after (block_stmt_iterator *i, tree t, enum bsi_iterator_update m)
{
set_bb_for_stmt (t, i->bb);
update_modified_stmts (t);
- tsi_link_after (&i->tsi, t, m);
+ tsi_link_after (&i->tsi, t, (enum tsi_iterator_update) m);
}
diff --git a/contrib/gcc/tree-vect-patterns.c b/contrib/gcc/tree-vect-patterns.c
index 1c57c59..5907f88 100644
--- a/contrib/gcc/tree-vect-patterns.c
+++ b/contrib/gcc/tree-vect-patterns.c
@@ -487,7 +487,7 @@ vect_pattern_recog_1 (
}
else
{
- enum tree_code vec_mode;
+ enum machine_mode vec_mode;
enum insn_code icode;
optab optab;
diff --git a/contrib/gcclibs/libiberty/regex.c b/contrib/gcclibs/libiberty/regex.c
index fa1df19..c24026e 100644
--- a/contrib/gcclibs/libiberty/regex.c
+++ b/contrib/gcclibs/libiberty/regex.c
@@ -149,7 +149,7 @@ char *realloc ();
# include <string.h>
# ifndef bzero
# ifndef _LIBC
-# define bzero(s, n) (memset (s, '\0', n), (s))
+# define bzero(s, n) ((void) (memset (s, '\0', n), (s)))
# else
# define bzero(s, n) __bzero (s, n)
# endif
diff --git a/contrib/gperf/src/gen-perf.cc b/contrib/gperf/src/gen-perf.cc
index 0b5109d..8840dc6 100644
--- a/contrib/gperf/src/gen-perf.cc
+++ b/contrib/gperf/src/gen-perf.cc
@@ -246,7 +246,7 @@ Gen_Perf::change (List_Node *prior, List_Node *curr)
{
if (option[DEBUG])
{
- fprintf (stderr, " by changing asso_value['%c'] (char #%d) to %d\n",
+ fprintf (stderr, " by changing asso_value['%c'] (char #%zd) to %d\n",
*p, p - union_set + 1, asso_values[(unsigned char)(*p)]);
fflush (stderr);
}
diff --git a/contrib/gperf/src/key-list.cc b/contrib/gperf/src/key-list.cc
index 1c941a4..2461470 100644
--- a/contrib/gperf/src/key-list.cc
+++ b/contrib/gperf/src/key-list.cc
@@ -497,8 +497,8 @@ Key_List::merge (List_Node *list1, List_Node *list2)
*resultp = list1;
break;
}
- if (occurrence_sort && list1->occurrence < list2->occurrence
- || hash_sort && list1->hash_value > list2->hash_value)
+ if ((occurrence_sort && list1->occurrence < list2->occurrence)
+ || (hash_sort && list1->hash_value > list2->hash_value))
{
*resultp = list2;
resultp = &list2->next; list2 = list1; list1 = *resultp;
@@ -1035,17 +1035,16 @@ Key_List::output_hash_function (void)
if (option[CPLUSPLUS])
printf ("%s::", option.get_class_name ());
printf ("%s ", option.get_hash_name ());
- printf (option[KRC] ?
- "(str, len)\n"
- " register char *str;\n"
- " register unsigned int len;\n" :
- option[C] ?
- "(str, len)\n"
- " register const char *str;\n"
- " register unsigned int len;\n" :
- option[ANSIC] | option[CPLUSPLUS] ?
- "(register const char *str, register unsigned int len)\n" :
- "");
+ if (option[KRC] || option[C] || option [ANSIC] || option[CPLUSPLUS])
+ printf (option[KRC] ?
+ "(str, len)\n"
+ " register char *str;\n"
+ " register unsigned int len;\n" :
+ option[C] ?
+ "(str, len)\n"
+ " register const char *str;\n"
+ " register unsigned int len;\n" :
+ "(register const char *str, register unsigned int len)\n");
/* Note that when the hash function is called, it has already been verified
that min_key_len <= len <= max_key_len. */
@@ -1442,7 +1441,7 @@ Key_List::output_lookup_array (void)
if (option[DEBUG])
fprintf (stderr,
- "dup_ptr[%d]: hash_value = %d, index = %d, count = %d\n",
+ "dup_ptr[%zd]: hash_value = %d, index = %d, count = %d\n",
dup_ptr - duplicates,
dup_ptr->hash_value, dup_ptr->index, dup_ptr->count);
@@ -1986,17 +1985,16 @@ Key_List::output_lookup_function (void)
if (option[CPLUSPLUS])
printf ("%s::", option.get_class_name ());
printf ("%s ", option.get_function_name ());
- printf (option[KRC] ?
- "(str, len)\n"
- " register char *str;\n"
- " register unsigned int len;\n" :
- option[C] ?
- "(str, len)\n"
- " register const char *str;\n"
- " register unsigned int len;\n" :
- option[ANSIC] | option[CPLUSPLUS] ?
- "(register const char *str, register unsigned int len)\n" :
- "");
+ if (option[KRC] || option[C] || option[ANSIC] || option[CPLUSPLUS])
+ printf (option[KRC] ?
+ "(str, len)\n"
+ " register char *str;\n"
+ " register unsigned int len;\n" :
+ option[C] ?
+ "(str, len)\n"
+ " register const char *str;\n"
+ " register unsigned int len;\n" :
+ "(register const char *str, register unsigned int len)\n");
/* Output the function's body. */
printf ("{\n");
diff --git a/contrib/gperf/src/options.cc b/contrib/gperf/src/options.cc
index d15e21c..7706848 100644
--- a/contrib/gperf/src/options.cc
+++ b/contrib/gperf/src/options.cc
@@ -237,7 +237,7 @@ Options::print_options (void)
{
putchar (*arg);
arg++;
- if (*arg >= 'A' && *arg <= 'Z' || *arg >= 'a' && *arg <= 'z')
+ if ((*arg >= 'A' && *arg <= 'Z') || (*arg >= 'a' && *arg <= 'z'))
{
putchar (*arg);
arg++;
diff --git a/contrib/groff/src/devices/grohtml/post-html.cpp b/contrib/groff/src/devices/grohtml/post-html.cpp
index 1283e06..6834e84 100644
--- a/contrib/groff/src/devices/grohtml/post-html.cpp
+++ b/contrib/groff/src/devices/grohtml/post-html.cpp
@@ -1587,7 +1587,7 @@ void header_desc::write_headings (FILE *f, int force)
buffer += as_string(h);
buffer += '\0';
- fprintf(f, buffer.contents());
+ fputs(buffer.contents(), f);
} else
fputs(g->text_string, f);
h++;
diff --git a/contrib/groff/src/libs/libdriver/input.cpp b/contrib/groff/src/libs/libdriver/input.cpp
index bf8a74e..c2b262a 100644
--- a/contrib/groff/src/libs/libdriver/input.cpp
+++ b/contrib/groff/src/libs/libdriver/input.cpp
@@ -995,7 +995,7 @@ next_command(void)
inline bool
odd(const int n)
{
- return (n & 1 == 1) ? true : false;
+ return ((n & 1) == 1) ? true : false;
}
//////////////////////////////////////////////////////////////////////
diff --git a/contrib/groff/src/roff/troff/mtsm.cpp b/contrib/groff/src/roff/troff/mtsm.cpp
index 630e973..38efc0a 100644
--- a/contrib/groff/src/roff/troff/mtsm.cpp
+++ b/contrib/groff/src/roff/troff/mtsm.cpp
@@ -611,14 +611,16 @@ int state_set::is_in(int_value_state i)
return (intset & (1 << (int)i)) != 0;
}
+// Note: this used to have a bug s.t. it always tested for bit 0 (benl 18/5/11)
int state_set::is_in(units_value_state u)
{
- return (unitsset & (1 << (int)u) != 0);
+ return (unitsset & (1 << (int)u)) != 0;
}
+// Note: this used to have a bug s.t. it always tested for bit 0 (benl 18/5/11)
int state_set::is_in(string_value_state s)
{
- return (stringset & (1 << (int)s) != 0);
+ return (stringset & (1 << (int)s)) != 0;
}
void state_set::add(units_value_state, int n)
diff --git a/contrib/groff/src/roff/troff/node.cpp b/contrib/groff/src/roff/troff/node.cpp
index 0d874d3..0e440b2 100644
--- a/contrib/groff/src/roff/troff/node.cpp
+++ b/contrib/groff/src/roff/troff/node.cpp
@@ -2157,7 +2157,7 @@ void glyph_node::debug_node()
if (c)
fprintf(stderr, "%c", c);
else
- fprintf(stderr, ci->nm.contents());
+ fputs(ci->nm.contents(), stderr);
if (push_state)
fprintf(stderr, " <push_state>");
if (state)
diff --git a/contrib/groff/src/utils/hpftodit/hpftodit.cpp b/contrib/groff/src/utils/hpftodit/hpftodit.cpp
index 5910fb2..d5d524f 100644
--- a/contrib/groff/src/utils/hpftodit/hpftodit.cpp
+++ b/contrib/groff/src/utils/hpftodit/hpftodit.cpp
@@ -870,9 +870,9 @@ output_charset(const int tfm_type)
else if (!all_flag)
continue;
else if (tfm_type == MSL)
- printf(hp_msl_to_ucode_name(charcode));
+ fputs(hp_msl_to_ucode_name(charcode), stdout);
else
- printf(unicode_to_ucode_name(charcode));
+ fputs(unicode_to_ucode_name(charcode), stdout);
printf("\t%d,%d",
scale(char_table[i].width), scale(char_table[i].ascent));
diff --git a/crypto/heimdal/lib/sl/slc-gram.y b/crypto/heimdal/lib/sl/slc-gram.y
index 7d9fadc..d58edfb 100644
--- a/crypto/heimdal/lib/sl/slc-gram.y
+++ b/crypto/heimdal/lib/sl/slc-gram.y
@@ -49,6 +49,7 @@ RCSID("$Id: slc-gram.y 20767 2007-06-01 11:24:52Z lha $");
#include "slc.h"
extern FILE *yyin;
extern struct assignment *assignment;
+extern int yyparse(void);
%}
%union {
diff --git a/etc/rc.d/ipfilter b/etc/rc.d/ipfilter
index fd1e99b..b6bdb4b 100755
--- a/etc/rc.d/ipfilter
+++ b/etc/rc.d/ipfilter
@@ -23,7 +23,7 @@ resync_precmd="$stop_precmd"
resync_cmd="ipfilter_resync"
status_precmd="$stop_precmd"
status_cmd="ipfilter_status"
-extra_commands="reload resync status"
+extra_commands="reload resync"
required_modules="ipl:ipfilter"
ipfilter_start()
diff --git a/etc/rc.d/pf b/etc/rc.d/pf
index 3426e90..3180a2c 100755
--- a/etc/rc.d/pf
+++ b/etc/rc.d/pf
@@ -19,7 +19,7 @@ check_cmd="pf_check"
reload_cmd="pf_reload"
resync_cmd="pf_resync"
status_cmd="pf_status"
-extra_commands="check reload resync status"
+extra_commands="check reload resync"
required_files="$pf_rules"
required_modules="pf"
diff --git a/games/fortune/datfiles/fortunes b/games/fortune/datfiles/fortunes
index 3f0ef02..7f2a7d4 100644
--- a/games/fortune/datfiles/fortunes
+++ b/games/fortune/datfiles/fortunes
@@ -10494,13 +10494,13 @@ Anti-trust laws should be approached with exactly that attitude.
Antonio Antonio
Was tired of living alonio
He thought he would woo Antonio Antonio
-Miss Lucamy Lu, Rode of on his polo ponio
+Miss Lucamy Lu, Rode off on his polo ponio
Miss Lucamy Lucy Molonio. And found the maid
In a bowery shade,
Sitting and knitting alonio.
Antonio Antonio
Said if you will be my ownio
-I'll love tou true Oh nonio Antonio
+I'll love you true Oh nonio Antonio
And buy for you You're far too bleak and bonio
An icery creamry conio. And all that I wish
You singular fish
@@ -10509,7 +10509,7 @@ Antonio Antonio
Uttered a dismal moanio
And went off and hid
Or I'm told that he did
-In the Antartical Zonio.
+In the Antarctical Zonio.
%
Antonym, n.:
The opposite of the word you're trying to think of.
@@ -20232,7 +20232,7 @@ Good-bye. I am leaving because I am bored.
Goodbye, cool world.
%
Goose pimples rose all over me, my hair stood on end, my eyes filled with
-tears of love and gratitude for this greatest of all conquerers of human
+tears of love and gratitude for this greatest of all conquerors of human
misery and shame, and my breath came in little gasps. If I had not known
that the Leader would have scorned such adulation, I might have fallen to
my knees in unashamed worship, but instead I drew myself to attention, raised
@@ -25099,7 +25099,7 @@ intellectual
enlightenment
%
IBM:
- [Internation Business Machines Corp.] Also known as Itty Bitty
+ [International Business Machines Corp.] Also known as Itty Bitty
Machines or The Lawyer's Friend. The dominant force in computer
marketing, having supplied worldwide some 75% of all known hardware
and 10% of all software. To protect itself from the litigious envy
diff --git a/games/fortune/datfiles/fortunes-o.real b/games/fortune/datfiles/fortunes-o.real
index 3e47792..3733ef9 100644
--- a/games/fortune/datfiles/fortunes-o.real
+++ b/games/fortune/datfiles/fortunes-o.real
@@ -7722,7 +7722,7 @@ I wooed a stewed nude in Bermuda,
I was lewd, but my God! she was lewder.
She said it was crude
To be wooed in the nude--
-I persued her, subdued her, and screwed her!
+I pursued her, subdued her, and screwed her!
%
I would like to say, Mister Bunce,
I'm a great connoisseur of hot cunts.
@@ -9044,7 +9044,7 @@ raped, his house burned, and all his cattle rustled. When he told his
distant neighbors about the tragedy, a few of them reported that the only
stranger they had seen in the area for weeks was a tall desperado wearing a
black hat and a red neckerchief.
- The cowboy saddled his fastest horse and set out to find the villian.
+ The cowboy saddled his fastest horse and set out to find the villain.
He searched for months but couldn't catch up with the culprit; in town after
dusty town he was told that a man fitting the description had been there but
had just departed; usually after some heinous crime.
diff --git a/games/fortune/datfiles/fortunes-o.sp.ok b/games/fortune/datfiles/fortunes-o.sp.ok
index 75cff75..e7734c6 100644
--- a/games/fortune/datfiles/fortunes-o.sp.ok
+++ b/games/fortune/datfiles/fortunes-o.sp.ok
@@ -1121,7 +1121,6 @@ pees
penis
pere
Perelman
-persued
pestes
Peteer
Pettigrew
@@ -1600,7 +1599,6 @@ vibrators
vici
Vida
vidi
-villian
virginem
Visme
viziti
diff --git a/games/fortune/datfiles/fortunes.sp.ok b/games/fortune/datfiles/fortunes.sp.ok
index 2ba73ec..02229cd 100644
--- a/games/fortune/datfiles/fortunes.sp.ok
+++ b/games/fortune/datfiles/fortunes.sp.ok
@@ -139,7 +139,6 @@ Anouilh
ANRS
Ansley
answerback
-Antartic
Anthony's
Antonym
Antrim
@@ -375,7 +374,6 @@ Bertolt
Besicovitch
Beslove
Betazoid
-bethumped
Bette
Bevan
BEW
@@ -468,7 +466,6 @@ booing
bookaholic
Booker's
boola
-Boorchi
Boorstin
bootable
Boothe
@@ -576,7 +573,6 @@ Bulwer
bumperless
Bumstead
Bungei
-BURBULATION
Buren
Burggoven
burgled
@@ -623,7 +619,6 @@ Callahan
Callahan's
Callimachus
Camden
-Camelia
Cameron
Camillo
Campbell
@@ -771,7 +766,6 @@ Churchill's
Churchy
Chuzzlewit
CI
-Cianci
Ciardi
cinched
cinema's
@@ -806,7 +800,6 @@ Cochran
cockamamie
Cocteau
Cody
-Cody's
Coevolution
cogito
Cohen's
@@ -826,7 +819,6 @@ Comebacks
Commedia
Commie
CommUNIXque
-compuberty
computatis
Computerdom
computerites
@@ -1077,8 +1069,6 @@ DJ
DMPK
Dobb's
Dobbs
-doberman
-doberperson
Dobie
Doc
Docquier
@@ -1203,7 +1193,6 @@ EINS
Einstein's
Eisley
Elbert
-ELBONICS
Eldridge
electrocommunications
Electrocution
@@ -1264,7 +1253,6 @@ Eschenbach
Escher
esperantisto
Esplandian
-Esser
est
estas
Estes
@@ -1293,7 +1281,6 @@ exhalation
exhibitionists
EXP
expatriated
-extemporanea
extracurricular
Exupery
Exxon's
@@ -1301,7 +1288,6 @@ eyestalks
Eyquem
Ezrin
FAA
-FACISM
Factorials
Fadiman
Fafhrd
@@ -1340,7 +1326,6 @@ Fellgett's
Felton
feminism's
Femme
-FENDERBERG
Fenelon
Fenster
Ferber
@@ -1369,7 +1354,6 @@ fikcio
fiks
filees
filename
-Filgoer's
filigrees
Filkharmonics
Fillmore
@@ -1398,7 +1382,6 @@ flamewars
Flandry
Flannagan's
Flannery
-FLANNISTER
Flappity
flatfoot
flatteries
@@ -1410,7 +1393,6 @@ Flon's
floppity
Florio
floss
-flouride
Flugg's
Flummery
flutterby
@@ -1557,7 +1539,6 @@ Geminis
Genderplex
Genesereth
Genghis
-genlock
genocide
Genter
Geritol
@@ -1605,7 +1586,6 @@ Giuseppe
Glanvill
Glaser
gleekzorp
-GLEEMITES
Glegg
gleknow
Glib's
@@ -2013,7 +1993,6 @@ if's
ifthen
Igmmlptk
Ignatowski
-ignisecond
ihuxw
IIc
III's
@@ -2498,7 +2477,6 @@ Lovin
Lowells
Lowery's
Lowes
-Lownes
LP
LPA
LSD
@@ -2534,7 +2512,6 @@ Ma's
Mabbitt
Mabley
Macaroons
-MacBeth
Maccius
MacDowell
MacDuff
@@ -2621,7 +2598,6 @@ Matz's
Maud
Maud'Dib
Maugham
-Maughm
Maupin
Maureens
Maurois
@@ -2630,7 +2606,6 @@ Maxey
Maxson
May's
Mayorga
-Mårten
MBAs
MBH
MC
@@ -2687,7 +2662,6 @@ Mendelson
mendicants
Mengot
Menninger
-Mensa
Menschen
Meow
meowing
@@ -2715,7 +2689,6 @@ Mickos
microchips
Microcomputing
micrometric
-Microsystem's
Microsystems
MicroVAXes
midgets
@@ -2730,7 +2703,6 @@ milk's
Milkbone
Millay
Milligan
-millihelen
Millikan
Millikan's
millions
@@ -2763,7 +2735,6 @@ Mitford
Mitgong
mittengrabben
mitts
-mittsquinter
MITZIE
Mix's
Miyamoto
@@ -2779,7 +2750,6 @@ modifaiing
Modula
Moebius
Mohandas
-Mohandis
mohmen
Moishe
Molander
@@ -2803,7 +2773,6 @@ Moolah
moonshiner's
Moore's
mopeds
-mophobia
Moping
moralists
Mordecai
@@ -2832,7 +2801,6 @@ Mt
MTA
Muad'dib
muckest
-mucklucks
Mudgeeraba
Mudhead
mudslide
@@ -2888,7 +2856,6 @@ nanohenry
nanometers
Nansen
Napoleon's
-narcolepulacyi
Narnia
Nasium's
Naso
@@ -2909,7 +2876,6 @@ Neantical
Nebuchadnezzar
Nebuchadnezzar's
necesas
-necessitious
NecroSoft
Nehru
Neil's
@@ -2940,7 +2906,6 @@ NF
NFL
Ngdanga
Niagra
-Niccoli
Nicklaus
Nicol
Nicolaides
@@ -3165,7 +3130,6 @@ Pearsall
PECCATOPHOBIA
Pecor's
Pedaeration
-pediddel
Peers's
Pegler
pelted
@@ -3192,7 +3156,6 @@ Personifiers
Petaluma
Petersons
Petr
-petribar
Petronius
Pfeiffer
Pfffttt
@@ -3204,7 +3167,6 @@ Philips
philogyny
phoney
Phooey
-phosflink
Picadilly
Pickard
Pickle's
@@ -3246,7 +3208,6 @@ Pocataligo
Pocatello
Podunk
Pohl's
-Poincair
Poincare's
pointy
Polanski
@@ -3347,7 +3308,6 @@ Pumpernickel
punchline
punning
PUPs
-PURPITATION
Purshottam
PUSHes
pushy
@@ -3551,7 +3511,6 @@ Saberhagen
Sacher's
Sadat
Saddam
-sadoequinecrophilia
Saens
Safford
Safire's
@@ -3605,7 +3564,6 @@ Schickele
Schieffer
schisms
schizophrenics
-schlattwhapper
schlichte
schluerfen
Schmendrick
@@ -3631,7 +3589,6 @@ Scintillae
Scott's
Scoville
SCRBL
-SCRIBLINE
Scrubb
scullery
scurries
@@ -3784,7 +3741,6 @@ somebody'd
something's
Sondheim
Sooooo
-Soren
Sorhed
sort've
sorta
@@ -3799,7 +3755,6 @@ SP
Spacemen
Spaceport
spacewar
-SPAGMUMPS
spake
Spam
spank
@@ -3824,7 +3779,6 @@ springenwerk
Springsteen
sprites
SPSW
-SQUATCHO
squaws
squealers
squrooneg
@@ -3980,7 +3934,6 @@ teepers
telematic
telepath
teleportation
-TELEPRESSION
telepsychology
tempfile
tendrils
@@ -4028,7 +3981,6 @@ tinpot
Tirith
tis
Tiselius
-Titas
tites
TLC
TM
@@ -4060,7 +4012,6 @@ toun
Tourbillon
Toven
trans
-transcendant
transmogrifiers
trapezes
Traub
@@ -4121,7 +4072,6 @@ TYDFS
tyg
typefaces
Tyroon
-tzu
Ubi
UDA
Udall's
@@ -4152,7 +4102,6 @@ Unseld
untechnician
unvoist
Updike
-upharsen
uponst
Urey
Urho
diff --git a/games/fortune/datfiles/freebsd-tips.sp.ok b/games/fortune/datfiles/freebsd-tips.sp.ok
index b543ea0..968f318 100644
--- a/games/fortune/datfiles/freebsd-tips.sp.ok
+++ b/games/fortune/datfiles/freebsd-tips.sp.ok
@@ -45,7 +45,6 @@ misc
natserv
ncal
netcat
-netscape
netstat
newfile
NICs
diff --git a/games/fortune/datfiles/gerrold.limerick b/games/fortune/datfiles/gerrold.limerick
index 8c6d054..f0bbce6 100644
--- a/games/fortune/datfiles/gerrold.limerick
+++ b/games/fortune/datfiles/gerrold.limerick
@@ -3,7 +3,7 @@
%% Copyright David Gerrold, 1984-2000, all rights reserved,
%% used with permission of the author.
%%
-%%© This is the copyright line.
+%%© This is the copyright line.
%%Eighty-nine is the year we assign.
%% These verses are caroled
%% by one David Gerrold.
diff --git a/games/fortune/datfiles/limerick b/games/fortune/datfiles/limerick
index a0344a8..5a92c78 100644
--- a/games/fortune/datfiles/limerick
+++ b/games/fortune/datfiles/limerick
@@ -260,7 +260,7 @@ And white footgear intended for tennis.
%
A dulcet-voiced callgirl named Shedd,
Who's cultured, well-spoken, well-bred,
- Had achieved some reknown
+ Had achieved some renown
For her tone going down--
There's a nice civil tongue in her head.
%
@@ -307,7 +307,7 @@ Had sex with a virgin named Grace.
By bleeding all over his face.
%
A gay young prince from Morocco
-Made love in a manner rococco.
+Made love in a manner rococo.
He painted his penis
To resemble a Venus
And flavored his semen with cocoa.
diff --git a/games/fortune/datfiles/limerick.sp.ok b/games/fortune/datfiles/limerick.sp.ok
index 00f1b42..be7135d 100644
--- a/games/fortune/datfiles/limerick.sp.ok
+++ b/games/fortune/datfiles/limerick.sp.ok
@@ -283,6 +283,7 @@ McTavish
meanie
meanies
meany
+Mensa
mentis
midgets
minimis
@@ -353,11 +354,9 @@ quimmy
quints
ravished
Reims
-reknown
Resounded
retriebrve
Rhyll
-rococco
rogered
Salinas
Sandem
diff --git a/games/fortune/datfiles/startrek.sp.ok b/games/fortune/datfiles/startrek.sp.ok
index 5d1180e..ccca709 100644
--- a/games/fortune/datfiles/startrek.sp.ok
+++ b/games/fortune/datfiles/startrek.sp.ok
@@ -14,7 +14,6 @@ Corbomite
Corby
Daystrom
Deela
-Dehaver
Elaan
Eleen
Eneg
diff --git a/games/fortune/datfiles/zippy.sp.ok b/games/fortune/datfiles/zippy.sp.ok
index 4214fca..b2f3fff 100644
--- a/games/fortune/datfiles/zippy.sp.ok
+++ b/games/fortune/datfiles/zippy.sp.ok
@@ -180,7 +180,7 @@ manicurist
matic
meatball
meltdown
-naugahide
+naugahyde
obstetrician
poindexter
pre
diff --git a/games/morse/morse.c b/games/morse/morse.c
index 6c8ff5f..f0abae39 100644
--- a/games/morse/morse.c
+++ b/games/morse/morse.c
@@ -161,20 +161,20 @@ static const struct morsetab iso8859_1tab[] = {
static const struct morsetab iso8859_7tab[] = {
/*
- * The greek alphabet; you'll need an 8859-7 font in order
+ * The Greek alphabet; you'll need an ISO8859-7 font in order
* to see the actual characters.
* This table does not implement:
* - the special sequences for the seven diphthongs,
* - the punctuation differences.
* Implementing these features would introduce too many
* special-cases in the program's main loop.
- * The diphtong sequences are:
+ * The diphthong sequences are:
* alpha iota .-.-
* alpha upsilon ..--
* epsilon upsilon ---.
* eta upsilon ...-
- * omikron iota ---..
- * omikron upsilon ..-
+ * omicron iota ---..
+ * omicron upsilon ..-
* upsilon iota .---
* The different punctuation symbols are:
* ; ..-.-
@@ -193,10 +193,10 @@ static const struct morsetab iso8859_7tab[] = {
{'è', "-.-."}, /* theta */
{'é', ".."}, /* iota */
{'ß', ".."}, /* iota with acute */
- {'ú', ".."}, /* iota with diairesis */
- {'À', ".."}, /* iota with acute and diairesis */
+ {'ú', ".."}, /* iota with diaeresis */
+ {'À', ".."}, /* iota with acute and diaeresis */
{'ê', "-.-"}, /* kappa */
- {'ë', ".-.."}, /* lamda */
+ {'ë', ".-.."}, /* lambda */
{'ì', "--"}, /* mu */
{'í', "-."}, /* nu */
{'î', "-..-"}, /* xi */
@@ -209,8 +209,8 @@ static const struct morsetab iso8859_7tab[] = {
{'ô', "-"}, /* tau */
{'õ', "-.--"}, /* upsilon */
{'ý', "-.--"}, /* upsilon with acute */
- {'û', "-.--"}, /* upsilon and diairesis */
- {'à', "-.--"}, /* upsilon with acute and diairesis */
+ {'û', "-.--"}, /* upsilon and diaeresis */
+ {'à', "-.--"}, /* upsilon with acute and diaeresis */
{'ö', "..-."}, /* phi */
{'÷', "----"}, /* chi */
{'ø', "--.-"}, /* psi */
@@ -222,29 +222,29 @@ static const struct morsetab iso8859_7tab[] = {
static const struct morsetab koi8rtab[] = {
/*
- * the cyrillic alphabet; you'll need a KOI8R font in order
+ * The Cyrillic alphabet; you'll need a KOI8-R font in order
* to see the actual characters
*/
- {'Á', ".-"}, /* a */
+ {'Á', ".-"}, /* a */
{'Â', "-..."}, /* be */
{'×', ".--"}, /* ve */
{'Ç', "--."}, /* ge */
{'Ä', "-.."}, /* de */
- {'Å', "."}, /* ye */
- {'£', "."}, /* yo, the same as ye */
+ {'Å', "."}, /* ye */
+ {'£', "."}, /* yo, the same as ye */
{'Ö', "...-"}, /* she */
{'Ú', "--.."}, /* ze */
- {'É', ".."}, /* i */
+ {'É', ".."}, /* i */
{'Ê', ".---"}, /* i kratkoye */
{'Ë', "-.-"}, /* ka */
{'Ì', ".-.."}, /* el */
- {'Í', "--"}, /* em */
- {'Î', "-."}, /* en */
+ {'Í', "--"}, /* em */
+ {'Î', "-."}, /* en */
{'Ï', "---"}, /* o */
{'Ð', ".--."}, /* pe */
{'Ò', ".-."}, /* er */
{'Ó', "..."}, /* es */
- {'Ô', "-"}, /* te */
+ {'Ô', "-"}, /* te */
{'Õ', "..-"}, /* u */
{'Æ', "..-."}, /* ef */
{'È', "...."}, /* kha */
@@ -305,9 +305,9 @@ main(int argc, char **argv)
while ((ch = getopt(argc, argv, GETOPTOPTS)) != -1)
switch ((char) ch) {
- case 'c':
- cpm = atoi(optarg);
- break;
+ case 'c':
+ cpm = atoi(optarg);
+ break;
case 'd':
device = optarg;
break;
diff --git a/gnu/usr.bin/Makefile b/gnu/usr.bin/Makefile
index 7eaad9f..0ee257f 100644
--- a/gnu/usr.bin/Makefile
+++ b/gnu/usr.bin/Makefile
@@ -47,12 +47,14 @@ _texinfo= texinfo
_rcs= rcs
.endif
-.if ${MK_TOOLCHAIN} != "no"
+.if ${MK_BINUTILS} != "no"
_binutils= binutils
+.endif
+.if ${MK_GCC} != "no"
_cc= cc
+.endif
.if ${MK_GDB} != "no"
_gdb= gdb
.endif
-.endif
.include <bsd.subdir.mk>
diff --git a/lib/Makefile b/lib/Makefile
index 8e48f4c..9a89886 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -89,7 +89,6 @@ SUBDIR= ${SUBDIR_ORDERED} \
libopie \
libpam \
libpcap \
- ${_libpkg} \
${_libpmc} \
${_libproc} \
libprocstat \
@@ -217,10 +216,6 @@ _libmp= libmp
_libpmc= libpmc
.endif
-.if ${MK_PKGTOOLS} != "no"
-_libpkg= libpkg
-.endif
-
.if ${MK_SENDMAIL} != "no"
_libmilter= libmilter
_libsm= libsm
diff --git a/lib/clang/clang.build.mk b/lib/clang/clang.build.mk
index da53455..f443f1d 100644
--- a/lib/clang/clang.build.mk
+++ b/lib/clang/clang.build.mk
@@ -15,7 +15,7 @@ CFLAGS+= -O1
TARGET_ARCH?= ${MACHINE_ARCH}
# XXX: 8.0, to keep __FreeBSD_cc_version happy
-CFLAGS+=-DLLVM_HOSTTRIPLE=\"${TARGET_ARCH}-undermydesk-freebsd9.0\"
+CFLAGS+=-DLLVM_HOSTTRIPLE=\"${TARGET_ARCH:C/amd64/x86_64/}-unknown-freebsd9.0\"
.ifndef LLVM_REQUIRES_EH
CXXFLAGS+=-fno-exceptions
diff --git a/lib/libc/sys/mq_setattr.2 b/lib/libc/sys/mq_setattr.2
index 2e5a6b1..79e523d 100644
--- a/lib/libc/sys/mq_setattr.2
+++ b/lib/libc/sys/mq_setattr.2
@@ -37,7 +37,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd November 29, 2005
+.Dd May 17, 2011
.Dt MQ_SETATTR 2
.Os
.Sh NAME
@@ -50,7 +50,7 @@
.Ft int
.Fo mq_setattr
.Fa "mqd_t mqdes"
-.Fa "struct mq_attr *restrict mqstat"
+.Fa "const struct mq_attr *restrict mqstat"
.Fa "struct mq_attr *restrict omqstat"
.Fc
.Sh DESCRIPTION
diff --git a/lib/libpkg/Makefile b/lib/libpkg/Makefile
deleted file mode 100644
index 8f2b325..0000000
--- a/lib/libpkg/Makefile
+++ /dev/null
@@ -1,47 +0,0 @@
-# $FreeBSD$
-
-.include <bsd.own.mk>
-
-LIB= pkg
-
-SHLIBDIR?= /usr/lib
-SHLIB_MAJOR= 0
-
-SRCS= deps.c \
- exec.c \
- file.c \
- global.c \
- match.c \
- msg.c \
- pen.c \
- pkgwrap.c \
- plist.c \
- str.c \
- url.c \
- version.c
-INCS= pkg.h
-
-CFLAGS+= -DYES_I_KNOW_THE_API_IS_RUBBISH_AND_IS_DOOMED_TO_CHANGE
-
-DPADD= ${LIBFETCH} ${LIBMD} ${LIBUTIL}
-LDADD= -lfetch -lmd -lutil
-
-.if ${MK_OPENSSL} != "no"
-DPADD+= ${LIBSSL} ${LIBCRYPTO}
-LDADD+= -lssl -lcrypto
-.endif
-
-WARNS?= 3
-
-DATE!= grep LIBPKG_VERSION ${.CURDIR}/pkg.h | sed 's|.*[ ]||'
-
-distfile: clean
- @(cd ${.CURDIR}/..; \
- cp -r libpkg libpkg-${DATE}; \
- tar -czf libpkg/libpkg-${DATE}.tar.gz \
- --exclude .#* --exclude *~ --exclude CVS \
- --exclude .svn --exclude libpkg-*.tar.gz \
- libpkg-${DATE}; \
- rm -rf libpkg-${DATE})
-
-.include <bsd.lib.mk>
diff --git a/lib/libpkg/pkgwrap.c b/lib/libpkg/pkgwrap.c
deleted file mode 100644
index 9c8c0c3..0000000
--- a/lib/libpkg/pkgwrap.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * FreeBSD install - a package for the installation and maintenance
- * of non-core utilities.
- *
- * 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.
- *
- * Maxim Sobolev
- * 8 September 2002
- *
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "pkg.h"
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-extern char **environ;
-
-void
-pkg_wrap(long curver, char **argv)
-{
- FILE* f;
- char ver[9]; /* Format is: 'YYYYMMDD\0' */
- char buffer[FILENAME_MAX+10]; /* Format is: 'YYYYMMDD <path>' */
- char cmd[FILENAME_MAX+5]; /* Format is: '<path> -PPq' */
- char *path, *cp;
- long ptver, lpver;
-
- if (getenv("PKG_NOWRAP") != NULL)
- goto nowrap;
-
- setenv("PKG_NOWRAP", "1", 1);
-
- /* Get alternative location for package tools. */
- if ((f = fopen(PKG_WRAPCONF_FNAME, "r")) == NULL) {
- goto nowrap;
- } else {
- if (get_string(buffer, FILENAME_MAX+9, f) == NULL) {
- goto nowrap;
- } else {
- if ((path = strrchr(buffer, ' ')) == NULL) {
- goto nowrap;
- } else {
- *path++ = '\0';
- }
- }
- }
-
- if ((cp = strrchr(argv[0], '/')) == NULL) {
- cp = argv[0];
- } else {
- cp++;
- }
-
- /* Get version of the other pkg_install and libpkg */
- snprintf(cmd, FILENAME_MAX+10, "%s/%s -PPq", path, cp);
- if ((f = popen(cmd, "r")) == NULL) {
- perror("popen()");
- goto nowrap;
- } else {
- if (get_string(ver, 9, f) == NULL)
- goto nowrap;
- else
- ptver = strtol(ver, NULL, 10);
- if (get_string(ver, 9, f) == NULL)
- goto nowrap;
- else
- lpver = strtol(ver, NULL, 10);
- pclose(f);
- }
-
- if ((lpver >= LIBPKG_VERSION) && (ptver > curver)) {
- snprintf(cmd, FILENAME_MAX, "%s/%s", path, cp);
- execve(cmd, argv, environ);
- }
-
-nowrap:
- unsetenv("PKG_NOWRAP");
-}
diff --git a/lib/libprocstat/Makefile b/lib/libprocstat/Makefile
index e289ef5..e509169 100644
--- a/lib/libprocstat/Makefile
+++ b/lib/libprocstat/Makefile
@@ -12,6 +12,9 @@ SRCS= cd9660.c \
smbfs.c \
udf.c
+VERSION_DEF= ${.CURDIR}/Versions.def
+SYMBOL_MAPS= ${.CURDIR}/Symbol.map
+
INCS= libprocstat.h
CFLAGS+= -I. -I${.CURDIR} -D_KVM_VNODE
SHLIB_MAJOR= 1
diff --git a/lib/libprocstat/Symbol.map b/lib/libprocstat/Symbol.map
new file mode 100644
index 0000000..b5d64d0
--- /dev/null
+++ b/lib/libprocstat/Symbol.map
@@ -0,0 +1,16 @@
+/*
+ * $FreeBSD$
+ */
+FBSD_1.2 {
+ procstat_close;
+ procstat_freefiles;
+ procstat_freeprocs;
+ procstat_get_pipe_info;
+ procstat_get_pts_info;
+ procstat_get_socket_info;
+ procstat_get_vnode_info;
+ procstat_getfiles;
+ procstat_getprocs;
+ procstat_open_kvm;
+ procstat_open_sysctl;
+};
diff --git a/lib/libprocstat/Versions.def b/lib/libprocstat/Versions.def
new file mode 100644
index 0000000..d69f5c9
--- /dev/null
+++ b/lib/libprocstat/Versions.def
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+# This version was first added to 9.0-current.
+FBSD_1.2 {
+};
diff --git a/lib/libprocstat/libprocstat.c b/lib/libprocstat/libprocstat.c
index 95b00d3..384fe73 100644
--- a/lib/libprocstat/libprocstat.c
+++ b/lib/libprocstat/libprocstat.c
@@ -132,6 +132,7 @@ procstat_close(struct procstat *procstat)
assert(procstat);
if (procstat->type == PROCSTAT_KVM)
kvm_close(procstat->kd);
+ free(procstat);
}
struct procstat *
@@ -253,7 +254,7 @@ procstat_getfiles(struct procstat *procstat, struct kinfo_proc *kp, int mmapped)
if (procstat->type == PROCSTAT_SYSCTL)
return (procstat_getfiles_sysctl(procstat, kp, mmapped));
else if (procstat->type == PROCSTAT_KVM)
- return (procstat_getfiles_kvm(procstat, kp, mmapped));
+ return (procstat_getfiles_kvm(procstat, kp, mmapped));
else
return (NULL);
}
diff --git a/lib/libsbuf/Makefile b/lib/libsbuf/Makefile
index 5d96c0e..79d3fe9 100644
--- a/lib/libsbuf/Makefile
+++ b/lib/libsbuf/Makefile
@@ -1,8 +1,13 @@
# $FreeBSD$
-LIB= sbuf
-SHLIBDIR?= /lib
-SRCS= subr_sbuf.c
+LIB= sbuf
+SHLIBDIR?= /lib
+SRCS= subr_sbuf.c
+
+SHLIB_MAJOR = 6
+
+SYMBOL_MAPS= ${.CURDIR}/Symbol.map
+VERSION_DEF= ${.CURDIR}/Version.def
.PATH: ${.CURDIR}/../../sys/kern
diff --git a/lib/libsbuf/Symbol.map b/lib/libsbuf/Symbol.map
new file mode 100644
index 0000000..75af558
--- /dev/null
+++ b/lib/libsbuf/Symbol.map
@@ -0,0 +1,24 @@
+/*
+ * $FreeBSD$
+ */
+
+FBSD_1.2 {
+ sbuf_new;
+ sbuf_clear;
+ sbuf_setpos;
+ sbuf_bcat;
+ sbuf_bcpy;
+ sbuf_cat;
+ sbuf_cpy;
+ sbuf_printf;
+ sbuf_vprintf;
+ sbuf_putc;
+ sbuf_set_drain;
+ sbuf_trim;
+ sbuf_error;
+ sbuf_finish;
+ sbuf_data;
+ sbuf_len;
+ sbuf_done;
+ sbuf_delete;
+};
diff --git a/lib/libsbuf/Version.def b/lib/libsbuf/Version.def
new file mode 100644
index 0000000..ab673d9
--- /dev/null
+++ b/lib/libsbuf/Version.def
@@ -0,0 +1,4 @@
+# $FreeBSD$
+
+FBSD_1.2 {
+};
diff --git a/release/Makefile b/release/Makefile
index 1dde3b1..081cdbf 100644
--- a/release/Makefile
+++ b/release/Makefile
@@ -25,11 +25,11 @@ PORTSDIR?= /usr/ports
DOCDIR?= /usr/doc
RELNOTES_LANG?= en_US.ISO8859-1
-TARGET_ARCH?= ${MACHINE_ARCH}
-.if ${TARGET_ARCH} == ${MACHINE_ARCH}
TARGET?= ${MACHINE}
+.if ${TARGET} == ${MACHINE}
+TARGET_ARCH?= ${MACHINE_ARCH}
.else
-TARGET?= ${TARGET_ARCH}
+TARGET_ARCH?= ${TARGET}
.endif
IMAKE= ${MAKE} TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}
DISTDIR= ${.OBJDIR}/dist
@@ -169,7 +169,9 @@ ftp: packagesystem
mkdir ftp
cp *.txz MANIFEST ftp
-release: obj ${RELEASE_TARGETS}
+release:
+ ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} obj
+ ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${RELEASE_TARGETS}
clean:
chflags -R noschg ${.OBJDIR}
diff --git a/release/generate-release.sh b/release/generate-release.sh
index 62d0528..080512a 100755
--- a/release/generate-release.sh
+++ b/release/generate-release.sh
@@ -63,7 +63,6 @@ if [ -d $2/usr/doc ]; then
fi
chroot $2 make -C /usr/src $MAKE_FLAGS buildworld buildkernel
-chroot $2 make -C /usr/src/release obj
chroot $2 make -C /usr/src/release release
chroot $2 make -C /usr/src/release install DESTDIR=/R
diff --git a/sbin/atacontrol/atacontrol.8 b/sbin/atacontrol/atacontrol.8
index 9ee6c2b..6c44687 100644
--- a/sbin/atacontrol/atacontrol.8
+++ b/sbin/atacontrol/atacontrol.8
@@ -1,5 +1,5 @@
.\"
-.\" Copyright (c) 2000,2001,2002 Søren Schmidt <sos@FreeBSD.org>
+.\" Copyright (c) 2000,2001,2002 Søren Schmidt <sos@FreeBSD.org>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
diff --git a/sbin/atacontrol/atacontrol.c b/sbin/atacontrol/atacontrol.c
index 4354ddf..7b67821 100644
--- a/sbin/atacontrol/atacontrol.c
+++ b/sbin/atacontrol/atacontrol.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2000 - 2006 Søren Schmidt <sos@FreeBSD.org>
+ * Copyright (c) 2000 - 2006 Søren Schmidt <sos@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/sbin/geom/class/part/geom_part.c b/sbin/geom/class/part/geom_part.c
index ed7b8f8..19d1502 100644
--- a/sbin/geom/class/part/geom_part.c
+++ b/sbin/geom/class/part/geom_part.c
@@ -253,13 +253,7 @@ find_provider(struct ggeom *gp, off_t minsector)
bestsector = 0;
LIST_FOREACH(pp, &gp->lg_provider, lg_provider) {
s = find_provcfg(pp, "start");
- if (s == NULL) {
- s = find_provcfg(pp, "offset");
- sector =
- (off_t)strtoimax(s, NULL, 0) / pp->lg_sectorsize;
- } else
- sector = (off_t)strtoimax(s, NULL, 0);
-
+ sector = (off_t)strtoimax(s, NULL, 0);
if (sector < minsector)
continue;
if (bestpp != NULL && sector >= bestsector)
@@ -379,18 +373,9 @@ gpart_autofill_resize(struct gctl_req *req)
errx(EXIT_FAILURE, "invalid partition index");
s = find_provcfg(pp, "start");
- if (s == NULL) {
- s = find_provcfg(pp, "offset");
- start = (off_t)strtoimax(s, NULL, 0) / pp->lg_sectorsize;
- } else
- start = (off_t)strtoimax(s, NULL, 0);
+ start = (off_t)strtoimax(s, NULL, 0);
s = find_provcfg(pp, "end");
- if (s == NULL) {
- s = find_provcfg(pp, "length");
- lba = start +
- (off_t)strtoimax(s, NULL, 0) / pp->lg_sectorsize;
- } else
- lba = (off_t)strtoimax(s, NULL, 0) + 1;
+ lba = (off_t)strtoimax(s, NULL, 0) + 1;
if (lba > last) {
geom_deletetree(&mesh);
@@ -402,12 +387,7 @@ gpart_autofill_resize(struct gctl_req *req)
new_size = ALIGNDOWN(last - start + 1, alignment);
else {
s = find_provcfg(pp, "start");
- if (s == NULL) {
- s = find_provcfg(pp, "offset");
- new_lba =
- (off_t)strtoimax(s, NULL, 0) / pp->lg_sectorsize;
- } else
- new_lba = (off_t)strtoimax(s, NULL, 0);
+ new_lba = (off_t)strtoimax(s, NULL, 0);
/*
* Is there any free space between current and
* next providers?
@@ -436,7 +416,7 @@ gpart_autofill(struct gctl_req *req)
struct gprovider *pp;
off_t first, last, a_first;
off_t size, start, a_lba;
- off_t lba, len, alignment;
+ off_t lba, len, alignment, offset;
uintmax_t grade;
const char *s;
int error, has_size, has_start, has_alignment;
@@ -487,8 +467,6 @@ gpart_autofill(struct gctl_req *req)
error = g_parse_lba(s, pp->lg_sectorsize, &size);
if (error)
errc(EXIT_FAILURE, error, "Invalid size param");
- if (size > alignment)
- size = ALIGNDOWN(size, alignment);
}
s = gctl_get_ascii(req, "start");
@@ -498,27 +476,29 @@ gpart_autofill(struct gctl_req *req)
error = g_parse_lba(s, pp->lg_sectorsize, &start);
if (error)
errc(EXIT_FAILURE, error, "Invalid start param");
- start = ALIGNUP(start, alignment);
}
/* No autofill necessary. */
if (has_size && has_start && !has_alignment)
goto done;
+ /* Adjust parameters to offset value for better alignment */
+ s = find_provcfg(pp, "offset");
+ offset = (s == NULL) ? 0:
+ (off_t)strtoimax(s, NULL, 0) / pp->lg_sectorsize;
+ start = ALIGNUP(start + offset, alignment);
+ if (size + offset > alignment)
+ size = ALIGNDOWN(size + offset, alignment);
+
first = (off_t)strtoimax(find_geomcfg(gp, "first"), NULL, 0);
last = (off_t)strtoimax(find_geomcfg(gp, "last"), NULL, 0);
grade = ~0ULL;
- a_first = ALIGNUP(first, alignment);
- last = ALIGNDOWN(last, alignment);
+ a_first = ALIGNUP(first + offset, alignment);
+ last = ALIGNDOWN(last + offset, alignment);
while ((pp = find_provider(gp, first)) != NULL) {
s = find_provcfg(pp, "start");
- if (s == NULL) {
- s = find_provcfg(pp, "offset");
- lba = (off_t)strtoimax(s, NULL, 0) / pp->lg_sectorsize;
- } else
- lba = (off_t)strtoimax(s, NULL, 0);
-
- a_lba = ALIGNDOWN(lba, alignment);
+ lba = (off_t)strtoimax(s, NULL, 0);
+ a_lba = ALIGNDOWN(lba + offset, alignment);
if (first < a_lba && a_first < a_lba) {
/* Free space [first, lba> */
len = a_lba - a_first;
@@ -543,13 +523,8 @@ gpart_autofill(struct gctl_req *req)
}
s = find_provcfg(pp, "end");
- if (s == NULL) {
- s = find_provcfg(pp, "length");
- first = lba +
- (off_t)strtoimax(s, NULL, 0) / pp->lg_sectorsize;
- } else
- first = (off_t)strtoimax(s, NULL, 0) + 1;
- a_first = ALIGNUP(first, alignment);
+ first = (off_t)strtoimax(s, NULL, 0) + 1;
+ a_first = ALIGNUP(first + offset, alignment);
}
if (a_first <= last) {
/* Free space [first-last] */
@@ -573,12 +548,11 @@ gpart_autofill(struct gctl_req *req)
}
}
}
-
if (grade == ~0ULL) {
geom_deletetree(&mesh);
return (ENOSPC);
}
-
+ start -= offset; /* Return back to real offset */
done:
snprintf(ssize, sizeof(ssize), "%jd", (intmax_t)size);
gctl_change_param(req, "size", -1, ssize);
@@ -625,21 +599,12 @@ gpart_show_geom(struct ggeom *gp, const char *element, int show_providers)
while ((pp = find_provider(gp, first)) != NULL) {
s = find_provcfg(pp, "start");
- if (s == NULL) {
- s = find_provcfg(pp, "offset");
- sector = (off_t)strtoimax(s, NULL, 0) / secsz;
- } else
- sector = (off_t)strtoimax(s, NULL, 0);
+ sector = (off_t)strtoimax(s, NULL, 0);
s = find_provcfg(pp, "end");
- if (s == NULL) {
- s = find_provcfg(pp, "length");
- length = (off_t)strtoimax(s, NULL, 0) / secsz;
- end = sector + length - 1;
- } else {
- end = (off_t)strtoimax(s, NULL, 0);
- length = end - sector + 1;
- }
+ end = (off_t)strtoimax(s, NULL, 0);
+ length = end - sector + 1;
+
s = find_provcfg(pp, "index");
idx = atoi(s);
if (first < sector) {
@@ -782,20 +747,12 @@ gpart_backup(struct gctl_req *req, unsigned int fl __unused)
printf("%s %s\n", scheme, s);
LIST_FOREACH(pp, &gp->lg_provider, lg_provider) {
s = find_provcfg(pp, "start");
- if (s == NULL) {
- s = find_provcfg(pp, "offset");
- sector = (off_t)strtoimax(s, NULL, 0) / secsz;
- } else
- sector = (off_t)strtoimax(s, NULL, 0);
+ sector = (off_t)strtoimax(s, NULL, 0);
s = find_provcfg(pp, "end");
- if (s == NULL) {
- s = find_provcfg(pp, "length");
- length = (off_t)strtoimax(s, NULL, 0) / secsz;
- } else {
- end = (off_t)strtoimax(s, NULL, 0);
- length = end - sector + 1;
- }
+ end = (off_t)strtoimax(s, NULL, 0);
+ length = end - sector + 1;
+
s = find_provcfg(pp, "label");
printf("%-*s %*s %*jd %*jd %s %s\n",
windex, find_provcfg(pp, "index"),
diff --git a/sbin/hastctl/hastctl.c b/sbin/hastctl/hastctl.c
index c4cd6a4..2f8a6eb 100644
--- a/sbin/hastctl/hastctl.c
+++ b/sbin/hastctl/hastctl.c
@@ -341,6 +341,17 @@ control_status(struct nv *nv)
printf(" dirty: %ju (%NB)\n",
(uintmax_t)nv_get_uint64(nv, "dirty%u", ii),
(intmax_t)nv_get_uint64(nv, "dirty%u", ii));
+ printf(" statistics:\n");
+ printf(" reads: %ju\n",
+ (uint64_t)nv_get_uint64(nv, "stat_read%u", ii));
+ printf(" writes: %ju\n",
+ (uint64_t)nv_get_uint64(nv, "stat_write%u", ii));
+ printf(" deletes: %ju\n",
+ (uint64_t)nv_get_uint64(nv, "stat_delete%u", ii));
+ printf(" flushes: %ju\n",
+ (uint64_t)nv_get_uint64(nv, "stat_flush%u", ii));
+ printf(" activemap updates: %ju\n",
+ (uint64_t)nv_get_uint64(nv, "stat_activemap_update%u", ii));
}
return (ret);
}
diff --git a/sbin/hastd/Makefile b/sbin/hastd/Makefile
index e6aff07..1ffd0a2 100644
--- a/sbin/hastd/Makefile
+++ b/sbin/hastd/Makefile
@@ -12,7 +12,7 @@ SRCS+= metadata.c
SRCS+= nv.c
SRCS+= secondary.c
SRCS+= parse.y pjdlog.c primary.c
-SRCS+= proto.c proto_common.c proto_socketpair.c proto_tcp4.c proto_uds.c
+SRCS+= proto.c proto_common.c proto_socketpair.c proto_tcp.c proto_uds.c
SRCS+= rangelock.c
SRCS+= subr.c
SRCS+= token.l
@@ -20,7 +20,7 @@ SRCS+= y.tab.h
MAN= hastd.8 hast.conf.5
NO_WFORMAT=
-CFLAGS+=-DPROTO_TCP4_DEFAULT_PORT=8457
+CFLAGS+=-DPROTO_TCP_DEFAULT_PORT=8457
CFLAGS+=-I${.CURDIR}
CFLAGS+=-DINET
.if ${MK_INET6_SUPPORT} != "no"
diff --git a/sbin/hastd/control.c b/sbin/hastd/control.c
index dce2d53..4d00403 100644
--- a/sbin/hastd/control.c
+++ b/sbin/hastd/control.c
@@ -199,6 +199,16 @@ control_status_worker(struct hast_resource *res, struct nv *nvout,
"extentsize%u", no);
nv_add_uint32(nvout, nv_get_uint32(cnvin, "keepdirty"),
"keepdirty%u", no);
+ nv_add_uint64(nvout, nv_get_uint64(cnvin, "stat_read"),
+ "stat_read%u", no);
+ nv_add_uint64(nvout, nv_get_uint64(cnvin, "stat_write"),
+ "stat_write%u", no);
+ nv_add_uint64(nvout, nv_get_uint64(cnvin, "stat_delete"),
+ "stat_delete%u", no);
+ nv_add_uint64(nvout, nv_get_uint64(cnvin, "stat_flush"),
+ "stat_flush%u", no);
+ nv_add_uint64(nvout, nv_get_uint64(cnvin, "stat_activemap_update"),
+ "stat_activemap_update%u", no);
end:
if (cnvin != NULL)
nv_free(cnvin);
@@ -446,6 +456,13 @@ ctrl_thread(void *arg)
nv_add_uint32(nvout, (uint32_t)0, "keepdirty");
nv_add_uint64(nvout, (uint64_t)0, "dirty");
}
+ nv_add_uint64(nvout, res->hr_stat_read, "stat_read");
+ nv_add_uint64(nvout, res->hr_stat_write, "stat_write");
+ nv_add_uint64(nvout, res->hr_stat_delete,
+ "stat_delete");
+ nv_add_uint64(nvout, res->hr_stat_flush, "stat_flush");
+ nv_add_uint64(nvout, res->hr_stat_activemap_update,
+ "stat_activemap_update");
nv_add_int16(nvout, 0, "error");
break;
case CONTROL_RELOAD:
diff --git a/sbin/hastd/hast.conf.5 b/sbin/hastd/hast.conf.5
index c4d5cc4..f53e6e3 100644
--- a/sbin/hastd/hast.conf.5
+++ b/sbin/hastd/hast.conf.5
@@ -28,7 +28,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 2, 2011
+.Dd May 20, 2011
.Dt HAST.CONF 5
.Os
.Sh NAME
@@ -159,8 +159,14 @@ tcp4://0.0.0.0
tcp4://0.0.0.0:8457
.Ed
.Pp
-The default value is
-.Pa tcp4://0.0.0.0:8457 .
+Multiple listen addresses can be specified.
+By default
+.Nm hastd
+listens on
+.Pa tcp4://0.0.0.0:8457
+and
+.Pa tcp6://[::]:8457
+if kernel supports IPv4 and IPv6 respectively.
.It Ic replication Aq mode
.Pp
Replication mode should be one of the following:
@@ -364,26 +370,35 @@ daemon.
.Sh EXAMPLES
The example configuration file can look as follows:
.Bd -literal -offset indent
+listen tcp://0.0.0.0
+
+on hasta {
+ listen tcp://2001:db8::1/64
+}
+on hastb {
+ listen tcp://2001:db8::2/64
+}
+
resource shared {
local /dev/da0
on hasta {
- remote tcp4://10.0.0.2
+ remote tcp://10.0.0.2
}
on hastb {
- remote tcp4://10.0.0.1
+ remote tcp://10.0.0.1
}
}
resource tank {
on hasta {
local /dev/mirror/tanka
- source tcp4://10.0.0.1
- remote tcp4://10.0.0.2
+ source tcp://10.0.0.1
+ remote tcp://10.0.0.2
}
on hastb {
local /dev/mirror/tankb
- source tcp4://10.0.0.2
- remote tcp4://10.0.0.1
+ source tcp://10.0.0.2
+ remote tcp://10.0.0.1
}
}
.Ed
diff --git a/sbin/hastd/hast.h b/sbin/hastd/hast.h
index df581e3..a62b63a 100644
--- a/sbin/hastd/hast.h
+++ b/sbin/hastd/hast.h
@@ -82,12 +82,13 @@
#define HIO_FLUSH 4
#define HIO_KEEPALIVE 5
-#define HAST_USER "hast"
-#define HAST_TIMEOUT 20
-#define HAST_CONFIG "/etc/hast.conf"
-#define HAST_CONTROL "/var/run/hastctl"
-#define HASTD_LISTEN "tcp4://0.0.0.0:8457"
-#define HASTD_PIDFILE "/var/run/hastd.pid"
+#define HAST_USER "hast"
+#define HAST_TIMEOUT 20
+#define HAST_CONFIG "/etc/hast.conf"
+#define HAST_CONTROL "/var/run/hastctl"
+#define HASTD_LISTEN_TCP4 "tcp4://0.0.0.0:8457"
+#define HASTD_LISTEN_TCP6 "tcp6://[::]:8457"
+#define HASTD_PIDFILE "/var/run/hastd.pid"
/* Default extent size. */
#define HAST_EXTENTSIZE 2097152
@@ -100,6 +101,14 @@
/* Number of seconds to sleep between reconnect retries or keepalive packets. */
#define HAST_KEEPALIVE 10
+struct hastd_listen {
+ /* Address to listen on. */
+ char hl_addr[HAST_ADDRSIZE];
+ /* Protocol-specific data. */
+ struct proto_conn *hl_conn;
+ TAILQ_ENTRY(hastd_listen) hl_next;
+};
+
struct hastd_config {
/* Address to communicate with hastctl(8). */
char hc_controladdr[HAST_ADDRSIZE];
@@ -107,10 +116,8 @@ struct hastd_config {
struct proto_conn *hc_controlconn;
/* Incoming control connection. */
struct proto_conn *hc_controlin;
- /* Address to listen on. */
- char hc_listenaddr[HAST_ADDRSIZE];
- /* Protocol-specific data. */
- struct proto_conn *hc_listenconn;
+ /* List of addresses to listen on. */
+ TAILQ_HEAD(, hastd_listen) hc_listen;
/* List of resources. */
TAILQ_HEAD(, hast_resource) hc_resources;
};
@@ -211,6 +218,17 @@ struct hast_resource {
/* Locked used to synchronize access to hr_amp. */
pthread_mutex_t hr_amp_lock;
+ /* Number of BIO_READ requests. */
+ uint64_t hr_stat_read;
+ /* Number of BIO_WRITE requests. */
+ uint64_t hr_stat_write;
+ /* Number of BIO_DELETE requests. */
+ uint64_t hr_stat_delete;
+ /* Number of BIO_FLUSH requests. */
+ uint64_t hr_stat_flush;
+ /* Number of activemap updates. */
+ uint64_t hr_stat_activemap_update;
+
/* Next resource. */
TAILQ_ENTRY(hast_resource) hr_next;
};
diff --git a/sbin/hastd/hastd.c b/sbin/hastd/hastd.c
index bc5fbc2..6518f0c 100644
--- a/sbin/hastd/hastd.c
+++ b/sbin/hastd/hastd.c
@@ -98,6 +98,7 @@ void
descriptors_cleanup(struct hast_resource *res)
{
struct hast_resource *tres;
+ struct hastd_listen *lst;
TAILQ_FOREACH(tres, &cfg->hc_resources, hr_next) {
if (tres == res) {
@@ -120,7 +121,10 @@ descriptors_cleanup(struct hast_resource *res)
if (cfg->hc_controlin != NULL)
proto_close(cfg->hc_controlin);
proto_close(cfg->hc_controlconn);
- proto_close(cfg->hc_listenconn);
+ TAILQ_FOREACH(lst, &cfg->hc_listen, hl_next) {
+ if (lst->hl_conn != NULL)
+ proto_close(lst->hl_conn);
+ }
(void)pidfile_close(pfh);
hook_fini();
pjdlog_fini();
@@ -462,6 +466,8 @@ hastd_reload(void)
{
struct hastd_config *newcfg;
struct hast_resource *nres, *cres, *tres;
+ struct hastd_listen *nlst, *clst;
+ unsigned int nlisten;
uint8_t role;
pjdlog_info("Reloading configuration...");
@@ -483,19 +489,37 @@ hastd_reload(void)
}
}
/*
- * Check if listen address has changed.
+ * Check if any listen address has changed.
*/
- if (strcmp(cfg->hc_listenaddr, newcfg->hc_listenaddr) != 0) {
- if (proto_server(newcfg->hc_listenaddr,
- &newcfg->hc_listenconn) < 0) {
- pjdlog_errno(LOG_ERR, "Unable to listen on address %s",
- newcfg->hc_listenaddr);
- goto failed;
+ nlisten = 0;
+ TAILQ_FOREACH(nlst, &newcfg->hc_listen, hl_next) {
+ TAILQ_FOREACH(clst, &cfg->hc_listen, hl_next) {
+ if (strcmp(nlst->hl_addr, clst->hl_addr) == 0)
+ break;
+ }
+ if (clst != NULL && clst->hl_conn != NULL) {
+ pjdlog_info("Keep listening on address %s.",
+ nlst->hl_addr);
+ nlst->hl_conn = clst->hl_conn;
+ nlisten++;
+ } else if (proto_server(nlst->hl_addr, &nlst->hl_conn) == 0) {
+ pjdlog_info("Listening on new address %s.",
+ nlst->hl_addr);
+ nlisten++;
+ } else {
+ pjdlog_errno(LOG_WARNING,
+ "Unable to listen on address %s", nlst->hl_addr);
}
}
+ if (nlisten == 0) {
+ pjdlog_error("No addresses to listen on.");
+ goto failed;
+ }
+
+ /* No failures from now on. */
+
/*
- * Only when both control and listen sockets are successfully
- * initialized switch them to new configuration.
+ * Switch to new control socket.
*/
if (newcfg->hc_controlconn != NULL) {
pjdlog_info("Control socket changed from %s to %s.",
@@ -506,15 +530,23 @@ hastd_reload(void)
strlcpy(cfg->hc_controladdr, newcfg->hc_controladdr,
sizeof(cfg->hc_controladdr));
}
- if (newcfg->hc_listenconn != NULL) {
- pjdlog_info("Listen socket changed from %s to %s.",
- cfg->hc_listenaddr, newcfg->hc_listenaddr);
- proto_close(cfg->hc_listenconn);
- cfg->hc_listenconn = newcfg->hc_listenconn;
- newcfg->hc_listenconn = NULL;
- strlcpy(cfg->hc_listenaddr, newcfg->hc_listenaddr,
- sizeof(cfg->hc_listenaddr));
+ /*
+ * Switch to new listen addresses. Close all that were removed.
+ */
+ while ((clst = TAILQ_FIRST(&cfg->hc_listen)) != NULL) {
+ TAILQ_FOREACH(nlst, &newcfg->hc_listen, hl_next) {
+ if (strcmp(nlst->hl_addr, clst->hl_addr) == 0)
+ break;
+ }
+ if (nlst == NULL && clst->hl_conn != NULL) {
+ proto_close(clst->hl_conn);
+ pjdlog_info("No longer listening on address %s.",
+ clst->hl_addr);
+ }
+ TAILQ_REMOVE(&cfg->hc_listen, clst, hl_next);
+ free(clst);
}
+ TAILQ_CONCAT(&cfg->hc_listen, &newcfg->hc_listen, hl_next);
/*
* Stop and remove resources that were removed from the configuration.
@@ -607,8 +639,20 @@ failed:
if (newcfg != NULL) {
if (newcfg->hc_controlconn != NULL)
proto_close(newcfg->hc_controlconn);
- if (newcfg->hc_listenconn != NULL)
- proto_close(newcfg->hc_listenconn);
+ while ((nlst = TAILQ_FIRST(&newcfg->hc_listen)) != NULL) {
+ if (nlst->hl_conn != NULL) {
+ TAILQ_FOREACH(clst, &cfg->hc_listen, hl_next) {
+ if (strcmp(nlst->hl_addr,
+ clst->hl_addr) == 0) {
+ break;
+ }
+ }
+ if (clst == NULL || clst->hl_conn == NULL)
+ proto_close(nlst->hl_conn);
+ }
+ TAILQ_REMOVE(&newcfg->hc_listen, nlst, hl_next);
+ free(nlst);
+ }
yy_config_free(newcfg);
}
pjdlog_warning("Configuration not reloaded.");
@@ -634,7 +678,7 @@ terminate_workers(void)
}
static void
-listen_accept(void)
+listen_accept(struct hastd_listen *lst)
{
struct hast_resource *res;
struct proto_conn *conn;
@@ -646,10 +690,10 @@ listen_accept(void)
pid_t pid;
int status;
- proto_local_address(cfg->hc_listenconn, laddr, sizeof(laddr));
+ proto_local_address(lst->hl_conn, laddr, sizeof(laddr));
pjdlog_debug(1, "Accepting connection to %s.", laddr);
- if (proto_accept(cfg->hc_listenconn, &conn) < 0) {
+ if (proto_accept(lst->hl_conn, &conn) < 0) {
pjdlog_errno(LOG_ERR, "Unable to accept connection %s", laddr);
return;
}
@@ -943,6 +987,7 @@ static void
main_loop(void)
{
struct hast_resource *res;
+ struct hastd_listen *lst;
struct timeval seltimeout;
int fd, maxfd, ret;
time_t lastcheck, now;
@@ -952,9 +997,6 @@ main_loop(void)
seltimeout.tv_sec = REPORT_INTERVAL;
seltimeout.tv_usec = 0;
- pjdlog_info("Started successfully, running protocol version %d.",
- HAST_PROTO_VERSION);
-
for (;;) {
check_signals();
@@ -963,10 +1005,14 @@ main_loop(void)
maxfd = fd = proto_descriptor(cfg->hc_controlconn);
PJDLOG_ASSERT(fd >= 0);
FD_SET(fd, &rfds);
- fd = proto_descriptor(cfg->hc_listenconn);
- PJDLOG_ASSERT(fd >= 0);
- FD_SET(fd, &rfds);
- maxfd = fd > maxfd ? fd : maxfd;
+ TAILQ_FOREACH(lst, &cfg->hc_listen, hl_next) {
+ if (lst->hl_conn == NULL)
+ continue;
+ fd = proto_descriptor(lst->hl_conn);
+ PJDLOG_ASSERT(fd >= 0);
+ FD_SET(fd, &rfds);
+ maxfd = fd > maxfd ? fd : maxfd;
+ }
TAILQ_FOREACH(res, &cfg->hc_resources, hr_next) {
if (res->hr_event == NULL)
continue;
@@ -1014,8 +1060,12 @@ main_loop(void)
if (FD_ISSET(proto_descriptor(cfg->hc_controlconn), &rfds))
control_handle(cfg);
- if (FD_ISSET(proto_descriptor(cfg->hc_listenconn), &rfds))
- listen_accept();
+ TAILQ_FOREACH(lst, &cfg->hc_listen, hl_next) {
+ if (lst->hl_conn == NULL)
+ continue;
+ if (FD_ISSET(proto_descriptor(lst->hl_conn), &rfds))
+ listen_accept(lst);
+ }
TAILQ_FOREACH(res, &cfg->hc_resources, hr_next) {
if (res->hr_event == NULL)
continue;
@@ -1053,6 +1103,7 @@ dummy_sighandler(int sig __unused)
int
main(int argc, char *argv[])
{
+ struct hastd_listen *lst;
const char *pidfile;
pid_t otherpid;
bool foreground;
@@ -1136,10 +1187,12 @@ main(int argc, char *argv[])
cfg->hc_controladdr);
}
/* Listen for remote connections. */
- if (proto_server(cfg->hc_listenaddr, &cfg->hc_listenconn) < 0) {
- KEEP_ERRNO((void)pidfile_remove(pfh));
- pjdlog_exit(EX_OSERR, "Unable to listen on address %s",
- cfg->hc_listenaddr);
+ TAILQ_FOREACH(lst, &cfg->hc_listen, hl_next) {
+ if (proto_server(lst->hl_addr, &lst->hl_conn) < 0) {
+ KEEP_ERRNO((void)pidfile_remove(pfh));
+ pjdlog_exit(EX_OSERR, "Unable to listen on address %s",
+ lst->hl_addr);
+ }
}
if (!foreground) {
@@ -1158,6 +1211,14 @@ main(int argc, char *argv[])
}
}
+ pjdlog_info("Started successfully, running protocol version %d.",
+ HAST_PROTO_VERSION);
+
+ pjdlog_debug(1, "Listening on control address %s.",
+ cfg->hc_controladdr);
+ TAILQ_FOREACH(lst, &cfg->hc_listen, hl_next)
+ pjdlog_info("Listening on address %s.", lst->hl_addr);
+
hook_init();
main_loop();
diff --git a/sbin/hastd/parse.y b/sbin/hastd/parse.y
index a04b686..6e8351d 100644
--- a/sbin/hastd/parse.y
+++ b/sbin/hastd/parse.y
@@ -33,12 +33,14 @@
#include <sys/param.h> /* MAXHOSTNAMELEN */
#include <sys/queue.h>
+#include <sys/socket.h>
#include <sys/sysctl.h>
#include <arpa/inet.h>
#include <assert.h>
#include <err.h>
+#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <sysexits.h>
@@ -59,7 +61,9 @@ static struct hast_resource *curres;
static bool mynode, hadmynode;
static char depth0_control[HAST_ADDRSIZE];
-static char depth0_listen[HAST_ADDRSIZE];
+static char depth0_listen_tcp4[HAST_ADDRSIZE];
+static char depth0_listen_tcp6[HAST_ADDRSIZE];
+static TAILQ_HEAD(, hastd_listen) depth0_listen;
static int depth0_replication;
static int depth0_checksum;
static int depth0_compression;
@@ -114,6 +118,19 @@ isitme(const char *name)
return (0);
}
+static bool
+family_supported(int family)
+{
+ int sock;
+
+ sock = socket(family, SOCK_STREAM, 0);
+ if (sock == -1 && errno == EPROTONOSUPPORT)
+ return (false);
+ if (sock >= 0)
+ (void)close(sock);
+ return (true);
+}
+
static int
node_names(char **namesp)
{
@@ -175,7 +192,11 @@ yy_config_parse(const char *config, bool exitonerror)
depth0_checksum = HAST_CHECKSUM_NONE;
depth0_compression = HAST_COMPRESSION_HOLE;
strlcpy(depth0_control, HAST_CONTROL, sizeof(depth0_control));
- strlcpy(depth0_listen, HASTD_LISTEN, sizeof(depth0_listen));
+ TAILQ_INIT(&depth0_listen);
+ strlcpy(depth0_listen_tcp4, HASTD_LISTEN_TCP4,
+ sizeof(depth0_listen_tcp4));
+ strlcpy(depth0_listen_tcp6, HASTD_LISTEN_TCP6,
+ sizeof(depth0_listen_tcp6));
depth0_exec[0] = '\0';
lconfig = calloc(1, sizeof(*lconfig));
@@ -186,6 +207,7 @@ yy_config_parse(const char *config, bool exitonerror)
return (NULL);
}
+ TAILQ_INIT(&lconfig->hc_listen);
TAILQ_INIT(&lconfig->hc_resources);
yyin = fopen(config, "r");
@@ -214,9 +236,50 @@ yy_config_parse(const char *config, bool exitonerror)
strlcpy(lconfig->hc_controladdr, depth0_control,
sizeof(lconfig->hc_controladdr));
}
- if (lconfig->hc_listenaddr[0] == '\0') {
- strlcpy(lconfig->hc_listenaddr, depth0_listen,
- sizeof(lconfig->hc_listenaddr));
+ if (!TAILQ_EMPTY(&depth0_listen))
+ TAILQ_CONCAT(&lconfig->hc_listen, &depth0_listen, hl_next);
+ if (TAILQ_EMPTY(&lconfig->hc_listen)) {
+ struct hastd_listen *lst;
+
+ if (family_supported(AF_INET)) {
+ lst = calloc(1, sizeof(*lst));
+ if (lst == NULL) {
+ pjdlog_error("Unable to allocate memory for listen address.");
+ yy_config_free(lconfig);
+ if (exitonerror)
+ exit(EX_TEMPFAIL);
+ return (NULL);
+ }
+ (void)strlcpy(lst->hl_addr, depth0_listen_tcp4,
+ sizeof(lst->hl_addr));
+ TAILQ_INSERT_TAIL(&lconfig->hc_listen, lst, hl_next);
+ } else {
+ pjdlog_debug(1,
+ "No IPv4 support in the kernel, not listening on IPv4 address.");
+ }
+ if (family_supported(AF_INET6)) {
+ lst = calloc(1, sizeof(*lst));
+ if (lst == NULL) {
+ pjdlog_error("Unable to allocate memory for listen address.");
+ yy_config_free(lconfig);
+ if (exitonerror)
+ exit(EX_TEMPFAIL);
+ return (NULL);
+ }
+ (void)strlcpy(lst->hl_addr, depth0_listen_tcp6,
+ sizeof(lst->hl_addr));
+ TAILQ_INSERT_TAIL(&lconfig->hc_listen, lst, hl_next);
+ } else {
+ pjdlog_debug(1,
+ "No IPv6 support in the kernel, not listening on IPv6 address.");
+ }
+ if (TAILQ_EMPTY(&lconfig->hc_listen)) {
+ pjdlog_error("No address to listen on.");
+ yy_config_free(lconfig);
+ if (exitonerror)
+ exit(EX_TEMPFAIL);
+ return (NULL);
+ }
}
TAILQ_FOREACH(curres, &lconfig->hc_resources, hr_next) {
assert(curres->hr_provname[0] != '\0');
@@ -274,8 +337,17 @@ yy_config_parse(const char *config, bool exitonerror)
void
yy_config_free(struct hastd_config *config)
{
+ struct hastd_listen *lst;
struct hast_resource *res;
+ while ((lst = TAILQ_FIRST(&depth0_listen)) != NULL) {
+ TAILQ_REMOVE(&depth0_listen, lst, hl_next);
+ free(lst);
+ }
+ while ((lst = TAILQ_FIRST(&config->hc_listen)) != NULL) {
+ TAILQ_REMOVE(&config->hc_listen, lst, hl_next);
+ free(lst);
+ }
while ((res = TAILQ_FIRST(&config->hc_resources)) != NULL) {
TAILQ_REMOVE(&config->hc_resources, res, hr_next);
free(res);
@@ -362,26 +434,30 @@ control_statement: CONTROL STR
listen_statement: LISTEN STR
{
+ struct hastd_listen *lst;
+
+ lst = calloc(1, sizeof(*lst));
+ if (lst == NULL) {
+ pjdlog_error("Unable to allocate memory for listen address.");
+ free($2);
+ return (1);
+ }
+ if (strlcpy(lst->hl_addr, $2, sizeof(lst->hl_addr)) >=
+ sizeof(lst->hl_addr)) {
+ pjdlog_error("listen argument is too long.");
+ free($2);
+ free(lst);
+ return (1);
+ }
switch (depth) {
case 0:
- if (strlcpy(depth0_listen, $2,
- sizeof(depth0_listen)) >=
- sizeof(depth0_listen)) {
- pjdlog_error("listen argument is too long.");
- free($2);
- return (1);
- }
+ TAILQ_INSERT_TAIL(&depth0_listen, lst, hl_next);
break;
case 1:
- if (!mynode)
- break;
- if (strlcpy(lconfig->hc_listenaddr, $2,
- sizeof(lconfig->hc_listenaddr)) >=
- sizeof(lconfig->hc_listenaddr)) {
- pjdlog_error("listen argument is too long.");
- free($2);
- return (1);
- }
+ if (mynode)
+ TAILQ_INSERT_TAIL(&depth0_listen, lst, hl_next);
+ else
+ free(lst);
break;
default:
assert(!"listen at wrong depth level");
diff --git a/sbin/hastd/pjdlog.c b/sbin/hastd/pjdlog.c
index 59d3ffa..16ecf4d 100644
--- a/sbin/hastd/pjdlog.c
+++ b/sbin/hastd/pjdlog.c
@@ -31,8 +31,10 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
+#include <arpa/inet.h>
#include <assert.h>
#include <errno.h>
@@ -103,22 +105,39 @@ pjdlog_printf_render_sockaddr(struct __printf_io *io,
switch (ss->ss_family) {
case AF_INET:
{
+ char addr[INET_ADDRSTRLEN];
const struct sockaddr_in *sin;
- in_addr_t ip;
unsigned int port;
sin = (const struct sockaddr_in *)ss;
- ip = ntohl(sin->sin_addr.s_addr);
port = ntohs(sin->sin_port);
+ if (inet_ntop(ss->ss_family, &sin->sin_addr, addr,
+ sizeof(addr)) == NULL) {
+ PJDLOG_ABORT("inet_ntop(AF_INET) failed: %s.",
+ strerror(errno));
+ }
+ snprintf(buf, sizeof(buf), "%s:%u", addr, port);
+ break;
+ }
+ case AF_INET6:
+ {
+ char addr[INET6_ADDRSTRLEN];
+ const struct sockaddr_in6 *sin;
+ unsigned int port;
- snprintf(buf, sizeof(buf), "%u.%u.%u.%u:%u",
- ((ip >> 24) & 0xff), ((ip >> 16) & 0xff),
- ((ip >> 8) & 0xff), (ip & 0xff), port);
+ sin = (const struct sockaddr_in6 *)ss;
+ port = ntohs(sin->sin6_port);
+ if (inet_ntop(ss->ss_family, &sin->sin6_addr, addr,
+ sizeof(addr)) == NULL) {
+ PJDLOG_ABORT("inet_ntop(AF_INET6) failed: %s.",
+ strerror(errno));
+ }
+ snprintf(buf, sizeof(buf), "[%s]:%u", addr, port);
break;
}
default:
- snprintf(buf, sizeof(buf), "[unsupported family %u]",
- (unsigned int)ss->ss_family);
+ snprintf(buf, sizeof(buf), "[unsupported family %hhu]",
+ ss->ss_family);
break;
}
ret = __printf_out(io, pi, buf, strlen(buf));
diff --git a/sbin/hastd/primary.c b/sbin/hastd/primary.c
index d8eb664..1f6585c 100644
--- a/sbin/hastd/primary.c
+++ b/sbin/hastd/primary.c
@@ -1117,6 +1117,7 @@ ggate_recv_thread(void *arg)
*/
switch (ggio->gctl_cmd) {
case BIO_READ:
+ res->hr_stat_read++;
pjdlog_debug(2,
"ggate_recv: (%p) Moving request to the send queue.",
hio);
@@ -1145,6 +1146,7 @@ ggate_recv_thread(void *arg)
QUEUE_INSERT1(hio, send, ncomp);
break;
case BIO_WRITE:
+ res->hr_stat_write++;
if (res->hr_resuid == 0) {
/*
* This is first write, initialize localcnt and
@@ -1183,12 +1185,21 @@ ggate_recv_thread(void *arg)
mtx_lock(&res->hr_amp_lock);
if (activemap_write_start(res->hr_amp,
ggio->gctl_offset, ggio->gctl_length)) {
+ res->hr_stat_activemap_update++;
(void)hast_activemap_flush(res);
}
mtx_unlock(&res->hr_amp_lock);
/* FALLTHROUGH */
case BIO_DELETE:
case BIO_FLUSH:
+ switch (ggio->gctl_cmd) {
+ case BIO_DELETE:
+ res->hr_stat_delete++;
+ break;
+ case BIO_FLUSH:
+ res->hr_stat_flush++;
+ break;
+ }
pjdlog_debug(2,
"ggate_recv: (%p) Moving request to the send queues.",
hio);
diff --git a/sbin/hastd/proto_tcp4.c b/sbin/hastd/proto_tcp.c
index 555fbe6..8f0f157 100644
--- a/sbin/hastd/proto_tcp4.c
+++ b/sbin/hastd/proto_tcp.c
@@ -1,5 +1,6 @@
/*-
* Copyright (c) 2009-2010 The FreeBSD Foundation
+ * Copyright (c) 2011 Pawel Jakub Dawidek <pawel@dawidek.net>
* All rights reserved.
*
* This software was developed by Pawel Jakub Dawidek under sponsorship from
@@ -51,37 +52,19 @@ __FBSDID("$FreeBSD$");
#include "proto_impl.h"
#include "subr.h"
-#define TCP4_CTX_MAGIC 0x7c441c
-struct tcp4_ctx {
+#define TCP_CTX_MAGIC 0x7c41c
+struct tcp_ctx {
int tc_magic;
- struct sockaddr_in tc_sin;
+ struct sockaddr_storage tc_sa;
int tc_fd;
int tc_side;
-#define TCP4_SIDE_CLIENT 0
-#define TCP4_SIDE_SERVER_LISTEN 1
-#define TCP4_SIDE_SERVER_WORK 2
+#define TCP_SIDE_CLIENT 0
+#define TCP_SIDE_SERVER_LISTEN 1
+#define TCP_SIDE_SERVER_WORK 2
};
-static int tcp4_connect_wait(void *ctx, int timeout);
-static void tcp4_close(void *ctx);
-
-static in_addr_t
-str2ip(const char *str)
-{
- struct hostent *hp;
- in_addr_t ip;
-
- ip = inet_addr(str);
- if (ip != INADDR_NONE) {
- /* It is a valid IP address. */
- return (ip);
- }
- /* Check if it is a valid host name. */
- hp = gethostbyname(str);
- if (hp == NULL)
- return (INADDR_NONE);
- return (((struct in_addr *)(void *)hp->h_addr)->s_addr);
-}
+static int tcp_connect_wait(void *ctx, int timeout);
+static void tcp_close(void *ctx);
/*
* Function converts the given string to unsigned number.
@@ -114,70 +97,106 @@ invalid:
}
static int
-tcp4_addr(const char *addr, int defport, struct sockaddr_in *sinp)
+tcp_addr(const char *addr, int defport, struct sockaddr_storage *sap)
{
- char iporhost[MAXHOSTNAMELEN];
+ char iporhost[MAXHOSTNAMELEN], portstr[6];
+ struct addrinfo hints;
+ struct addrinfo *res;
const char *pp;
+ intmax_t port;
size_t size;
- in_addr_t ip;
+ int error;
if (addr == NULL)
return (-1);
- if (strncasecmp(addr, "tcp4://", 7) == 0)
+ bzero(&hints, sizeof(hints));
+ hints.ai_flags = AI_ADDRCONFIG | AI_NUMERICSERV;
+ hints.ai_family = PF_UNSPEC;
+ hints.ai_socktype = SOCK_STREAM;
+ hints.ai_protocol = IPPROTO_TCP;
+
+ if (strncasecmp(addr, "tcp4://", 7) == 0) {
+ addr += 7;
+ hints.ai_family = PF_INET;
+ } else if (strncasecmp(addr, "tcp6://", 7) == 0) {
addr += 7;
- else if (strncasecmp(addr, "tcp://", 6) == 0)
+ hints.ai_family = PF_INET6;
+ } else if (strncasecmp(addr, "tcp://", 6) == 0) {
addr += 6;
- else {
+ } else {
/*
- * Because TCP4 is the default assume IP or host is given without
+ * Because TCP is the default assume IP or host is given without
* prefix.
*/
}
- sinp->sin_family = AF_INET;
- sinp->sin_len = sizeof(*sinp);
- /* Extract optional port. */
- pp = strrchr(addr, ':');
+ /*
+ * Extract optional port.
+ * There are three cases to consider.
+ * 1. hostname with port, eg. freefall.freebsd.org:8457
+ * 2. IPv4 address with port, eg. 192.168.0.101:8457
+ * 3. IPv6 address with port, eg. [fe80::1]:8457
+ * We discover IPv6 address by checking for two colons and if port is
+ * given, the address has to start with [.
+ */
+ pp = NULL;
+ if (strchr(addr, ':') != strrchr(addr, ':')) {
+ if (addr[0] == '[')
+ pp = strrchr(addr, ':');
+ } else {
+ pp = strrchr(addr, ':');
+ }
if (pp == NULL) {
/* Port not given, use the default. */
- sinp->sin_port = htons(defport);
+ port = defport;
} else {
- intmax_t port;
-
if (numfromstr(pp + 1, 1, 65535, &port) < 0)
return (errno);
- sinp->sin_port = htons(port);
}
+ (void)snprintf(portstr, sizeof(portstr), "%jd", (intmax_t)port);
/* Extract host name or IP address. */
if (pp == NULL) {
size = sizeof(iporhost);
if (strlcpy(iporhost, addr, size) >= size)
return (ENAMETOOLONG);
+ } else if (addr[0] == '[' && pp[-1] == ']') {
+ size = (size_t)(pp - addr - 2 + 1);
+ if (size > sizeof(iporhost))
+ return (ENAMETOOLONG);
+ (void)strlcpy(iporhost, addr + 1, size);
} else {
size = (size_t)(pp - addr + 1);
if (size > sizeof(iporhost))
return (ENAMETOOLONG);
(void)strlcpy(iporhost, addr, size);
}
- /* Convert string (IP address or host name) to in_addr_t. */
- ip = str2ip(iporhost);
- if (ip == INADDR_NONE)
+
+ error = getaddrinfo(iporhost, portstr, &hints, &res);
+ if (error != 0) {
+ pjdlog_debug(1, "getaddrinfo(%s, %s) failed: %s.", iporhost,
+ portstr, gai_strerror(error));
return (EINVAL);
- sinp->sin_addr.s_addr = ip;
+ }
+ if (res == NULL)
+ return (ENOENT);
+
+ memcpy(sap, res->ai_addr, res->ai_addrlen);
+
+ freeaddrinfo(res);
return (0);
}
static int
-tcp4_setup_new(const char *addr, int side, void **ctxp)
+tcp_setup_new(const char *addr, int side, void **ctxp)
{
- struct tcp4_ctx *tctx;
+ struct tcp_ctx *tctx;
int ret, nodelay;
PJDLOG_ASSERT(addr != NULL);
- PJDLOG_ASSERT(side == TCP4_SIDE_CLIENT ||
- side == TCP4_SIDE_SERVER_LISTEN);
+ PJDLOG_ASSERT(side == TCP_SIDE_CLIENT ||
+ side == TCP_SIDE_SERVER_LISTEN);
PJDLOG_ASSERT(ctxp != NULL);
tctx = malloc(sizeof(*tctx));
@@ -185,22 +204,21 @@ tcp4_setup_new(const char *addr, int side, void **ctxp)
return (errno);
/* Parse given address. */
- if ((ret = tcp4_addr(addr, PROTO_TCP4_DEFAULT_PORT,
- &tctx->tc_sin)) != 0) {
+ if ((ret = tcp_addr(addr, PROTO_TCP_DEFAULT_PORT, &tctx->tc_sa)) != 0) {
free(tctx);
return (ret);
}
- PJDLOG_ASSERT(tctx->tc_sin.sin_family != AF_UNSPEC);
+ PJDLOG_ASSERT(tctx->tc_sa.ss_family != AF_UNSPEC);
- tctx->tc_fd = socket(AF_INET, SOCK_STREAM, 0);
+ tctx->tc_fd = socket(tctx->tc_sa.ss_family, SOCK_STREAM, 0);
if (tctx->tc_fd == -1) {
ret = errno;
free(tctx);
return (ret);
}
- PJDLOG_ASSERT(tctx->tc_sin.sin_family != AF_UNSPEC);
+ PJDLOG_ASSERT(tctx->tc_sa.ss_family != AF_UNSPEC);
/* Socket settings. */
nodelay = 1;
@@ -210,20 +228,20 @@ tcp4_setup_new(const char *addr, int side, void **ctxp)
}
tctx->tc_side = side;
- tctx->tc_magic = TCP4_CTX_MAGIC;
+ tctx->tc_magic = TCP_CTX_MAGIC;
*ctxp = tctx;
return (0);
}
static int
-tcp4_setup_wrap(int fd, int side, void **ctxp)
+tcp_setup_wrap(int fd, int side, void **ctxp)
{
- struct tcp4_ctx *tctx;
+ struct tcp_ctx *tctx;
PJDLOG_ASSERT(fd >= 0);
- PJDLOG_ASSERT(side == TCP4_SIDE_CLIENT ||
- side == TCP4_SIDE_SERVER_WORK);
+ PJDLOG_ASSERT(side == TCP_SIDE_CLIENT ||
+ side == TCP_SIDE_SERVER_WORK);
PJDLOG_ASSERT(ctxp != NULL);
tctx = malloc(sizeof(*tctx));
@@ -231,51 +249,51 @@ tcp4_setup_wrap(int fd, int side, void **ctxp)
return (errno);
tctx->tc_fd = fd;
- tctx->tc_sin.sin_family = AF_UNSPEC;
+ tctx->tc_sa.ss_family = AF_UNSPEC;
tctx->tc_side = side;
- tctx->tc_magic = TCP4_CTX_MAGIC;
+ tctx->tc_magic = TCP_CTX_MAGIC;
*ctxp = tctx;
return (0);
}
static int
-tcp4_client(const char *srcaddr, const char *dstaddr, void **ctxp)
+tcp_client(const char *srcaddr, const char *dstaddr, void **ctxp)
{
- struct tcp4_ctx *tctx;
- struct sockaddr_in sin;
+ struct tcp_ctx *tctx;
+ struct sockaddr_storage sa;
int ret;
- ret = tcp4_setup_new(dstaddr, TCP4_SIDE_CLIENT, ctxp);
+ ret = tcp_setup_new(dstaddr, TCP_SIDE_CLIENT, ctxp);
if (ret != 0)
return (ret);
tctx = *ctxp;
if (srcaddr == NULL)
return (0);
- ret = tcp4_addr(srcaddr, 0, &sin);
+ ret = tcp_addr(srcaddr, 0, &sa);
if (ret != 0) {
- tcp4_close(tctx);
+ tcp_close(tctx);
return (ret);
}
- if (bind(tctx->tc_fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
+ if (bind(tctx->tc_fd, (struct sockaddr *)&sa, sa.ss_len) < 0) {
ret = errno;
- tcp4_close(tctx);
+ tcp_close(tctx);
return (ret);
}
return (0);
}
static int
-tcp4_connect(void *ctx, int timeout)
+tcp_connect(void *ctx, int timeout)
{
- struct tcp4_ctx *tctx = ctx;
+ struct tcp_ctx *tctx = ctx;
int error, flags;
PJDLOG_ASSERT(tctx != NULL);
- PJDLOG_ASSERT(tctx->tc_magic == TCP4_CTX_MAGIC);
- PJDLOG_ASSERT(tctx->tc_side == TCP4_SIDE_CLIENT);
+ PJDLOG_ASSERT(tctx->tc_magic == TCP_CTX_MAGIC);
+ PJDLOG_ASSERT(tctx->tc_side == TCP_SIDE_CLIENT);
PJDLOG_ASSERT(tctx->tc_fd >= 0);
- PJDLOG_ASSERT(tctx->tc_sin.sin_family != AF_UNSPEC);
+ PJDLOG_ASSERT(tctx->tc_sa.ss_family != AF_UNSPEC);
PJDLOG_ASSERT(timeout >= -1);
flags = fcntl(tctx->tc_fd, F_GETFL);
@@ -295,8 +313,8 @@ tcp4_connect(void *ctx, int timeout)
return (errno);
}
- if (connect(tctx->tc_fd, (struct sockaddr *)&tctx->tc_sin,
- sizeof(tctx->tc_sin)) == 0) {
+ if (connect(tctx->tc_fd, (struct sockaddr *)&tctx->tc_sa,
+ tctx->tc_sa.ss_len) == 0) {
if (timeout == -1)
return (0);
error = 0;
@@ -309,7 +327,7 @@ tcp4_connect(void *ctx, int timeout)
}
if (timeout == -1)
return (0);
- return (tcp4_connect_wait(ctx, timeout));
+ return (tcp_connect_wait(ctx, timeout));
done:
flags &= ~O_NONBLOCK;
if (fcntl(tctx->tc_fd, F_SETFL, flags) == -1) {
@@ -322,17 +340,17 @@ done:
}
static int
-tcp4_connect_wait(void *ctx, int timeout)
+tcp_connect_wait(void *ctx, int timeout)
{
- struct tcp4_ctx *tctx = ctx;
+ struct tcp_ctx *tctx = ctx;
struct timeval tv;
fd_set fdset;
socklen_t esize;
int error, flags, ret;
PJDLOG_ASSERT(tctx != NULL);
- PJDLOG_ASSERT(tctx->tc_magic == TCP4_CTX_MAGIC);
- PJDLOG_ASSERT(tctx->tc_side == TCP4_SIDE_CLIENT);
+ PJDLOG_ASSERT(tctx->tc_magic == TCP_CTX_MAGIC);
+ PJDLOG_ASSERT(tctx->tc_side == TCP_SIDE_CLIENT);
PJDLOG_ASSERT(tctx->tc_fd >= 0);
PJDLOG_ASSERT(timeout >= 0);
@@ -387,12 +405,12 @@ done:
}
static int
-tcp4_server(const char *addr, void **ctxp)
+tcp_server(const char *addr, void **ctxp)
{
- struct tcp4_ctx *tctx;
+ struct tcp_ctx *tctx;
int ret, val;
- ret = tcp4_setup_new(addr, TCP4_SIDE_SERVER_LISTEN, ctxp);
+ ret = tcp_setup_new(addr, TCP_SIDE_SERVER_LISTEN, ctxp);
if (ret != 0)
return (ret);
@@ -403,17 +421,17 @@ tcp4_server(const char *addr, void **ctxp)
(void)setsockopt(tctx->tc_fd, SOL_SOCKET, SO_REUSEADDR, &val,
sizeof(val));
- PJDLOG_ASSERT(tctx->tc_sin.sin_family != AF_UNSPEC);
+ PJDLOG_ASSERT(tctx->tc_sa.ss_family != AF_UNSPEC);
- if (bind(tctx->tc_fd, (struct sockaddr *)&tctx->tc_sin,
- sizeof(tctx->tc_sin)) < 0) {
+ if (bind(tctx->tc_fd, (struct sockaddr *)&tctx->tc_sa,
+ tctx->tc_sa.ss_len) < 0) {
ret = errno;
- tcp4_close(tctx);
+ tcp_close(tctx);
return (ret);
}
if (listen(tctx->tc_fd, 8) < 0) {
ret = errno;
- tcp4_close(tctx);
+ tcp_close(tctx);
return (ret);
}
@@ -421,25 +439,25 @@ tcp4_server(const char *addr, void **ctxp)
}
static int
-tcp4_accept(void *ctx, void **newctxp)
+tcp_accept(void *ctx, void **newctxp)
{
- struct tcp4_ctx *tctx = ctx;
- struct tcp4_ctx *newtctx;
+ struct tcp_ctx *tctx = ctx;
+ struct tcp_ctx *newtctx;
socklen_t fromlen;
int ret;
PJDLOG_ASSERT(tctx != NULL);
- PJDLOG_ASSERT(tctx->tc_magic == TCP4_CTX_MAGIC);
- PJDLOG_ASSERT(tctx->tc_side == TCP4_SIDE_SERVER_LISTEN);
+ PJDLOG_ASSERT(tctx->tc_magic == TCP_CTX_MAGIC);
+ PJDLOG_ASSERT(tctx->tc_side == TCP_SIDE_SERVER_LISTEN);
PJDLOG_ASSERT(tctx->tc_fd >= 0);
- PJDLOG_ASSERT(tctx->tc_sin.sin_family != AF_UNSPEC);
+ PJDLOG_ASSERT(tctx->tc_sa.ss_family != AF_UNSPEC);
newtctx = malloc(sizeof(*newtctx));
if (newtctx == NULL)
return (errno);
- fromlen = sizeof(tctx->tc_sin);
- newtctx->tc_fd = accept(tctx->tc_fd, (struct sockaddr *)&tctx->tc_sin,
+ fromlen = tctx->tc_sa.ss_len;
+ newtctx->tc_fd = accept(tctx->tc_fd, (struct sockaddr *)&tctx->tc_sa,
&fromlen);
if (newtctx->tc_fd < 0) {
ret = errno;
@@ -447,28 +465,28 @@ tcp4_accept(void *ctx, void **newctxp)
return (ret);
}
- newtctx->tc_side = TCP4_SIDE_SERVER_WORK;
- newtctx->tc_magic = TCP4_CTX_MAGIC;
+ newtctx->tc_side = TCP_SIDE_SERVER_WORK;
+ newtctx->tc_magic = TCP_CTX_MAGIC;
*newctxp = newtctx;
return (0);
}
static int
-tcp4_wrap(int fd, bool client, void **ctxp)
+tcp_wrap(int fd, bool client, void **ctxp)
{
- return (tcp4_setup_wrap(fd,
- client ? TCP4_SIDE_CLIENT : TCP4_SIDE_SERVER_WORK, ctxp));
+ return (tcp_setup_wrap(fd,
+ client ? TCP_SIDE_CLIENT : TCP_SIDE_SERVER_WORK, ctxp));
}
static int
-tcp4_send(void *ctx, const unsigned char *data, size_t size, int fd)
+tcp_send(void *ctx, const unsigned char *data, size_t size, int fd)
{
- struct tcp4_ctx *tctx = ctx;
+ struct tcp_ctx *tctx = ctx;
PJDLOG_ASSERT(tctx != NULL);
- PJDLOG_ASSERT(tctx->tc_magic == TCP4_CTX_MAGIC);
+ PJDLOG_ASSERT(tctx->tc_magic == TCP_CTX_MAGIC);
PJDLOG_ASSERT(tctx->tc_fd >= 0);
PJDLOG_ASSERT(fd == -1);
@@ -476,12 +494,12 @@ tcp4_send(void *ctx, const unsigned char *data, size_t size, int fd)
}
static int
-tcp4_recv(void *ctx, unsigned char *data, size_t size, int *fdp)
+tcp_recv(void *ctx, unsigned char *data, size_t size, int *fdp)
{
- struct tcp4_ctx *tctx = ctx;
+ struct tcp_ctx *tctx = ctx;
PJDLOG_ASSERT(tctx != NULL);
- PJDLOG_ASSERT(tctx->tc_magic == TCP4_CTX_MAGIC);
+ PJDLOG_ASSERT(tctx->tc_magic == TCP_CTX_MAGIC);
PJDLOG_ASSERT(tctx->tc_fd >= 0);
PJDLOG_ASSERT(fdp == NULL);
@@ -489,82 +507,105 @@ tcp4_recv(void *ctx, unsigned char *data, size_t size, int *fdp)
}
static int
-tcp4_descriptor(const void *ctx)
+tcp_descriptor(const void *ctx)
{
- const struct tcp4_ctx *tctx = ctx;
+ const struct tcp_ctx *tctx = ctx;
PJDLOG_ASSERT(tctx != NULL);
- PJDLOG_ASSERT(tctx->tc_magic == TCP4_CTX_MAGIC);
+ PJDLOG_ASSERT(tctx->tc_magic == TCP_CTX_MAGIC);
return (tctx->tc_fd);
}
static bool
-tcp4_address_match(const void *ctx, const char *addr)
+tcp_address_match(const void *ctx, const char *addr)
{
- const struct tcp4_ctx *tctx = ctx;
- struct sockaddr_in sin;
- socklen_t sinlen;
- in_addr_t ip1, ip2;
+ const struct tcp_ctx *tctx = ctx;
+ struct sockaddr_storage sa1, sa2;
+ socklen_t salen;
PJDLOG_ASSERT(tctx != NULL);
- PJDLOG_ASSERT(tctx->tc_magic == TCP4_CTX_MAGIC);
+ PJDLOG_ASSERT(tctx->tc_magic == TCP_CTX_MAGIC);
+
+ if (tcp_addr(addr, PROTO_TCP_DEFAULT_PORT, &sa1) != 0)
+ return (false);
- if (tcp4_addr(addr, PROTO_TCP4_DEFAULT_PORT, &sin) != 0)
+ salen = sizeof(sa2);
+ if (getpeername(tctx->tc_fd, (struct sockaddr *)&sa2, &salen) < 0)
return (false);
- ip1 = sin.sin_addr.s_addr;
- sinlen = sizeof(sin);
- if (getpeername(tctx->tc_fd, (struct sockaddr *)&sin, &sinlen) < 0)
+ if (sa1.ss_family != sa2.ss_family || sa1.ss_len != sa2.ss_len)
return (false);
- ip2 = sin.sin_addr.s_addr;
- return (ip1 == ip2);
+ switch (sa1.ss_family) {
+ case AF_INET:
+ {
+ struct sockaddr_in *sin1, *sin2;
+
+ sin1 = (struct sockaddr_in *)&sa1;
+ sin2 = (struct sockaddr_in *)&sa2;
+
+ return (memcmp(&sin1->sin_addr, &sin2->sin_addr,
+ sizeof(sin1->sin_addr)) == 0);
+ }
+ case AF_INET6:
+ {
+ struct sockaddr_in6 *sin1, *sin2;
+
+ sin1 = (struct sockaddr_in6 *)&sa1;
+ sin2 = (struct sockaddr_in6 *)&sa2;
+
+ return (memcmp(&sin1->sin6_addr, &sin2->sin6_addr,
+ sizeof(sin1->sin6_addr)) == 0);
+ }
+ default:
+ return (false);
+ }
}
static void
-tcp4_local_address(const void *ctx, char *addr, size_t size)
+tcp_local_address(const void *ctx, char *addr, size_t size)
{
- const struct tcp4_ctx *tctx = ctx;
- struct sockaddr_in sin;
- socklen_t sinlen;
+ const struct tcp_ctx *tctx = ctx;
+ struct sockaddr_storage sa;
+ socklen_t salen;
PJDLOG_ASSERT(tctx != NULL);
- PJDLOG_ASSERT(tctx->tc_magic == TCP4_CTX_MAGIC);
+ PJDLOG_ASSERT(tctx->tc_magic == TCP_CTX_MAGIC);
- sinlen = sizeof(sin);
- if (getsockname(tctx->tc_fd, (struct sockaddr *)&sin, &sinlen) < 0) {
+ salen = sizeof(sa);
+ if (getsockname(tctx->tc_fd, (struct sockaddr *)&sa, &salen) < 0) {
PJDLOG_VERIFY(strlcpy(addr, "N/A", size) < size);
return;
}
- PJDLOG_VERIFY(snprintf(addr, size, "tcp4://%S", &sin) < (ssize_t)size);
+ PJDLOG_VERIFY(snprintf(addr, size, "tcp://%S", &sa) < (ssize_t)size);
}
static void
-tcp4_remote_address(const void *ctx, char *addr, size_t size)
+tcp_remote_address(const void *ctx, char *addr, size_t size)
{
- const struct tcp4_ctx *tctx = ctx;
- struct sockaddr_in sin;
- socklen_t sinlen;
+ const struct tcp_ctx *tctx = ctx;
+ struct sockaddr_storage sa;
+ socklen_t salen;
PJDLOG_ASSERT(tctx != NULL);
- PJDLOG_ASSERT(tctx->tc_magic == TCP4_CTX_MAGIC);
+ PJDLOG_ASSERT(tctx->tc_magic == TCP_CTX_MAGIC);
- sinlen = sizeof(sin);
- if (getpeername(tctx->tc_fd, (struct sockaddr *)&sin, &sinlen) < 0) {
+ salen = sizeof(sa);
+ if (getpeername(tctx->tc_fd, (struct sockaddr *)&sa, &salen) < 0) {
PJDLOG_VERIFY(strlcpy(addr, "N/A", size) < size);
return;
}
- PJDLOG_VERIFY(snprintf(addr, size, "tcp4://%S", &sin) < (ssize_t)size);
+ PJDLOG_VERIFY(snprintf(addr, size, "tcp://%S", &sa) < (ssize_t)size);
}
static void
-tcp4_close(void *ctx)
+tcp_close(void *ctx)
{
- struct tcp4_ctx *tctx = ctx;
+ struct tcp_ctx *tctx = ctx;
PJDLOG_ASSERT(tctx != NULL);
- PJDLOG_ASSERT(tctx->tc_magic == TCP4_CTX_MAGIC);
+ PJDLOG_ASSERT(tctx->tc_magic == TCP_CTX_MAGIC);
if (tctx->tc_fd >= 0)
close(tctx->tc_fd);
@@ -572,26 +613,26 @@ tcp4_close(void *ctx)
free(tctx);
}
-static struct proto tcp4_proto = {
- .prt_name = "tcp4",
- .prt_client = tcp4_client,
- .prt_connect = tcp4_connect,
- .prt_connect_wait = tcp4_connect_wait,
- .prt_server = tcp4_server,
- .prt_accept = tcp4_accept,
- .prt_wrap = tcp4_wrap,
- .prt_send = tcp4_send,
- .prt_recv = tcp4_recv,
- .prt_descriptor = tcp4_descriptor,
- .prt_address_match = tcp4_address_match,
- .prt_local_address = tcp4_local_address,
- .prt_remote_address = tcp4_remote_address,
- .prt_close = tcp4_close
+static struct proto tcp_proto = {
+ .prt_name = "tcp",
+ .prt_client = tcp_client,
+ .prt_connect = tcp_connect,
+ .prt_connect_wait = tcp_connect_wait,
+ .prt_server = tcp_server,
+ .prt_accept = tcp_accept,
+ .prt_wrap = tcp_wrap,
+ .prt_send = tcp_send,
+ .prt_recv = tcp_recv,
+ .prt_descriptor = tcp_descriptor,
+ .prt_address_match = tcp_address_match,
+ .prt_local_address = tcp_local_address,
+ .prt_remote_address = tcp_remote_address,
+ .prt_close = tcp_close
};
static __constructor void
-tcp4_ctor(void)
+tcp_ctor(void)
{
- proto_register(&tcp4_proto, true);
+ proto_register(&tcp_proto, true);
}
diff --git a/sbin/hastd/secondary.c b/sbin/hastd/secondary.c
index 58b8f69..1597af8 100644
--- a/sbin/hastd/secondary.c
+++ b/sbin/hastd/secondary.c
@@ -514,6 +514,7 @@ requnpack(struct hast_resource *res, struct hio *hio)
goto end;
}
switch (hio->hio_cmd) {
+ case HIO_FLUSH:
case HIO_KEEPALIVE:
break;
case HIO_READ:
@@ -611,6 +612,20 @@ recv_thread(void *arg)
QUEUE_INSERT(send, hio);
continue;
}
+ switch (hio->hio_cmd) {
+ case HIO_READ:
+ res->hr_stat_read++;
+ break;
+ case HIO_WRITE:
+ res->hr_stat_write++;
+ break;
+ case HIO_DELETE:
+ res->hr_stat_delete++;
+ break;
+ case HIO_FLUSH:
+ res->hr_stat_flush++;
+ break;
+ }
reqlog(LOG_DEBUG, 2, -1, hio,
"recv: (%p) Got request header: ", hio);
if (hio->hio_cmd == HIO_KEEPALIVE) {
diff --git a/sbin/hastd/subr.c b/sbin/hastd/subr.c
index 29f33e7..806338b 100644
--- a/sbin/hastd/subr.c
+++ b/sbin/hastd/subr.c
@@ -224,7 +224,13 @@ drop_privs(struct hast_resource *res)
return (-1);
}
- if (res == NULL || res->hr_role != HAST_ROLE_PRIMARY)
+ /*
+ * Until capsicum doesn't allow ioctl(2) we cannot use it to sandbox
+ * primary and secondary worker processes, as primary uses GGATE
+ * ioctls and secondary uses ioctls to handle BIO_DELETE and BIO_FLUSH.
+ * For now capsicum is only used to sandbox hastctl.
+ */
+ if (res == NULL)
capsicum = (cap_enter() == 0);
else
capsicum = false;
diff --git a/sbin/hastd/token.l b/sbin/hastd/token.l
index 389dfed..67c1e13 100644
--- a/sbin/hastd/token.l
+++ b/sbin/hastd/token.l
@@ -68,7 +68,7 @@ sha256 { DP; return SHA256; }
hole { DP; return HOLE; }
lzf { DP; return LZF; }
[0-9]+ { DP; yylval.num = atoi(yytext); return NUM; }
-[a-zA-Z0-9\.\-_/\:]+ { DP; yylval.str = strdup(yytext); return STR; }
+[a-zA-Z0-9\.\-_/\:\[\]]+ { DP; yylval.str = strdup(yytext); return STR; }
\{ { DP; depth++; return OB; }
\} { DP; depth--; return CB; }
#.*$ /* ignore comments */;
diff --git a/sbin/ifconfig/ifmedia.c b/sbin/ifconfig/ifmedia.c
index 0fd2f2b..0b0daa3 100644
--- a/sbin/ifconfig/ifmedia.c
+++ b/sbin/ifconfig/ifmedia.c
@@ -268,13 +268,9 @@ setmedia(const char *val, int d, int s, const struct afswtch *afp)
subtype = get_media_subtype(IFM_TYPE(ifmr->ifm_ulist[0]), val);
strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
- ifr.ifr_media = (ifmr->ifm_current & ~(IFM_NMASK|IFM_TMASK)) |
+ ifr.ifr_media = (ifmr->ifm_current & IFM_IMASK) |
IFM_TYPE(ifmr->ifm_ulist[0]) | subtype;
- if ((ifr.ifr_media & IFM_TMASK) == 0) {
- ifr.ifr_media &= ~(IFM_GMASK | IFM_OMASK);
- }
-
ifmr->ifm_current = ifr.ifr_media;
callback_register(setifmediacallback, (void *)ifmr);
}
diff --git a/sbin/ipfw/ipfw.8 b/sbin/ipfw/ipfw.8
index a984f70..710996b 100644
--- a/sbin/ipfw/ipfw.8
+++ b/sbin/ipfw/ipfw.8
@@ -565,9 +565,9 @@ if the sysctl variable
is set to 0 (default), one can use
.Xr bpf 4
attached to the
-.Xr ipfw0
+.Li ipfw0
pseudo interface. There is no overhead if no
-.Xr bpf
+.Xr bpf 4
is attached to the pseudo interface.
.Pp
If
diff --git a/sbin/mount_reiserfs/mount_reiserfs.8 b/sbin/mount_reiserfs/mount_reiserfs.8
index a63dfdf..f246475 100644
--- a/sbin/mount_reiserfs/mount_reiserfs.8
+++ b/sbin/mount_reiserfs/mount_reiserfs.8
@@ -1,7 +1,7 @@
.\"
.\" Copyright (c) 1993,1994 Christopher G. Demetriou
.\" Copyright (c) 1999 Semen Ustimenko
-.\" Copyright (c) 2005 Jean-Sébastien Pédron
+.\" Copyright (c) 2005 Jean-Sébastien Pédron
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
diff --git a/sbin/mount_reiserfs/mount_reiserfs.c b/sbin/mount_reiserfs/mount_reiserfs.c
index 5c4e6fc..5fccfbe 100644
--- a/sbin/mount_reiserfs/mount_reiserfs.c
+++ b/sbin/mount_reiserfs/mount_reiserfs.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2005 Jean-Sébastien Pédron
+ * Copyright (c) 2005 Jean-Sébastien Pédron
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/share/examples/diskless/README.TEMPLATING b/share/examples/diskless/README.TEMPLATING
index b094267..28edcae 100644
--- a/share/examples/diskless/README.TEMPLATING
+++ b/share/examples/diskless/README.TEMPLATING
@@ -136,7 +136,7 @@ be useful to set up clients and server for diskless boot.
should never be overwritten by the templating copy.
- TYPICAL CUSTOMIZED CONFIGRATION SOFTLINKS
+ TYPICAL CUSTOMIZED CONFIGURATION SOFTLINKS
The following files typically need to be turned into softlinks
to /conf/ME/<filename>:
@@ -261,9 +261,9 @@ be useful to set up clients and server for diskless boot.
identity.pub
WHEN INITIALLY CONVERTING A TARGET MACHINE TO USE TEMPLATING, ALWAYS
- MAKE A FULL BACKUP OF THE TARGET MACHINE FIRST! You may accidently delete
- files on the target during the conversion due to forgetting to enter
- items into appropriate .cpignore files on the source.
+ MAKE A FULL BACKUP OF THE TARGET MACHINE FIRST! You may accidentally
+ delete files on the target during the conversion due to forgetting to
+ enter items into appropriate .cpignore files on the source.
SECURITY CONSIDERATIONS WITH NFS ROOT EXPORT FROM TEMPLATE MACHINE
SECURITY CONSIDERATIONS WITH NFS USR EXPORT FROM TEMPLATE MACHINE
diff --git a/share/examples/drivers/make_device_driver.sh b/share/examples/drivers/make_device_driver.sh
index 2acea33..d7b9259 100755
--- a/share/examples/drivers/make_device_driver.sh
+++ b/share/examples/drivers/make_device_driver.sh
@@ -485,7 +485,7 @@ ${1}_isa_probe (device_t device)
/*rid*/0, membase, memsize);
/*
* We found one, return non-positive numbers..
- * Return -N if we cant handle it, but not well.
+ * Return -N if we can't handle it, but not well.
* Return -2 if we would LIKE the device.
* Return -1 if we want it a lot.
* Return 0 if we MUST get the device.
diff --git a/share/examples/libvgl/demo.c b/share/examples/libvgl/demo.c
index 781f6a1..c2edfbc 100644
--- a/share/examples/libvgl/demo.c
+++ b/share/examples/libvgl/demo.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 1991-1997 Søren Schmidt
+ * Copyright (c) 1991-1997 Søren Schmidt
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -42,15 +42,15 @@ main(int argc, char **argv)
// set graphics mode, here 320x240 256 colors
// supported modes are (from <sys/consio.h>):
- // SW_VGA_CG320: std VGA 320x200 256 colors
- // SW_VGA_MODEX: Modex VGA 320x240 256 colors
- // SW_VGA_VG640: std VGA 640x480 16 colors
+ // SW_VGA_CG320: std VGA 320x200 256 colors
+ // SW_VGA_MODEX: Modex VGA 320x240 256 colors
+ // SW_VGA_VG640: std VGA 640x480 16 colors
VGLInit(SW_VGA_MODEX);
// initialize mouse and show pointer
VGLMouseInit(VGL_MOUSESHOW);
- // VGLDisplay is a ptr to a struct Bitmap defined and initialized by
+ // VGLDisplay is a ptr to a struct Bitmap defined and initialized by
// libvgl. The Bitmap points directly to screen memory etc.
xsize=VGLDisplay->Xsize;
ysize=VGLDisplay->Ysize;
@@ -61,7 +61,7 @@ main(int argc, char **argv)
VGLClear(tmp, 0);
// fill the screen with colored lines
- for (y=0; y<ysize; y++)
+ for (y=0; y<ysize; y++)
VGLLine(VGLDisplay, 0, y, xsize-1, y, y/2 % 256);
// draw some lines and circles just to show off
@@ -72,7 +72,7 @@ main(int argc, char **argv)
VGLEllipse(VGLDisplay, 256, 0, 256, 256, 63);
VGLEllipse(VGLDisplay, 0, 256, 256, 256, 0);
- // some text is also usefull
+ // some text is also useful
VGLBitmapString(VGLDisplay, 100,100,
"This is text", 63, 0, 0, VGL_DIR_RIGHT);
sleep(2);
@@ -86,7 +86,7 @@ main(int argc, char **argv)
"This is text", 63, 0, 0, VGL_DIR_DOWN);
sleep(2);
- // now show some simple bitblit
+ // now show some simple bitblit
for (i=0; i<256; i++)
for (j=0; j<256; j++)
tmp->Bitmap[i+256*j] = i%16;
@@ -106,12 +106,12 @@ main(int argc, char **argv)
// loop around drawing and copying
while (++i) {
VGLBitmapCopy(VGLDisplay, rand()%xsize, rand()%ysize,
- VGLDisplay, rand()%xsize, rand()%ysize,
- rand()%xsize, rand()%ysize);
+ VGLDisplay, rand()%xsize, rand()%ysize,
+ rand()%xsize, rand()%ysize);
VGLLine(VGLDisplay, rand()%xsize, rand()%ysize,
rand()%xsize, rand()%ysize, rand()%256);
VGLEllipse(VGLDisplay, rand()%xsize, rand()%ysize,
- rand()%xsize/2, rand()%ysize/2, rand()%256);
+ rand()%xsize/2, rand()%ysize/2, rand()%256);
rand();
if (i > 1000) break;
}
@@ -120,4 +120,3 @@ main(int argc, char **argv)
VGLEnd();
return 0;
}
-
diff --git a/share/examples/netgraph/ether.bridge b/share/examples/netgraph/ether.bridge
index 754e760..1e405f2 100644
--- a/share/examples/netgraph/ether.bridge
+++ b/share/examples/netgraph/ether.bridge
@@ -40,7 +40,7 @@ BRIDGE_NAME="bnet0"
# machine as well then set ${LOCAL_IFACES} as well (they may also be
# listed in ${BRIDGE_IFACES}). Of course, any ${LOCAL_IFACE} must
# be ifconfig(8)ured separately. If you don't want a ${LOCAL_IFACE}
-# then assign it the emtpy string.
+# then assign it the empty string.
BRIDGE_IFACES="de0 fxp0 fxp1"
LOCAL_IFACES="fxp0 fxp1"
diff --git a/share/examples/netgraph/frame_relay b/share/examples/netgraph/frame_relay
index 0becb47..53f643f 100644
--- a/share/examples/netgraph/frame_relay
+++ b/share/examples/netgraph/frame_relay
@@ -13,13 +13,13 @@ ngctl mkpeer ${CARD}: frame_relay rawdata downstream
# Link management protocol node.
ngctl mkpeer ${CARD}:rawdata lmi dlci0 auto0
-# Also attach dlci 1023, as it needs both to try autoconfiguring.
+# Also attach dlci 1023, as it needs both to try auto-configuring.
# The Link management protocol is now alive and probing..
ngctl connect ${CARD}:rawdata ${CARD}:rawdata.dlci0 dlci1023 auto1023
# Attach the DLCI(channel) the Telco has assigned you to
-# a node to hadle whatever protocol encapsulation your peer
-# is using. In this case rfc1490 encapsulation.
+# a node to handle whatever protocol encapsulation your peer
+# is using. In this case RFC1490 encapsulation.
ngctl mkpeer ${CARD}:rawdata rfc1490 dlci${DLCI} downstream
@@ -34,8 +34,8 @@ ngctl mkpeer ${CARD}:rawdata.dlci${DLCI} iface inet inet
# Then use ifconfig on interface ng0 as usual
# A variant on this whole set might use the 'name' command to make it more
-# readable. but it doesn't work if you have multiple lines or dlcis
-# e.g.
+# readable. But it doesn't work if you have multiple lines or dlcis
+# e.g.
# ngctl mkpeer ${CARD}: frame_relay rawdata downstream
# ngctl name ${CARD}:rawdata mux
# ngctl mkpeer mux: lmi dlci0 auto0
diff --git a/share/examples/netgraph/ngctl b/share/examples/netgraph/ngctl
index 80a7f22..e7b7cd8 100644
--- a/share/examples/netgraph/ngctl
+++ b/share/examples/netgraph/ngctl
@@ -46,7 +46,7 @@
# Note that we used ngctl's ``name'' command to do this. However,
# the following manually constructed netgraph message would have
-# acomplished the exact same thing:
+# accomplished the exact same thing:
+ msg foo name { name="fred" }
@@ -85,7 +85,7 @@
# As soon as we sent the message, we got back a response. Here
# ngctl is telling us that it received a control message with the
-# NGF_RESP (response) flag set, the reponse was to a prior ``getname''
+# NGF_RESP (response) flag set, the response was to a prior ``getname''
# control message, that the originator was the node addressable
# as ``fred:''. The message arguments field is then displayed to
# us in its ASCII form. In this case, what we get back is a struct
diff --git a/share/examples/netgraph/raw b/share/examples/netgraph/raw
index e0970f3..6dc39ca 100644
--- a/share/examples/netgraph/raw
+++ b/share/examples/netgraph/raw
@@ -6,7 +6,7 @@
CARD=sr0
# create an interface "ng0" and attach it to the sync port.
-# The packets had jolly well better be ip because we are not discriminating.
+# The packets had jolly well better be IP because we are not discriminating.
ngctl mkpeer ${CARD}: iface rawdata inet
# if ng0 already exists, use a CONNECT command instead of a mkpeer. e.g.
diff --git a/share/examples/netgraph/virtual.chain b/share/examples/netgraph/virtual.chain
index 73a12d6..bc6b854 100644
--- a/share/examples/netgraph/virtual.chain
+++ b/share/examples/netgraph/virtual.chain
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (c) 2010, Yavuz Gokirmak
+# Copyright (c) 2010, Yavuz Gokirmak
#
# All rights reserved.
#
@@ -14,7 +14,6 @@
#
# $FreeBSD$
#
-#
# This script creates and connects n router like nodes. Complex wide
# area topologies can be created with the help of script.
#
@@ -25,9 +24,9 @@
#
# 0. Make your own copy of this example script.
#
-# 1. Edit the definition of ${TARGET_TOPOLOGY} to define your virtual
+# 1. Edit the definition of ${TARGET_TOPOLOGY} to define your virtual
# nodes. Virtual topology definition includes node names and their
-# IP address. Target top. sytax: ( name|ip<->name|ip ... )
+# IP address. Target top. syntax: ( name|ip<->name|ip ... )
# Example 1: ( n1|10.0.2.1/30<->n2|10.0.2.2/30 ...)
# Example 2: ( n1|2001:b90::14a/125<->n1|2001:b90::14b/125 ...)
#
@@ -35,21 +34,21 @@
#
# 3. Add necessary static route commands for each virtual node. For
# example assume you have three virtual nodes connected each other
-# llike a chain ( n1 is connected to n2, n2 is connecte to n3 ).
-# In order to estabklish connectivity among these virtual nodes,
+# like a chain (n1 is connected to n2, n2 is connected to n3).
+# In order to establish connectivity among these virtual nodes,
# you have to add default routes to node n1 and node n3. Example
# static route command is:
-# STATIC_ROUTE0="jexec n1 route add -inet default 10.0.2.2"
-# STATIC_ROUTE1="jexec n3 route add -inet default 10.0.2.5"
-# After defining default routes with above format you have to set
+# STATIC_ROUTE0="jexec n1 route add -inet default 10.0.2.2"
+# STATIC_ROUTE1="jexec n3 route add -inet default 10.0.2.5"
+# After defining default routes with above format you have to set
# the total number of static route commands as:
# STATIC_ROUTE_CNT=2
#
# 4. Stop bridging by running this script with "stop" as the
# command line argument.
-#
-# 5. This cript uses a template file in order to carry information
-# between start and stop calls.
+#
+# 5. This script uses a template file in order to carry information
+# between start and stop calls.
# In the start call, the netgraph interfaces and jails are created.
# At the stop phase, all created objects should be removed.
# DO NOT delete the temporary file between the start and stop phases.
@@ -84,8 +83,8 @@
#
#
-# List the names of virtual nodes and their IP addresses. Use ':'
-# character to seperate node name from node IP address and netmask.
+# List the names of virtual nodes and their IP addresses. Use ':'
+# character to separate node name from node IP address and netmask.
TARGET_TOPOLOGY="n1|10.0.2.1/30<->n2|10.0.2.2/30 n2|10.0.2.5/30<->n3|10.0.2.6/30 n2|10.0.2.9/30<->n4|10.0.2.10/30"
STATIC_ROUTE0="jexec n1 route add -inet default 10.0.2.2"
@@ -93,10 +92,10 @@ STATIC_ROUTE1="jexec n3 route add -inet default 10.0.2.5"
STATIC_ROUTE2="jexec n4 route add -inet default 10.0.2.9"
STATIC_ROUTE_CNT=3
-# MAC manifacturer prefix. This can be modified according to needs.
-MAC_PREFIX="00:1d:92"
+# MAC manufacturer prefix. This can be modified according to needs.
+MAC_PREFIX="00:1d:92"
-# Temporary file is important for proper execution of script.
+# Temporary file is important for proper execution of script.
TEMP_FILE="/var/tmp/.virtual.chain.tmp"
# Set root directory for jails to be created.
@@ -112,7 +111,7 @@ JAIL_PATH="/usr/jails/router"
virtual_chain_start() {
# Load netgraph KLD's as necessary.
-
+
for KLD in ng_ether ng_bridge ng_eiface; do
if ! kldstat -v | grep -qw ${KLD}; then
echo -n "Loading ${KLD}.ko... "
@@ -122,21 +121,21 @@ virtual_chain_start() {
done
# Reset all interfaces and jails. If temporary file can not be found
- # script assumes that there is no previous configuration.
-
+ # script assumes that there is no previous configuration.
+
if [ ! -e ${TEMP_FILE} ]; then
echo "No previous configuration(${TEMP_FILE}) found to clean-up."
else
echo -n "Cleaning previous configuration..."
virtual_chain_stop
echo "done"
- fi
+ fi
- # Create temporary file for usage. This file includes generated
+ # Create temporary file for usage. This file includes generated
# interface names and jail names. All bridges, interfaces and jails
- # are written to file while created. In clean-up process written
- # objects are cleaned (i.e removed) from system.
-
+ # are written to file while created. In clean-up process written
+ # objects are cleaned (i.e. removed) from system.
+
if [ -e ${TEMP_FILE} ]; then
touch ${TEMP_FILE}
fi
@@ -144,40 +143,40 @@ virtual_chain_start() {
# Attach other interfaces as well.
for CONNECTION in ${TARGET_TOPOLOGY}; do
-
+
# Virtual connections are defined in TARGET_TOPOLOGY variable.
# They have the form of 'nodeName|IPaddr'. Below two lines split
-
+
PEER1=`echo ${CONNECTION} | awk -F"<->" '{print $1}'`
PEER1_NAME=`echo ${PEER1} | awk -F"|" '{print $1}'`
PEER1_IP=`echo ${PEER1} | awk -F"|" '{print $2}'`
-
+
PEER2=`echo ${CONNECTION} | awk -F"<->" '{print $2}'`
PEER2_NAME=`echo ${PEER2} | awk -F"|" '{print $1}'`
PEER2_IP=`echo ${PEER2} | awk -F"|" '{print $2}'`
# !!! if not created already..
- # Create virtual node (jail) with given name and using
+ # Create virtual node (jail) with given name and using
# JAIL_PATH as root directory for jail.
virtual_chain_create_peer_if_necessary ${PEER1_NAME}
virtual_chain_create_peer_if_necessary ${PEER2_NAME}
# create an interface for peer with the given peer IP. Get interface
- # for future use; you will connect this interface to the other
+ # for future use; you will connect this interface to the other
# peers' (PEER2) interface.
virtual_chain_create_interface_with_ip ${PEER1_NAME} ${PEER1_IP}
PEER1_INTERFACE=${RET_INTERFACE}
-
+
# create an interface for peer with the given peer IP. Get interface
- # for future use; you will connect this interface to the other
+ # for future use; you will connect this interface to the other
# peers' (PEER2) interface.
virtual_chain_create_interface_with_ip ${PEER2_NAME} ${PEER2_IP}
PEER2_INTERFACE=${RET_INTERFACE}
# Connect virtual interface to other interface. Syntax is :
# ngctl connect INTERFACE1: INTERFACE2: ether ether.
-
+
echo -n "Connecting ${PEER1_INTERFACE}:ether to ${PEER2_INTERFACE}:ether..."
ngctl connect ${PEER1_INTERFACE}: ${PEER2_INTERFACE}: ether ether \
|| exit 1
@@ -193,7 +192,7 @@ virtual_chain_start() {
i=`expr $i + 1`
done
- echo "Virtual WAN established succesfully!"
+ echo "Virtual WAN established successfully!"
}
virtual_chain_create_interface_with_ip() {
@@ -201,35 +200,35 @@ virtual_chain_create_interface_with_ip() {
NODE_NAME=$1
NODE_IP=$2
- # Create a ng_eiface object for virtual node. ng_eiface
+ # Create a ng_eiface object for virtual node. ng_eiface
# object has a hook that can be connected to one of bridge
- # links. After creating interface get its automatically
- # generated name for further usage.
+ # links. After creating interface get its automatically
+ # generated name for further usage.
echo "Creating eiface interface for virtual node ${NODE_NAME}."
ngctl mkpeer eiface ether ether
EIFACE=`ngctl l | grep ngeth | tail -n 1| awk '{print $2}'`
- echo "Interface ${EIFACE} is created."
-
+ echo "Interface ${EIFACE} is created."
+
# Write name of the interface to temp file. Clean-up procedure
# will use this name to shutdown interface.
-
+
echo "interface ${EIFACE}" >> ${TEMP_FILE}
- # Move virtual interface to virtual node. Note that Interface
+ # Move virtual interface to virtual node. Note that Interface
# name will not be changed at the end of this movement. Moved
# interface can be seen at the output of ifconfig command in
# jail: 'jexec jailname ifconfig'
- echo "Moving ${EIFACE} to ${NODE_NAME}"
+ echo "Moving ${EIFACE} to ${NODE_NAME}"
ifconfig ${EIFACE} vnet ${NODE_NAME}
-
+
# Make lo0 interface localhost.
jexec ${NODE_NAME} ifconfig lo0 localhost
# Generate a random mac address for virtual interface. First
# three octets can be changed by user. Last three octets are
- # generated randomly.
+ # generated randomly.
M4=`od -An -N2 -i /dev/random | sed -e 's/ //g' | \
awk '{ print $1 % 256 }'`
M5=`od -An -N2 -i /dev/random | sed -e 's/ //g' | \
@@ -244,16 +243,16 @@ virtual_chain_create_interface_with_ip() {
echo "Setting MAC address of ${EIFACE} to '${MAC}'"
jexec ${NODE_NAME} ifconfig ${EIFACE} link $MAC
- # Either IPv4 or IPv6 can be used in this script. Ifconfig
+ # Either IPv4 or IPv6 can be used in this script. Ifconfig
# IP setting syntax differs slightly for two IP versions.
# For version 4 'inet' keyword is used whereas for version 6
# 'inet6' is used. Below line tries to decide which IP version
- # is given and sets IPVER to 'inet' or 'inet6'.
+ # is given and sets IPVER to 'inet' or 'inet6'.
IPVER=`echo ${NODE_IP} | awk -F"." '{ split($4,last,"/"); \
if( NF==4 && $1>0 && $1<256 && $2<256 && $3<256 && \
last[1]<256) print "inet"; else print "inet6"}'`
-
+
# Set IP address of virtual interface in virtual node.
echo "Setting IP address of ${EIFACE} to '${NODE_IP}'"
jexec ${NODE_NAME} ifconfig ${EIFACE} ${IPVER} ${NODE_IP}
@@ -264,23 +263,22 @@ virtual_chain_create_interface_with_ip() {
virtual_chain_create_peer_if_necessary() {
if ! grep -q $1 ${TEMP_FILE} ; then
-
- echo -n "Creating virtual node (jail) ${1}..."
+
+ echo -n "Creating virtual node (jail) ${1}..."
jail -c vnet name=${1} host.hostname=${1} \
- path=${JAIL_PATH} persist
+ path=${JAIL_PATH} persist
jexec ${1} sysctl -w net.inet.ip.forwarding=1
jexec ${1} sysctl -w net.inet6.ip6.forwarding=1
echo "done"
-
- # Write name of the jail to temp file. Clean-up
+
+ # Write name of the jail to temp file. Clean-up
# procedure will use this name to remove jail.
-
+
echo "node ${1}" >> ${TEMP_FILE}
fi
}
-
# Stop routine.
virtual_chain_stop() {
@@ -288,31 +286,31 @@ virtual_chain_stop() {
echo "Nothing to stop! ${TEMP_FILE}: temp file not found"
else
- echo -n "Shutdown bridge interface.."
+ echo -n "Shutdown bridge interface.."
OBJECTS=`cat ${TEMP_FILE} | grep bridge | awk '{print $2}'`
for BRIDGE in ${OBJECTS}; do
ngctl shutdown ${BRIDGE}: >/dev/null 2>&1
done
echo "done"
-
- echo -n "Shutdown all eiface interfaces..."
+
+ echo -n "Shutdown all eiface interfaces..."
OBJECTS=`cat ${TEMP_FILE} | grep interface | awk '{print $2}'`
for INTERFACE in ${OBJECTS}; do
ngctl shutdown ${INTERFACE}: >/dev/null 2>&1
done
echo "done"
-
- echo -n "Removing all jails..."
+
+ echo -n "Removing all jails..."
OBJECTS=`cat ${TEMP_FILE} | grep node | awk '{print $2}'`
for NODE in ${OBJECTS}; do
jail -r ${NODE}
done
echo "done"
-
- echo "Removing tempfile ${TEMP_FILE}"
+
+ echo "Removing tempfile ${TEMP_FILE}"
rm ${TEMP_FILE}
fi
- echo "Virtual LAN objects removed succesfully!"
+ echo "Virtual LAN objects removed successfully!"
}
@@ -324,7 +322,6 @@ virtual_chain_usage() {
# Main entry point.
-
case $# in
1)
case $1 in
@@ -340,7 +337,7 @@ case $# in
echo " temp file not found"
else
virtual_chain_stop
- fi
+ fi
;;
help)
virtual_chain_usage
diff --git a/share/examples/netgraph/virtual.lan b/share/examples/netgraph/virtual.lan
index bce33e1..5e6e3ac 100644
--- a/share/examples/netgraph/virtual.lan
+++ b/share/examples/netgraph/virtual.lan
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (c) 2010, Yavuz Gokirmak
+# Copyright (c) 2010, Yavuz Gokirmak
#
# All rights reserved.
#
@@ -13,13 +13,12 @@
# its use.
#
# $FreeBSD$
-
#
-# This script adds virtual nodes to one of the physical interfaces
+# This script adds virtual nodes to one of the physical interfaces
# visible on your local area network (LAN). Virtual nodes seems real
-# to external observers.
+# to external observers.
# If traceroute is executed to one of virtual nodes, the IP
-# address of the physical interface will not be seen in the output.
+# address of the physical interface will not be seen in the output.
# Virtual nodes are generated via jails and network connections are
# established using ng_bridge(4) and ng_eiface(4) node types.
#
@@ -29,11 +28,11 @@
#
# 1. Edit the definition of ${ETHER_INTF} as described below
# to define your real interface connected to the LAN. Virtual nodes
-# will placed on the same physical network as this interface.
+# will placed on the same physical network as this interface.
#
-# 2. Edit the definition of ${TARGET_TOPOLOGY} to define your virtual
+# 2. Edit the definition of ${TARGET_TOPOLOGY} to define your virtual
# nodes. Virtual topology definition includes node names and their
-# IP address. Target top. sytax: ( node1|ip1/24 node2|ip2/24 ... )
+# IP address. Target top. syntax: ( node1|ip1/24 node2|ip2/24 ... )
# Example 1: ( n1|122.122.122.12/24, n2|122.122.122.13/24 ...)
# Example 2: ( n1|2001:b90::14a/125, n1|2001:b90::14b/125 ...)
#
@@ -41,9 +40,9 @@
#
# 4. Stop bridging by running this script with "stop" as the
# command line argument.
-#
-# 5. This cript uses a template file in order to carry information
-# between start and stop calls.
+#
+# 5. This script uses a template file in order to carry information
+# between start and stop calls.
# In the start call, the netgraph interfaces and jails are created.
# At the stop phase, all created objects should be removed.
# DO NOT delete the temporary file between the start and stop phases.
@@ -80,19 +79,19 @@
#
# Give the name of ethernet interface. Virtual nodes will be seen as
-# local neighbours of this interface.
+# local neighbours of this interface.
ETHER_INTF="em0"
-# List the names of virtual nodes and their IP addresses. Use ':'
-# character to seperate node name from node IP address and netmask.
+# List the names of virtual nodes and their IP addresses. Use ':'
+# character to separate node name from node IP address and netmask.
TARGET_TOPOLOGY="c1|10.0.2.20/24 c2|10.0.2.21/24 c3|10.0.2.22/24"
-# MAC manifacturer prefix. This can be modified according to needs.
-MAC_PREFIX="00:1d:92"
+# MAC manufacturer prefix. This can be modified according to needs.
+MAC_PREFIX="00:1d:92"
-# Temporary file is important for proper execution of script.
+# Temporary file is important for proper execution of script.
TEMP_FILE="/var/tmp/.virtual.lan.tmp"
# Set root directory for jails to be created.
@@ -108,7 +107,7 @@ JAIL_PATH="/usr/jails/node"
virtual_lan_start() {
# Load netgraph KLD's as necessary.
-
+
for KLD in ng_ether ng_bridge ng_eiface; do
if ! kldstat -v | grep -qw ${KLD}; then
echo -n "Loading ${KLD}.ko... "
@@ -118,21 +117,21 @@ virtual_lan_start() {
done
# Reset all interfaces and jails. If temporary file can not be found
- # script assumes that there is no previous configuration.
-
+ # script assumes that there is no previous configuration.
+
if [ ! -e ${TEMP_FILE} ]; then
echo "No previous configuration(${TEMP_FILE}) found to clean-up."
else
echo -n "Cleaning previous configuration..."
virtual_lan_stop
echo "done"
- fi
+ fi
- # Create temporary file for usage. This file includes generated
+ # Create temporary file for usage. This file includes generated
# interface names and jail names. All bridges, interfaces and jails
- # are written to file while created. In clean-up process written
- # objects are cleaned (i.e removed) from system.
-
+ # are written to file while created. In clean-up process written
+ # objects are cleaned (i.e. removed) from system.
+
if [ -e ${TEMP_FILE} ]; then
touch ${TEMP_FILE}
fi
@@ -150,20 +149,20 @@ virtual_lan_start() {
# is used to create a name for new bridge.
BRIDGE_COUNT=`ngctl l | grep bridge | wc -l | sed -e "s/ //g"`
BRIDGE_NAME="bridge${BRIDGE_COUNT}"
-
+
# Create new ng_bridge(4) node and attach it to the ethernet interface.
# Connect ng_ether:lower hook to bridge:link0 when creating bridge and
# connect ng_ether:upper hook to bridge:link1 after bridge name is set.
-
+
echo "Creating bridge interface: ${BRIDGE_NAME}..."
ngctl mkpeer ${ETHER_INTF}: bridge lower link0 || exit 1
ngctl name ${ETHER_INTF}:lower ${BRIDGE_NAME} || exit 1
ngctl connect ${ETHER_INTF}: ${BRIDGE_NAME}: upper link1 || exit 1
echo "Bridge ${BRIDGE_NAME} is created and ${ETHER_INTF} is connected."
-
+
# In the above code block two hooks are connected to bridge interface,
- # therefore LINKNUM is set to 2 indicating total number of connected
- # hooks on the bridge interface.
+ # therefore LINKNUM is set to 2 indicating total number of connected
+ # hooks on the bridge interface.
LINKNUM=2
# Write name of the bridge to temp file. Clean-up procedure will use
@@ -173,7 +172,7 @@ virtual_lan_start() {
# Attach other interfaces as well.
for NODE in ${TARGET_TOPOLOGY}; do
-
+
# Virtual nodes are defined in TARGET_TOPOLOGY variable. They
# have the form of 'nodeName|IPaddr'. Below two lines split
# node definition to get node name and node IP.
@@ -181,48 +180,48 @@ virtual_lan_start() {
NODE_NAME=`echo ${NODE} | awk -F"|" '{print $1}'`
NODE_IP=`echo ${NODE} | awk -F"|" '{print $2}'`
- # Create virtual node (jail) with given name and using
+ # Create virtual node (jail) with given name and using
# JAIL_PATH as root directory for jail.
- echo -n "Creating virtual node (jail) ${NODE_NAME}..."
+ echo -n "Creating virtual node (jail) ${NODE_NAME}..."
jail -c vnet name=${NODE_NAME} host.hostname=${NODE_NAME} \
- path=${JAIL_PATH} persist
+ path=${JAIL_PATH} persist
echo "done"
-
- # Write name of the jail to temp file. Clean-up procedure will
+
+ # Write name of the jail to temp file. Clean-up procedure will
# use this name to remove jail.
-
+
echo "node ${NODE_NAME}" >> ${TEMP_FILE}
- # Create a ng_eiface object for virtual node. ng_eiface
+ # Create a ng_eiface object for virtual node. ng_eiface
# object has a hook that can be connected to one of bridge
- # links. After creating interface get its automatically
- # generated name for further usage.
+ # links. After creating interface get its automatically
+ # generated name for further usage.
echo "Creating eiface interface for virtual node ${NODE_NAME}."
ngctl mkpeer eiface ether ether
EIFACE=`ngctl l | grep ngeth | tail -n 1| awk '{print $2}'`
- echo "Interface ${EIFACE} is created."
-
+ echo "Interface ${EIFACE} is created."
+
# Write name of the interface to temp file. Clean-up procedure
# will use this name to shutdown interface.
-
+
echo "interface ${EIFACE}" >> ${TEMP_FILE}
-
- # Move virtual interface to virtual node. Note that Interface
+
+ # Move virtual interface to virtual node. Note that Interface
# name will not be changed at the end of this movement. Moved
# interface can be seen at the output of ifconfig command in
# jail: 'jexec jailname ifconfig'
- echo "Moving ${EIFACE} to ${NODE_NAME}"
+ echo "Moving ${EIFACE} to ${NODE_NAME}"
ifconfig ${EIFACE} vnet ${NODE_NAME}
-
+
# Make lo0 interface localhost.
jexec ${NODE_NAME} ifconfig lo0 localhost
# Generate a random mac address for virtual interface. First
# three octets can be changed by user. Last three octets are
- # generated randomly.
+ # generated randomly.
M4=`od -An -N2 -i /dev/random | sed -e 's/ //g' | \
awk '{ print $1 % 256 }'`
M5=`od -An -N2 -i /dev/random | sed -e 's/ //g' | \
@@ -237,35 +236,35 @@ virtual_lan_start() {
echo "Setting MAC address of ${EIFACE} to '${MAC}'"
jexec ${NODE_NAME} ifconfig ${EIFACE} link $MAC
- # Either IPv4 or IPv6 can be used in this script. Ifconfig
+ # Either IPv4 or IPv6 can be used in this script. Ifconfig
# IP setting syntax differs slightly for two IP versions.
# For version 4 'inet' keyword is used whereas for version 6
# 'inet6' is used. Below line tries to decide which IP version
- # is given and sets IPVER to 'inet' or 'inet6'.
+ # is given and sets IPVER to 'inet' or 'inet6'.
IPVER=`echo ${NODE_IP} | awk -F"." '{ split($4,last,"/"); \
if( NF==4 && $1>0 && $1<256 && $2<256 && $3<256 && \
last[1]<256) print "inet"; else print "inet6"}'`
-
+
# Set IP address of virtual interface in virtual node.
echo "Setting IP address of ${EIFACE} to '${NODE_IP}'"
jexec ${NODE_NAME} ifconfig ${EIFACE} ${IPVER} ${NODE_IP}
-
+
# Connect virtual interface to bridge interface. Syntax is :
# ngctl connect INTERFACE: BRIDGE: INTERFACE_HOOK EMPTY_LINK.
# Interface has one hook named 'ether' and below line connects
- # ether hook to bridge's first unconnected link.
-
+ # ether hook to bridge's first unconnected link.
+
echo -n "Connecting ${EIFACE}:ether to ${BRIDGE_NAME}:link${LINKNUM}..."
ngctl connect ${EIFACE}: ${BRIDGE_NAME}: ether link${LINKNUM} \
|| exit 1
echo "done"
# Now, bridge has one more connected link thus link count is
- # incremented.
+ # incremented.
LINKNUM=`expr ${LINKNUM} + 1`
done
- echo "Virtual LAN established succesfully!"
+ echo "Virtual LAN established successfully!"
}
@@ -276,31 +275,31 @@ virtual_lan_stop() {
echo "Nothing to stop! ${TEMP_FILE}: temp file not found"
else
- echo -n "Shutdown bridge interface.."
+ echo -n "Shutdown bridge interface.."
OBJECTS=`cat ${TEMP_FILE} | grep bridge | awk '{print $2}'`
for BRIDGE in ${OBJECTS}; do
ngctl shutdown ${BRIDGE}: >/dev/null 2>&1
done
echo "done"
-
- echo -n "Shutdown all eiface interfaces..."
+
+ echo -n "Shutdown all eiface interfaces..."
OBJECTS=`cat ${TEMP_FILE} | grep interface | awk '{print $2}'`
for INTERFACE in ${OBJECTS}; do
ngctl shutdown ${INTERFACE}: >/dev/null 2>&1
done
echo "done"
-
- echo -n "Removing all jails..."
+
+ echo -n "Removing all jails..."
OBJECTS=`cat ${TEMP_FILE} | grep node | awk '{print $2}'`
for NODE in ${OBJECTS}; do
jail -r ${NODE}
done
echo "done"
-
- echo "Removing tempfile ${TEMP_FILE}"
+
+ echo "Removing tempfile ${TEMP_FILE}"
rm ${TEMP_FILE}
fi
- echo "Virtual LAN objects removed succesfully!"
+ echo "Virtual LAN objects removed successfully!"
}
@@ -327,7 +326,7 @@ case $# in
echo " temp file not found"
else
virtual_lan_stop
- fi
+ fi
;;
help)
virtual_lan_usage
diff --git a/share/man/man4/ahci.4 b/share/man/man4/ahci.4
index 144d64b..68aea35 100644
--- a/share/man/man4/ahci.4
+++ b/share/man/man4/ahci.4
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd January 28, 2010
+.Dd May 17, 2011
.Dt AHCI 4
.Os
.Sh NAME
@@ -121,6 +121,15 @@ hardware command queues (up to 32 commands per port),
Native Command Queuing, SATA interface Power Management, device hot-plug
and Message Signaled Interrupts.
.Pp
+Driver supports "LED" enclosure management messages, defined by the AHCI.
+When supported by hardware, it allows to control per-port activity, locate
+and fault LEDs via the
+.Xr led 4
+API for localization and status reporting purposes.
+Supporting AHCI controllers may transmit that information to the backplane
+controllers via SGPIO interface. Backplane controllers interpret received
+statuses in some way (IBPI standard) to report them using present indicators.
+.Pp
AHCI hardware is also supported by ataahci driver from
.Xr ata 4
subsystem.
@@ -135,6 +144,15 @@ subclass 6 (SATA) and programming interface 1 (AHCI).
Also, in cooperation with atamarvell and atajmicron drivers of ata(4),
it supports AHCI part of legacy-PATA + AHCI-SATA combined controllers,
such as JMicron JMB36x and Marvell 88SX61xx.
+.Sh FILES
+.Bl -tag -width /dev/led/ahcich*.locate
+.It Pa /dev/led/ahcich*.act
+activity LED device nodes
+.It Pa /dev/led/ahcich*.fault
+fault LED device nodes
+.It Pa /dev/led/ahcich*.locate
+locate LED device nodes
+.El
.Sh SEE ALSO
.Xr ada 4 ,
.Xr ata 4 ,
diff --git a/share/man/man4/aio.4 b/share/man/man4/aio.4
index 3ea71b0..8e773d9 100644
--- a/share/man/man4/aio.4
+++ b/share/man/man4/aio.4
@@ -1,5 +1,5 @@
.\"-
-.\" Copyright (c) 2002 Dag-Erling Coïdan Smørgrav
+.\" Copyright (c) 2002 Dag-Erling Coïdan Smørgrav
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
diff --git a/share/man/man4/ata.4 b/share/man/man4/ata.4
index 44973f1..05e03d6 100644
--- a/share/man/man4/ata.4
+++ b/share/man/man4/ata.4
@@ -1,5 +1,5 @@
.\"
-.\" Copyright (c) 2003 Søren Schmidt <sos@FreeBSD.org>
+.\" Copyright (c) 2003 Søren Schmidt <sos@FreeBSD.org>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
diff --git a/share/man/man4/atkbd.4 b/share/man/man4/atkbd.4
index 73831c2..0c486e2 100644
--- a/share/man/man4/atkbd.4
+++ b/share/man/man4/atkbd.4
@@ -26,7 +26,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd January 29, 2008
+.Dd May 20, 2011
.Dt ATKBD 4
.Os
.Sh NAME
@@ -176,6 +176,11 @@ When this option is given, the
.Nm
driver will not test the keyboard port during the probe routine.
Some machines hang during boot when this test is performed.
+.It bit 4 (PROBE_TYPEMATIC)
+When this option is given, the
+.Nm
+driver will try to probe the keyboard typematic rate on boot.
+Some machines hang during boot when this test is performed.
.El
.\".Sh FILES
.Sh EXAMPLES
diff --git a/share/man/man4/cc_hd.4 b/share/man/man4/cc_hd.4
index d761539..5c4c2de 100644
--- a/share/man/man4/cc_hd.4
+++ b/share/man/man4/cc_hd.4
@@ -98,7 +98,7 @@ Community Foundation Silicon Valley.
.Sh FUTURE WORK
The Hamilton Institute have recently made some improvements to the algorithm
implemented by this module and have called it Coexistent-TCP (C-TCP).
-The improvments should be evaluated and potentially incorporated into this
+The improvements should be evaluated and potentially incorporated into this
module.
.Sh HISTORY
The
diff --git a/share/man/man4/coretemp.4 b/share/man/man4/coretemp.4
index ce4eb36..efae020 100644
--- a/share/man/man4/coretemp.4
+++ b/share/man/man4/coretemp.4
@@ -1,5 +1,5 @@
.\"-
-.\" Copyright (c) 2007 Dag-Erling Coïdan Smørgrav
+.\" Copyright (c) 2007 Dag-Erling Coïdan Smørgrav
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
diff --git a/share/man/man4/geom_map.4 b/share/man/man4/geom_map.4
index 3d65dcd..6af91be 100644
--- a/share/man/man4/geom_map.4
+++ b/share/man/man4/geom_map.4
@@ -25,12 +25,12 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 5, 2011
+.Dd May 17, 2011
.Dt GEOM_MAP 4
.Os
.Sh NAME
.Nm geom_map
-.Nd "GEOM module that map difined items as separate partitions"
+.Nd "GEOM module that maps defined items as separate partitions"
.Sh SYNOPSIS
To compile this driver into the kernel,
place the following line in your
@@ -41,16 +41,16 @@ kernel configuration file:
.Sh DESCRIPTION
The
.Nm
-framework provides support for mapping defined parts of the media. Basicaly it
-is helpful in the embedded devices where in the one continous flash are loader,
-kernel and rootfs parts. The
+framework provides support for mapping defined parts of the media.
+Basically it is helpful for embedded devices where in the one continuous
+flash are loader, kernel and rootfs parts.
.Nm
-allows making them available as separate parts and protect loader from
-overwriting.
+allows making them available as separate parts and protects the loader from
+being overwritten.
.Pp
At boot time
.Nm
-partitions listed (only with bootverbose) as:
+partitions are listed (only with bootverbose) as:
.Bd -literal -offset indent
MAP: 0x30000, data=0x30000 "/dev/map/bootloader"
MAP: 30000x10000, data=0x10000 "/dev/map/factory"
@@ -62,13 +62,19 @@ MAP: 150000x690000, data=0x690000 "/dev/map/rootfs"
MAP: 7e0000x20000, data=0x20000 "/dev/map/config"
.Ed
.Pp
-Also
+The current
.Nm
-current configuration can be accessible with sysctl's kern.geom.conftxt,
-kern.geom.confxml, kern.geom.confdot or geom map list.
+configuration can be accessed with the following
+.Xr sysctl 8
+nodes:
+.Va kern.geom.conftxt , kern.geom.confxml ,
+and
+.Va kern.geom.confdot
+or by using
+.Dq Li "geom map list" .
.Bd -literal -offset indent
-# sysctl kern.geom.conftxt
-kern.geom.conftxt: 0 MD md0 10485760 512 u 0 s 512 f 0 fs 0 l 10485760 t malloc
+# sysctl -n kern.geom.conftxt
+0 MD md0 10485760 512 u 0 s 512 f 0 fs 0 l 10485760 t malloc
0 DISK cfid0 8388608 4 hd 0 sc 0
1 MAP map/config 131072 4 i 5 o 8257536 entry 0 dsize 131072
1 MAP map/rootfs 6881280 4 i 4 o 1376256 entry 0 dsize 6881280
@@ -79,49 +85,55 @@ kern.geom.conftxt: 0 MD md0 10485760 512 u 0 s 512 f 0 fs 0 l 10485760 t malloc
1 MAP map/bootloader 196608 4 i 0 o 0 entry 0 dsize 196608
.Ed
.Pp
-Driver configuration can be done in device hints file. List of used parameters:
+Driver configuration can be done in
+.Xr device.hints 5 .
+List of used parameters:
.Bl -tag -width indent
-.It Fa at
+.It Va at
select media to attach
-.It Fa name
-name of partiton (will create device /dev/map/that_name)
-.It Fa start
+.It Va name
+name of partition (will create device
+.Pa /dev/map/ Ns Ar that_name )
+.It Va start
offset from the beginning of the parent media to start of the mapped partition.
-This field can also have special value
-"search:searchstart:searchstep:searchkey", where:
+This field can also have a special value
+.Qq Li search: Ns Ar searchstart Ns Li : Ns Ar searchstep Ns Li : Ns Ar searchkey ,
+where:
.Bl -tag -width indent
-.It Fa searchstart
+.It Ar searchstart
offset from the beginning of the parent media where search will be started
-.It Fa searchstep
+.It Ar searchstep
value of the increment used while searching for the partition boundary markers
-.It Fa searchkey
-key which will be used to find partition boundary markers. Wildcard "." char
-can be used to match any char on that position
+.It Ar searchkey
+key which will be used to find partition boundary markers.
+The wildcard
+.Ql .\&
+can be used to match any character on that position
.El
-.It Fa end
-offset from the beginning of the parent media to end of the mapped partition.
-This field can also have special value
-"search:searchstart:searchstep:searchkey", look "start" for details.
-.It Fa offset
-offset where the data of mapped partition begins
+.It Va end
+offset from the beginning of the parent media to the end of the mapped partition.
+This field can also have the special value
+.Qq Li search: Ns Ar searchstart Ns Li : Ns Ar searchstep Ns Li : Ns Ar searchkey ,
+as described above.
+.It Va offset
+offset where the data of the mapped partition begins
.El
.Pp
-Each record contains start address(bytes) from the media begin, size(bytes),
-offset where the data of mapped partition begins, and the name of new device.
+Each record contains the start address (in bytes) from the media begin, size
+(in bytes), offset where the data of mapped partition begins, and the name of
+new device.
.Bd -literal -offset indent
MAP: 150000x690000, data=0x690000 "/dev/map/rootfs"
.Ed
.Bd -literal
-00150000 - begin address
+00150000 - start address
00690000 - size
00000000 - data begin from zero offset
00690000 - data size
"map/rootfs" - new media will be accessible via /dev/map/rootfs dev.
.Ed
.Sh EXAMPLES
-.Pp
-.Bl -bullet -compact
-If we need to implement layout shown above, we need to define the folowing
+If we need to implement layout shown above, we need to define the following
hints:
.Bd -literal -offset indent
hint.map.0.at="cfid0"
@@ -129,10 +141,17 @@ hint.map.0.start=0x00000000
hint.map.0.end=0x00030000
hint.map.0.name="bootloader"
hint.map.0.readonly=1
-
.Ed
-define "/dev/map/bootloader" at disk "cfid0" starting at 0x00000000 and end
-0x00030000, also marked as readonly.
+.Pp
+This defines
+.Pa /dev/map/bootloader
+at disk
+.Pa cfid0
+starting at
+.Li 0x00000000
+and ending at
+.Li 0x00030000 ,
+it is also marked as readonly.
.Bd -literal -offset indent
hint.map.1.at="cfid0"
hint.map.1.start=0x00030000
@@ -148,13 +167,28 @@ hint.map.3.at="cfid0"
hint.map.3.name="kernel"
hint.map.3.start=0x00040000
hint.map.3.end="search:0x00100000:0x10000:.!/bin/sh"
-
.Ed
-define "/dev/map/kernel" at disk "cfid0" starting at 0x00040000, but end
-position must be searched by the key ".!/bin/sh", from offset 0x00100000 to end
-of media with step 0x10000. Real marker in that case is "#!/bin/sh", but "#"
-terminates the line when hints file is parsed, so we need to use wildcard "."
-instead of "#".
+.Pp
+This defines
+.Pa /dev/map/kernel
+at disk
+.Pa cfid0
+starting at
+.Li 0x00040000 ,
+but the end position must be searched by finding the key
+.Dq Li ".!/bin/sh" ,
+from offset
+.Li 0x00100000
+to the end of media with step
+.Li 0x10000 .
+The real marker in this case is
+.Dq Li "#!/bin/sh" ,
+but
+.Ql #
+terminates the line when the hints file is parsed, so we need to use wildcard
+.Ql .\&
+instead of
+.Ql # .
.Bd -literal -offset indent
hint.map.4.at="cfid0"
hint.map.4.name="rootfs"
@@ -166,13 +200,11 @@ hint.map.5.start=0x007e0000
hint.map.5.end=0x00800000
hint.map.5.name="config"
.Ed
-.El
.Sh SEE ALSO
-.Xr GEOM 4 ,
+.Xr geom 4 ,
.Xr geom 8 ,
.Xr sysctl 8
.Sh AUTHORS
-.An -nosplit
The
.Nm
driver was written by
diff --git a/share/man/man4/hpet.4 b/share/man/man4/hpet.4
index f787895..f501e0b 100644
--- a/share/man/man4/hpet.4
+++ b/share/man/man4/hpet.4
@@ -69,14 +69,14 @@ This driver uses High Precision Event Timer hardware (part of the chipset,
usually enumerated via ACPI) to supply kernel with one time counter and
several (usually from 3 to 8) event timers.
This hardware includes single main counter with known increment frequency
-(10MHz or more), and several programable comparators (optionally with
+(10MHz or more), and several programmable comparators (optionally with
automatic reload feature).
When value of the main counter matches current value of any comparator,
interrupt can be generated.
Depending on hardware capabilities and configuration, interrupt can be
delivered as regular I/O APIC interrupt (ISA or PCI) in range from 0 to 31,
or as Front Side Bus interrupt, alike to PCI MSI interrupts, or in so called
-"LegacyReplacement Route" HPET can speal IRQ0 of i8254 and IRQ8 of the RTC.
+"LegacyReplacement Route" HPET can steal IRQ0 of i8254 and IRQ8 of the RTC.
Interrupt can be either edge- or level-triggered. In last case they could be
safely shared with PCI IRQs.
Driver prefers to use FSB interrupts, if supported, to avoid sharing.
diff --git a/share/man/man4/ichwd.4 b/share/man/man4/ichwd.4
index 497712c..25b6dbb 100644
--- a/share/man/man4/ichwd.4
+++ b/share/man/man4/ichwd.4
@@ -1,5 +1,5 @@
.\"-
-.\" Copyright (c) 2007 Dag-Erling Coïdan Smørgrav
+.\" Copyright (c) 2007 Dag-Erling Coïdan Smørgrav
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
diff --git a/share/man/man4/man4.i386/Makefile b/share/man/man4/man4.i386/Makefile
index 0134d57..974eec0 100644
--- a/share/man/man4/man4.i386/Makefile
+++ b/share/man/man4/man4.i386/Makefile
@@ -12,6 +12,7 @@ MAN= aic.4 \
ep.4 \
ex.4 \
fe.4 \
+ glxiic.4 \
glxsb.4 \
ie.4 \
longrun.4 \
diff --git a/share/man/man4/man4.i386/glxiic.4 b/share/man/man4/man4.i386/glxiic.4
new file mode 100644
index 0000000..30d3ffe
--- /dev/null
+++ b/share/man/man4/man4.i386/glxiic.4
@@ -0,0 +1,106 @@
+.\" Copyright (c) 2011 Henrik Brix Andersen <brix@FreeBSD.org>
+.\" 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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 15, 2011
+.Dt GLXIIC 4 i386
+.Os
+.Sh NAME
+.Nm glxiic
+.Nd Geode LX CS5536 I2C controller 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 pci"
+.Cd "device isa"
+.Cd "device glxiic"
+.Cd "device iicbus"
+.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
+glxiic_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver supports the System Management Bus controller of the Geode LX
+series CS5536 Companion Device. The Geode LX is a member of the AMD
+Geode family of integrated x86 system chips.
+.Pp
+Although AMD refers to this device as a System Management Bus (SMBus)
+controller, it is really an I2C controller (it lacks SMBus ALERT# and
+Alert Response support).
+.Pp
+The
+.Nm
+driver supports both I2C master and slave mode.
+.Sh SYSCTL VARIABLE
+The
+.Nm
+driver supports the following variable as both
+.Xr sysctl 8
+and
+.Xr loader 8
+tunable:
+.Bl -tag -width indent
+.It Va dev.glxiic.0.timeout
+This variable controls the I2C bus timeout in milliseconds. The
+default timeout is 35 milliseconds. A value of zero disables the
+timeout.
+.El
+.Sh CAVEAT
+The
+.Nm
+driver uses the interrupt line number configured by the board firmware
+by default. If no interrupt line number has been configured by the
+board firmware (or to override the interrupt line number configured by
+board firmware), place the following line in
+.Xr device.hints 5 :
+.Bd -ragged -offset indent
+hint.glxiic.0.irq="10"
+.Ed
+.Pp
+The interrupt line number must be between 1 and 15.
+.Sh SEE ALSO
+.Xr iicbus 4 ,
+.Xr device.hints 5 ,
+.Xr loader.conf 5 ,
+.Xr loader 8 ,
+.Xr sysctl 8
+.Sh HISTORY
+The
+.Nm
+device driver and manual page first appeared in
+.Fx 9.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+device driver and manual page were written by
+.An Henrik Brix Andersen Aq brix@FreeBSD.org .
diff --git a/share/man/man4/msk.4 b/share/man/man4/msk.4
index fe32a68..200c6f7 100644
--- a/share/man/man4/msk.4
+++ b/share/man/man4/msk.4
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd November 23, 2010
+.Dd May 23, 2011
.Dt MSK 4
.Os
.Sh NAME
@@ -195,6 +195,8 @@ Marvell Yukon 88E8071 Gigabit Ethernet
.It
Marvell Yukon 88E8072 Gigabit Ethernet
.It
+Marvell Yukon 88E8075 Gigabit Ethernet
+.It
SysKonnect SK-9Sxx Gigabit Ethernet
.It
SysKonnect SK-9Exx Gigabit Ethernet
diff --git a/share/man/man4/pst.4 b/share/man/man4/pst.4
index f207e2d..3ce95d8 100644
--- a/share/man/man4/pst.4
+++ b/share/man/man4/pst.4
@@ -1,5 +1,5 @@
.\"
-.\" Copyright (c) 2001,2002 Søren Schmidt
+.\" Copyright (c) 2001,2002 Søren Schmidt
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
diff --git a/share/man/man4/ucycom.4 b/share/man/man4/ucycom.4
index 9276462..6d76564 100644
--- a/share/man/man4/ucycom.4
+++ b/share/man/man4/ucycom.4
@@ -1,5 +1,5 @@
.\"-
-.\" Copyright (c) 2004 Dag-Erling Coïdan Smørgrav
+.\" Copyright (c) 2004 Dag-Erling Coïdan Smørgrav
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
diff --git a/share/man/man4/xhci.4 b/share/man/man4/xhci.4
index 670d395..09f3185 100644
--- a/share/man/man4/xhci.4
+++ b/share/man/man4/xhci.4
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd February 24, 2011
+.Dd May 17, 2011
.Dt XHCI 4
.Os
.Sh NAME
@@ -49,6 +49,13 @@ The
controller supports
.Tn USB
connection speeds up to 5.0Gbps when using a USB 3.0 compliant device.
+.Sh HARDWARE
+The
+.Nm
+driver supports
+.Tn XHCI
+compatible controllers having PCI class 12 (serial bus),
+subclass 3 (USB) and programming interface 48 (XHCI).
.Sh SEE ALSO
.Xr ehci 4 ,
.Xr ohci 4 ,
diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5
index 16f247b..cf062c5 100644
--- a/share/man/man5/rc.conf.5
+++ b/share/man/man5/rc.conf.5
@@ -3772,7 +3772,7 @@ Set to
.Dq Li -l -U root
by default.
These are flags to pass to
-.Xr jail .
+.Xr jail 8 .
.It Va jail_ Ns Ao Ar jname Ac Ns Va _interface
.Pq Vt str
Unset by default.
diff --git a/share/man/man5/reiserfs.5 b/share/man/man5/reiserfs.5
index eda7028..dd7757c 100644
--- a/share/man/man5/reiserfs.5
+++ b/share/man/man5/reiserfs.5
@@ -1,5 +1,5 @@
.\"
-.\" Copyright (c) 2005 Jean-Sébastien Pédron
+.\" Copyright (c) 2005 Jean-Sébastien Pédron
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5
index 134e4f3..f0b9905 100644
--- a/share/man/man5/src.conf.5
+++ b/share/man/man5/src.conf.5
@@ -1,7 +1,7 @@
.\" DO NOT EDIT-- this file is automatically generated.
.\" from FreeBSD: head/tools/build/options/makeman 221733 2011-05-10 13:01:11Z ru
.\" $FreeBSD$
-.Dd May 10, 2011
+.Dd May 22, 2011
.Dt SRC.CONF 5
.Os
.Sh NAME
@@ -206,6 +206,14 @@ and
.\" from FreeBSD: head/tools/build/options/WITH_BIND_XML 193280 2009-06-01 21:58:59Z dougb
Set to enable the http statistics interface for named.
This requires ports/textproc/libxml2 to be installed in /usr/local.
+.It Va WITHOUT_BINUTILS
+.\" from FreeBSD: head/tools/build/options/WITHOUT_BINUTILS 222090 2011-05-19 05:13:25Z imp
+Set to not install binutils (as, c++-filt, gconv, gnu-ar, gnu-randlib,
+ld, nm, objcopy, objdump, readelf, size and strip)
+.Bf -symbolic
+The option does not generally work for build targets, unless some alternative
+toolchain is enabled.
+.Ef
.It Va WITHOUT_BLUETOOTH
.\" from FreeBSD: head/tools/build/options/WITHOUT_BLUETOOTH 156932 2006-03-21 07:50:50Z ru
Set to not build Bluetooth related kernel modules, programs and libraries.
@@ -364,6 +372,13 @@ Set to not build
.It Va WITHOUT_GAMES
.\" from FreeBSD: head/tools/build/options/WITHOUT_GAMES 156932 2006-03-21 07:50:50Z ru
Set to not build games.
+.It Va WITHOUT_GCC
+.\" from FreeBSD: head/tools/build/options/WITHOUT_GCC 222090 2011-05-19 05:13:25Z imp
+Set to not install gcc and g++.
+.Bf -symbolic
+The option does not generally work for build targets, unless some alternative
+toolchain is enabled.
+.Ef
.It Va WITHOUT_GCOV
.\" from FreeBSD: head/tools/build/options/WITHOUT_GCOV 156932 2006-03-21 07:50:50Z ru
Set to not build the
@@ -512,6 +527,12 @@ Set to build some programs without Kerberos support, like
.Xr sshd 8 ,
and
.Xr telnetd 8 .
+.It Va WITHOUT_KERNEL_SYMBOLS
+.\" from FreeBSD: head/tools/build/options/WITHOUT_KERNEL_SYMBOLS 222189 2011-05-22 18:23:17Z imp
+Set to not install kernel symbol files.
+.Bf -symbolic
+This option is recommended for those people who have small root partitions.
+.Ef
.It Va WITHOUT_KVM
.\" from FreeBSD: head/tools/build/options/WITHOUT_KVM 174550 2007-12-12 16:43:17Z ru
Set to not build the
@@ -712,6 +733,11 @@ will not be built either if this option is set.
Set to not build
.Xr ntpd 8
and related programs.
+.It Va WITH_OFED
+.\" from FreeBSD: head/tools/build/options/WITH_OFED 222016 2011-05-17 11:06:41Z ru
+Set to build the
+.Dq "OpenFabrics Enterprise Distribution"
+Infiniband software stack.
.It Va WITHOUT_OPENSSH
.\" from FreeBSD: head/tools/build/options/WITHOUT_OPENSSH 156932 2006-03-21 07:50:50Z ru
Set to not build OpenSSH.
@@ -879,8 +905,12 @@ When set, it also enforces the following options:
.Pp
.Bl -item -compact
.It
+.Va WITHOUT_BINUTILS
+.It
.Va WITHOUT_CLANG
.It
+.Va WITHOUT_GCC
+.It
.Va WITHOUT_GDB
.El
.It Va WITHOUT_USB
diff --git a/share/man/man9/LOCK_PROFILING.9 b/share/man/man9/LOCK_PROFILING.9
index cdb78b3..94b2246 100644
--- a/share/man/man9/LOCK_PROFILING.9
+++ b/share/man/man9/LOCK_PROFILING.9
@@ -1,5 +1,5 @@
.\"-
-.\" Copyright (c) 2004 Dag-Erling Coïdan Smørgrav
+.\" Copyright (c) 2004 Dag-Erling Coïdan Smørgrav
.\" Copyright (c) 2005 Robert N. M. Watson
.\" Copyright (c) 2006 Kip Macy
.\" All rights reserved.
diff --git a/share/man/man9/pseudofs.9 b/share/man/man9/pseudofs.9
index b0b22ff..5d39496 100644
--- a/share/man/man9/pseudofs.9
+++ b/share/man/man9/pseudofs.9
@@ -1,5 +1,5 @@
.\"-
-.\" Copyright (c) 2001 Dag-Erling Coïdan Smørgrav
+.\" Copyright (c) 2001 Dag-Erling Coïdan Smørgrav
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
diff --git a/share/man/man9/sbuf.9 b/share/man/man9/sbuf.9
index 4b93df5..d17b34c 100644
--- a/share/man/man9/sbuf.9
+++ b/share/man/man9/sbuf.9
@@ -1,5 +1,5 @@
.\"-
-.\" Copyright (c) 2000 Poul-Henning Kamp and Dag-Erling Coïdan Smørgrav
+.\" Copyright (c) 2000 Poul-Henning Kamp and Dag-Erling Coïdan Smørgrav
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -52,7 +52,7 @@
.Nm sbuf_len ,
.Nm sbuf_done ,
.Nm sbuf_delete
-.Nd safe string formatting
+.Nd safe string composition
.Sh SYNOPSIS
.In sys/types.h
.In sys/sbuf.h
@@ -106,14 +106,20 @@
.Sh DESCRIPTION
The
.Nm
-family of functions allows one to safely allocate, construct and
-release bounded NUL-terminated strings in kernel space.
+family of functions allows one to safely allocate, compose and
+release strings in kernel or user space.
+.Pp
Instead of arrays of characters, these functions operate on structures
called
.Fa sbufs ,
defined in
.In sys/sbuf.h .
.Pp
+Any errors encountered during the allocation or composition of the
+string will be latched in the data structure,
+making a single error test at the end of the composition
+sufficient to determine success or failure of the entire process.
+.Pp
The
.Fn sbuf_new
function initializes the
@@ -468,14 +474,35 @@ The
function
returns \-1 if copying string from userland failed, and number of bytes
copied otherwise.
+.Pp
The
-.Fn sbuf_finish
-function returns ENOMEM if the sbuf overflowed before being finished,
+.Fn sbuf_finish 9
+function (the kernel version) returns ENOMEM if the sbuf overflowed before
+being finished,
or returns the error code from the drain if one is attached.
-When used as
-.Xr sbuf_finish 3 ,
-.Fn sbuf_finish
-will return \-1 and set errno on error instead.
+.Pp
+The
+.Fn sbuf_finish 3
+function (the userland version)
+will return zero for success and \-1 and set errno on error.
+.Sh EXAMPLES
+.Bd -literal -compact
+#include <sys/sbuf.h>
+
+struct sbuf *sb;
+
+sb = sbuf_new_auto();
+sbuf_cat(sb, "Customers found:\en");
+TAILQ_FOREACH(foo, &foolist, list) {
+ sbuf_printf(sb, " %4d %s\en", foo->index, foo->name);
+ sbuf_printf(sb, " Address: %s\en", foo->address);
+ sbuf_printf(sb, " Zip: %s\en", foo->zipcode);
+}
+if (sbuf_finish(sb)) /* Check for any and all errors */
+ err(1,"Could not generate message");
+transmit_msg(sbuf_data(sb), sbuf_len(sb));
+sbuf_delete(sb);
+.Ed
.Sh SEE ALSO
.Xr printf 3 ,
.Xr strcat 3 ,
diff --git a/share/man/man9/zone.9 b/share/man/man9/zone.9
index a2132b5..32531bb 100644
--- a/share/man/man9/zone.9
+++ b/share/man/man9/zone.9
@@ -1,5 +1,5 @@
.\"-
-.\" Copyright (c) 2001 Dag-Erling Coïdan Smørgrav
+.\" Copyright (c) 2001 Dag-Erling Coïdan Smørgrav
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
diff --git a/share/misc/bsd-family-tree b/share/misc/bsd-family-tree
index 1d20448..1f4ec11 100644
--- a/share/misc/bsd-family-tree
+++ b/share/misc/bsd-family-tree
@@ -562,7 +562,7 @@ Australian Computer Society, Hobart, August 1993.
Peter H. Salus. Unix at 25. Byte Magazine, October 1994.
URL: http://www.byte.com/art/9410/sec8/art3.htm
-Andreas Klemm, Lars Köller. If you're going to San Francisco ...
+Andreas Klemm, Lars Köller. If you're going to San Francisco ...
Die freien BSD-Varianten von Unix. c't April 1997, page 368ff.
BSD Release Announcements collection.
diff --git a/share/misc/committers-src.dot b/share/misc/committers-src.dot
index 2199590..d450c8a 100644
--- a/share/misc/committers-src.dot
+++ b/share/misc/committers-src.dot
@@ -100,6 +100,7 @@ antoine [label="Antoine Brodin\nantoine@FreeBSD.org\n2008/02/03"]
ariff [label="Ariff Abdullah\nariff@FreeBSD.org\n2005/11/14"]
art [label="Artem Belevich\nart@FreeBSD.org\n2011/03/29"]
avg [label="Andriy Gapon\navg@FreeBSD.org\n2009/02/18"]
+benl [label="Ben Laurie\nbenl@FreeBSD.org\n2011/05/18"]
benno [label="Benno Rice\nbenno@FreeBSD.org\n2000/11/02"]
bms [label="Bruce M Simpson\nbms@FreeBSD.org\n2003/08/06"]
brian [label="Brian Somers\nbrian@FreeBSD.org\n1996/12/16"]
@@ -486,6 +487,7 @@ peter -> asmodai
peter -> jayanth
peter -> ps
+philip -> benl
philip -> ed
philip -> jls
philip -> matteo
@@ -546,6 +548,8 @@ sheldonh -> iedowse
shin -> ume
+simon -> benl
+
sos -> marcel
thompsa -> weongyo
diff --git a/share/misc/iso3166 b/share/misc/iso3166
index 70ca84f..d8d5972 100644
--- a/share/misc/iso3166
+++ b/share/misc/iso3166
@@ -46,6 +46,7 @@ BJ BEN 204 Benin
BM BMU 060 Bermuda
BT BTN 064 Bhutan
BO BOL 068 Bolivia, Plurinational State of
+BQ BES 535 Bonaire, Saint Eustatius and Saba
BA BIH 070 Bosnia and Herzegovina
BW BWA 072 Botswana
BV BVT 074 Bouvet Island
@@ -75,6 +76,7 @@ CR CRI 188 Costa Rica
CI CIV 384 Cote d'Ivoire
HR HRV 191 Croatia
CU CUB 192 Cuba
+CW CUW 531 Curacao
CY CYP 196 Cyprus
CZ CZE 203 Czech Republic
DK DNK 208 Denmark
@@ -205,7 +207,7 @@ RW RWA 646 Rwanda
BL BLM 652 Saint Barthelemy
KN KNA 659 Saint Kitts and Nevis
LC LCA 662 Saint Lucia
-MF MAF 663 Saint Martin
+MF MAF 663 Saint Martin (French Part)
VC VCT 670 Saint Vincent and the Grenadines
WS WSM 882 Samoa
SM SMR 674 San Marino
@@ -216,6 +218,7 @@ RS SRB 688 Serbia
SC SYC 690 Seychelles
SL SLE 694 Sierra Leone
SG SGP 702 Singapore
+SX SXM 534 Sint Maarten (Dutch part)
SK SVK 703 Slovakia
SI SVN 705 Slovenia
SB SLB 090 Solomon Islands
@@ -224,7 +227,7 @@ ZA ZAF 710 South Africa
GS SGS 239 South Georgia and the South Sandwich Islands
ES ESP 724 Spain
LK LKA 144 Sri Lanka
-SH SHN 654 Saint Helena
+SH SHN 654 Saint Helena, Ascension and Tristan da Cunha
PM SPM 666 Saint Pierre and Miquelon
SD SDN 736 Sudan
SR SUR 740 Suriname
@@ -395,7 +398,7 @@ ZW ZWE 716 Zimbabwe
# Newsletter III-41 1993-07-28
# MAURITIUS, changes outside this document
#
-# Newletter III-42 1993-07-12
+# Newsletter III-42 1993-07-12
# SAINT VINCENT AND THE GRENADINES, changes outside this document
#
# Newsletter III-43 1993-07-12
@@ -426,15 +429,15 @@ ZW ZWE 716 Zimbabwe
# Czechoslovakia officially deleted
#
# Newsletter III-52, 1993-07-02
-# Angola, changing information not included in this file. Offical name
+# Angola, changing information not included in this file. Official name
# change to Republic of Angola
#
# Newsletter III-53, 1993-07-12
-# Madagascar, changing information not included in this file. Official
+# Madagascar, changing information not included in this file. Official
# name change to Republic of Madagascar
#
# Newsletter III-54, 1993-07-23
-# South Georgia and the South Sandwich Islands, previously covered by
+# South Georgia and the South Sandwich Islands, previously covered by
# Falkland Islands
#
# Newsletter III-55, 1993-07-16
@@ -450,23 +453,23 @@ ZW ZWE 716 Zimbabwe
#
# Newsletter III-58, 1993-07-16
# Afghanistan, changing information not included in this file
-# Official name change to Islamic State of Afghanistan
+# Official name change to Islamic State of Afghanistan
#
-# Newsletter III-32, 1993-07-25 ammendment
-# Kyrgyzstan, changing information not included in this file. Offical name
+# Newsletter III-32, 1993-07-25 amendment
+# Kyrgyzstan, changing information not included in this file. Official name
# change to Kyrgyz Republic
#
# Newsletter III-59, 1994-01-26
-# Andorra, changing information not included in this file. Offical name
+# Andorra, changing information not included in this file. Official name
# change to Pricipality of Andorra
#
# Newsletter III-60, 1994-01-26
-# Cambodia, changing information not included in this file. Offical name
+# Cambodia, changing information not included in this file. Official name
# change to Kingdom of Cambodia
#
# Thu Feb 10 1994
# At this point the fourth edition of ISO 3166 appears. It can *now* be
-# ordered from national standards institutions. The RIPE NCC will continue
+# ordered from national standards institutions. The RIPE NCC will continue
# tracking changes.
#
# [deletia]
@@ -537,3 +540,11 @@ ZW ZWE 716 Zimbabwe
#
# Newsletter VI-6 2009-05-08
# Name change for Plurinational State of Bolivia.
+#
+# Newsletter VI-7 2010-02-22
+# Name change for Saint Helena, Ascension and Tristan da Cunha
+#
+# Newsletter VI-8 2010-12-15
+# BONAIRE, SAINT EUSTATIUS AND SABA (BQ), CURACAO (CW) and
+# SINT MAARTEN (DUTCH PART) (SX) added as new entries.
+# NETHERLANDS ANTILLES (AN) removed.
diff --git a/share/mk/bsd.libnames.mk b/share/mk/bsd.libnames.mk
index f338893..a5d3030 100644
--- a/share/mk/bsd.libnames.mk
+++ b/share/mk/bsd.libnames.mk
@@ -129,7 +129,6 @@ MINUSLPAM+= -lypclnt
LIBPANEL?= ${DESTDIR}${LIBDIR}/libpanel.a
LIBPCAP?= ${DESTDIR}${LIBDIR}/libpcap.a
-LIBPKG?= ${DESTDIR}${LIBDIR}/libpkg.a
LIBPMC?= ${DESTDIR}${LIBDIR}/libpmc.a
LIBPROC?= ${DESTDIR}${LIBDIR}/libproc.a
LIBPTHREAD?= ${DESTDIR}${LIBDIR}/libpthread.a
diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk
index cbbe7c9..f7ab5f8 100644
--- a/share/mk/bsd.own.mk
+++ b/share/mk/bsd.own.mk
@@ -297,6 +297,7 @@ __DEFAULT_YES_OPTIONS = \
BIND_MTREE \
BIND_NAMED \
BIND_UTILS \
+ BINUTILS \
BLUETOOTH \
BOOT \
BSD_CPIO \
@@ -317,6 +318,7 @@ __DEFAULT_YES_OPTIONS = \
FP_LIBC \
FREEBSD_UPDATE \
GAMES \
+ GCC \
GCOV \
GDB \
GNU \
@@ -333,6 +335,7 @@ __DEFAULT_YES_OPTIONS = \
IPX \
JAIL \
KERBEROS \
+ KERNEL_SYMBOLS \
KVM \
LEGACY_CONSOLE \
LIB32 \
@@ -529,7 +532,9 @@ MK_GROFF:= no
.endif
.if ${MK_TOOLCHAIN} == "no"
+MK_BINUTILS:= no
MK_CLANG:= no
+MK_GCC:= no
MK_GDB:= no
.endif
diff --git a/sys/amd64/amd64/identcpu.c b/sys/amd64/amd64/identcpu.c
index 1da4181..805ba1e 100644
--- a/sys/amd64/amd64/identcpu.c
+++ b/sys/amd64/amd64/identcpu.c
@@ -216,6 +216,14 @@ printcpuinfo(void)
printf(" Family = %x", CPUID_TO_FAMILY(cpu_id));
printf(" Model = %x", CPUID_TO_MODEL(cpu_id));
printf(" Stepping = %u", cpu_id & CPUID_STEPPING);
+
+ /*
+ * AMD CPUID Specification
+ * http://support.amd.com/us/Embedded_TechDocs/25481.pdf
+ *
+ * Intel Processor Identification and CPUID Instruction
+ * http://www.intel.com/assets/pdf/appnote/241618.pdf
+ */
if (cpu_high > 0) {
/*
@@ -277,38 +285,29 @@ printcpuinfo(void)
"\012SSSE3" /* SSSE3 */
"\013CNXT-ID" /* L1 context ID available */
"\014<b11>"
- "\015<b12>"
+ "\015FMA" /* Fused Multiply Add */
"\016CX16" /* CMPXCHG16B Instruction */
"\017xTPR" /* Send Task Priority Messages*/
"\020PDCM" /* Perf/Debug Capability MSR */
"\021<b16>"
- "\022PCID" /* Process-context Identifiers */
+ "\022PCID" /* Process-context Identifiers*/
"\023DCA" /* Direct Cache Access */
- "\024SSE4.1"
- "\025SSE4.2"
+ "\024SSE4.1" /* SSE 4.1 */
+ "\025SSE4.2" /* SSE 4.2 */
"\026x2APIC" /* xAPIC Extensions */
- "\027MOVBE"
- "\030POPCNT"
- "\031<b24>"
- "\032AESNI" /* AES Crypto*/
- "\033XSAVE"
- "\034OSXSAVE"
- "\035<b28>"
- "\036<b29>"
+ "\027MOVBE" /* MOVBE Instruction */
+ "\030POPCNT" /* POPCNT Instruction */
+ "\031TSCDLT" /* TSC-Deadline Timer */
+ "\032AESNI" /* AES Crypto */
+ "\033XSAVE" /* XSAVE/XRSTOR States */
+ "\034OSXSAVE" /* OS-Enabled State Management*/
+ "\035AVX" /* Advanced Vector Extensions */
+ "\036F16C" /* Half-precision conversions */
"\037<b30>"
"\040HV" /* Hypervisor */
);
}
- /*
- * AMD64 Architecture Programmer's Manual Volume 3:
- * General-Purpose and System Instructions
- * http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/24594.pdf
- *
- * IA-32 Intel Architecture Software Developer's Manual,
- * Volume 2A: Instruction Set Reference, A-M
- * ftp://download.intel.com/design/Pentium4/manuals/25366617.pdf
- */
if (amd_feature != 0) {
printf("\n AMD Features=0x%b", amd_feature,
"\020" /* in hex */
@@ -361,18 +360,18 @@ printcpuinfo(void)
"\011Prefetch" /* 3DNow! Prefetch/PrefetchW */
"\012OSVW" /* OS visible workaround */
"\013IBS" /* Instruction based sampling */
- "\014SSE5" /* SSE5 */
+ "\014XOP" /* XOP extended instructions */
"\015SKINIT" /* SKINIT/STGI */
"\016WDT" /* Watchdog timer */
"\017<b14>"
- "\020<b15>"
- "\021<b16>"
+ "\020LWP" /* Lightweight Profiling */
+ "\021FMA4" /* 4-operand FMA instructions */
"\022<b17>"
"\023<b18>"
- "\024<b19>"
+ "\024NodeId" /* NodeId MSR support */
"\025<b20>"
- "\026<b21>"
- "\027<b22>"
+ "\026TBM" /* Trailing Bit Manipulation */
+ "\027Topology" /* Topology Extensions */
"\030<b23>"
"\031<b24>"
"\032<b25>"
diff --git a/sys/amd64/include/specialreg.h b/sys/amd64/include/specialreg.h
index bafa616..6ee76aa 100644
--- a/sys/amd64/include/specialreg.h
+++ b/sys/amd64/include/specialreg.h
@@ -123,6 +123,7 @@
#define CPUID2_TM2 0x00000100
#define CPUID2_SSSE3 0x00000200
#define CPUID2_CNXTID 0x00000400
+#define CPUID2_FMA 0x00001000
#define CPUID2_CX16 0x00002000
#define CPUID2_XTPR 0x00004000
#define CPUID2_PDCM 0x00008000
@@ -133,7 +134,12 @@
#define CPUID2_X2APIC 0x00200000
#define CPUID2_MOVBE 0x00400000
#define CPUID2_POPCNT 0x00800000
+#define CPUID2_TSCDLT 0x01000000
#define CPUID2_AESNI 0x02000000
+#define CPUID2_XSAVE 0x04000000
+#define CPUID2_OSXSAVE 0x08000000
+#define CPUID2_AVX 0x10000000
+#define CPUID2_F16C 0x20000000
#define CPUID2_HV 0x80000000
/*
@@ -170,9 +176,14 @@
#define AMDID2_PREFETCH 0x00000100
#define AMDID2_OSVW 0x00000200
#define AMDID2_IBS 0x00000400
-#define AMDID2_SSE5 0x00000800
+#define AMDID2_XOP 0x00000800
#define AMDID2_SKINIT 0x00001000
#define AMDID2_WDT 0x00002000
+#define AMDID2_LWP 0x00008000
+#define AMDID2_FMA4 0x00010000
+#define AMDID2_NODE_ID 0x00080000
+#define AMDID2_TBM 0x00200000
+#define AMDID2_TOPOLOGY 0x00400000
/*
* CPUID instruction 1 eax info
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
index f8912ca..ba13747 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
@@ -689,6 +689,9 @@ zfs_secpolicy_destroy(zfs_cmd_t *zc, cred_t *cr)
* and destroying snapshots requires descendent permissions, a successfull
* check of the top level snapshot applies to snapshots of all descendent
* datasets as well.
+ *
+ * The top level snapshot may not exist when doing a recursive destroy.
+ * In this case fallback to permissions of the parent dataset.
*/
static int
zfs_secpolicy_destroy_snaps(zfs_cmd_t *zc, cred_t *cr)
@@ -700,6 +703,9 @@ zfs_secpolicy_destroy_snaps(zfs_cmd_t *zc, cred_t *cr)
error = zfs_secpolicy_destroy_perms(dsname, cr);
+ if (error == ENOENT)
+ error = zfs_secpolicy_destroy_perms(zc->zc_name, cr);
+
strfree(dsname);
return (error);
}
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
index e9a956c..fffc181 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
@@ -93,7 +93,7 @@ static int zfs_vget(vfs_t *vfsp, ino_t ino, int flags, vnode_t **vpp);
static int zfs_sync(vfs_t *vfsp, int waitfor);
static int zfs_checkexp(vfs_t *vfsp, struct sockaddr *nam, int *extflagsp,
struct ucred **credanonp, int *numsecflavors, int **secflavors);
-static int zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, vnode_t **vpp);
+static int zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, int flags, vnode_t **vpp);
static void zfs_objset_close(zfsvfs_t *zfsvfs);
static void zfs_freevfs(vfs_t *vfsp);
@@ -2007,7 +2007,7 @@ CTASSERT(SHORT_FID_LEN <= sizeof(struct fid));
CTASSERT(LONG_FID_LEN <= sizeof(struct fid));
static int
-zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, vnode_t **vpp)
+zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, int flags, vnode_t **vpp)
{
zfsvfs_t *zfsvfs = vfsp->vfs_data;
znode_t *zp;
@@ -2069,7 +2069,7 @@ zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, vnode_t **vpp)
VN_HOLD(*vpp);
}
ZFS_EXIT(zfsvfs);
- err = zfs_vnode_lock(*vpp, LK_EXCLUSIVE | LK_RETRY);
+ err = zfs_vnode_lock(*vpp, flags | LK_RETRY);
if (err != 0)
*vpp = NULL;
return (err);
@@ -2096,7 +2096,7 @@ zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, vnode_t **vpp)
*vpp = ZTOV(zp);
ZFS_EXIT(zfsvfs);
- err = zfs_vnode_lock(*vpp, LK_EXCLUSIVE | LK_RETRY);
+ err = zfs_vnode_lock(*vpp, flags | LK_RETRY);
if (err == 0)
vnode_create_vobject(*vpp, zp->z_size, curthread);
else
diff --git a/sys/cddl/dev/cyclic/cyclic.c b/sys/cddl/dev/cyclic/cyclic.c
index b9a6979..e7b7f50 100644
--- a/sys/cddl/dev/cyclic/cyclic.c
+++ b/sys/cddl/dev/cyclic/cyclic.c
@@ -341,6 +341,16 @@ static cyc_backend_t cyclic_backend;
MALLOC_DEFINE(M_CYCLIC, "cyclic", "Cyclic timer subsystem");
+static __inline hrtime_t
+cyc_gethrtime(void)
+{
+ struct bintime bt;
+
+ binuptime(&bt);
+ return ((hrtime_t)bt.sec * NANOSEC +
+ (((uint64_t)NANOSEC * (uint32_t)(bt.frac >> 32)) >> 32));
+}
+
/*
* Returns 1 if the upheap propagated to the root, 0 if it did not. This
* allows the caller to reprogram the backend only when the root has been
@@ -507,7 +517,7 @@ cyclic_fire(cpu_t *c)
cyc_index_t *heap = cpu->cyp_heap;
cyclic_t *cyclic, *cyclics = cpu->cyp_cyclics;
void *arg = be->cyb_arg;
- hrtime_t now = gethrtime();
+ hrtime_t now = cyc_gethrtime();
hrtime_t exp;
if (cpu->cyp_nelems == 0) {
@@ -687,7 +697,7 @@ cyclic_add_xcall(cyc_xcallarg_t *arg)
* If a start time hasn't been explicitly specified, we'll
* start on the next interval boundary.
*/
- cyclic->cy_expire = (gethrtime() / cyclic->cy_interval + 1) *
+ cyclic->cy_expire = (cyc_gethrtime() / cyclic->cy_interval + 1) *
cyclic->cy_interval;
} else {
cyclic->cy_expire = when->cyt_when;
diff --git a/sys/cddl/dev/cyclic/i386/cyclic_machdep.c b/sys/cddl/dev/cyclic/i386/cyclic_machdep.c
index 1c18fc1..6f93663 100644
--- a/sys/cddl/dev/cyclic/i386/cyclic_machdep.c
+++ b/sys/cddl/dev/cyclic/i386/cyclic_machdep.c
@@ -30,6 +30,7 @@ static void enable(cyb_arg_t);
static void disable(cyb_arg_t);
static void reprogram(cyb_arg_t, hrtime_t);
static void xcall(cyb_arg_t, cpu_t *, cyc_func_t, void *);
+static void cyclic_clock(struct trapframe *frame);
static cyc_backend_t be = {
NULL, /* cyb_configure */
@@ -45,6 +46,7 @@ static void
cyclic_ap_start(void *dummy)
{
/* Initialise the rest of the CPUs. */
+ cyclic_clock_func = cyclic_clock;
cyclic_mp_init();
}
@@ -63,18 +65,10 @@ cyclic_machdep_init(void)
static void
cyclic_machdep_uninit(void)
{
- int i;
-
- for (i = 0; i <= mp_maxid; i++)
- /* Reset the cyclic clock callback hook. */
- cyclic_clock_func[i] = NULL;
-
/* De-register the cyclic backend. */
cyclic_uninit();
}
-static hrtime_t exp_due[MAXCPU];
-
/*
* This function is the one registered by the machine dependent
* initialiser as the callback for high speed timer events.
@@ -84,7 +78,7 @@ cyclic_clock(struct trapframe *frame)
{
cpu_t *c = &solaris_cpu[curcpu];
- if (c->cpu_cyclic != NULL && gethrtime() >= exp_due[curcpu]) {
+ if (c->cpu_cyclic != NULL) {
if (TRAPF_USERMODE(frame)) {
c->cpu_profile_pc = 0;
c->cpu_profile_upc = TRAPF_PC(frame);
@@ -102,26 +96,34 @@ cyclic_clock(struct trapframe *frame)
}
}
-static void enable(cyb_arg_t arg)
+static void
+enable(cyb_arg_t arg __unused)
{
- /* Register the cyclic clock callback function. */
- cyclic_clock_func[curcpu] = cyclic_clock;
+
}
-static void disable(cyb_arg_t arg)
+static void
+disable(cyb_arg_t arg __unused)
{
- /* Reset the cyclic clock callback function. */
- cyclic_clock_func[curcpu] = NULL;
+
}
-static void reprogram(cyb_arg_t arg, hrtime_t exp)
+static void
+reprogram(cyb_arg_t arg __unused, hrtime_t exp)
{
- exp_due[curcpu] = exp;
+ struct bintime bt;
+ struct timespec ts;
+
+ ts.tv_sec = exp / 1000000000;
+ ts.tv_nsec = exp % 1000000000;
+ timespec2bintime(&ts, &bt);
+ clocksource_cyc_set(&bt);
}
-static void xcall(cyb_arg_t arg, cpu_t *c, cyc_func_t func, void *param)
+static void xcall(cyb_arg_t arg __unused, cpu_t *c, cyc_func_t func,
+ void *param)
{
- smp_rendezvous_cpus((cpumask_t) (1 << c->cpuid),
+ smp_rendezvous_cpus((cpumask_t)1 << c->cpuid,
smp_no_rendevous_barrier, func, smp_no_rendevous_barrier, param);
}
diff --git a/sys/conf/files.i386 b/sys/conf/files.i386
index f518bc9..4f0d0d0 100644
--- a/sys/conf/files.i386
+++ b/sys/conf/files.i386
@@ -171,6 +171,7 @@ dev/fdc/fdc_acpi.c optional fdc
dev/fdc/fdc_isa.c optional fdc isa
dev/fdc/fdc_pccard.c optional fdc pccard
dev/fe/if_fe_isa.c optional fe isa
+dev/glxiic/glxiic.c optional glxiic
dev/glxsb/glxsb.c optional glxsb
dev/glxsb/glxsb_hash.c optional glxsb
dev/hptmv/entry.c optional hptmv
diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk
index 58ab6ee..a0a595f 100644
--- a/sys/conf/kern.mk
+++ b/sys/conf/kern.mk
@@ -1,15 +1,12 @@
# $FreeBSD$
#
-# Warning flags for compiling the kernel and components of the kernel.
+# Warning flags for compiling the kernel and components of the kernel:
#
-# Note that the newly added -Wcast-qual is responsible for generating
-# most of the remaining warnings. Warnings introduced with -Wall will
-# also pop up, but are easier to fix.
CWARNFLAGS?= -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \
-Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual \
-Wundef -Wno-pointer-sign -fformat-extensions \
- -Wmissing-include-dirs
+ -Wmissing-include-dirs -fdiagnostics-show-option
#
# The following flags are next up for working on:
# -Wextra
diff --git a/sys/conf/kern.post.mk b/sys/conf/kern.post.mk
index 80b1bc2..8cb36f9 100644
--- a/sys/conf/kern.post.mk
+++ b/sys/conf/kern.post.mk
@@ -227,7 +227,8 @@ kernel-install:
.endif
mkdir -p ${DESTDIR}${KODIR}
${INSTALL} -p -m 555 -o ${KMODOWN} -g ${KMODGRP} ${KERNEL_KO} ${DESTDIR}${KODIR}
-.if defined(DEBUG) && !defined(INSTALL_NODEBUG)
+.if defined(DEBUG) && !defined(INSTALL_NODEBUG) && \
+ (defined(MK_KERNEL_SYMBOLS) && ${MK_KERNEL_SYMBOLS} != "no")
${INSTALL} -p -m 555 -o ${KMODOWN} -g ${KMODGRP} ${KERNEL_KO}.symbols ${DESTDIR}${KODIR}
.endif
.if defined(KERNEL_EXTRA_INSTALL)
@@ -239,7 +240,8 @@ kernel-install:
kernel-reinstall:
@-chflags -R noschg ${DESTDIR}${KODIR}
${INSTALL} -p -m 555 -o ${KMODOWN} -g ${KMODGRP} ${KERNEL_KO} ${DESTDIR}${KODIR}
-.if defined(DEBUG) && !defined(INSTALL_NODEBUG)
+.if defined(DEBUG) && !defined(INSTALL_NODEBUG) && \
+ (defined(MK_KERNEL_SYMBOLS) && ${MK_KERNEL_SYMBOLS} != "no")
${INSTALL} -p -m 555 -o ${KMODOWN} -g ${KMODGRP} ${KERNEL_KO}.symbols ${DESTDIR}${KODIR}
.endif
diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk
index 6d22e41..36e0b9d 100644
--- a/sys/conf/kmod.mk
+++ b/sys/conf/kmod.mk
@@ -286,7 +286,8 @@ realinstall: _kmodinstall
_kmodinstall:
${INSTALL} -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \
${_INSTALLFLAGS} ${PROG} ${DESTDIR}${KMODDIR}
-.if defined(DEBUG_FLAGS) && !defined(INSTALL_NODEBUG)
+.if defined(DEBUG_FLAGS) && !defined(INSTALL_NODEBUG) && \
+ (defined(MK_KERNEL_SYMBOLS) && ${MK_KERNEL_SYMBOLS} != "no")
${INSTALL} -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \
${_INSTALLFLAGS} ${PROG}.symbols ${DESTDIR}${KMODDIR}
.endif
diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh
index 6fe0a63..9681c79 100644
--- a/sys/conf/newvers.sh
+++ b/sys/conf/newvers.sh
@@ -139,4 +139,4 @@ int osreldate = ${RELDATE};
char kern_ident[] = "${i}";
EOF
-echo `expr ${v} + 1` > version
+echo $((v + 1)) > version
diff --git a/sys/dev/acpica/acpi_hpet.c b/sys/dev/acpica/acpi_hpet.c
index 4ea5c85..40e8676 100644
--- a/sys/dev/acpica/acpi_hpet.c
+++ b/sys/dev/acpica/acpi_hpet.c
@@ -476,7 +476,7 @@ hpet_attach(device_t dev)
sc->tc.tc_get_timecount = hpet_get_timecount,
sc->tc.tc_counter_mask = ~0u,
sc->tc.tc_name = "HPET",
- sc->tc.tc_quality = 900,
+ sc->tc.tc_quality = 950,
sc->tc.tc_frequency = sc->freq;
sc->tc.tc_priv = sc;
tc_init(&sc->tc);
diff --git a/sys/dev/acpica/acpi_timer.c b/sys/dev/acpica/acpi_timer.c
index f456206..1741683 100644
--- a/sys/dev/acpica/acpi_timer.c
+++ b/sys/dev/acpica/acpi_timer.c
@@ -203,7 +203,7 @@ acpi_timer_probe(device_t dev)
if (j == 10) {
acpi_timer_timecounter.tc_name = "ACPI-fast";
acpi_timer_timecounter.tc_get_timecount = acpi_timer_get_timecount;
- acpi_timer_timecounter.tc_quality = 1000;
+ acpi_timer_timecounter.tc_quality = 900;
} else {
acpi_timer_timecounter.tc_name = "ACPI-safe";
acpi_timer_timecounter.tc_get_timecount = acpi_timer_get_timecount_safe;
diff --git a/sys/dev/ahci/ahci.c b/sys/dev/ahci/ahci.c
index 6ff8f9d..2a06492 100644
--- a/sys/dev/ahci/ahci.c
+++ b/sys/dev/ahci/ahci.c
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
#include <machine/resource.h>
#include <machine/bus.h>
#include <sys/rman.h>
+#include <dev/led/led.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/pcireg.h>
#include "ahci.h"
@@ -68,6 +69,7 @@ static int ahci_ch_resume(device_t dev);
static void ahci_ch_pm(void *arg);
static void ahci_ch_intr_locked(void *data);
static void ahci_ch_intr(void *data);
+static void ahci_ch_led(void *priv, int onoff);
static int ahci_ctlr_reset(device_t dev);
static int ahci_ctlr_setup(device_t dev);
static void ahci_begin_transaction(device_t dev, union ccb *ccb);
@@ -418,6 +420,8 @@ ahci_attach(device_t dev)
ctlr->caps &= ~AHCI_CAP_SNCQ;
if ((ctlr->caps & AHCI_CAP_CCCS) == 0)
ctlr->ccc = 0;
+ mtx_init(&ctlr->em_mtx, "AHCI EM lock", NULL, MTX_DEF);
+ ctlr->emloc = ATA_INL(ctlr->r_mem, AHCI_EM_LOC);
ahci_ctlr_setup(dev);
/* Setup interrupts. */
if (ahci_setup_interrupt(dev)) {
@@ -521,6 +525,7 @@ ahci_detach(device_t dev)
rman_fini(&ctlr->sc_iomem);
if (ctlr->r_mem)
bus_release_resource(dev, SYS_RES_MEMORY, ctlr->r_rid, ctlr->r_mem);
+ mtx_destroy(&ctlr->em_mtx);
return (0);
}
@@ -887,6 +892,7 @@ ahci_ch_attach(device_t dev)
struct cam_devq *devq;
int rid, error, i, sata_rev = 0;
u_int32_t version;
+ char buf[32];
ch->dev = dev;
ch->unit = (intptr_t)device_get_ivars(dev);
@@ -995,6 +1001,25 @@ ahci_ch_attach(device_t dev)
ahci_ch_pm, dev);
}
mtx_unlock(&ch->mtx);
+ if ((ch->caps & AHCI_CAP_EMS) &&
+ (ctlr->capsem & AHCI_EM_LED)) {
+ for (i = 0; i < AHCI_NUM_LEDS; i++) {
+ ch->leds[i].dev = dev;
+ ch->leds[i].num = i;
+ }
+ if ((ctlr->capsem & AHCI_EM_ALHD) == 0) {
+ snprintf(buf, sizeof(buf), "%s.act",
+ device_get_nameunit(dev));
+ ch->leds[0].led = led_create(ahci_ch_led,
+ &ch->leds[0], buf);
+ }
+ snprintf(buf, sizeof(buf), "%s.locate",
+ device_get_nameunit(dev));
+ ch->leds[1].led = led_create(ahci_ch_led, &ch->leds[1], buf);
+ snprintf(buf, sizeof(buf), "%s.fault",
+ device_get_nameunit(dev));
+ ch->leds[2].led = led_create(ahci_ch_led, &ch->leds[2], buf);
+ }
return (0);
err3:
@@ -1014,7 +1039,12 @@ static int
ahci_ch_detach(device_t dev)
{
struct ahci_channel *ch = device_get_softc(dev);
+ int i;
+ for (i = 0; i < AHCI_NUM_LEDS; i++) {
+ if (ch->leds[i].led)
+ led_destroy(ch->leds[i].led);
+ }
mtx_lock(&ch->mtx);
xpt_async(AC_LOST_DEVICE, ch->path, NULL);
/* Forget about reset. */
@@ -1137,6 +1167,47 @@ static driver_t ahcich_driver = {
};
DRIVER_MODULE(ahcich, ahci, ahcich_driver, ahcich_devclass, 0, 0);
+static void
+ahci_ch_setleds(device_t dev)
+{
+ struct ahci_channel *ch;
+ struct ahci_controller *ctlr;
+ size_t buf;
+ int i, timeout;
+ int16_t val;
+
+ ctlr = device_get_softc(device_get_parent(dev));
+ ch = device_get_softc(dev);
+
+ val = 0;
+ for (i = 0; i < AHCI_NUM_LEDS; i++)
+ val |= ch->leds[i].state << (i * 3);
+
+ buf = (ctlr->emloc & 0xffff0000) >> 14;
+ mtx_lock(&ctlr->em_mtx);
+ timeout = 1000;
+ while (ATA_INL(ctlr->r_mem, AHCI_EM_CTL) & (AHCI_EM_TM | AHCI_EM_RST) &&
+ --timeout > 0)
+ DELAY(1000);
+ if (timeout == 0)
+ device_printf(dev, "EM timeout\n");
+ ATA_OUTL(ctlr->r_mem, buf, (1 << 8) | (0 << 16) | (0 << 24));
+ ATA_OUTL(ctlr->r_mem, buf + 4, ch->unit | (val << 16));
+ ATA_OUTL(ctlr->r_mem, AHCI_EM_CTL, AHCI_EM_TM);
+ mtx_unlock(&ctlr->em_mtx);
+}
+
+static void
+ahci_ch_led(void *priv, int onoff)
+{
+ struct ahci_led *led;
+
+ led = (struct ahci_led *)priv;
+
+ led->state = onoff;
+ ahci_ch_setleds(led->dev);
+}
+
struct ahci_dc_cb_args {
bus_addr_t maddr;
int error;
diff --git a/sys/dev/ahci/ahci.h b/sys/dev/ahci/ahci.h
index cd5356a..3ace69f 100644
--- a/sys/dev/ahci/ahci.h
+++ b/sys/dev/ahci/ahci.h
@@ -376,6 +376,15 @@ struct ahci_device {
u_int caps;
};
+struct ahci_led {
+ device_t dev; /* Device handle */
+ struct cdev *led;
+ uint8_t num; /* Number of this led */
+ uint8_t state; /* State of this led */
+};
+
+#define AHCI_NUM_LEDS 3
+
/* structure describing an ATA channel */
struct ahci_channel {
device_t dev; /* Device handle */
@@ -386,6 +395,7 @@ struct ahci_channel {
struct ata_dma dma; /* DMA data */
struct cam_sim *sim;
struct cam_path *path;
+ struct ahci_led leds[3];
uint32_t caps; /* Controller capabilities */
uint32_t caps2; /* Controller capabilities */
uint32_t chcaps; /* Channel capabilities */
@@ -443,6 +453,7 @@ struct ahci_controller {
uint32_t caps; /* Controller capabilities */
uint32_t caps2; /* Controller capabilities */
uint32_t capsem; /* Controller capabilities */
+ uint32_t emloc; /* EM buffer location */
int quirks;
int numirqs;
int channels;
@@ -453,6 +464,7 @@ struct ahci_controller {
void (*function)(void *);
void *argument;
} interrupt[AHCI_MAX_PORTS];
+ struct mtx em_mtx; /* EM access lock */
};
enum ahci_err_type {
diff --git a/sys/dev/alc/if_alcreg.h b/sys/dev/alc/if_alcreg.h
index 93dc664..3011abf 100644
--- a/sys/dev/alc/if_alcreg.h
+++ b/sys/dev/alc/if_alcreg.h
@@ -17,12 +17,12 @@
* 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
- * DAMATES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * 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 DAMATE.
+ * SUCH DAMAGE.
*
* $FreeBSD$
*/
diff --git a/sys/dev/ale/if_alereg.h b/sys/dev/ale/if_alereg.h
index 896b0ab..445af99 100644
--- a/sys/dev/ale/if_alereg.h
+++ b/sys/dev/ale/if_alereg.h
@@ -17,12 +17,12 @@
* 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
- * DAMATES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * 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 DAMATE.
+ * SUCH DAMAGE.
*
* $FreeBSD$
*/
diff --git a/sys/dev/ath/ah_osdep.c b/sys/dev/ath/ah_osdep.c
index 090b690..b14bba0 100644
--- a/sys/dev/ath/ah_osdep.c
+++ b/sys/dev/ath/ah_osdep.c
@@ -140,16 +140,20 @@ ath_hal_ether_sprintf(const u_int8_t *mac)
}
#ifdef AH_DEBUG
+
+/* This must match the definition in ath_hal/ah_debug.h */
+#define HAL_DEBUG_UNMASKABLE 0xf0000000
void
DO_HALDEBUG(struct ath_hal *ah, u_int mask, const char* fmt, ...)
{
- if (ath_hal_debug & mask) {
+ if ((mask == HAL_DEBUG_UNMASKABLE) || (ath_hal_debug & mask)) {
__va_list ap;
va_start(ap, fmt);
ath_hal_vprintf(ah, fmt, ap);
va_end(ap);
}
}
+#undef HAL_DEBUG_UNMASKABLE
#endif /* AH_DEBUG */
#ifdef AH_DEBUG_ALQ
diff --git a/sys/dev/ath/ath_hal/ah.c b/sys/dev/ath/ath_hal/ah.c
index 2cc1e08..13a59f1 100644
--- a/sys/dev/ath/ath_hal/ah.c
+++ b/sys/dev/ath/ath_hal/ah.c
@@ -1069,7 +1069,7 @@ ath_hal_ini_write(struct ath_hal *ah, const HAL_INI_ARRAY *ia,
HAL_INI_VAL(ia, r, col));
/* Analog shift register delay seems needed for Merlin - PR kern/154220 */
- if (HAL_INI_VAL(ia, r, 0) >= 0x7800 && HAL_INI_VAL(ia, r, 0) < 0x78a0)
+ if (HAL_INI_VAL(ia, r, 0) >= 0x7800 && HAL_INI_VAL(ia, r, 0) < 0x7900)
OS_DELAY(100);
DMA_YIELD(regWr);
diff --git a/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c b/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c
index 15f3864..0d6adc1 100644
--- a/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c
+++ b/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c
@@ -857,7 +857,7 @@ ar5212GetCapability(struct ath_hal *ah, HAL_CAPABILITY_TYPE type,
case HAL_CAP_MCAST_KEYSRCH: /* multicast frame keycache search */
switch (capability) {
case 0: /* hardware capability */
- return HAL_OK;
+ return pCap->halMcastKeySrchSupport ? HAL_OK : HAL_ENXIO;
case 1:
return (ahp->ah_staId1Defaults &
AR_STA_ID1_MCAST_KSRCH) ? HAL_OK : HAL_ENXIO;
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c b/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
index d545733..6779bf9 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
@@ -816,7 +816,7 @@ ar5416FillCapabilityInfo(struct ath_hal *ah)
pCap->halPSPollBroken = AH_TRUE; /* XXX fixed in later revs? */
pCap->halVEOLSupport = AH_TRUE;
pCap->halBssIdMaskSupport = AH_TRUE;
- pCap->halMcastKeySrchSupport = AH_FALSE;
+ pCap->halMcastKeySrchSupport = AH_TRUE; /* Works on AR5416 and later */
pCap->halTsfAddSupport = AH_TRUE;
pCap->hal4AddrAggrSupport = AH_FALSE; /* Broken in Owl */
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c b/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c
index d8609bb..ee61c30 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c
@@ -501,7 +501,7 @@ ar5416PerCalibrationN(struct ath_hal *ah, struct ieee80211_channel *chan,
* and update the history buffer.
*/
r = ar5416GetNf(ah, chan);
- if (r <= 0) {
+ if (r == 0 || r == -1) {
/* NF calibration result isn't valid */
HALDEBUG(ah, HAL_DEBUG_UNMASKABLE, "%s: NF calibration"
" didn't finish; delaying CCA\n", __func__);
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c b/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
index e45a829..d2ae351 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
@@ -1368,10 +1368,6 @@ ar5416UpdateChainMasks(struct ath_hal *ah, HAL_BOOL is_ht)
AH5416(ah)->ah_rx_chainmask);
}
-#ifndef IS_5GHZ_FAST_CLOCK_EN
-#define IS_5GHZ_FAST_CLOCK_EN(ah, chan) AH_FALSE
-#endif
-
void
ar5416InitPLL(struct ath_hal *ah, const struct ieee80211_channel *chan)
{
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c b/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c
index 3cf7da9..48956c5 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c
@@ -208,10 +208,11 @@ ar5416SetupTxDesc(struct ath_hal *ah, struct ath_desc *ds,
| SM(ahp->ah_tx_chainmask, AR_ChainSel2)
| SM(ahp->ah_tx_chainmask, AR_ChainSel3)
;
- ads->ds_ctl8 = 0;
- ads->ds_ctl9 = (txPower << 24); /* XXX? */
- ads->ds_ctl10 = (txPower << 24); /* XXX? */
- ads->ds_ctl11 = (txPower << 24); /* XXX? */
+ ads->ds_ctl8 = SM(0, AR_AntCtl0);
+ ads->ds_ctl9 = SM(0, AR_AntCtl1) | SM(txPower, AR_XmitPower1);
+ ads->ds_ctl10 = SM(0, AR_AntCtl2) | SM(txPower, AR_XmitPower2);
+ ads->ds_ctl11 = SM(0, AR_AntCtl3) | SM(txPower, AR_XmitPower3);
+
if (keyIx != HAL_TXKEYIX_INVALID) {
/* XXX validate key index */
ads->ds_ctl1 |= SM(keyIx, AR_DestIdx);
@@ -232,11 +233,16 @@ ar5416SetupTxDesc(struct ath_hal *ah, struct ath_desc *ds,
ads->ds_ctl7 |= (rtsctsRate << AR_RTSCTSRate_S);
}
+ /*
+ * Set the TX antenna to 0 for Kite
+ * To preserve existing behaviour, also set the TPC bits to 0;
+ * when TPC is enabled these should be filled in appropriately.
+ */
if (AR_SREV_KITE(ah)) {
- ads->ds_ctl8 = 0;
- ads->ds_ctl9 = 0;
- ads->ds_ctl10 = 0;
- ads->ds_ctl11 = 0;
+ ads->ds_ctl8 = SM(0, AR_AntCtl0);
+ ads->ds_ctl9 = SM(0, AR_AntCtl1) | SM(0, AR_XmitPower1);
+ ads->ds_ctl10 = SM(0, AR_AntCtl2) | SM(0, AR_XmitPower2);
+ ads->ds_ctl11 = SM(0, AR_AntCtl3) | SM(0, AR_XmitPower3);
}
return AH_TRUE;
#undef RTSCTS
@@ -410,10 +416,10 @@ ar5416SetupFirstTxDesc(struct ath_hal *ah, struct ath_desc *ds,
| SM(AH5416(ah)->ah_tx_chainmask, AR_ChainSel3);
/* NB: no V1 WAR */
- ads->ds_ctl8 = 0;
- ads->ds_ctl9 = (txPower << 24);
- ads->ds_ctl10 = (txPower << 24);
- ads->ds_ctl11 = (txPower << 24);
+ ads->ds_ctl8 = SM(0, AR_AntCtl0);
+ ads->ds_ctl9 = SM(0, AR_AntCtl1) | SM(txPower, AR_XmitPower1);
+ ads->ds_ctl10 = SM(0, AR_AntCtl2) | SM(txPower, AR_XmitPower2);
+ ads->ds_ctl11 = SM(0, AR_AntCtl3) | SM(txPower, AR_XmitPower3);
ads->ds_ctl6 &= ~(0xffff);
ads->ds_ctl6 |= SM(aggrLen, AR_AggrLen);
@@ -424,11 +430,16 @@ ar5416SetupFirstTxDesc(struct ath_hal *ah, struct ath_desc *ds,
| (flags & HAL_TXDESC_RTSENA ? AR_RTSEnable : 0);
}
+ /*
+ * Set the TX antenna to 0 for Kite
+ * To preserve existing behaviour, also set the TPC bits to 0;
+ * when TPC is enabled these should be filled in appropriately.
+ */
if (AR_SREV_KITE(ah)) {
- ads->ds_ctl8 = 0;
- ads->ds_ctl9 = 0;
- ads->ds_ctl10 = 0;
- ads->ds_ctl11 = 0;
+ ads->ds_ctl8 = SM(0, AR_AntCtl0);
+ ads->ds_ctl9 = SM(0, AR_AntCtl1) | SM(0, AR_XmitPower1);
+ ads->ds_ctl10 = SM(0, AR_AntCtl2) | SM(0, AR_XmitPower2);
+ ads->ds_ctl11 = SM(0, AR_AntCtl3) | SM(0, AR_XmitPower3);
}
return AH_TRUE;
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416desc.h b/sys/dev/ath/ath_hal/ar5416/ar5416desc.h
index 76f5080..105c5d6 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416desc.h
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416desc.h
@@ -205,6 +205,29 @@ struct ar5416_desc {
#define AR_STBC2 0x40000000
#define AR_STBC3 0x80000000
+/* ds_ctl8 */
+#define AR_AntCtl0 0x00ffffff
+#define AR_AntCtl0_S 0
+/* Xmit 0 TPC is AR_XmitPower in ctl0 */
+
+/* ds_ctl9 */
+#define AR_AntCtl1 0x00ffffff
+#define AR_AntCtl1_S 0
+#define AR_XmitPower1 0xff000000
+#define AR_XmitPower1_S 24
+
+/* ds_ctl10 */
+#define AR_AntCtl2 0x00ffffff
+#define AR_AntCtl2_S 0
+#define AR_XmitPower2 0xff000000
+#define AR_XmitPower2_S 24
+
+/* ds_ctl11 */
+#define AR_AntCtl3 0x00ffffff
+#define AR_AntCtl3_S 0
+#define AR_XmitPower3 0xff000000
+#define AR_XmitPower3_S 24
+
/*************
* TX Status *
*************/
diff --git a/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c b/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c
index 5869c03..3351edb 100644
--- a/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c
+++ b/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c
@@ -430,7 +430,7 @@ ar9280WriteIni(struct ath_hal *ah, const struct ieee80211_channel *chan)
OS_REG_WRITE(ah, reg, val);
/* Analog shift register delay seems needed for Merlin - PR kern/154220 */
- if (reg >= 0x7800 && reg < 0x78a0)
+ if (reg >= 0x7800 && reg < 0x7900)
OS_DELAY(100);
DMA_YIELD(regWrites);
diff --git a/sys/dev/ath/ath_rate/sample/sample.c b/sys/dev/ath/ath_rate/sample/sample.c
index 312623e..27bb98c 100644
--- a/sys/dev/ath/ath_rate/sample/sample.c
+++ b/sys/dev/ath/ath_rate/sample/sample.c
@@ -161,9 +161,10 @@ dot11rate_label(const HAL_RATE_TABLE *rt, int rix)
* or -1 if all the average_tx_times are 0.
*/
static __inline int
-pick_best_rate(struct sample_node *sn, const HAL_RATE_TABLE *rt,
+pick_best_rate(struct ath_node *an, const HAL_RATE_TABLE *rt,
int size_bin, int require_acked_before)
{
+ struct sample_node *sn = ATH_NODE_SAMPLE(an);
int best_rate_rix, best_rate_tt;
uint32_t mask;
int rix, tt;
@@ -174,6 +175,12 @@ pick_best_rate(struct sample_node *sn, const HAL_RATE_TABLE *rt,
if ((mask & 1) == 0) /* not a supported rate */
continue;
+ /* Don't pick a non-HT rate for a HT node */
+ if ((an->an_node.ni_flags & IEEE80211_NODE_HT) &&
+ (rt->info[rix].phy != IEEE80211_T_HT)) {
+ continue;
+ }
+
tt = sn->stats[size_bin][rix].average_tx_time;
if (tt <= 0 ||
(require_acked_before &&
@@ -196,11 +203,12 @@ pick_best_rate(struct sample_node *sn, const HAL_RATE_TABLE *rt,
* Pick a good "random" bit-rate to sample other than the current one.
*/
static __inline int
-pick_sample_rate(struct sample_softc *ssc , struct sample_node *sn,
+pick_sample_rate(struct sample_softc *ssc , struct ath_node *an,
const HAL_RATE_TABLE *rt, int size_bin)
{
#define DOT11RATE(ix) (rt->info[ix].dot11Rate & IEEE80211_RATE_VAL)
#define MCS(ix) (rt->info[ix].dot11Rate | IEEE80211_RATE_MCS)
+ struct sample_node *sn = ATH_NODE_SAMPLE(an);
int current_rix, rix;
unsigned current_tt;
uint32_t mask;
@@ -208,6 +216,7 @@ pick_sample_rate(struct sample_softc *ssc , struct sample_node *sn,
current_rix = sn->current_rix[size_bin];
if (current_rix < 0) {
/* no successes yet, send at the lowest bit-rate */
+ /* XXX should return MCS0 if HT */
return 0;
}
@@ -223,6 +232,13 @@ pick_sample_rate(struct sample_softc *ssc , struct sample_node *sn,
continue;
}
+ /* if the node is HT and the rate isn't HT, don't bother sample */
+ if ((an->an_node.ni_flags & IEEE80211_NODE_HT) &&
+ (rt->info[rix].phy != IEEE80211_T_HT)) {
+ mask &= ~(1<<rix);
+ goto nextrate;
+ }
+
/* this bit-rate is always worse than the current one */
if (sn->stats[size_bin][rix].perfect_tx_time > current_tt) {
mask &= ~(1<<rix);
@@ -236,10 +252,12 @@ pick_sample_rate(struct sample_softc *ssc , struct sample_node *sn,
goto nextrate;
}
- /* don't sample more than 2 rates higher for rates > 11M */
- if (DOT11RATE(rix) > 2*11 && rix > current_rix + 2) {
- mask &= ~(1<<rix);
- goto nextrate;
+ /* Don't sample more than 2 rates higher for rates > 11M for non-HT rates */
+ if (! (an->an_node.ni_flags & IEEE80211_NODE_HT)) {
+ if (DOT11RATE(rix) > 2*11 && rix > current_rix + 2) {
+ mask &= ~(1<<rix);
+ goto nextrate;
+ }
}
sn->last_sample_rix[size_bin] = rix;
@@ -327,7 +345,7 @@ ath_rate_findrate(struct ath_softc *sc, struct ath_node *an,
/* XXX TODO: this doesn't know about 11gn vs 11g protection; teach it */
mrr = sc->sc_mrretry && !(ic->ic_flags & IEEE80211_F_USEPROT);
- best_rix = pick_best_rate(sn, rt, size_bin, !mrr);
+ best_rix = pick_best_rate(an, rt, size_bin, !mrr);
if (best_rix >= 0) {
average_tx_time = sn->stats[size_bin][best_rix].average_tx_time;
} else {
@@ -338,7 +356,7 @@ ath_rate_findrate(struct ath_softc *sc, struct ath_node *an,
* rates to sample_rate% of the total transmission time.
*/
if (sn->sample_tt[size_bin] < average_tx_time * (sn->packets_since_sample[size_bin]*ssc->sample_rate/100)) {
- rix = pick_sample_rate(ssc, sn, rt, size_bin);
+ rix = pick_sample_rate(ssc, an, rt, size_bin);
IEEE80211_NOTE(an->an_node.ni_vap, IEEE80211_MSG_RATECTL,
&an->an_node, "size %u sample rate %d current rate %d",
bin_to_size(size_bin), RATE(rix),
diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c
index 8f13b26..745a0d5 100644
--- a/sys/dev/ath/if_ath.c
+++ b/sys/dev/ath/if_ath.c
@@ -3966,9 +3966,21 @@ ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
sc->sc_stats.ast_tx_fifoerr++;
if (ts->ts_status & HAL_TXERR_FILT)
sc->sc_stats.ast_tx_filtered++;
+ if (ts->ts_status & HAL_TXERR_XTXOP)
+ sc->sc_stats.ast_tx_xtxop++;
+ if (ts->ts_status & HAL_TXERR_TIMER_EXPIRED)
+ sc->sc_stats.ast_tx_timerexpired++;
+
+ /* XXX HAL_TX_DATA_UNDERRUN */
+ /* XXX HAL_TX_DELIM_UNDERRUN */
+
if (bf->bf_m->m_flags & M_FF)
sc->sc_stats.ast_ff_txerr++;
}
+ /* XXX when is this valid? */
+ if (ts->ts_status & HAL_TX_DESC_CFG_ERR)
+ sc->sc_stats.ast_tx_desccfgerr++;
+
sr = ts->ts_shortretry;
lr = ts->ts_longretry;
sc->sc_stats.ast_tx_shortretry += sr;
diff --git a/sys/dev/ath/if_ath_sysctl.c b/sys/dev/ath/if_ath_sysctl.c
index 8e06497..6c1a6b2 100644
--- a/sys/dev/ath/if_ath_sysctl.c
+++ b/sys/dev/ath/if_ath_sysctl.c
@@ -709,6 +709,12 @@ ath_sysctl_stats_attach(struct ath_softc *sc)
&sc->sc_stats.ast_tx_timeout, 0, "TX Global Timeout");
SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_cst", CTLFLAG_RD,
&sc->sc_stats.ast_tx_cst, 0, "TX Carrier Sense Timeout");
+ SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_xtxop", CTLFLAG_RD,
+ &sc->sc_stats.ast_tx_xtxop, 0, "TX exceeded TXOP");
+ SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_timerexpired", CTLFLAG_RD,
+ &sc->sc_stats.ast_tx_timerexpired, 0, "TX exceeded TX_TIMER register");
+ SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_desccfgerr", CTLFLAG_RD,
+ &sc->sc_stats.ast_tx_desccfgerr, 0, "TX Descriptor Cfg Error");
/* Attach the RX phy error array */
ath_sysctl_stats_attach_rxphyerr(sc, child);
diff --git a/sys/dev/ath/if_athioctl.h b/sys/dev/ath/if_athioctl.h
index 1c9d23f..98dd037 100644
--- a/sys/dev/ath/if_athioctl.h
+++ b/sys/dev/ath/if_athioctl.h
@@ -121,17 +121,20 @@ struct ath_stats {
u_int32_t ast_be_missed; /* missed beacons */
u_int32_t ast_ani_cal; /* ANI calibrations performed */
u_int32_t ast_rx_agg; /* number of aggregate frames RX'ed */
- u_int32_t ast_rx_halfgi;
- u_int32_t ast_rx_2040;
- u_int32_t ast_rx_pre_crc_err;
- u_int32_t ast_rx_post_crc_err;
- u_int32_t ast_rx_decrypt_busy_err;
+ u_int32_t ast_rx_halfgi; /* RX half-GI */
+ u_int32_t ast_rx_2040; /* RX 40mhz frame */
+ u_int32_t ast_rx_pre_crc_err; /* RX pre-delimiter CRC error */
+ u_int32_t ast_rx_post_crc_err; /* RX post-delimiter CRC error */
+ u_int32_t ast_rx_decrypt_busy_err; /* RX decrypt engine busy error */
u_int32_t ast_rx_hi_rx_chain;
u_int32_t ast_tx_htprotect; /* HT tx frames with protection */
- u_int32_t ast_rx_hitqueueend;
+ u_int32_t ast_rx_hitqueueend; /* RX hit descr queue end */
u_int32_t ast_tx_timeout; /* Global TX timeout */
u_int32_t ast_tx_cst; /* Carrier sense timeout */
- u_int32_t ast_pad[16];
+ u_int32_t ast_tx_xtxop; /* tx exceeded TXOP */
+ u_int32_t ast_tx_timerexpired; /* tx exceeded TX_TIMER */
+ u_int32_t ast_tx_desccfgerr; /* tx desc cfg error */
+ u_int32_t ast_pad[13];
};
#define SIOCGATHSTATS _IOWR('i', 137, struct ifreq)
diff --git a/sys/dev/atkbdc/atkbd.c b/sys/dev/atkbdc/atkbd.c
index 600020f..643554d 100644
--- a/sys/dev/atkbdc/atkbd.c
+++ b/sys/dev/atkbdc/atkbd.c
@@ -1097,6 +1097,9 @@ get_typematic(keyboard_t *kbd)
x86regs_t regs;
uint8_t *p;
+ if (!(kbd->kb_config & KB_CONF_PROBE_TYPEMATIC))
+ return (ENODEV);
+
if (x86bios_get_intr(0x15) == 0 || x86bios_get_intr(0x16) == 0)
return (ENODEV);
diff --git a/sys/dev/atkbdc/atkbdreg.h b/sys/dev/atkbdc/atkbdreg.h
index cf7ee6b..3d54b4d 100644
--- a/sys/dev/atkbdc/atkbdreg.h
+++ b/sys/dev/atkbdc/atkbdreg.h
@@ -36,6 +36,7 @@
#define KB_CONF_NO_RESET (1 << 1) /* don't reset the keyboard */
#define KB_CONF_ALT_SCANCODESET (1 << 2) /* assume the XT type keyboard */
#define KB_CONF_NO_PROBE_TEST (1 << 3) /* don't test keyboard during probe */
+#define KB_CONF_PROBE_TYPEMATIC (1 << 4) /* probe keyboard typematic */
#ifdef _KERNEL
diff --git a/sys/dev/bge/if_bge.c b/sys/dev/bge/if_bge.c
index 3d725fc..0f87eb0 100644
--- a/sys/dev/bge/if_bge.c
+++ b/sys/dev/bge/if_bge.c
@@ -2836,7 +2836,7 @@ bge_attach(device_t dev)
if (sc->bge_asicrev == BGE_ASICREV_BCM5719 &&
sc->bge_chipid == BGE_CHIPID_BCM5719_A0) {
/* Jumbo frame on BCM5719 A0 does not work. */
- sc->bge_flags &= ~BGE_FLAG_JUMBO_FRAME;
+ sc->bge_flags &= ~BGE_FLAG_JUMBO;
}
break;
case BGE_ASICREV_BCM5755:
diff --git a/sys/dev/cfi/cfi_dev.c b/sys/dev/cfi/cfi_dev.c
index d635753..9b232bd 100644
--- a/sys/dev/cfi/cfi_dev.c
+++ b/sys/dev/cfi/cfi_dev.c
@@ -145,7 +145,8 @@ cfi_devopen(struct cdev *dev, int oflags, int devtype, struct thread *td)
sc = dev->si_drv1;
/* We allow only 1 open. */
- if (!atomic_cmpset_acq_ptr(&sc->sc_opened, NULL, td->td_proc))
+ if (!atomic_cmpset_acq_ptr((uintptr_t *)&sc->sc_opened,
+ (uintptr_t)NULL, (uintptr_t)td->td_proc))
return (EBUSY);
return (0);
}
diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c
index 929f31b..469af8d 100644
--- a/sys/dev/cxgbe/t4_main.c
+++ b/sys/dev/cxgbe/t4_main.c
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
#include <net/if.h>
#include <net/if_types.h>
#include <net/if_dl.h>
+#include <net/if_vlan_var.h>
#include "common/t4_hw.h"
#include "common/common.h"
@@ -365,7 +366,13 @@ t4_attach(device_t dev)
sc->mbox = sc->pf;
pci_enable_busmaster(dev);
- pci_set_max_read_req(dev, 4096);
+ if (pci_find_cap(dev, PCIY_EXPRESS, &i) == 0) {
+ pci_set_max_read_req(dev, 4096);
+ v = pci_read_config(dev, i + PCIR_EXPRESS_DEVICE_CTL, 2);
+ v |= PCIM_EXP_CTL_RELAXED_ORD_ENABLE;
+ pci_write_config(dev, i + PCIR_EXPRESS_DEVICE_CTL, v, 2);
+ }
+
snprintf(sc->lockname, sizeof(sc->lockname), "%s",
device_get_nameunit(dev));
mtx_init(&sc->sc_lock, sc->lockname, 0, MTX_DEF);
@@ -3208,41 +3215,9 @@ filter_rpl(struct adapter *sc, const struct cpl_set_tcb_rpl *rpl)
int
t4_os_find_pci_capability(struct adapter *sc, int cap)
{
- device_t dev;
- struct pci_devinfo *dinfo;
- pcicfgregs *cfg;
- uint32_t status;
- uint8_t ptr;
-
- dev = sc->dev;
- dinfo = device_get_ivars(dev);
- cfg = &dinfo->cfg;
-
- status = pci_read_config(dev, PCIR_STATUS, 2);
- if (!(status & PCIM_STATUS_CAPPRESENT))
- return (0);
-
- switch (cfg->hdrtype & PCIM_HDRTYPE) {
- case 0:
- case 1:
- ptr = PCIR_CAP_PTR;
- break;
- case 2:
- ptr = PCIR_CAP_PTR_2;
- break;
- default:
- return (0);
- break;
- }
- ptr = pci_read_config(dev, ptr, 1);
-
- while (ptr != 0) {
- if (pci_read_config(dev, ptr + PCICAP_ID, 1) == cap)
- return (ptr);
- ptr = pci_read_config(dev, ptr + PCICAP_NEXTPTR, 1);
- }
+ int i;
- return (0);
+ return (pci_find_cap(sc->dev, cap, &i) == 0 ? i : 0);
}
int
diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c
index 5440528..a0ef172 100644
--- a/sys/dev/cxgbe/t4_sge.c
+++ b/sys/dev/cxgbe/t4_sge.c
@@ -100,7 +100,7 @@ static int alloc_ring(struct adapter *, size_t, bus_dma_tag_t *, bus_dmamap_t *,
static int free_ring(struct adapter *, bus_dma_tag_t, bus_dmamap_t, bus_addr_t,
void *);
static int alloc_iq_fl(struct port_info *, struct sge_iq *, struct sge_fl *,
- int);
+ int, int);
static int free_iq_fl(struct port_info *, struct sge_iq *, struct sge_fl *);
static int alloc_iq(struct sge_iq *, int);
static int free_iq(struct sge_iq *);
@@ -141,6 +141,7 @@ static int handle_sge_egr_update(struct adapter *,
const struct cpl_sge_egr_update *);
static int ctrl_tx(struct adapter *, struct sge_ctrlq *, struct mbuf *);
+static int sysctl_abs_id(SYSCTL_HANDLER_ARGS);
extern void filter_rpl(struct adapter *, const struct cpl_set_tcb_rpl *);
@@ -1103,7 +1104,7 @@ free_ring(struct adapter *sc, bus_dma_tag_t tag, bus_dmamap_t map,
*/
static int
alloc_iq_fl(struct port_info *pi, struct sge_iq *iq, struct sge_fl *fl,
- int intr_idx)
+ int intr_idx, int cong)
{
int rc, i, cntxt_id;
size_t len;
@@ -1154,6 +1155,8 @@ alloc_iq_fl(struct port_info *pi, struct sge_iq *iq, struct sge_fl *fl,
V_FW_IQ_CMD_IQESIZE(ilog2(iq->esize) - 4));
c.iqsize = htobe16(iq->qsize);
c.iqaddr = htobe64(iq->ba);
+ if (cong >= 0)
+ c.iqns_to_fl0congen = htobe32(F_FW_IQ_CMD_IQFLINTCONGEN);
if (fl) {
mtx_init(&fl->fl_lock, fl->lockname, NULL, MTX_DEF);
@@ -1197,7 +1200,15 @@ alloc_iq_fl(struct port_info *pi, struct sge_iq *iq, struct sge_fl *fl,
fl->needed = fl->cap;
c.iqns_to_fl0congen =
- htobe32(V_FW_IQ_CMD_FL0HOSTFCMODE(X_HOSTFCMODE_NONE));
+ htobe32(V_FW_IQ_CMD_FL0HOSTFCMODE(X_HOSTFCMODE_NONE) |
+ F_FW_IQ_CMD_FL0FETCHRO | F_FW_IQ_CMD_FL0DATARO |
+ F_FW_IQ_CMD_FL0PADEN);
+ if (cong >= 0) {
+ c.iqns_to_fl0congen |=
+ htobe32(V_FW_IQ_CMD_FL0CNGCHMAP(cong) |
+ F_FW_IQ_CMD_FL0CONGCIF |
+ F_FW_IQ_CMD_FL0CONGEN);
+ }
c.fl0dcaen_to_fl0cidxfthresh =
htobe16(V_FW_IQ_CMD_FL0FBMIN(X_FETCHBURSTMIN_64B) |
V_FW_IQ_CMD_FL0FBMAX(X_FETCHBURSTMAX_512B));
@@ -1324,7 +1335,7 @@ free_iq_fl(struct port_info *pi, struct sge_iq *iq, struct sge_fl *fl)
static int
alloc_iq(struct sge_iq *iq, int intr_idx)
{
- return alloc_iq_fl(NULL, iq, NULL, intr_idx);
+ return alloc_iq_fl(NULL, iq, NULL, intr_idx, -1);
}
static int
@@ -1341,7 +1352,7 @@ alloc_rxq(struct port_info *pi, struct sge_rxq *rxq, int intr_idx, int idx)
struct sysctl_oid_list *children;
char name[16];
- rc = alloc_iq_fl(pi, &rxq->iq, &rxq->fl, intr_idx);
+ rc = alloc_iq_fl(pi, &rxq->iq, &rxq->fl, intr_idx, 1 << pi->tx_chan);
if (rc != 0)
return (rc);
@@ -1363,6 +1374,9 @@ alloc_rxq(struct port_info *pi, struct sge_rxq *rxq, int intr_idx, int idx)
NULL, "rx queue");
children = SYSCTL_CHILDREN(oid);
+ SYSCTL_ADD_PROC(&pi->ctx, children, OID_AUTO, "abs_id",
+ CTLTYPE_INT | CTLFLAG_RD, &rxq->iq.abs_id, 0, sysctl_abs_id, "I",
+ "absolute id of the queue");
#ifdef INET
SYSCTL_ADD_INT(&pi->ctx, children, OID_AUTO, "lro_queued", CTLFLAG_RD,
&rxq->lro.lro_queued, 0, NULL);
@@ -1432,7 +1446,7 @@ alloc_ctrlq(struct adapter *sc, struct sge_ctrlq *ctrlq, int idx)
c.physeqid_pkd = htobe32(0);
c.fetchszm_to_iqid =
htobe32(V_FW_EQ_CTRL_CMD_HOSTFCMODE(X_HOSTFCMODE_STATUS_PAGE) |
- V_FW_EQ_CTRL_CMD_PCIECHN(idx) |
+ V_FW_EQ_CTRL_CMD_PCIECHN(idx) | F_FW_EQ_CTRL_CMD_FETCHRO |
V_FW_EQ_CTRL_CMD_IQID(eq->iqid));
c.dcaen_to_eqsize =
htobe32(V_FW_EQ_CTRL_CMD_FBMIN(X_FETCHBURSTMIN_64B) |
@@ -1557,7 +1571,7 @@ alloc_txq(struct port_info *pi, struct sge_txq *txq, int idx)
c.viid_pkd = htobe32(V_FW_EQ_ETH_CMD_VIID(pi->viid));
c.fetchszm_to_iqid =
htobe32(V_FW_EQ_ETH_CMD_HOSTFCMODE(X_HOSTFCMODE_STATUS_PAGE) |
- V_FW_EQ_ETH_CMD_PCIECHN(pi->tx_chan) |
+ V_FW_EQ_ETH_CMD_PCIECHN(pi->tx_chan) | F_FW_EQ_ETH_CMD_FETCHRO |
V_FW_EQ_ETH_CMD_IQID(eq->iqid));
c.dcaen_to_eqsize = htobe32(V_FW_EQ_ETH_CMD_FBMIN(X_FETCHBURSTMIN_64B) |
V_FW_EQ_ETH_CMD_FBMAX(X_FETCHBURSTMAX_512B) |
@@ -2733,3 +2747,12 @@ failed:
return (rc);
}
+
+static int
+sysctl_abs_id(SYSCTL_HANDLER_ARGS)
+{
+ uint16_t *id = arg1;
+ int i = *id;
+
+ return sysctl_handle_int(oidp, &i, 0, req);
+}
diff --git a/sys/dev/gem/if_gem.c b/sys/dev/gem/if_gem.c
index 814c9a8..9ee43f2 100644
--- a/sys/dev/gem/if_gem.c
+++ b/sys/dev/gem/if_gem.c
@@ -739,8 +739,10 @@ gem_reset_rxdma(struct gem_softc *sc)
{
int i;
- if (gem_reset_rx(sc) != 0)
+ if (gem_reset_rx(sc) != 0) {
+ sc->sc_ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
return (gem_init_locked(sc));
+ }
for (i = 0; i < GEM_NRXDESC; i++)
if (sc->sc_rxsoft[i].rxs_mbuf != NULL)
GEM_UPDATE_RXDESC(sc, i);
@@ -924,6 +926,9 @@ gem_init_locked(struct gem_softc *sc)
GEM_LOCK_ASSERT(sc, MA_OWNED);
+ if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+ return;
+
#ifdef GEM_DEBUG
CTR2(KTR_GEM, "%s: %s: calling stop", device_get_name(sc->sc_dev),
__func__);
@@ -1762,6 +1767,7 @@ gem_intr(void *v)
if ((status2 &
(GEM_MAC_TX_UNDERRUN | GEM_MAC_TX_PKT_TOO_LONG)) != 0) {
sc->sc_ifp->if_oerrors++;
+ sc->sc_ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
gem_init_locked(sc);
}
}
@@ -1814,6 +1820,7 @@ gem_watchdog(struct gem_softc *sc)
++ifp->if_oerrors;
/* Try to get more packets going. */
+ ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
gem_init_locked(sc);
gem_start_locked(ifp);
return (EJUSTRETURN);
diff --git a/sys/dev/glxiic/glxiic.c b/sys/dev/glxiic/glxiic.c
new file mode 100644
index 0000000..6eeac7c
--- /dev/null
+++ b/sys/dev/glxiic/glxiic.c
@@ -0,0 +1,1078 @@
+/*-
+ * Copyright (c) 2011 Henrik Brix Andersen <brix@FreeBSD.org>
+ * 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 <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+/*
+ * AMD Geode LX CS5536 System Management Bus controller.
+ *
+ * Although AMD refers to this device as an SMBus controller, it
+ * really is an I2C controller (It lacks SMBus ALERT# and Alert
+ * Response support).
+ *
+ * The driver is implemented as an interrupt-driven state machine,
+ * supporting both master and slave mode.
+ */
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <sys/sysctl.h>
+#ifdef GLXIIC_DEBUG
+#include <sys/syslog.h>
+#endif
+
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pcivar.h>
+
+#include <machine/bus.h>
+#include <sys/rman.h>
+#include <machine/resource.h>
+
+#include <dev/iicbus/iiconf.h>
+#include <dev/iicbus/iicbus.h>
+
+#include "iicbus_if.h"
+
+/* CS5536 PCI-ISA ID. */
+#define GLXIIC_CS5536_DEV_ID 0x20901022
+
+/* MSRs. */
+#define GLXIIC_MSR_PIC_YSEL_HIGH 0x51400021
+
+/* Bus speeds. */
+#define GLXIIC_SLOW 0x0258 /* 10 kHz. */
+#define GLXIIC_FAST 0x0078 /* 50 kHz. */
+#define GLXIIC_FASTEST 0x003c /* 100 kHz. */
+
+/* Default bus activity timeout in milliseconds. */
+#define GLXIIC_DEFAULT_TIMEOUT 35
+
+/* GPIO register offsets. */
+#define GLXIIC_GPIOL_OUT_AUX1_SEL 0x10
+#define GLXIIC_GPIOL_IN_AUX1_SEL 0x34
+
+/* GPIO 14 (SMB_CLK) and 15 (SMB_DATA) bitmasks. */
+#define GLXIIC_GPIO_14_15_ENABLE 0x0000c000
+#define GLXIIC_GPIO_14_15_DISABLE 0xc0000000
+
+/* SMB register offsets. */
+#define GLXIIC_SMB_SDA 0x00
+#define GLXIIC_SMB_STS 0x01
+#define GLXIIC_SMB_STS_SLVSTP_BIT (1 << 7)
+#define GLXIIC_SMB_STS_SDAST_BIT (1 << 6)
+#define GLXIIC_SMB_STS_BER_BIT (1 << 5)
+#define GLXIIC_SMB_STS_NEGACK_BIT (1 << 4)
+#define GLXIIC_SMB_STS_STASTR_BIT (1 << 3)
+#define GLXIIC_SMB_STS_NMATCH_BIT (1 << 2)
+#define GLXIIC_SMB_STS_MASTER_BIT (1 << 1)
+#define GLXIIC_SMB_STS_XMIT_BIT (1 << 0)
+#define GLXIIC_SMB_CTRL_STS 0x02
+#define GLXIIC_SMB_CTRL_STS_TGSCL_BIT (1 << 5)
+#define GLXIIC_SMB_CTRL_STS_TSDA_BIT (1 << 4)
+#define GLXIIC_SMB_CTRL_STS_GCMTCH_BIT (1 << 3)
+#define GLXIIC_SMB_CTRL_STS_MATCH_BIT (1 << 2)
+#define GLXIIC_SMB_CTRL_STS_BB_BIT (1 << 1)
+#define GLXIIC_SMB_CTRL_STS_BUSY_BIT (1 << 0)
+#define GLXIIC_SMB_CTRL1 0x03
+#define GLXIIC_SMB_CTRL1_STASTRE_BIT (1 << 7)
+#define GLXIIC_SMB_CTRL1_NMINTE_BIT (1 << 6)
+#define GLXIIC_SMB_CTRL1_GCMEN_BIT (1 << 5)
+#define GLXIIC_SMB_CTRL1_ACK_BIT (1 << 4)
+#define GLXIIC_SMB_CTRL1_INTEN_BIT (1 << 2)
+#define GLXIIC_SMB_CTRL1_STOP_BIT (1 << 1)
+#define GLXIIC_SMB_CTRL1_START_BIT (1 << 0)
+#define GLXIIC_SMB_ADDR 0x04
+#define GLXIIC_SMB_ADDR_SAEN_BIT (1 << 7)
+#define GLXIIC_SMB_CTRL2 0x05
+#define GLXIIC_SMB_CTRL2_EN_BIT (1 << 0)
+#define GLXIIC_SMB_CTRL3 0x06
+
+typedef enum {
+ GLXIIC_STATE_IDLE,
+ GLXIIC_STATE_SLAVE_TX,
+ GLXIIC_STATE_SLAVE_RX,
+ GLXIIC_STATE_MASTER_ADDR,
+ GLXIIC_STATE_MASTER_TX,
+ GLXIIC_STATE_MASTER_RX,
+ GLXIIC_STATE_MASTER_STOP,
+ GLXIIC_STATE_MAX,
+} glxiic_state_t;
+
+struct glxiic_softc {
+ device_t dev; /* Myself. */
+ device_t iicbus; /* IIC bus. */
+ struct mtx mtx; /* Lock. */
+ glxiic_state_t state; /* Driver state. */
+ struct callout callout; /* Driver state timeout callout. */
+ int timeout; /* Driver state timeout (ms). */
+
+ int smb_rid; /* SMB controller resource ID. */
+ struct resource *smb_res; /* SMB controller resource. */
+ int gpio_rid; /* GPIO resource ID. */
+ struct resource *gpio_res; /* GPIO resource. */
+
+ int irq_rid; /* IRQ resource ID. */
+ struct resource *irq_res; /* IRQ resource. */
+ void *irq_handler; /* IRQ handler cookie. */
+ int old_irq; /* IRQ mapped by board firmware. */
+
+ struct iic_msg *msg; /* Current master mode message. */
+ uint32_t nmsgs; /* Number of messages remaining. */
+ uint8_t *data; /* Current master mode data byte. */
+ uint16_t ndata; /* Number of data bytes remaining. */
+ int error; /* Last master mode error. */
+
+ uint8_t addr; /* Own address. */
+ uint16_t sclfrq; /* Bus frequency. */
+};
+
+#ifdef GLXIIC_DEBUG
+#define GLXIIC_DEBUG_LOG(fmt, args...) \
+ log(LOG_DEBUG, "%s: " fmt "\n" , __func__ , ## args)
+#else
+#define GLXIIC_DEBUG_LOG(fmt, args...)
+#endif
+
+#define GLXIIC_SCLFRQ(n) ((n << 1))
+#define GLXIIC_SMBADDR(n) ((n >> 1))
+#define GLXIIC_SMB_IRQ_TO_MAP(n) ((n << 16))
+#define GLXIIC_MAP_TO_SMB_IRQ(n) ((n >> 16) & 0xf)
+
+#define GLXIIC_LOCK(_sc) mtx_lock(&_sc->mtx)
+#define GLXIIC_UNLOCK(_sc) mtx_unlock(&_sc->mtx)
+#define GLXIIC_LOCK_INIT(_sc) \
+ mtx_init(&_sc->mtx, device_get_nameunit(_sc->dev), "glxiic", MTX_DEF)
+#define GLXIIC_SLEEP(_sc) \
+ mtx_sleep(_sc, &_sc->mtx, IICPRI, "glxiic", 0)
+#define GLXIIC_WAKEUP(_sc) wakeup(_sc);
+#define GLXIIC_LOCK_DESTROY(_sc) mtx_destroy(&_sc->mtx);
+#define GLXIIC_ASSERT_LOCKED(_sc) mtx_assert(&_sc->mtx, MA_OWNED);
+
+typedef int (glxiic_state_callback_t)(struct glxiic_softc *sc,
+ uint8_t status);
+
+static glxiic_state_callback_t glxiic_state_idle_callback;
+static glxiic_state_callback_t glxiic_state_slave_tx_callback;
+static glxiic_state_callback_t glxiic_state_slave_rx_callback;
+static glxiic_state_callback_t glxiic_state_master_addr_callback;
+static glxiic_state_callback_t glxiic_state_master_tx_callback;
+static glxiic_state_callback_t glxiic_state_master_rx_callback;
+static glxiic_state_callback_t glxiic_state_master_stop_callback;
+
+struct glxiic_state_table_entry {
+ glxiic_state_callback_t *callback;
+ boolean_t master;
+};
+typedef struct glxiic_state_table_entry glxiic_state_table_entry_t;
+
+static glxiic_state_table_entry_t glxiic_state_table[GLXIIC_STATE_MAX] = {
+ [GLXIIC_STATE_IDLE] = {
+ .callback = &glxiic_state_idle_callback,
+ .master = FALSE,
+ },
+
+ [GLXIIC_STATE_SLAVE_TX] = {
+ .callback = &glxiic_state_slave_tx_callback,
+ .master = FALSE,
+ },
+
+ [GLXIIC_STATE_SLAVE_RX] = {
+ .callback = &glxiic_state_slave_rx_callback,
+ .master = FALSE,
+ },
+
+ [GLXIIC_STATE_MASTER_ADDR] = {
+ .callback = &glxiic_state_master_addr_callback,
+ .master = TRUE,
+ },
+
+ [GLXIIC_STATE_MASTER_TX] = {
+ .callback = &glxiic_state_master_tx_callback,
+ .master = TRUE,
+ },
+
+ [GLXIIC_STATE_MASTER_RX] = {
+ .callback = &glxiic_state_master_rx_callback,
+ .master = TRUE,
+ },
+
+ [GLXIIC_STATE_MASTER_STOP] = {
+ .callback = &glxiic_state_master_stop_callback,
+ .master = TRUE,
+ },
+};
+
+static void glxiic_identify(driver_t *driver, device_t parent);
+static int glxiic_probe(device_t dev);
+static int glxiic_attach(device_t dev);
+static int glxiic_detach(device_t dev);
+
+static uint8_t glxiic_read_status_locked(struct glxiic_softc *sc);
+static void glxiic_stop_locked(struct glxiic_softc *sc);
+static void glxiic_timeout(void *arg);
+static void glxiic_start_timeout_locked(struct glxiic_softc *sc);
+static void glxiic_set_state_locked(struct glxiic_softc *sc,
+ glxiic_state_t state);
+static int glxiic_handle_slave_match_locked(struct glxiic_softc *sc,
+ uint8_t status);
+static void glxiic_intr(void *arg);
+
+static int glxiic_reset(device_t dev, u_char speed, u_char addr,
+ u_char *oldaddr);
+static int glxiic_transfer(device_t dev, struct iic_msg *msgs,
+ uint32_t nmsgs);
+
+static void glxiic_smb_map_interrupt(int irq);
+static void glxiic_gpio_enable(struct glxiic_softc *sc);
+static void glxiic_gpio_disable(struct glxiic_softc *sc);
+static void glxiic_smb_enable(struct glxiic_softc *sc, uint8_t speed,
+ uint8_t addr);
+static void glxiic_smb_disable(struct glxiic_softc *sc);
+
+static device_method_t glxiic_methods[] = {
+ DEVMETHOD(device_identify, glxiic_identify),
+ DEVMETHOD(device_probe, glxiic_probe),
+ DEVMETHOD(device_attach, glxiic_attach),
+ DEVMETHOD(device_detach, glxiic_detach),
+
+ DEVMETHOD(iicbus_reset, glxiic_reset),
+ DEVMETHOD(iicbus_transfer, glxiic_transfer),
+ DEVMETHOD(iicbus_callback, iicbus_null_callback),
+
+ { 0, 0 }
+};
+
+static driver_t glxiic_driver = {
+ "glxiic",
+ glxiic_methods,
+ sizeof(struct glxiic_softc),
+};
+
+static devclass_t glxiic_devclass;
+
+DRIVER_MODULE(glxiic, isab, glxiic_driver, glxiic_devclass, 0, 0);
+DRIVER_MODULE(iicbus, glxiic, iicbus_driver, iicbus_devclass, 0, 0);
+MODULE_DEPEND(glxiic, iicbus, 1, 1, 1);
+
+static void
+glxiic_identify(driver_t *driver, device_t parent)
+{
+
+ /* Prevent child from being added more than once. */
+ if (device_find_child(parent, driver->name, -1) != NULL)
+ return;
+
+ if (pci_get_devid(parent) == GLXIIC_CS5536_DEV_ID) {
+ if (device_add_child(parent, driver->name, -1) == NULL)
+ device_printf(parent, "Could not add glxiic child\n");
+ }
+}
+
+static int
+glxiic_probe(device_t dev)
+{
+
+ if (resource_disabled("glxiic", device_get_unit(dev)))
+ return (ENXIO);
+
+ device_set_desc(dev, "AMD Geode CS5536 SMBus controller");
+
+ return (BUS_PROBE_DEFAULT);
+}
+
+static int
+glxiic_attach(device_t dev)
+{
+ struct glxiic_softc *sc;
+ struct sysctl_ctx_list *ctx;
+ struct sysctl_oid *tree;
+ int error, irq, unit;
+ uint32_t irq_map;
+ char tn[32];
+
+ sc = device_get_softc(dev);
+ sc->dev = dev;
+ sc->state = GLXIIC_STATE_IDLE;
+ error = 0;
+
+ GLXIIC_LOCK_INIT(sc);
+ callout_init_mtx(&sc->callout, &sc->mtx, 0);
+
+ sc->smb_rid = PCIR_BAR(0);
+ sc->smb_res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &sc->smb_rid,
+ RF_ACTIVE);
+ if (sc->smb_res == NULL) {
+ device_printf(dev, "Could not allocate SMBus I/O port\n");
+ error = ENXIO;
+ goto out;
+ }
+
+ sc->gpio_rid = PCIR_BAR(1);
+ sc->gpio_res = bus_alloc_resource_any(dev, SYS_RES_IOPORT,
+ &sc->gpio_rid, RF_SHAREABLE | RF_ACTIVE);
+ if (sc->gpio_res == NULL) {
+ device_printf(dev, "Could not allocate GPIO I/O port\n");
+ error = ENXIO;
+ goto out;
+ }
+
+ /* Ensure the controller is not enabled by firmware. */
+ glxiic_smb_disable(sc);
+
+ /* Read the existing IRQ map. */
+ irq_map = rdmsr(GLXIIC_MSR_PIC_YSEL_HIGH);
+ sc->old_irq = GLXIIC_MAP_TO_SMB_IRQ(irq_map);
+
+ unit = device_get_unit(dev);
+ if (resource_int_value("glxiic", unit, "irq", &irq) == 0) {
+ if (irq < 1 || irq > 15) {
+ device_printf(dev, "Bad value %d for glxiic.%d.irq\n",
+ irq, unit);
+ error = ENXIO;
+ goto out;
+ }
+
+ if (bootverbose)
+ device_printf(dev, "Using irq %d set by hint\n", irq);
+ } else if (sc->old_irq != 0) {
+ if (bootverbose)
+ device_printf(dev, "Using irq %d set by firmware\n",
+ irq);
+ irq = sc->old_irq;
+ } else {
+ device_printf(dev, "No irq mapped by firmware");
+ printf(" and no glxiic.%d.irq hint provided\n", unit);
+ error = ENXIO;
+ goto out;
+ }
+
+ /* Map the SMBus interrupt to the requested legacy IRQ. */
+ glxiic_smb_map_interrupt(irq);
+
+ sc->irq_rid = 0;
+ sc->irq_res = bus_alloc_resource(dev, SYS_RES_IRQ, &sc->irq_rid,
+ irq, irq, 1, RF_SHAREABLE | RF_ACTIVE);
+ if (sc->irq_res == NULL) {
+ device_printf(dev, "Could not allocate IRQ %d\n", irq);
+ error = ENXIO;
+ goto out;
+ }
+
+ error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_MISC | INTR_MPSAFE,
+ NULL, glxiic_intr, sc, &(sc->irq_handler));
+ if (error != 0) {
+ device_printf(dev, "Could not setup IRQ handler\n");
+ error = ENXIO;
+ goto out;
+ }
+
+ if ((sc->iicbus = device_add_child(dev, "iicbus", -1)) == NULL) {
+ device_printf(dev, "Could not allocate iicbus instance\n");
+ error = ENXIO;
+ goto out;
+ }
+
+ ctx = device_get_sysctl_ctx(dev);
+ tree = device_get_sysctl_tree(dev);
+
+ sc->timeout = GLXIIC_DEFAULT_TIMEOUT;
+ snprintf(tn, sizeof(tn), "dev.glxiic.%d.timeout", unit);
+ TUNABLE_INT_FETCH(tn, &sc->timeout);
+ SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
+ "timeout", CTLFLAG_RW | CTLFLAG_TUN, &sc->timeout, 0,
+ "activity timeout in ms");
+
+ glxiic_gpio_enable(sc);
+ glxiic_smb_enable(sc, IIC_FASTEST, 0);
+
+ error = bus_generic_attach(dev);
+ if (error != 0) {
+ device_printf(dev, "Could not probe and attach children\n");
+ error = ENXIO;
+ }
+out:
+ if (error != 0) {
+ callout_drain(&sc->callout);
+
+ if (sc->iicbus != NULL)
+ device_delete_child(dev, sc->iicbus);
+ if (sc->smb_res != NULL) {
+ glxiic_smb_disable(sc);
+ bus_release_resource(dev, SYS_RES_IOPORT, sc->smb_rid,
+ sc->smb_res);
+ }
+ if (sc->gpio_res != NULL) {
+ glxiic_gpio_disable(sc);
+ bus_release_resource(dev, SYS_RES_IOPORT, sc->gpio_rid,
+ sc->gpio_res);
+ }
+ if (sc->irq_handler != NULL)
+ bus_teardown_intr(dev, sc->irq_res, sc->irq_handler);
+ if (sc->irq_res != NULL)
+ bus_release_resource(dev, SYS_RES_IRQ, sc->irq_rid,
+ sc->irq_res);
+
+ /* Restore the old SMBus interrupt mapping. */
+ glxiic_smb_map_interrupt(sc->old_irq);
+
+ GLXIIC_LOCK_DESTROY(sc);
+ }
+
+ return (error);
+}
+
+static int
+glxiic_detach(device_t dev)
+{
+ struct glxiic_softc *sc;
+ int error;
+
+ sc = device_get_softc(dev);
+
+ error = bus_generic_detach(dev);
+ if (error != 0)
+ goto out;
+ if (sc->iicbus != NULL)
+ error = device_delete_child(dev, sc->iicbus);
+
+out:
+ callout_drain(&sc->callout);
+
+ if (sc->smb_res != NULL) {
+ glxiic_smb_disable(sc);
+ bus_release_resource(dev, SYS_RES_IOPORT, sc->smb_rid,
+ sc->smb_res);
+ }
+ if (sc->gpio_res != NULL) {
+ glxiic_gpio_disable(sc);
+ bus_release_resource(dev, SYS_RES_IOPORT, sc->gpio_rid,
+ sc->gpio_res);
+ }
+ if (sc->irq_handler != NULL)
+ bus_teardown_intr(dev, sc->irq_res, sc->irq_handler);
+ if (sc->irq_res != NULL)
+ bus_release_resource(dev, SYS_RES_IRQ, sc->irq_rid,
+ sc->irq_res);
+
+ /* Restore the old SMBus interrupt mapping. */
+ glxiic_smb_map_interrupt(sc->old_irq);
+
+ GLXIIC_LOCK_DESTROY(sc);
+
+ return (error);
+}
+
+static uint8_t
+glxiic_read_status_locked(struct glxiic_softc *sc)
+{
+ uint8_t status;
+
+ GLXIIC_ASSERT_LOCKED(sc);
+
+ status = bus_read_1(sc->smb_res, GLXIIC_SMB_STS);
+
+ /* Clear all status flags except SDAST and STASTR after reading. */
+ bus_write_1(sc->smb_res, GLXIIC_SMB_STS, (GLXIIC_SMB_STS_SLVSTP_BIT |
+ GLXIIC_SMB_STS_BER_BIT | GLXIIC_SMB_STS_NEGACK_BIT |
+ GLXIIC_SMB_STS_NMATCH_BIT));
+
+ return (status);
+}
+
+static void
+glxiic_stop_locked(struct glxiic_softc *sc)
+{
+ uint8_t status, ctrl1;
+
+ GLXIIC_ASSERT_LOCKED(sc);
+
+ status = glxiic_read_status_locked(sc);
+
+ ctrl1 = bus_read_1(sc->smb_res, GLXIIC_SMB_CTRL1);
+ bus_write_1(sc->smb_res, GLXIIC_SMB_CTRL1,
+ ctrl1 | GLXIIC_SMB_CTRL1_STOP_BIT);
+
+ /*
+ * Perform a dummy read of SDA in master receive mode to clear
+ * SDAST if set.
+ */
+ if ((status & GLXIIC_SMB_STS_XMIT_BIT) == 0 &&
+ (status & GLXIIC_SMB_STS_SDAST_BIT) != 0)
+ bus_read_1(sc->smb_res, GLXIIC_SMB_SDA);
+
+ /* Check stall after start bit and clear if needed */
+ if ((status & GLXIIC_SMB_STS_STASTR_BIT) != 0) {
+ bus_write_1(sc->smb_res, GLXIIC_SMB_STS,
+ GLXIIC_SMB_STS_STASTR_BIT);
+ }
+}
+
+static void
+glxiic_timeout(void *arg)
+{
+ struct glxiic_softc *sc;
+ uint8_t error;
+
+ sc = (struct glxiic_softc *)arg;
+
+ GLXIIC_DEBUG_LOG("timeout in state %d", sc->state);
+
+ if (glxiic_state_table[sc->state].master) {
+ sc->error = IIC_ETIMEOUT;
+ GLXIIC_WAKEUP(sc);
+ } else {
+ error = IIC_ETIMEOUT;
+ iicbus_intr(sc->iicbus, INTR_ERROR, &error);
+ }
+
+ glxiic_smb_disable(sc);
+ glxiic_smb_enable(sc, IIC_UNKNOWN, sc->addr);
+ glxiic_set_state_locked(sc, GLXIIC_STATE_IDLE);
+}
+
+static void
+glxiic_start_timeout_locked(struct glxiic_softc *sc)
+{
+
+ GLXIIC_ASSERT_LOCKED(sc);
+
+ callout_reset(&sc->callout, sc->timeout * 1000 / hz, glxiic_timeout,
+ sc);
+}
+
+static void
+glxiic_set_state_locked(struct glxiic_softc *sc, glxiic_state_t state)
+{
+
+ GLXIIC_ASSERT_LOCKED(sc);
+
+ if (state == GLXIIC_STATE_IDLE)
+ callout_stop(&sc->callout);
+ else if (sc->timeout > 0)
+ glxiic_start_timeout_locked(sc);
+
+ sc->state = state;
+}
+
+static int
+glxiic_handle_slave_match_locked(struct glxiic_softc *sc, uint8_t status)
+{
+ uint8_t ctrl_sts, addr;
+
+ GLXIIC_ASSERT_LOCKED(sc);
+
+ ctrl_sts = bus_read_1(sc->smb_res, GLXIIC_SMB_CTRL_STS);
+
+ if ((ctrl_sts & GLXIIC_SMB_CTRL_STS_MATCH_BIT) != 0) {
+ if ((status & GLXIIC_SMB_STS_XMIT_BIT) != 0) {
+ addr = sc->addr | LSB;
+ glxiic_set_state_locked(sc,
+ GLXIIC_STATE_SLAVE_TX);
+ } else {
+ addr = sc->addr & ~LSB;
+ glxiic_set_state_locked(sc,
+ GLXIIC_STATE_SLAVE_RX);
+ }
+ iicbus_intr(sc->iicbus, INTR_START, &addr);
+ } else if ((ctrl_sts & GLXIIC_SMB_CTRL_STS_GCMTCH_BIT) != 0) {
+ addr = 0;
+ glxiic_set_state_locked(sc, GLXIIC_STATE_SLAVE_RX);
+ iicbus_intr(sc->iicbus, INTR_GENERAL, &addr);
+ } else {
+ GLXIIC_DEBUG_LOG("unknown slave match");
+ return (IIC_ESTATUS);
+ }
+
+ return (IIC_NOERR);
+}
+
+static int
+glxiic_state_idle_callback(struct glxiic_softc *sc, uint8_t status)
+{
+
+ GLXIIC_ASSERT_LOCKED(sc);
+
+ if ((status & GLXIIC_SMB_STS_BER_BIT) != 0) {
+ GLXIIC_DEBUG_LOG("bus error in idle");
+ return (IIC_EBUSERR);
+ }
+
+ if ((status & GLXIIC_SMB_STS_NMATCH_BIT) != 0) {
+ return (glxiic_handle_slave_match_locked(sc, status));
+ }
+
+ return (IIC_NOERR);
+}
+
+static int
+glxiic_state_slave_tx_callback(struct glxiic_softc *sc, uint8_t status)
+{
+ uint8_t data;
+
+ GLXIIC_ASSERT_LOCKED(sc);
+
+ if ((status & GLXIIC_SMB_STS_BER_BIT) != 0) {
+ GLXIIC_DEBUG_LOG("bus error in slave tx");
+ return (IIC_EBUSERR);
+ }
+
+ if ((status & GLXIIC_SMB_STS_SLVSTP_BIT) != 0) {
+ iicbus_intr(sc->iicbus, INTR_STOP, NULL);
+ glxiic_set_state_locked(sc, GLXIIC_STATE_IDLE);
+ return (IIC_NOERR);
+ }
+
+ if ((status & GLXIIC_SMB_STS_NEGACK_BIT) != 0) {
+ iicbus_intr(sc->iicbus, INTR_NOACK, NULL);
+ return (IIC_NOERR);
+ }
+
+ if ((status & GLXIIC_SMB_STS_NMATCH_BIT) != 0) {
+ /* Handle repeated start in slave mode. */
+ return (glxiic_handle_slave_match_locked(sc, status));
+ }
+
+ if ((status & GLXIIC_SMB_STS_SDAST_BIT) == 0) {
+ GLXIIC_DEBUG_LOG("not awaiting data in slave tx");
+ return (IIC_ESTATUS);
+ }
+
+ iicbus_intr(sc->iicbus, INTR_TRANSMIT, &data);
+ bus_write_1(sc->smb_res, GLXIIC_SMB_SDA, data);
+
+ glxiic_start_timeout_locked(sc);
+
+ return (IIC_NOERR);
+}
+
+static int
+glxiic_state_slave_rx_callback(struct glxiic_softc *sc, uint8_t status)
+{
+ uint8_t data;
+
+ GLXIIC_ASSERT_LOCKED(sc);
+
+ if ((status & GLXIIC_SMB_STS_BER_BIT) != 0) {
+ GLXIIC_DEBUG_LOG("bus error in slave rx");
+ return (IIC_EBUSERR);
+ }
+
+ if ((status & GLXIIC_SMB_STS_SLVSTP_BIT) != 0) {
+ iicbus_intr(sc->iicbus, INTR_STOP, NULL);
+ glxiic_set_state_locked(sc, GLXIIC_STATE_IDLE);
+ return (IIC_NOERR);
+ }
+
+ if ((status & GLXIIC_SMB_STS_NMATCH_BIT) != 0) {
+ /* Handle repeated start in slave mode. */
+ return (glxiic_handle_slave_match_locked(sc, status));
+ }
+
+ if ((status & GLXIIC_SMB_STS_SDAST_BIT) == 0) {
+ GLXIIC_DEBUG_LOG("no pending data in slave rx");
+ return (IIC_ESTATUS);
+ }
+
+ data = bus_read_1(sc->smb_res, GLXIIC_SMB_SDA);
+ iicbus_intr(sc->iicbus, INTR_RECEIVE, &data);
+
+ glxiic_start_timeout_locked(sc);
+
+ return (IIC_NOERR);
+}
+
+static int
+glxiic_state_master_addr_callback(struct glxiic_softc *sc, uint8_t status)
+{
+ uint8_t slave;
+
+ GLXIIC_ASSERT_LOCKED(sc);
+
+ if ((status & GLXIIC_SMB_STS_BER_BIT) != 0) {
+ GLXIIC_DEBUG_LOG("bus error after master start");
+ return (IIC_EBUSERR);
+ }
+
+ if ((status & GLXIIC_SMB_STS_MASTER_BIT) == 0) {
+ GLXIIC_DEBUG_LOG("not bus master after master start");
+ return (IIC_ESTATUS);
+ }
+
+ if ((status & GLXIIC_SMB_STS_SDAST_BIT) == 0) {
+ GLXIIC_DEBUG_LOG("not awaiting address in master addr");
+ return (IIC_ESTATUS);
+ }
+
+ if ((sc->msg->flags & IIC_M_RD) != 0) {
+ slave = sc->msg->slave | LSB;
+ glxiic_set_state_locked(sc, GLXIIC_STATE_MASTER_RX);
+ } else {
+ slave = sc->msg->slave & ~LSB;
+ glxiic_set_state_locked(sc, GLXIIC_STATE_MASTER_TX);
+ }
+
+ sc->data = sc->msg->buf;
+ sc->ndata = sc->msg->len;
+
+ /* Handle address-only transfer. */
+ if (sc->ndata == 0)
+ glxiic_set_state_locked(sc, GLXIIC_STATE_MASTER_STOP);
+
+ bus_write_1(sc->smb_res, GLXIIC_SMB_SDA, slave);
+
+ return (IIC_NOERR);
+}
+
+static int
+glxiic_state_master_tx_callback(struct glxiic_softc *sc, uint8_t status)
+{
+
+ GLXIIC_ASSERT_LOCKED(sc);
+
+ if ((status & GLXIIC_SMB_STS_BER_BIT) != 0) {
+ GLXIIC_DEBUG_LOG("bus error in master tx");
+ return (IIC_EBUSERR);
+ }
+
+ if ((status & GLXIIC_SMB_STS_MASTER_BIT) == 0) {
+ GLXIIC_DEBUG_LOG("not bus master in master tx");
+ return (IIC_ESTATUS);
+ }
+
+ if ((status & GLXIIC_SMB_STS_NEGACK_BIT) != 0) {
+ GLXIIC_DEBUG_LOG("slave nack in master tx");
+ return (IIC_ENOACK);
+ }
+
+ if ((status & GLXIIC_SMB_STS_STASTR_BIT) != 0) {
+ bus_write_1(sc->smb_res, GLXIIC_SMB_STS,
+ GLXIIC_SMB_STS_STASTR_BIT);
+ }
+
+ if ((status & GLXIIC_SMB_STS_SDAST_BIT) == 0) {
+ GLXIIC_DEBUG_LOG("not awaiting data in master tx");
+ return (IIC_ESTATUS);
+ }
+
+ bus_write_1(sc->smb_res, GLXIIC_SMB_SDA, *sc->data++);
+ if (--sc->ndata == 0)
+ glxiic_set_state_locked(sc, GLXIIC_STATE_MASTER_STOP);
+ else
+ glxiic_start_timeout_locked(sc);
+
+ return (IIC_NOERR);
+}
+
+static int
+glxiic_state_master_rx_callback(struct glxiic_softc *sc, uint8_t status)
+{
+ uint8_t ctrl1;
+
+ GLXIIC_ASSERT_LOCKED(sc);
+
+ if ((status & GLXIIC_SMB_STS_BER_BIT) != 0) {
+ GLXIIC_DEBUG_LOG("bus error in master rx");
+ return (IIC_EBUSERR);
+ }
+
+ if ((status & GLXIIC_SMB_STS_MASTER_BIT) == 0) {
+ GLXIIC_DEBUG_LOG("not bus master in master rx");
+ return (IIC_ESTATUS);
+ }
+
+ if ((status & GLXIIC_SMB_STS_NEGACK_BIT) != 0) {
+ GLXIIC_DEBUG_LOG("slave nack in rx");
+ return (IIC_ENOACK);
+ }
+
+ if (sc->ndata == 1) {
+ /* Last byte from slave, set NACK. */
+ ctrl1 = bus_read_1(sc->smb_res, GLXIIC_SMB_CTRL1);
+ bus_write_1(sc->smb_res, GLXIIC_SMB_CTRL1,
+ ctrl1 | GLXIIC_SMB_CTRL1_ACK_BIT);
+ }
+
+ if ((status & GLXIIC_SMB_STS_STASTR_BIT) != 0) {
+ /* Bus is stalled, clear and wait for data. */
+ bus_write_1(sc->smb_res, GLXIIC_SMB_STS,
+ GLXIIC_SMB_STS_STASTR_BIT);
+ return (IIC_NOERR);
+ }
+
+ if ((status & GLXIIC_SMB_STS_SDAST_BIT) == 0) {
+ GLXIIC_DEBUG_LOG("no pending data in master rx");
+ return (IIC_ESTATUS);
+ }
+
+ *sc->data++ = bus_read_1(sc->smb_res, GLXIIC_SMB_SDA);
+ if (--sc->ndata == 0) {
+ /* Proceed with stop on reading last byte. */
+ glxiic_set_state_locked(sc, GLXIIC_STATE_MASTER_STOP);
+ return (glxiic_state_table[sc->state].callback(sc, status));
+ }
+
+ glxiic_start_timeout_locked(sc);
+
+ return (IIC_NOERR);
+}
+
+static int
+glxiic_state_master_stop_callback(struct glxiic_softc *sc, uint8_t status)
+{
+ uint8_t ctrl1;
+
+ GLXIIC_ASSERT_LOCKED(sc);
+
+ if ((status & GLXIIC_SMB_STS_BER_BIT) != 0) {
+ GLXIIC_DEBUG_LOG("bus error in master stop");
+ return (IIC_EBUSERR);
+ }
+
+ if ((status & GLXIIC_SMB_STS_MASTER_BIT) == 0) {
+ GLXIIC_DEBUG_LOG("not bus master in master stop");
+ return (IIC_ESTATUS);
+ }
+
+ if ((status & GLXIIC_SMB_STS_NEGACK_BIT) != 0) {
+ GLXIIC_DEBUG_LOG("slave nack in master stop");
+ return (IIC_ENOACK);
+ }
+
+ if (--sc->nmsgs > 0) {
+ /* Start transfer of next message. */
+ if ((sc->msg->flags & IIC_M_NOSTOP) == 0) {
+ glxiic_stop_locked(sc);
+ }
+
+ ctrl1 = bus_read_1(sc->smb_res, GLXIIC_SMB_CTRL1);
+ bus_write_1(sc->smb_res, GLXIIC_SMB_CTRL1,
+ ctrl1 | GLXIIC_SMB_CTRL1_START_BIT);
+
+ glxiic_set_state_locked(sc, GLXIIC_STATE_MASTER_ADDR);
+ sc->msg++;
+ } else {
+ /* Last message. */
+ glxiic_stop_locked(sc);
+ glxiic_set_state_locked(sc, GLXIIC_STATE_IDLE);
+ sc->error = IIC_NOERR;
+ GLXIIC_WAKEUP(sc);
+ }
+
+ return (IIC_NOERR);
+}
+
+static void
+glxiic_intr(void *arg)
+{
+ struct glxiic_softc *sc;
+ int error;
+ uint8_t status, data;
+
+ sc = (struct glxiic_softc *)arg;
+
+ GLXIIC_LOCK(sc);
+
+ status = glxiic_read_status_locked(sc);
+
+ /* Check if this interrupt originated from the SMBus. */
+ if ((status &
+ ~(GLXIIC_SMB_STS_MASTER_BIT | GLXIIC_SMB_STS_XMIT_BIT)) != 0) {
+
+ error = glxiic_state_table[sc->state].callback(sc, status);
+
+ if (error != IIC_NOERR) {
+ if (glxiic_state_table[sc->state].master) {
+ glxiic_stop_locked(sc);
+ glxiic_set_state_locked(sc, GLXIIC_STATE_IDLE);
+ sc->error = error;
+ GLXIIC_WAKEUP(sc);
+ } else {
+ data = error & 0xff;
+ iicbus_intr(sc->iicbus, INTR_ERROR, &data);
+ glxiic_set_state_locked(sc, GLXIIC_STATE_IDLE);
+ }
+ }
+ }
+
+ GLXIIC_UNLOCK(sc);
+}
+
+static int
+glxiic_reset(device_t dev, u_char speed, u_char addr, u_char *oldaddr)
+{
+ struct glxiic_softc *sc;
+
+ sc = device_get_softc(dev);
+
+ GLXIIC_LOCK(sc);
+
+ if (oldaddr != NULL)
+ *oldaddr = sc->addr;
+ sc->addr = addr;
+
+ /* A disable/enable cycle resets the controller. */
+ glxiic_smb_disable(sc);
+ glxiic_smb_enable(sc, speed, addr);
+
+ if (glxiic_state_table[sc->state].master) {
+ sc->error = IIC_ESTATUS;
+ GLXIIC_WAKEUP(sc);
+ }
+ glxiic_set_state_locked(sc, GLXIIC_STATE_IDLE);
+
+ GLXIIC_UNLOCK(sc);
+
+ return (IIC_NOERR);
+}
+
+static int
+glxiic_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs)
+{
+ struct glxiic_softc *sc;
+ int error;
+ uint8_t ctrl1;
+
+ sc = device_get_softc(dev);
+
+ GLXIIC_LOCK(sc);
+
+ if (sc->state != GLXIIC_STATE_IDLE) {
+ error = IIC_EBUSBSY;
+ goto out;
+ }
+
+ sc->msg = msgs;
+ sc->nmsgs = nmsgs;
+ glxiic_set_state_locked(sc, GLXIIC_STATE_MASTER_ADDR);
+
+ /* Set start bit and let glxiic_intr() handle the transfer. */
+ ctrl1 = bus_read_1(sc->smb_res, GLXIIC_SMB_CTRL1);
+ bus_write_1(sc->smb_res, GLXIIC_SMB_CTRL1,
+ ctrl1 | GLXIIC_SMB_CTRL1_START_BIT);
+
+ GLXIIC_SLEEP(sc);
+ error = sc->error;
+out:
+ GLXIIC_UNLOCK(sc);
+
+ return (error);
+}
+
+static void
+glxiic_smb_map_interrupt(int irq)
+{
+ uint32_t irq_map;
+ int old_irq;
+
+ /* Protect the read-modify-write operation. */
+ critical_enter();
+
+ irq_map = rdmsr(GLXIIC_MSR_PIC_YSEL_HIGH);
+ old_irq = GLXIIC_MAP_TO_SMB_IRQ(irq_map);
+
+ if (irq != old_irq) {
+ irq_map &= ~GLXIIC_SMB_IRQ_TO_MAP(old_irq);
+ irq_map |= GLXIIC_SMB_IRQ_TO_MAP(irq);
+ wrmsr(GLXIIC_MSR_PIC_YSEL_HIGH, irq_map);
+ }
+
+ critical_exit();
+}
+
+static void
+glxiic_gpio_enable(struct glxiic_softc *sc)
+{
+
+ bus_write_4(sc->gpio_res, GLXIIC_GPIOL_IN_AUX1_SEL,
+ GLXIIC_GPIO_14_15_ENABLE);
+ bus_write_4(sc->gpio_res, GLXIIC_GPIOL_OUT_AUX1_SEL,
+ GLXIIC_GPIO_14_15_ENABLE);
+}
+
+static void
+glxiic_gpio_disable(struct glxiic_softc *sc)
+{
+
+ bus_write_4(sc->gpio_res, GLXIIC_GPIOL_OUT_AUX1_SEL,
+ GLXIIC_GPIO_14_15_DISABLE);
+ bus_write_4(sc->gpio_res, GLXIIC_GPIOL_IN_AUX1_SEL,
+ GLXIIC_GPIO_14_15_DISABLE);
+}
+
+static void
+glxiic_smb_enable(struct glxiic_softc *sc, uint8_t speed, uint8_t addr)
+{
+ uint8_t ctrl1;
+
+ ctrl1 = 0;
+
+ switch (speed) {
+ case IIC_SLOW:
+ sc->sclfrq = GLXIIC_SLOW;
+ break;
+ case IIC_FAST:
+ sc->sclfrq = GLXIIC_FAST;
+ break;
+ case IIC_FASTEST:
+ sc->sclfrq = GLXIIC_FASTEST;
+ break;
+ case IIC_UNKNOWN:
+ default:
+ /* Reuse last frequency. */
+ break;
+ }
+
+ /* Set bus speed and enable controller. */
+ bus_write_2(sc->smb_res, GLXIIC_SMB_CTRL2,
+ GLXIIC_SCLFRQ(sc->sclfrq) | GLXIIC_SMB_CTRL2_EN_BIT);
+
+ if (addr != 0) {
+ /* Enable new match and global call match interrupts. */
+ ctrl1 |= GLXIIC_SMB_CTRL1_NMINTE_BIT |
+ GLXIIC_SMB_CTRL1_GCMEN_BIT;
+ bus_write_1(sc->smb_res, GLXIIC_SMB_ADDR,
+ GLXIIC_SMB_ADDR_SAEN_BIT | GLXIIC_SMBADDR(addr));
+ } else {
+ bus_write_1(sc->smb_res, GLXIIC_SMB_ADDR, 0);
+ }
+
+ /* Enable stall after start and interrupt. */
+ bus_write_1(sc->smb_res, GLXIIC_SMB_CTRL1,
+ ctrl1 | GLXIIC_SMB_CTRL1_STASTRE_BIT | GLXIIC_SMB_CTRL1_INTEN_BIT);
+}
+
+static void
+glxiic_smb_disable(struct glxiic_softc *sc)
+{
+ uint16_t sclfrq;
+
+ sclfrq = bus_read_2(sc->smb_res, GLXIIC_SMB_CTRL2);
+ bus_write_2(sc->smb_res, GLXIIC_SMB_CTRL2,
+ sclfrq & ~GLXIIC_SMB_CTRL2_EN_BIT);
+}
diff --git a/sys/dev/hwpmc/hwpmc_mod.c b/sys/dev/hwpmc/hwpmc_mod.c
index 4fa169c..d6225d8 100644
--- a/sys/dev/hwpmc/hwpmc_mod.c
+++ b/sys/dev/hwpmc/hwpmc_mod.c
@@ -4083,7 +4083,7 @@ pmc_process_interrupt(int cpu, struct pmc *pm, struct trapframe *tf,
done:
/* mark CPU as needing processing */
- atomic_set_rel_int(&pmc_cpumask, (1 << cpu));
+ atomic_set_int(&pmc_cpumask, (1 << cpu));
return (error);
}
@@ -4193,7 +4193,7 @@ pmc_process_samples(int cpu)
break;
if (ps->ps_nsamples == PMC_SAMPLE_INUSE) {
/* Need a rescan at a later time. */
- atomic_set_rel_int(&pmc_cpumask, (1 << cpu));
+ atomic_set_int(&pmc_cpumask, (1 << cpu));
break;
}
@@ -4782,7 +4782,7 @@ pmc_cleanup(void)
PMCDBG(MOD,INI,0, "%s", "cleanup");
/* switch off sampling */
- atomic_store_rel_int(&pmc_cpumask, 0);
+ pmc_cpumask = 0;
pmc_intr = NULL;
sx_xlock(&pmc_sx);
diff --git a/sys/dev/iwn/if_iwn.c b/sys/dev/iwn/if_iwn.c
index 11c5238..29e391f 100644
--- a/sys/dev/iwn/if_iwn.c
+++ b/sys/dev/iwn/if_iwn.c
@@ -3527,7 +3527,8 @@ iwn_tx_data(struct iwn_softc *sc, struct mbuf *m, struct ieee80211_node *ni)
BUS_DMASYNC_PREWRITE);
/* Update TX scheduler. */
- ops->update_sched(sc, ring->qid, ring->cur, tx->id, totlen);
+ if (ring->qid >= sc->firstaggqueue)
+ ops->update_sched(sc, ring->qid, ring->cur, tx->id, totlen);
/* Kick TX ring. */
ring->cur = (ring->cur + 1) % IWN_TX_RING_COUNT;
@@ -3730,7 +3731,8 @@ iwn_tx_data_raw(struct iwn_softc *sc, struct mbuf *m,
BUS_DMASYNC_PREWRITE);
/* Update TX scheduler. */
- ops->update_sched(sc, ring->qid, ring->cur, tx->id, totlen);
+ if (ring->qid >= sc->firstaggqueue)
+ ops->update_sched(sc, ring->qid, ring->cur, tx->id, totlen);
/* Kick TX ring. */
ring->cur = (ring->cur + 1) % IWN_TX_RING_COUNT;
@@ -3894,7 +3896,6 @@ iwn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
static int
iwn_cmd(struct iwn_softc *sc, int code, const void *buf, int size, int async)
{
- struct iwn_ops *ops = &sc->ops;
struct iwn_tx_ring *ring = &sc->txq[4];
struct iwn_tx_desc *desc;
struct iwn_tx_data *data;
@@ -3954,9 +3955,6 @@ iwn_cmd(struct iwn_softc *sc, int code, const void *buf, int size, int async)
bus_dmamap_sync(ring->desc_dma.tag, ring->desc_dma.map,
BUS_DMASYNC_PREWRITE);
- /* Update TX scheduler. */
- ops->update_sched(sc, ring->qid, ring->cur, 0, 0);
-
/* Kick command ring. */
ring->cur = (ring->cur + 1) % IWN_TX_RING_COUNT;
IWN_WRITE(sc, IWN_HBUS_TARG_WRPTR, ring->qid << 8 | ring->cur);
diff --git a/sys/dev/mii/mii.c b/sys/dev/mii/mii.c
index fbdd0ea..224f85d 100644
--- a/sys/dev/mii/mii.c
+++ b/sys/dev/mii/mii.c
@@ -552,7 +552,7 @@ mii_down(struct mii_data *mii)
static unsigned char
mii_bitreverse(unsigned char x)
{
- static unsigned char nibbletab[16] = {
+ unsigned const char const nibbletab[16] = {
0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15
};
@@ -567,6 +567,6 @@ mii_oui(u_int id1, u_int id2)
h = (id1 << 6) | (id2 >> 10);
return ((mii_bitreverse(h >> 16) << 16) |
- (mii_bitreverse((h >> 8) & 0xff) << 8) |
- mii_bitreverse(h & 0xff));
+ (mii_bitreverse((h >> 8) & 0xff) << 8) |
+ mii_bitreverse(h & 0xff));
}
diff --git a/sys/dev/mk48txx/mk48txx.c b/sys/dev/mk48txx/mk48txx.c
index 9742e82..de116d0 100644
--- a/sys/dev/mk48txx/mk48txx.c
+++ b/sys/dev/mk48txx/mk48txx.c
@@ -33,7 +33,8 @@
__FBSDID("$FreeBSD$");
/*
- * Mostek MK48T02, MK48T08, MK48T18, MK48T59 time-of-day chip subroutines
+ * Mostek MK48T02, MK48T08, MK48T18, MK48T37 and MK48T59 time-of-day chip
+ * subroutines
*/
#include <sys/param.h>
@@ -67,6 +68,7 @@ static const struct {
{ "mk48t02", MK48T02_CLKSZ, MK48T02_CLKOFF, 0 },
{ "mk48t08", MK48T08_CLKSZ, MK48T08_CLKOFF, 0 },
{ "mk48t18", MK48T18_CLKSZ, MK48T18_CLKOFF, 0 },
+ { "mk48t37", MK48T37_CLKSZ, MK48T37_CLKOFF, MK48TXX_EXT_REGISTERS },
{ "mk48t59", MK48T59_CLKSZ, MK48T59_CLKOFF, MK48TXX_EXT_REGISTERS },
};
diff --git a/sys/dev/mk48txx/mk48txxreg.h b/sys/dev/mk48txx/mk48txxreg.h
index bae6ae5..ef55b87 100644
--- a/sys/dev/mk48txx/mk48txxreg.h
+++ b/sys/dev/mk48txx/mk48txxreg.h
@@ -152,5 +152,8 @@
#define MK48T18_CLKSZ 8192
#define MK48T18_CLKOFF 0x1ff0
+#define MK48T37_CLKSZ 32768
+#define MK48T37_CLKOFF 0x1ff0
+
#define MK48T59_CLKSZ 8192
#define MK48T59_CLKOFF 0x1ff0
diff --git a/sys/dev/msk/if_msk.c b/sys/dev/msk/if_msk.c
index 3af1b20..2adbf1c 100644
--- a/sys/dev/msk/if_msk.c
+++ b/sys/dev/msk/if_msk.c
@@ -221,6 +221,10 @@ static struct msk_product {
"Marvell Yukon 88E8071 Gigabit Ethernet" },
{ VENDORID_MARVELL, DEVICEID_MRVL_436C,
"Marvell Yukon 88E8072 Gigabit Ethernet" },
+ { VENDORID_MARVELL, DEVICEID_MRVL_436D,
+ "Marvell Yukon 88E8055 Gigabit Ethernet" },
+ { VENDORID_MARVELL, DEVICEID_MRVL_4370,
+ "Marvell Yukon 88E8075 Gigabit Ethernet" },
{ VENDORID_MARVELL, DEVICEID_MRVL_4380,
"Marvell Yukon 88E8057 Gigabit Ethernet" },
{ VENDORID_MARVELL, DEVICEID_MRVL_4381,
@@ -1030,7 +1034,10 @@ msk_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
}
}
ifp->if_mtu = ifr->ifr_mtu;
- msk_init_locked(sc_if);
+ if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) {
+ ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
+ msk_init_locked(sc_if);
+ }
}
MSK_IF_UNLOCK(sc_if);
break;
@@ -1212,37 +1219,30 @@ msk_phy_power(struct msk_softc *sc, int mode)
*/
CSR_WRITE_1(sc, B2_Y2_CLK_GATE, val);
- val = CSR_PCI_READ_4(sc, PCI_OUR_REG_1);
- val &= ~(PCI_Y2_PHY1_POWD | PCI_Y2_PHY2_POWD);
+ our = CSR_PCI_READ_4(sc, PCI_OUR_REG_1);
+ our &= ~(PCI_Y2_PHY1_POWD | PCI_Y2_PHY2_POWD);
if (sc->msk_hw_id == CHIP_ID_YUKON_XL) {
if (sc->msk_hw_rev > CHIP_REV_YU_XL_A1) {
/* Deassert Low Power for 1st PHY. */
- val |= PCI_Y2_PHY1_COMA;
+ our |= PCI_Y2_PHY1_COMA;
if (sc->msk_num_port > 1)
- val |= PCI_Y2_PHY2_COMA;
+ our |= PCI_Y2_PHY2_COMA;
}
}
- /* Release PHY from PowerDown/COMA mode. */
- CSR_PCI_WRITE_4(sc, PCI_OUR_REG_1, val);
- switch (sc->msk_hw_id) {
- case CHIP_ID_YUKON_EC_U:
- case CHIP_ID_YUKON_EX:
- case CHIP_ID_YUKON_FE_P:
- case CHIP_ID_YUKON_UL_2:
- case CHIP_ID_YUKON_OPT:
- CSR_WRITE_2(sc, B0_CTST, Y2_HW_WOL_OFF);
-
- /* Enable all clocks. */
- CSR_PCI_WRITE_4(sc, PCI_OUR_REG_3, 0);
- our = CSR_PCI_READ_4(sc, PCI_OUR_REG_4);
- our &= (PCI_FORCE_ASPM_REQUEST|PCI_ASPM_GPHY_LINK_DOWN|
- PCI_ASPM_INT_FIFO_EMPTY|PCI_ASPM_CLKRUN_REQUEST);
+ if (sc->msk_hw_id == CHIP_ID_YUKON_EC_U ||
+ sc->msk_hw_id == CHIP_ID_YUKON_EX ||
+ sc->msk_hw_id >= CHIP_ID_YUKON_FE_P) {
+ val = CSR_PCI_READ_4(sc, PCI_OUR_REG_4);
+ val &= (PCI_FORCE_ASPM_REQUEST |
+ PCI_ASPM_GPHY_LINK_DOWN | PCI_ASPM_INT_FIFO_EMPTY |
+ PCI_ASPM_CLKRUN_REQUEST);
/* Set all bits to 0 except bits 15..12. */
- CSR_PCI_WRITE_4(sc, PCI_OUR_REG_4, our);
- our = CSR_PCI_READ_4(sc, PCI_OUR_REG_5);
- our &= PCI_CTL_TIM_VMAIN_AV_MSK;
- CSR_PCI_WRITE_4(sc, PCI_OUR_REG_5, our);
+ CSR_PCI_WRITE_4(sc, PCI_OUR_REG_4, val);
+ val = CSR_PCI_READ_4(sc, PCI_OUR_REG_5);
+ val &= PCI_CTL_TIM_VMAIN_AV_MSK;
+ CSR_PCI_WRITE_4(sc, PCI_OUR_REG_5, val);
CSR_PCI_WRITE_4(sc, PCI_CFG_REG_1, 0);
+ CSR_WRITE_2(sc, B0_CTST, Y2_HW_WOL_ON);
/*
* Disable status race, workaround for
* Yukon EC Ultra & Yukon EX.
@@ -1251,10 +1251,10 @@ msk_phy_power(struct msk_softc *sc, int mode)
val |= GLB_GPIO_STAT_RACE_DIS;
CSR_WRITE_4(sc, B2_GP_IO, val);
CSR_READ_4(sc, B2_GP_IO);
- break;
- default:
- break;
}
+ /* Release PHY from PowerDown/COMA mode. */
+ CSR_PCI_WRITE_4(sc, PCI_OUR_REG_1, our);
+
for (i = 0; i < sc->msk_num_port; i++) {
CSR_WRITE_2(sc, MR_ADDR(i, GMAC_LINK_CTRL),
GMLC_RST_SET);
@@ -1300,28 +1300,33 @@ mskc_reset(struct msk_softc *sc)
bus_addr_t addr;
uint16_t status;
uint32_t val;
- int i;
-
- CSR_WRITE_2(sc, B0_CTST, CS_RST_CLR);
+ int i, initram;
/* Disable ASF. */
- if (sc->msk_hw_id == CHIP_ID_YUKON_EX) {
- status = CSR_READ_2(sc, B28_Y2_ASF_HCU_CCSR);
- /* Clear AHB bridge & microcontroller reset. */
- status &= ~(Y2_ASF_HCU_CCSR_AHB_RST |
- Y2_ASF_HCU_CCSR_CPU_RST_MODE);
- /* Clear ASF microcontroller state. */
- status &= ~ Y2_ASF_HCU_CCSR_UC_STATE_MSK;
- CSR_WRITE_2(sc, B28_Y2_ASF_HCU_CCSR, status);
- } else
- CSR_WRITE_1(sc, B28_Y2_ASF_STAT_CMD, Y2_ASF_RESET);
- CSR_WRITE_2(sc, B0_CTST, Y2_ASF_DISABLE);
-
- /*
- * Since we disabled ASF, S/W reset is required for Power Management.
- */
- CSR_WRITE_2(sc, B0_CTST, CS_RST_SET);
- CSR_WRITE_2(sc, B0_CTST, CS_RST_CLR);
+ if (sc->msk_hw_id >= CHIP_ID_YUKON_XL &&
+ sc->msk_hw_id <= CHIP_ID_YUKON_SUPR) {
+ if (sc->msk_hw_id == CHIP_ID_YUKON_EX ||
+ sc->msk_hw_id == CHIP_ID_YUKON_SUPR) {
+ CSR_WRITE_4(sc, B28_Y2_CPU_WDOG, 0);
+ status = CSR_READ_2(sc, B28_Y2_ASF_HCU_CCSR);
+ /* Clear AHB bridge & microcontroller reset. */
+ status &= ~(Y2_ASF_HCU_CCSR_AHB_RST |
+ Y2_ASF_HCU_CCSR_CPU_RST_MODE);
+ /* Clear ASF microcontroller state. */
+ status &= ~Y2_ASF_HCU_CCSR_UC_STATE_MSK;
+ status &= ~Y2_ASF_HCU_CCSR_CPU_CLK_DIVIDE_MSK;
+ CSR_WRITE_2(sc, B28_Y2_ASF_HCU_CCSR, status);
+ CSR_WRITE_4(sc, B28_Y2_CPU_WDOG, 0);
+ } else
+ CSR_WRITE_1(sc, B28_Y2_ASF_STAT_CMD, Y2_ASF_RESET);
+ CSR_WRITE_2(sc, B0_CTST, Y2_ASF_DISABLE);
+ /*
+ * Since we disabled ASF, S/W reset is required for
+ * Power Management.
+ */
+ CSR_WRITE_2(sc, B0_CTST, CS_RST_SET);
+ CSR_WRITE_2(sc, B0_CTST, CS_RST_CLR);
+ }
/* Clear all error bits in the PCI status register. */
status = pci_read_config(sc->msk_dev, PCIR_STATUS, 2);
@@ -1362,17 +1367,22 @@ mskc_reset(struct msk_softc *sc)
/* Reset GPHY/GMAC Control */
for (i = 0; i < sc->msk_num_port; i++) {
/* GPHY Control reset. */
- CSR_WRITE_4(sc, MR_ADDR(i, GPHY_CTRL), GPC_RST_SET);
- CSR_WRITE_4(sc, MR_ADDR(i, GPHY_CTRL), GPC_RST_CLR);
+ CSR_WRITE_1(sc, MR_ADDR(i, GPHY_CTRL), GPC_RST_SET);
+ CSR_WRITE_1(sc, MR_ADDR(i, GPHY_CTRL), GPC_RST_CLR);
/* GMAC Control reset. */
CSR_WRITE_4(sc, MR_ADDR(i, GMAC_CTRL), GMC_RST_SET);
CSR_WRITE_4(sc, MR_ADDR(i, GMAC_CTRL), GMC_RST_CLR);
CSR_WRITE_4(sc, MR_ADDR(i, GMAC_CTRL), GMC_F_LOOPB_OFF);
- if (sc->msk_hw_id == CHIP_ID_YUKON_EX)
+ if (sc->msk_hw_id == CHIP_ID_YUKON_EX ||
+ sc->msk_hw_id == CHIP_ID_YUKON_SUPR)
CSR_WRITE_4(sc, MR_ADDR(i, GMAC_CTRL),
GMC_BYP_MACSECRX_ON | GMC_BYP_MACSECTX_ON |
GMC_BYP_RETR_ON);
}
+
+ if (sc->msk_hw_id == CHIP_ID_YUKON_SUPR &&
+ sc->msk_hw_rev > CHIP_REV_YU_SU_B0)
+ CSR_PCI_WRITE_4(sc, PCI_OUR_REG_3, PCI_CLK_MACSEC_DIS);
if (sc->msk_hw_id == CHIP_ID_YUKON_OPT && sc->msk_hw_rev == 0) {
/* Disable PCIe PHY powerdown(reg 0x80, bit7). */
CSR_WRITE_4(sc, Y2_PEX_PHY_DATA, (0x0080 << 16) | 0x0080);
@@ -1396,8 +1406,14 @@ mskc_reset(struct msk_softc *sc)
CSR_WRITE_1(sc, GMAC_TI_ST_CTRL, GMT_ST_STOP);
CSR_WRITE_1(sc, GMAC_TI_ST_CTRL, GMT_ST_CLR_IRQ);
+ initram = 0;
+ if (sc->msk_hw_id == CHIP_ID_YUKON_XL ||
+ sc->msk_hw_id == CHIP_ID_YUKON_EC ||
+ sc->msk_hw_id == CHIP_ID_YUKON_FE)
+ initram++;
+
/* Configure timeout values. */
- for (i = 0; i < sc->msk_num_port; i++) {
+ for (i = 0; initram > 0 && i < sc->msk_num_port; i++) {
CSR_WRITE_2(sc, SELECT_RAM_BUFFER(i, B3_RI_CTRL), RI_RST_SET);
CSR_WRITE_2(sc, SELECT_RAM_BUFFER(i, B3_RI_CTRL), RI_RST_CLR);
CSR_WRITE_1(sc, SELECT_RAM_BUFFER(i, B3_RI_WTO_R1),
@@ -1706,13 +1722,15 @@ mskc_attach(device_t dev)
}
}
+ /* Enable all clocks before accessing any registers. */
+ CSR_PCI_WRITE_4(sc, PCI_OUR_REG_3, 0);
+
CSR_WRITE_2(sc, B0_CTST, CS_RST_CLR);
sc->msk_hw_id = CSR_READ_1(sc, B2_CHIP_ID);
sc->msk_hw_rev = (CSR_READ_1(sc, B2_MAC_CFG) >> 4) & 0x0f;
/* Bail out if chip is not recognized. */
if (sc->msk_hw_id < CHIP_ID_YUKON_XL ||
sc->msk_hw_id > CHIP_ID_YUKON_OPT ||
- sc->msk_hw_id == CHIP_ID_YUKON_SUPR ||
sc->msk_hw_id == CHIP_ID_YUKON_UNKNOWN) {
device_printf(dev, "unknown device: id=0x%02x, rev=0x%02x\n",
sc->msk_hw_id, sc->msk_hw_rev);
@@ -1746,9 +1764,6 @@ mskc_attach(device_t dev)
resource_int_value(device_get_name(dev), device_get_unit(dev),
"int_holdoff", &sc->msk_int_holdoff);
- /* Soft reset. */
- CSR_WRITE_2(sc, B0_CTST, CS_RST_SET);
- CSR_WRITE_2(sc, B0_CTST, CS_RST_CLR);
sc->msk_pmd = CSR_READ_1(sc, B2_PMD_TYP);
/* Check number of MACs. */
sc->msk_num_port = 1;
@@ -1822,6 +1837,11 @@ mskc_attach(device_t dev)
sc->msk_clock = 156; /* 156 MHz */
sc->msk_pflags |= MSK_FLAG_JUMBO;
break;
+ case CHIP_ID_YUKON_SUPR:
+ sc->msk_clock = 125; /* 125 MHz */
+ sc->msk_pflags |= MSK_FLAG_JUMBO | MSK_FLAG_DESCV2 |
+ MSK_FLAG_AUTOTX_CSUM;
+ break;
case CHIP_ID_YUKON_UL_2:
sc->msk_clock = 125; /* 125 MHz */
sc->msk_pflags |= MSK_FLAG_JUMBO;
@@ -2963,6 +2983,7 @@ mskc_resume(device_t dev)
MSK_LOCK(sc);
+ CSR_PCI_WRITE_4(sc, PCI_OUR_REG_3, 0);
mskc_reset(sc);
for (i = 0; i < sc->msk_num_port; i++) {
if (sc->msk_if[i] != NULL && sc->msk_if[i]->msk_ifp != NULL &&
@@ -3654,37 +3675,24 @@ msk_set_tx_stfwd(struct msk_if_softc *sc_if)
ifp = sc_if->msk_ifp;
sc = sc_if->msk_softc;
- switch (sc->msk_hw_id) {
- case CHIP_ID_YUKON_EX:
- if (sc->msk_hw_rev == CHIP_REV_YU_EX_A0)
- goto yukon_ex_workaround;
- if (ifp->if_mtu > ETHERMTU)
- CSR_WRITE_4(sc,
- MR_ADDR(sc_if->msk_port, TX_GMF_CTRL_T),
- TX_JUMBO_ENA | TX_STFW_ENA);
- else
- CSR_WRITE_4(sc,
- MR_ADDR(sc_if->msk_port, TX_GMF_CTRL_T),
- TX_JUMBO_DIS | TX_STFW_ENA);
- break;
- default:
-yukon_ex_workaround:
+ if ((sc->msk_hw_id == CHIP_ID_YUKON_EX &&
+ sc->msk_hw_rev != CHIP_REV_YU_EX_A0) ||
+ sc->msk_hw_id >= CHIP_ID_YUKON_SUPR) {
+ CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, TX_GMF_CTRL_T),
+ TX_STFW_ENA);
+ } else {
if (ifp->if_mtu > ETHERMTU) {
/* Set Tx GMAC FIFO Almost Empty Threshold. */
CSR_WRITE_4(sc,
MR_ADDR(sc_if->msk_port, TX_GMF_AE_THR),
MSK_ECU_JUMBO_WM << 16 | MSK_ECU_AE_THR);
/* Disable Store & Forward mode for Tx. */
- CSR_WRITE_4(sc,
- MR_ADDR(sc_if->msk_port, TX_GMF_CTRL_T),
- TX_JUMBO_ENA | TX_STFW_DIS);
+ CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, TX_GMF_CTRL_T),
+ TX_STFW_DIS);
} else {
- /* Enable Store & Forward mode for Tx. */
- CSR_WRITE_4(sc,
- MR_ADDR(sc_if->msk_port, TX_GMF_CTRL_T),
- TX_JUMBO_DIS | TX_STFW_ENA);
+ CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, TX_GMF_CTRL_T),
+ TX_STFW_ENA);
}
- break;
}
}
@@ -3737,7 +3745,8 @@ msk_init_locked(struct msk_if_softc *sc_if)
CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), GMC_RST_SET);
CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), GMC_RST_CLR);
CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), GMC_F_LOOPB_OFF);
- if (sc->msk_hw_id == CHIP_ID_YUKON_EX)
+ if (sc->msk_hw_id == CHIP_ID_YUKON_EX ||
+ sc->msk_hw_id == CHIP_ID_YUKON_SUPR)
CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL),
GMC_BYP_MACSECRX_ON | GMC_BYP_MACSECTX_ON |
GMC_BYP_RETR_ON);
@@ -3932,7 +3941,8 @@ msk_init_locked(struct msk_if_softc *sc_if)
msk_stop(sc_if);
return;
}
- if (sc->msk_hw_id == CHIP_ID_YUKON_EX) {
+ if (sc->msk_hw_id == CHIP_ID_YUKON_EX ||
+ sc->msk_hw_id == CHIP_ID_YUKON_SUPR) {
/* Disable flushing of non-ASF packets. */
CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, RX_GMF_CTRL_T),
GMF_RX_MACSEC_FLUSH_OFF);
diff --git a/sys/dev/msk/if_mskreg.h b/sys/dev/msk/if_mskreg.h
index 3b05b9b..583f5e8 100644
--- a/sys/dev/msk/if_mskreg.h
+++ b/sys/dev/msk/if_mskreg.h
@@ -144,6 +144,8 @@
#define DEVICEID_MRVL_436A 0x436A
#define DEVICEID_MRVL_436B 0x436B
#define DEVICEID_MRVL_436C 0x436C
+#define DEVICEID_MRVL_436D 0x436D
+#define DEVICEID_MRVL_4370 0x4370
#define DEVICEID_MRVL_4380 0x4380
#define DEVICEID_MRVL_4381 0x4381
@@ -321,6 +323,9 @@
#define PCI_OS_SPD_X100 2 /* PCI-X 100MHz Bus */
#define PCI_OS_SPD_X133 3 /* PCI-X 133MHz Bus */
+/* PCI_OUR_REG_3 32 bit Our Register 3 (Yukon-ECU only) */
+#define PCI_CLK_MACSEC_DIS BIT_17 /* Disable Clock MACSec. */
+
/* PCI_OUR_REG_4 32 bit Our Register 4 (Yukon-ECU only) */
#define PCI_TIMER_VALUE_MSK (0xff<<16) /* Bit 23..16: Timer Value Mask */
#define PCI_FORCE_ASPM_REQUEST BIT_15 /* Force ASPM Request (A1 only) */
@@ -677,6 +682,7 @@
/* ASF Subsystem Registers (Yukon-2 only) */
#define B28_Y2_SMB_CONFIG 0x0e40 /* 32 bit ASF SMBus Config Register */
#define B28_Y2_SMB_CSD_REG 0x0e44 /* 32 bit ASF SMB Control/Status/Data */
+#define B28_Y2_CPU_WDOG 0x0e48 /* 32 bit Watchdog Register */
#define B28_Y2_ASF_IRQ_V_BASE 0x0e60 /* 32 bit ASF IRQ Vector Base */
#define B28_Y2_ASF_STAT_CMD 0x0e68 /* 32 bit ASF Status and Command Reg */
#define B28_Y2_ASF_HCU_CCSR 0x0e68 /* 32 bit ASF HCU CCSR (Yukon EX) */
@@ -918,6 +924,10 @@
#define CHIP_REV_YU_EX_A0 1 /* Chip Rev. for Yukon-2 EX A0 */
#define CHIP_REV_YU_EX_B0 2 /* Chip Rev. for Yukon-2 EX B0 */
+#define CHIP_REV_YU_SU_A0 0 /* Chip Rev. for Yukon-2 SUPR A0 */
+#define CHIP_REV_YU_SU_B0 1 /* Chip Rev. for Yukon-2 SUPR B0 */
+#define CHIP_REV_YU_SU_B1 3 /* Chip Rev. for Yukon-2 SUPR B1 */
+
/* B2_Y2_CLK_GATE 8 bit Clock Gating (Yukon-2 only) */
#define Y2_STATUS_LNK2_INAC BIT_7 /* Status Link 2 inactiv (0 = activ) */
#define Y2_CLK_GAT_LNK2_DIS BIT_6 /* Disable clock gating Link 2 */
diff --git a/sys/dev/pci/pcireg.h b/sys/dev/pci/pcireg.h
index db74809..216882c 100644
--- a/sys/dev/pci/pcireg.h
+++ b/sys/dev/pci/pcireg.h
@@ -367,6 +367,7 @@
#define PCIP_SERIALBUS_USB_UHCI 0x00
#define PCIP_SERIALBUS_USB_OHCI 0x10
#define PCIP_SERIALBUS_USB_EHCI 0x20
+#define PCIP_SERIALBUS_USB_XHCI 0x30
#define PCIP_SERIALBUS_USB_DEVICE 0xfe
#define PCIS_SERIALBUS_FC 0x04
#define PCIS_SERIALBUS_SMBUS 0x05
diff --git a/sys/dev/puc/pucdata.c b/sys/dev/puc/pucdata.c
index 6b1deda..83b02ea 100644
--- a/sys/dev/puc/pucdata.c
+++ b/sys/dev/puc/pucdata.c
@@ -656,6 +656,12 @@ const struct puc_cfg puc_pci_devices[] = {
PUC_PORT_4S, 0x10, 0, 8,
},
+ { 0x1415, 0x950a, 0x131f, 0x2030,
+ "SIIG Cyber 2S PCIe",
+ DEFAULT_RCLK * 10,
+ PUC_PORT_2S, 0x10, 0, 8,
+ },
+
{ 0x1415, 0x950a, 0xffff, 0,
"Oxford Semiconductor OX16PCI954 UARTs",
DEFAULT_RCLK,
diff --git a/sys/dev/scc/scc_bfe_ebus.c b/sys/dev/scc/scc_bfe_ebus.c
index 17386db..6c944f7 100644
--- a/sys/dev/scc/scc_bfe_ebus.c
+++ b/sys/dev/scc/scc_bfe_ebus.c
@@ -56,7 +56,8 @@ scc_ebus_probe(device_t dev)
cmpt = ofw_bus_get_compat(dev);
if (cmpt == NULL)
cmpt = "";
- if (!strcmp(nm, "se") || !strcmp(cmpt, "sab82532")) {
+ if (!strcmp(nm, "se") || !strcmp(nm, "FJSV,se") ||
+ !strcmp(cmpt, "sab82532")) {
device_set_desc(dev, "Siemens SAB 82532 dual channel SCC");
sc->sc_class = &scc_sab82532_class;
return (scc_bfe_probe(dev, EBUS_REGSHFT, EBUS_RCLK, 0));
diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c
index 8fbb7a6..4f8670a 100644
--- a/sys/dev/sound/usb/uaudio.c
+++ b/sys/dev/sound/usb/uaudio.c
@@ -539,9 +539,6 @@ uaudio_probe(device_t dev)
if (uaa->usb_mode != USB_MODE_HOST)
return (ENXIO);
- if (uaa->use_generic == 0)
- return (ENXIO);
-
/* lookup non-standard device */
if (uaa->info.bInterfaceClass != UICLASS_AUDIO) {
@@ -555,7 +552,7 @@ uaudio_probe(device_t dev)
if (usb_test_quirk(uaa, UQ_BAD_AUDIO))
return (ENXIO);
else
- return (0);
+ return (BUS_PROBE_GENERIC);
}
/* check for MIDI stream */
@@ -564,7 +561,7 @@ uaudio_probe(device_t dev)
if (usb_test_quirk(uaa, UQ_BAD_MIDI))
return (ENXIO);
else
- return (0);
+ return (BUS_PROBE_GENERIC);
}
return (ENXIO);
}
diff --git a/sys/dev/uart/uart_cpu_sparc64.c b/sys/dev/uart/uart_cpu_sparc64.c
index c89b39f..582e919 100644
--- a/sys/dev/uart/uart_cpu_sparc64.c
+++ b/sys/dev/uart/uart_cpu_sparc64.c
@@ -238,7 +238,8 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di)
di->bas.regshft = 0;
di->bas.rclk = 0;
class = NULL;
- if (!strcmp(buf, "se") || !strcmp(compat, "sab82532")) {
+ if (!strcmp(buf, "se") || !strcmp(buf, "FJSV,se") ||
+ !strcmp(compat, "sab82532")) {
class = &uart_sab82532_class;
/* SAB82532 are only known to be used for TTYs. */
if ((di->bas.chan = uart_cpu_channel(dev)) == 0)
diff --git a/sys/dev/usb/controller/xhci_pci.c b/sys/dev/usb/controller/xhci_pci.c
index 984ed39..40358bf 100644
--- a/sys/dev/usb/controller/xhci_pci.c
+++ b/sys/dev/usb/controller/xhci_pci.c
@@ -137,7 +137,7 @@ xhci_pci_match(device_t self)
{
if ((pci_get_class(self) == PCIC_SERIALBUS)
&& (pci_get_subclass(self) == PCIS_SERIALBUS_USB)
- && (pci_get_progif(self) == PCI_INTERFACE_XHCI)) {
+ && (pci_get_progif(self) == PCIP_SERIALBUS_USB_XHCI)) {
return ("XHCI (generic) USB 3.0 controller");
}
return (NULL); /* dunno */
diff --git a/sys/dev/usb/controller/xhcireg.h b/sys/dev/usb/controller/xhcireg.h
index fb2d1ca..71c5c28 100644
--- a/sys/dev/usb/controller/xhcireg.h
+++ b/sys/dev/usb/controller/xhcireg.h
@@ -33,7 +33,6 @@
#define PCI_XHCI_USBREV 0x60 /* RO USB protocol revision */
#define PCI_USB_REV_3_0 0x30 /* USB 3.0 */
#define PCI_XHCI_FLADJ 0x61 /* RW frame length adjust */
-#define PCI_INTERFACE_XHCI 0x30 /* USB 3.0 - XHCI */
/* XHCI capability registers */
#define XHCI_CAPLENGTH 0x00 /* RO capability */
diff --git a/sys/dev/usb/input/uhid.c b/sys/dev/usb/input/uhid.c
index 8b33f83..a7fd899 100644
--- a/sys/dev/usb/input/uhid.c
+++ b/sys/dev/usb/input/uhid.c
@@ -617,10 +617,6 @@ uhid_probe(device_t dev)
if (uaa->usb_mode != USB_MODE_HOST) {
return (ENXIO);
}
- if (uaa->use_generic == 0) {
- /* give Mouse and Keyboard drivers a try first */
- return (ENXIO);
- }
if (uaa->info.bInterfaceClass != UICLASS_HID) {
/* the Xbox 360 gamepad doesn't use the HID class */
diff --git a/sys/dev/usb/input/ukbd.c b/sys/dev/usb/input/ukbd.c
index 2015233..9182663 100644
--- a/sys/dev/usb/input/ukbd.c
+++ b/sys/dev/usb/input/ukbd.c
@@ -771,7 +771,7 @@ ukbd_probe(device_t dev)
if (usb_test_quirk(uaa, UQ_KBD_IGNORE))
return (ENXIO);
else
- return (BUS_PROBE_GENERIC);
+ return (BUS_PROBE_DEFAULT);
}
error = usbd_req_get_hid_desc(uaa->device, NULL,
@@ -793,7 +793,7 @@ ukbd_probe(device_t dev)
if (usb_test_quirk(uaa, UQ_KBD_IGNORE))
error = ENXIO;
else
- error = BUS_PROBE_GENERIC;
+ error = BUS_PROBE_DEFAULT;
} else
error = ENXIO;
diff --git a/sys/dev/usb/input/ums.c b/sys/dev/usb/input/ums.c
index af4bfc9..af9aa1f 100644
--- a/sys/dev/usb/input/ums.c
+++ b/sys/dev/usb/input/ums.c
@@ -373,7 +373,7 @@ ums_probe(device_t dev)
if ((uaa->info.bInterfaceSubClass == UISUBCLASS_BOOT) &&
(uaa->info.bInterfaceProtocol == UIPROTO_MOUSE))
- return (BUS_PROBE_GENERIC);
+ return (BUS_PROBE_DEFAULT);
error = usbd_req_get_hid_desc(uaa->device, NULL,
&d_ptr, &d_len, M_TEMP, uaa->info.bIfaceIndex);
@@ -383,7 +383,7 @@ ums_probe(device_t dev)
if (hid_is_collection(d_ptr, d_len,
HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_MOUSE)))
- error = BUS_PROBE_GENERIC;
+ error = BUS_PROBE_DEFAULT;
else
error = ENXIO;
diff --git a/sys/dev/usb/storage/umass.c b/sys/dev/usb/storage/umass.c
index de6ad9d..158d843 100644
--- a/sys/dev/usb/storage/umass.c
+++ b/sys/dev/usb/storage/umass.c
@@ -782,6 +782,7 @@ umass_probe_proto(device_t dev, struct usb_attach_arg *uaa)
uint32_t proto = umass_get_proto(uaa->iface);
memset(&ret, 0, sizeof(ret));
+ ret.error = BUS_PROBE_GENERIC;
/* Search for protocol enforcement */
@@ -870,10 +871,6 @@ umass_probe(device_t dev)
if (uaa->usb_mode != USB_MODE_HOST) {
return (ENXIO);
}
- if (uaa->use_generic == 0) {
- /* give other drivers a try first */
- return (ENXIO);
- }
temp = umass_probe_proto(dev, uaa);
return (temp.error);
diff --git a/sys/dev/usb/storage/ustorage_fs.c b/sys/dev/usb/storage/ustorage_fs.c
index c62c96b..dbf025a 100644
--- a/sys/dev/usb/storage/ustorage_fs.c
+++ b/sys/dev/usb/storage/ustorage_fs.c
@@ -334,10 +334,6 @@ ustorage_fs_probe(device_t dev)
if (uaa->usb_mode != USB_MODE_DEVICE) {
return (ENXIO);
}
- if (uaa->use_generic == 0) {
- /* give other drivers a try first */
- return (ENXIO);
- }
/* Check for a standards compliant device */
id = usbd_get_interface_descriptor(uaa->iface);
if ((id == NULL) ||
@@ -346,7 +342,7 @@ ustorage_fs_probe(device_t dev)
(id->bInterfaceProtocol != UIPROTO_MASS_BBB)) {
return (ENXIO);
}
- return (0);
+ return (BUS_PROBE_GENERIC);
}
static int
diff --git a/sys/dev/usb/usb_device.c b/sys/dev/usb/usb_device.c
index a8b79a8..893e79d 100644
--- a/sys/dev/usb/usb_device.c
+++ b/sys/dev/usb/usb_device.c
@@ -1334,7 +1334,6 @@ usb_probe_and_attach(struct usb_device *udev, uint8_t iface_index)
uaa.info.bIfaceIndex = i;
uaa.info.bIfaceNum =
iface->idesc->bInterfaceNumber;
- uaa.use_generic = 0;
uaa.driver_info = 0; /* reset driver_info */
DPRINTFN(2, "iclass=%u/%u/%u iindex=%u/%u\n",
@@ -1344,16 +1343,6 @@ usb_probe_and_attach(struct usb_device *udev, uint8_t iface_index)
uaa.info.bIfaceIndex,
uaa.info.bIfaceNum);
- /* try specific interface drivers first */
-
- if (usb_probe_and_attach_sub(udev, &uaa)) {
- /* ignore */
- }
- /* try generic interface drivers last */
-
- uaa.use_generic = 1;
- uaa.driver_info = 0; /* reset driver_info */
-
if (usb_probe_and_attach_sub(udev, &uaa)) {
/* ignore */
}
diff --git a/sys/dev/usb/usbdi.h b/sys/dev/usb/usbdi.h
index 9bd326e..8f6da7c 100644
--- a/sys/dev/usb/usbdi.h
+++ b/sys/dev/usb/usbdi.h
@@ -357,7 +357,6 @@ struct usb_attach_arg {
struct usb_interface *iface; /* current interface */
enum usb_hc_mode usb_mode; /* host or device mode */
uint8_t port;
- uint8_t use_generic; /* hint for generic drivers */
uint8_t dev_state;
#define UAA_DEV_READY 0
#define UAA_DEV_DISABLED 1
diff --git a/sys/dev/vge/if_vge.c b/sys/dev/vge/if_vge.c
index 4549bb0..d9a58cc 100644
--- a/sys/dev/vge/if_vge.c
+++ b/sys/dev/vge/if_vge.c
@@ -685,7 +685,18 @@ vge_dma_alloc(struct vge_softc *sc)
bus_addr_t lowaddr, tx_ring_end, rx_ring_end;
int error, i;
- lowaddr = BUS_SPACE_MAXADDR;
+ /*
+ * It seems old PCI controllers do not support DAC. DAC
+ * configuration can be enabled by accessing VGE_CHIPCFG3
+ * register but honor EEPROM configuration instead of
+ * blindly overriding DAC configuration. PCIe based
+ * controllers are supposed to support 64bit DMA so enable
+ * 64bit DMA on these controllers.
+ */
+ if ((sc->vge_flags & VGE_FLAG_PCIE) != 0)
+ lowaddr = BUS_SPACE_MAXADDR;
+ else
+ lowaddr = BUS_SPACE_MAXADDR_32BIT;
again:
/* Create parent ring tag. */
@@ -802,10 +813,14 @@ again:
goto again;
}
+ if ((sc->vge_flags & VGE_FLAG_PCIE) != 0)
+ lowaddr = VGE_BUF_DMA_MAXADDR;
+ else
+ lowaddr = BUS_SPACE_MAXADDR_32BIT;
/* Create parent buffer tag. */
error = bus_dma_tag_create(bus_get_dma_tag(sc->vge_dev),/* parent */
1, 0, /* algnmnt, boundary */
- VGE_BUF_DMA_MAXADDR, /* lowaddr */
+ lowaddr, /* lowaddr */
BUS_SPACE_MAXADDR, /* highaddr */
NULL, NULL, /* filter, filterarg */
BUS_SPACE_MAXSIZE_32BIT, /* maxsize */
diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c
index 77757f2..0ad57ec 100644
--- a/sys/fs/cd9660/cd9660_vfsops.c
+++ b/sys/fs/cd9660/cd9660_vfsops.c
@@ -586,9 +586,10 @@ cd9660_statfs(mp, sbp)
/* ARGSUSED */
static int
-cd9660_fhtovp(mp, fhp, vpp)
+cd9660_fhtovp(mp, fhp, flags, vpp)
struct mount *mp;
struct fid *fhp;
+ int flags;
struct vnode **vpp;
{
struct ifid ifh;
diff --git a/sys/fs/ext2fs/ext2_vfsops.c b/sys/fs/ext2fs/ext2_vfsops.c
index 5c807dc..1b47e91 100644
--- a/sys/fs/ext2fs/ext2_vfsops.c
+++ b/sys/fs/ext2fs/ext2_vfsops.c
@@ -973,7 +973,7 @@ ext2_vget(struct mount *mp, ino_t ino, int flags, struct vnode **vpp)
* those rights via. exflagsp and credanonp
*/
static int
-ext2_fhtovp(struct mount *mp, struct fid *fhp, struct vnode **vpp)
+ext2_fhtovp(struct mount *mp, struct fid *fhp, int flags, struct vnode **vpp)
{
struct inode *ip;
struct ufid *ufhp;
diff --git a/sys/fs/hpfs/hpfs_vfsops.c b/sys/fs/hpfs/hpfs_vfsops.c
index 676b5c7..866004e 100644
--- a/sys/fs/hpfs/hpfs_vfsops.c
+++ b/sys/fs/hpfs/hpfs_vfsops.c
@@ -417,6 +417,7 @@ static int
hpfs_fhtovp(
struct mount *mp,
struct fid *fhp,
+ int flags,
struct vnode **vpp)
{
struct vnode *nvp;
diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c
index e04ef9c..e347640 100644
--- a/sys/fs/msdosfs/msdosfs_vfsops.c
+++ b/sys/fs/msdosfs/msdosfs_vfsops.c
@@ -963,7 +963,7 @@ loop:
}
static int
-msdosfs_fhtovp(struct mount *mp, struct fid *fhp, struct vnode **vpp)
+msdosfs_fhtovp(struct mount *mp, struct fid *fhp, int flags, struct vnode **vpp)
{
struct msdosfsmount *pmp = VFSTOMSDOSFS(mp);
struct defid *defhp = (struct defid *) fhp;
diff --git a/sys/fs/nfs/nfs_commonkrpc.c b/sys/fs/nfs/nfs_commonkrpc.c
index 8b5f391..ba1ac4e 100644
--- a/sys/fs/nfs/nfs_commonkrpc.c
+++ b/sys/fs/nfs/nfs_commonkrpc.c
@@ -78,17 +78,17 @@ static int nfs3_jukebox_delay = 10;
static int nfs_skip_wcc_data_onerr = 1;
static int nfs_keytab_enctype = ETYPE_DES_CBC_CRC;
-SYSCTL_DECL(_vfs_newnfs);
+SYSCTL_DECL(_vfs_nfs);
-SYSCTL_INT(_vfs_newnfs, OID_AUTO, bufpackets, CTLFLAG_RW, &nfs_bufpackets, 0,
+SYSCTL_INT(_vfs_nfs, OID_AUTO, bufpackets, CTLFLAG_RW, &nfs_bufpackets, 0,
"Buffer reservation size 2 < x < 64");
-SYSCTL_INT(_vfs_newnfs, OID_AUTO, reconnects, CTLFLAG_RD, &nfs_reconnects, 0,
+SYSCTL_INT(_vfs_nfs, OID_AUTO, reconnects, CTLFLAG_RD, &nfs_reconnects, 0,
"Number of times the nfs client has had to reconnect");
-SYSCTL_INT(_vfs_newnfs, OID_AUTO, nfs3_jukebox_delay, CTLFLAG_RW, &nfs3_jukebox_delay, 0,
+SYSCTL_INT(_vfs_nfs, OID_AUTO, nfs3_jukebox_delay, CTLFLAG_RW, &nfs3_jukebox_delay, 0,
"Number of seconds to delay a retry after receiving EJUKEBOX");
-SYSCTL_INT(_vfs_newnfs, OID_AUTO, skip_wcc_data_onerr, CTLFLAG_RW, &nfs_skip_wcc_data_onerr, 0,
+SYSCTL_INT(_vfs_nfs, OID_AUTO, skip_wcc_data_onerr, CTLFLAG_RW, &nfs_skip_wcc_data_onerr, 0,
"Disable weak cache consistency checking when server returns an error");
-SYSCTL_INT(_vfs_newnfs, OID_AUTO, keytab_enctype, CTLFLAG_RW, &nfs_keytab_enctype, 0,
+SYSCTL_INT(_vfs_nfs, OID_AUTO, keytab_enctype, CTLFLAG_RW, &nfs_keytab_enctype, 0,
"Encryption type for the keytab entry used by nfs");
static void nfs_down(struct nfsmount *, struct thread *, const char *,
diff --git a/sys/fs/nfs/nfs_commonport.c b/sys/fs/nfs/nfs_commonport.c
index ee37cbc..6254915 100644
--- a/sys/fs/nfs/nfs_commonport.c
+++ b/sys/fs/nfs/nfs_commonport.c
@@ -69,14 +69,12 @@ void (*ncl_call_invalcaches)(struct vnode *) = NULL;
static int nfs_realign_test;
static int nfs_realign_count;
-SYSCTL_NODE(_vfs, OID_AUTO, newnfs, CTLFLAG_RW, 0, "New NFS filesystem");
-SYSCTL_INT(_vfs_newnfs, OID_AUTO, realign_test, CTLFLAG_RW, &nfs_realign_test,
+SYSCTL_NODE(_vfs, OID_AUTO, nfs, CTLFLAG_RW, 0, "New NFS filesystem");
+SYSCTL_INT(_vfs_nfs, OID_AUTO, realign_test, CTLFLAG_RW, &nfs_realign_test,
0, "Number of realign tests done");
-SYSCTL_INT(_vfs_newnfs, OID_AUTO, realign_count, CTLFLAG_RW, &nfs_realign_count,
+SYSCTL_INT(_vfs_nfs, OID_AUTO, realign_count, CTLFLAG_RW, &nfs_realign_count,
0, "Number of mbuf realignments done");
-SYSCTL_INT(_vfs_newnfs, OID_AUTO, nfs4acl_enable, CTLFLAG_RW, &nfsrv_useacl,
- 0, "Enable NFSv4 ACLs");
-SYSCTL_STRING(_vfs_newnfs, OID_AUTO, callback_addr, CTLFLAG_RW,
+SYSCTL_STRING(_vfs_nfs, OID_AUTO, callback_addr, CTLFLAG_RW,
nfsv4_callbackaddr, sizeof(nfsv4_callbackaddr),
"NFSv4 callback addr for server to use");
diff --git a/sys/fs/nfsclient/nfs_clkrpc.c b/sys/fs/nfsclient/nfs_clkrpc.c
index 1b6734d..c4f7e94 100644
--- a/sys/fs/nfsclient/nfs_clkrpc.c
+++ b/sys/fs/nfsclient/nfs_clkrpc.c
@@ -46,8 +46,6 @@ __FBSDID("$FreeBSD$");
NFSDLOCKMUTEX;
-SYSCTL_DECL(_vfs_newnfs);
-
SVCPOOL *nfscbd_pool;
static int nfs_cbproc(struct nfsrv_descript *, u_int32_t);
diff --git a/sys/fs/nfsclient/nfs_clnfsiod.c b/sys/fs/nfsclient/nfs_clnfsiod.c
index 7ee19ad..0f1810f 100644
--- a/sys/fs/nfsclient/nfs_clnfsiod.c
+++ b/sys/fs/nfsclient/nfs_clnfsiod.c
@@ -80,11 +80,11 @@ static void nfssvc_iod(void *);
static int nfs_asyncdaemon[NFS_MAXASYNCDAEMON];
-SYSCTL_DECL(_vfs_newnfs);
+SYSCTL_DECL(_vfs_nfs);
/* Maximum number of seconds a nfsiod kthread will sleep before exiting */
static unsigned int nfs_iodmaxidle = 120;
-SYSCTL_UINT(_vfs_newnfs, OID_AUTO, iodmaxidle, CTLFLAG_RW, &nfs_iodmaxidle, 0,
+SYSCTL_UINT(_vfs_nfs, OID_AUTO, iodmaxidle, CTLFLAG_RW, &nfs_iodmaxidle, 0,
"Max number of seconds an nfsiod kthread will sleep before exiting");
/* Maximum number of nfsiod kthreads */
@@ -123,7 +123,7 @@ out:
mtx_unlock(&ncl_iod_mutex);
return (0);
}
-SYSCTL_PROC(_vfs_newnfs, OID_AUTO, iodmin, CTLTYPE_UINT | CTLFLAG_RW, 0,
+SYSCTL_PROC(_vfs_nfs, OID_AUTO, iodmin, CTLTYPE_UINT | CTLFLAG_RW, 0,
sizeof (nfs_iodmin), sysctl_iodmin, "IU",
"Min number of nfsiod kthreads to keep as spares");
@@ -159,7 +159,7 @@ out:
mtx_unlock(&ncl_iod_mutex);
return (0);
}
-SYSCTL_PROC(_vfs_newnfs, OID_AUTO, iodmax, CTLTYPE_UINT | CTLFLAG_RW, 0,
+SYSCTL_PROC(_vfs_nfs, OID_AUTO, iodmax, CTLTYPE_UINT | CTLFLAG_RW, 0,
sizeof (ncl_iodmax), sysctl_iodmax, "IU",
"Max number of nfsiod kthreads");
@@ -214,7 +214,7 @@ nfsiod_setup(void *dummy)
{
int error;
- TUNABLE_INT_FETCH("vfs.newnfs.iodmin", &nfs_iodmin);
+ TUNABLE_INT_FETCH("vfs.nfs.iodmin", &nfs_iodmin);
nfscl_init();
mtx_lock(&ncl_iod_mutex);
/* Silently limit the start number of nfsiod's */
@@ -231,7 +231,7 @@ nfsiod_setup(void *dummy)
SYSINIT(newnfsiod, SI_SUB_KTHREAD_IDLE, SI_ORDER_ANY, nfsiod_setup, NULL);
static int nfs_defect = 0;
-SYSCTL_INT(_vfs_newnfs, OID_AUTO, defect, CTLFLAG_RW, &nfs_defect, 0,
+SYSCTL_INT(_vfs_nfs, OID_AUTO, defect, CTLFLAG_RW, &nfs_defect, 0,
"Allow nfsiods to migrate serving different mounts");
/*
diff --git a/sys/fs/nfsclient/nfs_clsubs.c b/sys/fs/nfsclient/nfs_clsubs.c
index 7bff646..0c05631 100644
--- a/sys/fs/nfsclient/nfs_clsubs.c
+++ b/sys/fs/nfsclient/nfs_clsubs.c
@@ -174,9 +174,9 @@ ncl_printf(const char *fmt, ...)
#ifdef NFS_ACDEBUG
#include <sys/sysctl.h>
-SYSCTL_DECL(_vfs_newnfs);
+SYSCTL_DECL(_vfs_nfs);
static int nfs_acdebug;
-SYSCTL_INT(_vfs_newnfs, OID_AUTO, acdebug, CTLFLAG_RW, &nfs_acdebug, 0, "");
+SYSCTL_INT(_vfs_nfs, OID_AUTO, acdebug, CTLFLAG_RW, &nfs_acdebug, 0, "");
#endif
/*
diff --git a/sys/fs/nfsclient/nfs_clvfsops.c b/sys/fs/nfsclient/nfs_clvfsops.c
index b11160b..84725dd 100644
--- a/sys/fs/nfsclient/nfs_clvfsops.c
+++ b/sys/fs/nfsclient/nfs_clvfsops.c
@@ -79,22 +79,21 @@ FEATURE(nfscl, "NFSv4 client");
extern int nfscl_ticks;
extern struct timeval nfsboottime;
extern struct nfsstats newnfsstats;
+extern int nfsrv_useacl;
MALLOC_DEFINE(M_NEWNFSREQ, "newnfsclient_req", "New NFS request header");
MALLOC_DEFINE(M_NEWNFSMNT, "newnfsmnt", "New NFS mount struct");
-SYSCTL_DECL(_vfs_newnfs);
-SYSCTL_STRUCT(_vfs_newnfs, NFS_NFSSTATS, nfsstats, CTLFLAG_RW,
- &newnfsstats, nfsstats, "S,nfsstats");
+SYSCTL_DECL(_vfs_nfs);
static int nfs_ip_paranoia = 1;
-SYSCTL_INT(_vfs_newnfs, OID_AUTO, nfs_ip_paranoia, CTLFLAG_RW,
+SYSCTL_INT(_vfs_nfs, OID_AUTO, nfs_ip_paranoia, CTLFLAG_RW,
&nfs_ip_paranoia, 0, "");
static int nfs_tprintf_initial_delay = NFS_TPRINTF_INITIAL_DELAY;
-SYSCTL_INT(_vfs_newnfs, NFS_TPRINTF_INITIAL_DELAY,
+SYSCTL_INT(_vfs_nfs, NFS_TPRINTF_INITIAL_DELAY,
downdelayinitial, CTLFLAG_RW, &nfs_tprintf_initial_delay, 0, "");
/* how long between console messages "nfs server foo not responding" */
static int nfs_tprintf_delay = NFS_TPRINTF_DELAY;
-SYSCTL_INT(_vfs_newnfs, NFS_TPRINTF_DELAY,
+SYSCTL_INT(_vfs_nfs, NFS_TPRINTF_DELAY,
downdelayinterval, CTLFLAG_RW, &nfs_tprintf_delay, 0, "");
static int nfs_mountroot(struct mount *);
@@ -152,14 +151,14 @@ struct nfsv3_diskless nfsv3_diskless = { { { 0 } } };
int nfs_diskless_valid = 0;
#endif
-SYSCTL_INT(_vfs_newnfs, OID_AUTO, diskless_valid, CTLFLAG_RD,
+SYSCTL_INT(_vfs_nfs, OID_AUTO, diskless_valid, CTLFLAG_RD,
&nfs_diskless_valid, 0,
"Has the diskless struct been filled correctly");
-SYSCTL_STRING(_vfs_newnfs, OID_AUTO, diskless_rootpath, CTLFLAG_RD,
+SYSCTL_STRING(_vfs_nfs, OID_AUTO, diskless_rootpath, CTLFLAG_RD,
nfsv3_diskless.root_hostnam, 0, "Path to nfs root");
-SYSCTL_OPAQUE(_vfs_newnfs, OID_AUTO, diskless_rootaddr, CTLFLAG_RD,
+SYSCTL_OPAQUE(_vfs_nfs, OID_AUTO, diskless_rootaddr, CTLFLAG_RD,
&nfsv3_diskless.root_saddr, sizeof(nfsv3_diskless.root_saddr),
"%Ssockaddr_in", "Diskless root nfs address");
@@ -1081,15 +1080,21 @@ nfs_mount(struct mount *mp)
dirpath[0] = '\0';
dirlen = strlen(dirpath);
- if (has_nfs_args_opt == 0 && vfs_getopt(mp->mnt_optnew, "addr",
- (void **)&args.addr, &args.addrlen) == 0) {
- if (args.addrlen > SOCK_MAXADDRLEN) {
- error = ENAMETOOLONG;
+ if (has_nfs_args_opt == 0) {
+ if (vfs_getopt(mp->mnt_optnew, "addr",
+ (void **)&args.addr, &args.addrlen) == 0) {
+ if (args.addrlen > SOCK_MAXADDRLEN) {
+ error = ENAMETOOLONG;
+ goto out;
+ }
+ nam = malloc(args.addrlen, M_SONAME, M_WAITOK);
+ bcopy(args.addr, nam, args.addrlen);
+ nam->sa_len = args.addrlen;
+ } else {
+ vfs_mount_error(mp, "No server address");
+ error = EINVAL;
goto out;
}
- nam = malloc(args.addrlen, M_SONAME, M_WAITOK);
- bcopy(args.addr, nam, args.addrlen);
- nam->sa_len = args.addrlen;
}
args.fh = nfh;
@@ -1327,6 +1332,15 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam,
if (argp->flags & NFSMNT_NFSV3)
ncl_fsinfo(nmp, *vpp, cred, td);
+ /* Mark if the mount point supports NFSv4 ACLs. */
+ if ((argp->flags & NFSMNT_NFSV4) != 0 && nfsrv_useacl != 0 &&
+ ret == 0 &&
+ NFSISSET_ATTRBIT(&nfsva.na_suppattr, NFSATTRBIT_ACL)) {
+ MNT_ILOCK(mp);
+ mp->mnt_flag |= MNT_NFS4ACLS;
+ MNT_IUNLOCK(mp);
+ }
+
/*
* Lose the lock but keep the ref.
*/
diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c
index 6dc709f..1b08582 100644
--- a/sys/fs/nfsclient/nfs_clvnops.c
+++ b/sys/fs/nfsclient/nfs_clvnops.c
@@ -63,7 +63,6 @@ __FBSDID("$FreeBSD$");
#include <sys/signalvar.h>
#include <vm/vm.h>
-#include <vm/vm_object.h>
#include <vm/vm_extern.h>
#include <vm/vm_object.h>
@@ -199,27 +198,27 @@ static int nfs_renameit(struct vnode *sdvp, struct vnode *svp,
*/
#define DIRHDSIZ (sizeof (struct dirent) - (MAXNAMLEN + 1))
-SYSCTL_DECL(_vfs_newnfs);
+SYSCTL_DECL(_vfs_nfs);
static int nfsaccess_cache_timeout = NFS_MAXATTRTIMO;
-SYSCTL_INT(_vfs_newnfs, OID_AUTO, access_cache_timeout, CTLFLAG_RW,
+SYSCTL_INT(_vfs_nfs, OID_AUTO, access_cache_timeout, CTLFLAG_RW,
&nfsaccess_cache_timeout, 0, "NFS ACCESS cache timeout");
static int nfs_prime_access_cache = 0;
-SYSCTL_INT(_vfs_newnfs, OID_AUTO, prime_access_cache, CTLFLAG_RW,
+SYSCTL_INT(_vfs_nfs, OID_AUTO, prime_access_cache, CTLFLAG_RW,
&nfs_prime_access_cache, 0,
"Prime NFS ACCESS cache when fetching attributes");
static int newnfs_commit_on_close = 0;
-SYSCTL_INT(_vfs_newnfs, OID_AUTO, commit_on_close, CTLFLAG_RW,
+SYSCTL_INT(_vfs_nfs, OID_AUTO, commit_on_close, CTLFLAG_RW,
&newnfs_commit_on_close, 0, "write+commit on close, else only write");
static int nfs_clean_pages_on_close = 1;
-SYSCTL_INT(_vfs_newnfs, OID_AUTO, clean_pages_on_close, CTLFLAG_RW,
+SYSCTL_INT(_vfs_nfs, OID_AUTO, clean_pages_on_close, CTLFLAG_RW,
&nfs_clean_pages_on_close, 0, "NFS clean dirty pages on close");
int newnfs_directio_enable = 0;
-SYSCTL_INT(_vfs_newnfs, OID_AUTO, nfs_directio_enable, CTLFLAG_RW,
+SYSCTL_INT(_vfs_nfs, OID_AUTO, nfs_directio_enable, CTLFLAG_RW,
&newnfs_directio_enable, 0, "Enable NFS directio");
/*
@@ -234,14 +233,14 @@ SYSCTL_INT(_vfs_newnfs, OID_AUTO, nfs_directio_enable, CTLFLAG_RW,
* meaningful.
*/
int newnfs_directio_allow_mmap = 1;
-SYSCTL_INT(_vfs_newnfs, OID_AUTO, nfs_directio_allow_mmap, CTLFLAG_RW,
+SYSCTL_INT(_vfs_nfs, OID_AUTO, nfs_directio_allow_mmap, CTLFLAG_RW,
&newnfs_directio_allow_mmap, 0, "Enable mmaped IO on file with O_DIRECT opens");
#if 0
-SYSCTL_INT(_vfs_newnfs, OID_AUTO, access_cache_hits, CTLFLAG_RD,
+SYSCTL_INT(_vfs_nfs, OID_AUTO, access_cache_hits, CTLFLAG_RD,
&newnfsstats.accesscache_hits, 0, "NFS ACCESS cache hit count");
-SYSCTL_INT(_vfs_newnfs, OID_AUTO, access_cache_misses, CTLFLAG_RD,
+SYSCTL_INT(_vfs_nfs, OID_AUTO, access_cache_misses, CTLFLAG_RD,
&newnfsstats.accesscache_misses, 0, "NFS ACCESS cache miss count");
#endif
diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c
index 11c287f..d62be99 100644
--- a/sys/fs/nfsserver/nfs_nfsdport.c
+++ b/sys/fs/nfsserver/nfs_nfsdport.c
@@ -2551,7 +2551,7 @@ nfsvno_fhtovp(struct mount *mp, fhandle_t *fhp, struct sockaddr *nam,
if (VFS_NEEDSGIANT(mp))
error = ESTALE;
else
- error = VFS_FHTOVP(mp, &fhp->fh_fid, vpp);
+ error = VFS_FHTOVP(mp, &fhp->fh_fid, LK_EXCLUSIVE, vpp);
if (error != 0)
/* Make sure the server replies ESTALE to the client. */
error = ESTALE;
@@ -2834,7 +2834,7 @@ nfsvno_getvp(fhandle_t *fhp)
mp = vfs_busyfs(&fhp->fh_fsid);
if (mp == NULL)
return (NULL);
- error = VFS_FHTOVP(mp, &fhp->fh_fid, &vp);
+ error = VFS_FHTOVP(mp, &fhp->fh_fid, LK_EXCLUSIVE, &vp);
vfs_unbusy(mp);
if (error)
return (NULL);
diff --git a/sys/fs/ntfs/ntfs_vfsops.c b/sys/fs/ntfs/ntfs_vfsops.c
index b5e024b..d3468af 100644
--- a/sys/fs/ntfs/ntfs_vfsops.c
+++ b/sys/fs/ntfs/ntfs_vfsops.c
@@ -616,6 +616,7 @@ static int
ntfs_fhtovp(
struct mount *mp,
struct fid *fhp,
+ int flags,
struct vnode **vpp)
{
struct vnode *nvp;
diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c
index 7bd4ab7..e39dd8f 100644
--- a/sys/fs/nullfs/null_vfsops.c
+++ b/sys/fs/nullfs/null_vfsops.c
@@ -321,13 +321,15 @@ nullfs_vget(mp, ino, flags, vpp)
}
static int
-nullfs_fhtovp(mp, fidp, vpp)
+nullfs_fhtovp(mp, fidp, flags, vpp)
struct mount *mp;
struct fid *fidp;
+ int flags;
struct vnode **vpp;
{
int error;
- error = VFS_FHTOVP(MOUNTTONULLMOUNT(mp)->nullm_vfs, fidp, vpp);
+ error = VFS_FHTOVP(MOUNTTONULLMOUNT(mp)->nullm_vfs, fidp, LK_EXCLUSIVE,
+ vpp);
if (error)
return (error);
diff --git a/sys/fs/tmpfs/tmpfs_vfsops.c b/sys/fs/tmpfs/tmpfs_vfsops.c
index 356be5e..9d23bd2 100644
--- a/sys/fs/tmpfs/tmpfs_vfsops.c
+++ b/sys/fs/tmpfs/tmpfs_vfsops.c
@@ -71,7 +71,8 @@ MALLOC_DEFINE(M_TMPFSNAME, "tmpfs name", "tmpfs file names");
static int tmpfs_mount(struct mount *);
static int tmpfs_unmount(struct mount *, int);
static int tmpfs_root(struct mount *, int flags, struct vnode **);
-static int tmpfs_fhtovp(struct mount *, struct fid *, struct vnode **);
+static int tmpfs_fhtovp(struct mount *, struct fid *, int,
+ struct vnode **);
static int tmpfs_statfs(struct mount *, struct statfs *);
/* --------------------------------------------------------------------- */
@@ -341,7 +342,8 @@ tmpfs_root(struct mount *mp, int flags, struct vnode **vpp)
/* --------------------------------------------------------------------- */
static int
-tmpfs_fhtovp(struct mount *mp, struct fid *fhp, struct vnode **vpp)
+tmpfs_fhtovp(struct mount *mp, struct fid *fhp, int flags,
+ struct vnode **vpp)
{
boolean_t found;
struct tmpfs_fid *tfhp;
diff --git a/sys/fs/udf/udf_vfsops.c b/sys/fs/udf/udf_vfsops.c
index 7be5384..bb2c09d 100644
--- a/sys/fs/udf/udf_vfsops.c
+++ b/sys/fs/udf/udf_vfsops.c
@@ -722,7 +722,7 @@ udf_vget(struct mount *mp, ino_t ino, int flags, struct vnode **vpp)
}
static int
-udf_fhtovp(struct mount *mp, struct fid *fhp, struct vnode **vpp)
+udf_fhtovp(struct mount *mp, struct fid *fhp, int flags, struct vnode **vpp)
{
struct ifid *ifhp;
struct vnode *nvp;
diff --git a/sys/fs/unionfs/union_vfsops.c b/sys/fs/unionfs/union_vfsops.c
index e11219c..96258fb 100644
--- a/sys/fs/unionfs/union_vfsops.c
+++ b/sys/fs/unionfs/union_vfsops.c
@@ -454,7 +454,8 @@ unionfs_vget(struct mount *mp, ino_t ino, int flags, struct vnode **vpp)
}
static int
-unionfs_fhtovp(struct mount *mp, struct fid *fidp, struct vnode **vpp)
+unionfs_fhtovp(struct mount *mp, struct fid *fidp, int flags,
+ struct vnode **vpp)
{
return (EOPNOTSUPP);
}
diff --git a/sys/geom/eli/g_eli_key_cache.c b/sys/geom/eli/g_eli_key_cache.c
index 0a5a9ca..de4989b 100644
--- a/sys/geom/eli/g_eli_key_cache.c
+++ b/sys/geom/eli/g_eli_key_cache.c
@@ -124,6 +124,7 @@ g_eli_key_allocate(struct g_eli_softc *sc, uint64_t keyno)
ekey = RB_FIND(g_eli_key_tree, &sc->sc_ekeys_tree, &keysearch);
if (ekey != NULL) {
bzero(key, sizeof(*key));
+ free(key, M_ELI);
key = ekey;
TAILQ_REMOVE(&sc->sc_ekeys_queue, key, gek_next);
} else {
diff --git a/sys/geom/gate/g_gate.c b/sys/geom/gate/g_gate.c
index 9b4d782..22338a5 100644
--- a/sys/geom/gate/g_gate.c
+++ b/sys/geom/gate/g_gate.c
@@ -180,6 +180,7 @@ g_gate_start(struct bio *bp)
break;
case BIO_DELETE:
case BIO_WRITE:
+ case BIO_FLUSH:
/* XXX: Hack to allow read-only mounts. */
if ((sc->sc_flags & G_GATE_FLAG_READONLY) != 0) {
g_io_deliver(bp, EPERM);
@@ -580,6 +581,7 @@ g_gate_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct threa
switch (bp->bio_cmd) {
case BIO_READ:
case BIO_DELETE:
+ case BIO_FLUSH:
break;
case BIO_WRITE:
error = copyout(bp->bio_data, ggio->gctl_data,
@@ -643,6 +645,7 @@ start_end:
break;
case BIO_DELETE:
case BIO_WRITE:
+ case BIO_FLUSH:
break;
}
}
diff --git a/sys/geom/part/g_part.c b/sys/geom/part/g_part.c
index aa5444e..a3f8575 100644
--- a/sys/geom/part/g_part.c
+++ b/sys/geom/part/g_part.c
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
#include <sys/mutex.h>
#include <sys/queue.h>
#include <sys/sbuf.h>
+#include <sys/sysctl.h>
#include <sys/systm.h>
#include <sys/uuid.h>
#include <geom/geom.h>
@@ -104,6 +105,13 @@ struct g_part_alias_list {
{ "netbsd-swap", G_PART_ALIAS_NETBSD_SWAP },
};
+SYSCTL_DECL(_kern_geom);
+SYSCTL_NODE(_kern_geom, OID_AUTO, part, CTLFLAG_RW, 0, "GEOM_PART stuff");
+static u_int check_integrity = 1;
+TUNABLE_INT("kern.geom.part.check_integrity", &check_integrity);
+SYSCTL_UINT(_kern_geom_part, OID_AUTO, check_integrity, CTLFLAG_RW,
+ &check_integrity, 1, "Enable integrity checking");
+
/*
* The GEOM partitioning class.
*/
@@ -231,47 +239,111 @@ g_part_geometry(struct g_part_table *table, struct g_consumer *cp,
}
}
+#define DPRINTF(...) if (bootverbose) { \
+ printf("GEOM_PART: " __VA_ARGS__); \
+}
+
static int
g_part_check_integrity(struct g_part_table *table, struct g_consumer *cp)
{
struct g_part_entry *e1, *e2;
struct g_provider *pp;
+ int failed;
+ failed = 0;
pp = cp->provider;
- if (table->gpt_first > table->gpt_last ||
- table->gpt_last > pp->mediasize / pp->sectorsize - 1)
- goto fail;
-
+ if (table->gpt_last < table->gpt_first) {
+ DPRINTF("last LBA is below first LBA: %jd < %jd\n",
+ (intmax_t)table->gpt_last, (intmax_t)table->gpt_first);
+ failed++;
+ }
+ if (table->gpt_last > pp->mediasize / pp->sectorsize - 1) {
+ DPRINTF("last LBA extends beyond mediasize: "
+ "%jd > %jd\n", (intmax_t)table->gpt_last,
+ (intmax_t)pp->mediasize / pp->sectorsize - 1);
+ failed++;
+ }
LIST_FOREACH(e1, &table->gpt_entry, gpe_entry) {
if (e1->gpe_deleted || e1->gpe_internal)
continue;
- if (e1->gpe_start < table->gpt_first ||
- e1->gpe_start > table->gpt_last ||
- e1->gpe_end < e1->gpe_start ||
- e1->gpe_end > table->gpt_last)
- goto fail;
+ if (e1->gpe_start < table->gpt_first) {
+ DPRINTF("partition %d has start offset below first "
+ "LBA: %jd < %jd\n", e1->gpe_index,
+ (intmax_t)e1->gpe_start,
+ (intmax_t)table->gpt_first);
+ failed++;
+ }
+ if (e1->gpe_start > table->gpt_last) {
+ DPRINTF("partition %d has start offset beyond last "
+ "LBA: %jd > %jd\n", e1->gpe_index,
+ (intmax_t)e1->gpe_start,
+ (intmax_t)table->gpt_last);
+ failed++;
+ }
+ if (e1->gpe_end < e1->gpe_start) {
+ DPRINTF("partition %d has end offset below start "
+ "offset: %jd < %jd\n", e1->gpe_index,
+ (intmax_t)e1->gpe_end,
+ (intmax_t)e1->gpe_start);
+ failed++;
+ }
+ if (e1->gpe_end > table->gpt_last) {
+ DPRINTF("partition %d has end offset beyond last "
+ "LBA: %jd > %jd\n", e1->gpe_index,
+ (intmax_t)e1->gpe_end,
+ (intmax_t)table->gpt_last);
+ failed++;
+ }
e2 = e1;
while ((e2 = LIST_NEXT(e2, gpe_entry)) != NULL) {
if (e2->gpe_deleted || e2->gpe_internal)
continue;
if (e1->gpe_start >= e2->gpe_start &&
- e1->gpe_start <= e2->gpe_end)
- goto fail;
+ e1->gpe_start <= e2->gpe_end) {
+ DPRINTF("partition %d has start offset inside "
+ "partition %d: start[%d] %jd >= start[%d] "
+ "%jd <= end[%d] %jd\n",
+ e1->gpe_index, e2->gpe_index,
+ e2->gpe_index, (intmax_t)e2->gpe_start,
+ e1->gpe_index, (intmax_t)e1->gpe_start,
+ e2->gpe_index, (intmax_t)e2->gpe_end);
+ failed++;
+ }
if (e1->gpe_end >= e2->gpe_start &&
- e1->gpe_end <= e2->gpe_end)
- goto fail;
+ e1->gpe_end <= e2->gpe_end) {
+ DPRINTF("partition %d has end offset inside "
+ "partition %d: start[%d] %jd >= end[%d] "
+ "%jd <= end[%d] %jd\n",
+ e1->gpe_index, e2->gpe_index,
+ e2->gpe_index, (intmax_t)e2->gpe_start,
+ e1->gpe_index, (intmax_t)e1->gpe_end,
+ e2->gpe_index, (intmax_t)e2->gpe_end);
+ failed++;
+ }
if (e1->gpe_start < e2->gpe_start &&
- e1->gpe_end > e2->gpe_end)
- goto fail;
+ e1->gpe_end > e2->gpe_end) {
+ DPRINTF("partition %d contains partition %d: "
+ "start[%d] %jd > start[%d] %jd, end[%d] "
+ "%jd < end[%d] %jd\n",
+ e1->gpe_index, e2->gpe_index,
+ e1->gpe_index, (intmax_t)e1->gpe_start,
+ e2->gpe_index, (intmax_t)e2->gpe_start,
+ e2->gpe_index, (intmax_t)e2->gpe_end,
+ e1->gpe_index, (intmax_t)e1->gpe_end);
+ failed++;
+ }
}
}
- return (0);
-fail:
- if (bootverbose)
+ if (failed != 0) {
printf("GEOM_PART: integrity check failed (%s, %s)\n",
pp->name, table->gpt_scheme->name);
- return (EINVAL);
+ if (check_integrity != 0)
+ return (EINVAL);
+ table->gpt_corrupt = 1;
+ }
+ return (0);
}
+#undef DPRINTF
struct g_part_entry *
g_part_new_entry(struct g_part_table *table, int index, quad_t start,
diff --git a/sys/geom/part/g_part_mbr.c b/sys/geom/part/g_part_mbr.c
index 4fa829a..63dcac4 100644
--- a/sys/geom/part/g_part_mbr.c
+++ b/sys/geom/part/g_part_mbr.c
@@ -251,14 +251,11 @@ g_part_mbr_bootcode(struct g_part_table *basetable, struct g_part_parms *gpp)
static int
g_part_mbr_create(struct g_part_table *basetable, struct g_part_parms *gpp)
{
- struct g_consumer *cp;
struct g_provider *pp;
struct g_part_mbr_table *table;
uint32_t msize;
pp = gpp->gpp_provider;
- cp = LIST_FIRST(&pp->consumers);
-
if (pp->sectorsize < MBRSIZE)
return (ENOSPC);
diff --git a/sys/geom/part/g_part_pc98.c b/sys/geom/part/g_part_pc98.c
index 693fad8..0bdc0a6 100644
--- a/sys/geom/part/g_part_pc98.c
+++ b/sys/geom/part/g_part_pc98.c
@@ -246,14 +246,11 @@ g_part_pc98_bootcode(struct g_part_table *basetable, struct g_part_parms *gpp)
static int
g_part_pc98_create(struct g_part_table *basetable, struct g_part_parms *gpp)
{
- struct g_consumer *cp;
struct g_provider *pp;
struct g_part_pc98_table *table;
uint32_t cyl, msize;
pp = gpp->gpp_provider;
- cp = LIST_FIRST(&pp->consumers);
-
if (pp->sectorsize < SECSIZE || pp->mediasize < BOOTSIZE)
return (ENOSPC);
if (pp->sectorsize > SECSIZE)
diff --git a/sys/gnu/fs/reiserfs/reiserfs_vfsops.c b/sys/gnu/fs/reiserfs/reiserfs_vfsops.c
index 1b5ce88..9b7ccd9 100644
--- a/sys/gnu/fs/reiserfs/reiserfs_vfsops.c
+++ b/sys/gnu/fs/reiserfs/reiserfs_vfsops.c
@@ -335,7 +335,8 @@ reiserfs_statfs(struct mount *mp, struct statfs *sbp)
* those rights via. exflagsp and credanonp
*/
static int
-reiserfs_fhtovp(struct mount *mp, struct fid *fhp, struct vnode **vpp)
+reiserfs_fhtovp(struct mount *mp, struct fid *fhp, int flags,
+ struct vnode **vpp)
{
int error;
struct rfid *rfhp;
diff --git a/sys/gnu/fs/xfs/FreeBSD/support/kdb.c b/sys/gnu/fs/xfs/FreeBSD/support/kdb.c
index 274f23d..b133dfe 100644
--- a/sys/gnu/fs/xfs/FreeBSD/support/kdb.c
+++ b/sys/gnu/fs/xfs/FreeBSD/support/kdb.c
@@ -56,7 +56,7 @@ kdb_getarea_size(void *res, unsigned long addr, size_t size)
}
int
-db_putarea_size(unsigned long addr, void *res, size_t size)
+kdb_putarea_size(unsigned long addr, void *res, size_t size)
{
return 0;
}
diff --git a/sys/gnu/fs/xfs/FreeBSD/xfs_mountops.c b/sys/gnu/fs/xfs/FreeBSD/xfs_mountops.c
index f89618e..e9ccfc9 100644
--- a/sys/gnu/fs/xfs/FreeBSD/xfs_mountops.c
+++ b/sys/gnu/fs/xfs/FreeBSD/xfs_mountops.c
@@ -370,9 +370,10 @@ _xfs_vget(mp, ino, flags, vpp)
}
static int
-_xfs_fhtovp(mp, fidp, vpp)
+_xfs_fhtovp(mp, fidp, flags, vpp)
struct mount *mp;
struct fid *fidp;
+ int flags;
struct vnode **vpp;
{
printf("xfs_fhtovp\n");
diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES
index a68037b..866e641 100644
--- a/sys/i386/conf/NOTES
+++ b/sys/i386/conf/NOTES
@@ -731,6 +731,12 @@ options SAFE_DEBUG # enable debugging support: hw.safe.debug
options SAFE_RNDTEST # enable rndtest support
#
+# glxiic is an I2C driver for the AMD Geode LX CS5536 System Management Bus
+# controller. Requires 'device iicbus'.
+#
+device glxiic # AMD Geode LX CS5536 System Management Bus
+
+#
# glxsb is a driver for the Security Block in AMD Geode LX processors.
# Requires 'device crypto'.
#
diff --git a/sys/i386/i386/identcpu.c b/sys/i386/i386/identcpu.c
index cd90d47..de0ee09 100644
--- a/sys/i386/i386/identcpu.c
+++ b/sys/i386/i386/identcpu.c
@@ -693,6 +693,13 @@ printcpuinfo(void)
printf(" Stepping = %u", cpu_id & CPUID_STEPPING);
if (cpu_vendor_id == CPU_VENDOR_CYRIX)
printf("\n DIR=0x%04x", cyrix_did);
+ /*
+ * AMD CPUID Specification
+ * http://support.amd.com/us/Embedded_TechDocs/25481.pdf
+ *
+ * Intel Processor Identification and CPUID Instruction
+ * http://www.intel.com/assets/pdf/appnote/241618.pdf
+ */
if (cpu_high > 0) {
/*
@@ -754,38 +761,29 @@ printcpuinfo(void)
"\012SSSE3" /* SSSE3 */
"\013CNXT-ID" /* L1 context ID available */
"\014<b11>"
- "\015<b12>"
+ "\015FMA" /* Fused Multiply Add */
"\016CX16" /* CMPXCHG16B Instruction */
"\017xTPR" /* Send Task Priority Messages*/
"\020PDCM" /* Perf/Debug Capability MSR */
"\021<b16>"
- "\022PCID" /* Process-context Identifiers */
+ "\022PCID" /* Process-context Identifiers*/
"\023DCA" /* Direct Cache Access */
- "\024SSE4.1"
- "\025SSE4.2"
+ "\024SSE4.1" /* SSE 4.1 */
+ "\025SSE4.2" /* SSE 4.2 */
"\026x2APIC" /* xAPIC Extensions */
- "\027MOVBE"
- "\030POPCNT"
- "\031<b24>"
- "\032AESNI" /* AES Crypto*/
- "\033XSAVE"
- "\034OSXSAVE"
- "\035<b28>"
- "\036<b29>"
+ "\027MOVBE" /* MOVBE Instruction */
+ "\030POPCNT" /* POPCNT Instruction */
+ "\031TSCDLT" /* TSC-Deadline Timer */
+ "\032AESNI" /* AES Crypto */
+ "\033XSAVE" /* XSAVE/XRSTOR States */
+ "\034OSXSAVE" /* OS-Enabled State Management*/
+ "\035AVX" /* Advanced Vector Extensions */
+ "\036F16C" /* Half-precision conversions */
"\037<b30>"
"\040HV" /* Hypervisor */
);
}
- /*
- * AMD64 Architecture Programmer's Manual Volume 3:
- * General-Purpose and System Instructions
- * http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/24594.pdf
- *
- * IA-32 Intel Architecture Software Developer's Manual,
- * Volume 2A: Instruction Set Reference, A-M
- * ftp://download.intel.com/design/Pentium4/manuals/25366617.pdf
- */
if (amd_feature != 0) {
printf("\n AMD Features=0x%b", amd_feature,
"\020" /* in hex */
@@ -838,18 +836,18 @@ printcpuinfo(void)
"\011Prefetch" /* 3DNow! Prefetch/PrefetchW */
"\012OSVW" /* OS visible workaround */
"\013IBS" /* Instruction based sampling */
- "\014SSE5" /* SSE5 */
+ "\014XOP" /* XOP extended instructions */
"\015SKINIT" /* SKINIT/STGI */
"\016WDT" /* Watchdog timer */
"\017<b14>"
- "\020<b15>"
- "\021<b16>"
+ "\020LWP" /* Lightweight Profiling */
+ "\021FMA4" /* 4-operand FMA instructions */
"\022<b17>"
"\023<b18>"
- "\024<b19>"
+ "\024NodeId" /* NodeId MSR support */
"\025<b20>"
- "\026<b21>"
- "\027<b22>"
+ "\026TBM" /* Trailing Bit Manipulation */
+ "\027Topology" /* Topology Extensions */
"\030<b23>"
"\031<b24>"
"\032<b25>"
diff --git a/sys/i386/include/specialreg.h b/sys/i386/include/specialreg.h
index adccaf4..e3199f7 100644
--- a/sys/i386/include/specialreg.h
+++ b/sys/i386/include/specialreg.h
@@ -120,6 +120,7 @@
#define CPUID2_TM2 0x00000100
#define CPUID2_SSSE3 0x00000200
#define CPUID2_CNXTID 0x00000400
+#define CPUID2_FMA 0x00001000
#define CPUID2_CX16 0x00002000
#define CPUID2_XTPR 0x00004000
#define CPUID2_PDCM 0x00008000
@@ -130,7 +131,12 @@
#define CPUID2_X2APIC 0x00200000
#define CPUID2_MOVBE 0x00400000
#define CPUID2_POPCNT 0x00800000
+#define CPUID2_TSCDLT 0x01000000
#define CPUID2_AESNI 0x02000000
+#define CPUID2_XSAVE 0x04000000
+#define CPUID2_OSXSAVE 0x08000000
+#define CPUID2_AVX 0x10000000
+#define CPUID2_F16C 0x20000000
#define CPUID2_HV 0x80000000
/*
@@ -167,9 +173,14 @@
#define AMDID2_PREFETCH 0x00000100
#define AMDID2_OSVW 0x00000200
#define AMDID2_IBS 0x00000400
-#define AMDID2_SSE5 0x00000800
+#define AMDID2_XOP 0x00000800
#define AMDID2_SKINIT 0x00001000
#define AMDID2_WDT 0x00002000
+#define AMDID2_LWP 0x00008000
+#define AMDID2_FMA4 0x00010000
+#define AMDID2_NODE_ID 0x00080000
+#define AMDID2_TBM 0x00200000
+#define AMDID2_TOPOLOGY 0x00400000
/*
* CPUID instruction 1 eax info
diff --git a/sys/i386/include/xen/xenvar.h b/sys/i386/include/xen/xenvar.h
index 4f8c857..365930a 100644
--- a/sys/i386/include/xen/xenvar.h
+++ b/sys/i386/include/xen/xenvar.h
@@ -99,7 +99,6 @@ void xpq_init(void);
(((bits)+BITS_PER_LONG-1)/BITS_PER_LONG)
#define DECLARE_BITMAP(name,bits) \
unsigned long name[BITS_TO_LONGS(bits)]
-typedef struct { DECLARE_BITMAP(bits, NR_CPUS); } xen_cpumask_t;
int xen_create_contiguous_region(vm_page_t pages, int npages);
diff --git a/sys/i386/xen/mp_machdep.c b/sys/i386/xen/mp_machdep.c
index 1bfc0e9..2919570 100644
--- a/sys/i386/xen/mp_machdep.c
+++ b/sys/i386/xen/mp_machdep.c
@@ -960,6 +960,30 @@ start_ap(int apic_id)
}
/*
+ * send an IPI to a specific CPU.
+ */
+static void
+ipi_send_cpu(int cpu, u_int ipi)
+{
+ u_int bitmap, old_pending, new_pending;
+
+ if (IPI_IS_BITMAPED(ipi)) {
+ bitmap = 1 << ipi;
+ ipi = IPI_BITMAP_VECTOR;
+ do {
+ old_pending = cpu_ipi_pending[cpu];
+ new_pending = old_pending | bitmap;
+ } while (!atomic_cmpset_int(&cpu_ipi_pending[cpu],
+ old_pending, new_pending));
+ if (!old_pending)
+ ipi_pcpu(cpu, RESCHEDULE_VECTOR);
+ } else {
+ KASSERT(call_data != NULL, ("call_data not set"));
+ ipi_pcpu(cpu, CALL_FUNCTION_VECTOR);
+ }
+}
+
+/*
* Flush the TLB on all other CPU's
*/
static void
@@ -1101,14 +1125,6 @@ void
ipi_selected(cpumask_t cpus, u_int ipi)
{
int cpu;
- u_int bitmap = 0;
- u_int old_pending;
- u_int new_pending;
-
- if (IPI_IS_BITMAPED(ipi)) {
- bitmap = 1 << ipi;
- ipi = IPI_BITMAP_VECTOR;
- }
/*
* IPI_STOP_HARD maps to a NMI and the trap handler needs a bit
@@ -1118,23 +1134,11 @@ ipi_selected(cpumask_t cpus, u_int ipi)
if (ipi == IPI_STOP_HARD)
atomic_set_int(&ipi_nmi_pending, cpus);
- CTR3(KTR_SMP, "%s: cpus: %x ipi: %x", __func__, cpus, ipi);
while ((cpu = ffs(cpus)) != 0) {
cpu--;
cpus &= ~(1 << cpu);
-
- if (bitmap) {
- do {
- old_pending = cpu_ipi_pending[cpu];
- new_pending = old_pending | bitmap;
- } while (!atomic_cmpset_int(&cpu_ipi_pending[cpu],
- old_pending, new_pending));
- if (!old_pending)
- ipi_pcpu(cpu, RESCHEDULE_VECTOR);
- } else {
- KASSERT(call_data != NULL, ("call_data not set"));
- ipi_pcpu(cpu, CALL_FUNCTION_VECTOR);
- }
+ CTR3(KTR_SMP, "%s: cpu: %d ipi: %x", __func__, cpu, ipi);
+ ipi_send_cpu(cpu, ipi);
}
}
@@ -1144,14 +1148,6 @@ ipi_selected(cpumask_t cpus, u_int ipi)
void
ipi_cpu(int cpu, u_int ipi)
{
- u_int bitmap = 0;
- u_int old_pending;
- u_int new_pending;
-
- if (IPI_IS_BITMAPED(ipi)) {
- bitmap = 1 << ipi;
- ipi = IPI_BITMAP_VECTOR;
- }
/*
* IPI_STOP_HARD maps to a NMI and the trap handler needs a bit
@@ -1162,19 +1158,7 @@ ipi_cpu(int cpu, u_int ipi)
atomic_set_int(&ipi_nmi_pending, 1 << cpu);
CTR3(KTR_SMP, "%s: cpu: %d ipi: %x", __func__, cpu, ipi);
-
- if (bitmap) {
- do {
- old_pending = cpu_ipi_pending[cpu];
- new_pending = old_pending | bitmap;
- } while (!atomic_cmpset_int(&cpu_ipi_pending[cpu],
- old_pending, new_pending));
- if (!old_pending)
- ipi_pcpu(cpu, RESCHEDULE_VECTOR);
- } else {
- KASSERT(call_data != NULL, ("call_data not set"));
- ipi_pcpu(cpu, CALL_FUNCTION_VECTOR);
- }
+ ipi_send_cpu(cpu, ipi);
}
/*
diff --git a/sys/kern/device_if.m b/sys/kern/device_if.m
index 2931c0a..eb720eb 100644
--- a/sys/kern/device_if.m
+++ b/sys/kern/device_if.m
@@ -89,28 +89,29 @@ CODE {
* the probe before returning. The return value of DEVICE_PROBE()
* is used to elect which driver is used - the driver which returns
* the largest non-error value wins the election and attaches to
- * the device.
+ * the device. Common non-error values are described in the
+ * DEVICE_PROBE(9) manual page.
*
* If a driver matches the hardware, it should set the device
* description string using device_set_desc() or
- * device_set_desc_copy(). This string is
- * used to generate an informative message when DEVICE_ATTACH()
- * is called.
+ * device_set_desc_copy(). This string is used to generate an
+ * informative message when DEVICE_ATTACH() is called.
*
* As a special case, if a driver returns zero, the driver election
* is cut short and that driver will attach to the device
- * immediately.
+ * immediately. This should rarely be used.
*
- * For example, a probe method for a pci device driver might look
+ * For example, a probe method for a PCI device driver might look
* like this:
*
* @code
- * int foo_probe(device_t dev)
+ * int
+ * foo_probe(device_t dev)
* {
* if (pci_get_vendor(dev) == FOOVENDOR &&
* pci_get_device(dev) == FOODEVICE) {
* device_set_desc(dev, "Foo device");
- * return (0);
+ * return (BUS_PROBE_DEFAULT);
* }
* return (ENXIO);
* }
@@ -125,7 +126,8 @@ CODE {
*
* @param dev the device to probe
*
- * @retval 0 if the driver strongly matches this device
+ * @retval 0 if this is the only possible driver for this
+ * device
* @retval negative if the driver can match this device - the
* least negative value is used to select the
* driver
diff --git a/sys/kern/kern_clocksource.c b/sys/kern/kern_clocksource.c
index 604bd2d..dd8bab5 100644
--- a/sys/kern/kern_clocksource.c
+++ b/sys/kern/kern_clocksource.c
@@ -56,7 +56,7 @@ __FBSDID("$FreeBSD$");
#ifdef KDTRACE_HOOKS
#include <sys/dtrace_bsd.h>
-cyclic_clock_func_t cyclic_clock_func[MAXCPU];
+cyclic_clock_func_t cyclic_clock_func = NULL;
#endif
int cpu_disable_deep_sleep = 0; /* Timer dies in C3. */
@@ -128,6 +128,9 @@ struct pcpu_state {
struct bintime nexthard; /* Next hardlock() event. */
struct bintime nextstat; /* Next statclock() event. */
struct bintime nextprof; /* Next profclock() event. */
+#ifdef KDTRACE_HOOKS
+ struct bintime nextcyc; /* Next OpenSolaris cyclics event. */
+#endif
int ipi; /* This CPU needs IPI. */
int idle; /* This CPU is in idle mode. */
};
@@ -190,17 +193,10 @@ handleevents(struct bintime *now, int fake)
usermode = TRAPF_USERMODE(frame);
pc = TRAPF_PC(frame);
}
-#ifdef KDTRACE_HOOKS
- /*
- * If the DTrace hooks are configured and a callback function
- * has been registered, then call it to process the high speed
- * timers.
- */
- if (!fake && cyclic_clock_func[curcpu] != NULL)
- (*cyclic_clock_func[curcpu])(frame);
-#endif
+
runs = 0;
state = DPCPU_PTR(timerstate);
+
while (bintime_cmp(now, &state->nexthard, >=)) {
bintime_add(&state->nexthard, &hardperiod);
runs++;
@@ -224,6 +220,16 @@ handleevents(struct bintime *now, int fake)
}
} else
state->nextprof = state->nextstat;
+
+#ifdef KDTRACE_HOOKS
+ if (fake == 0 && cyclic_clock_func != NULL &&
+ state->nextcyc.sec != -1 &&
+ bintime_cmp(now, &state->nextcyc, >=)) {
+ state->nextcyc.sec = -1;
+ (*cyclic_clock_func)(frame);
+ }
+#endif
+
getnextcpuevent(&t, 0);
if (fake == 2) {
state->nextevent = t;
@@ -263,10 +269,13 @@ getnextcpuevent(struct bintime *event, int idle)
} else { /* If CPU is active - handle all types of events. */
if (bintime_cmp(event, &state->nextstat, >))
*event = state->nextstat;
- if (profiling &&
- bintime_cmp(event, &state->nextprof, >))
+ if (profiling && bintime_cmp(event, &state->nextprof, >))
*event = state->nextprof;
}
+#ifdef KDTRACE_HOOKS
+ if (state->nextcyc.sec != -1 && bintime_cmp(event, &state->nextcyc, >))
+ *event = state->nextcyc;
+#endif
}
/*
@@ -590,6 +599,9 @@ cpu_initclocks_bsp(void)
CPU_FOREACH(cpu) {
state = DPCPU_ID_PTR(cpu, timerstate);
mtx_init(&state->et_hw_mtx, "et_hw_mtx", NULL, MTX_SPIN);
+#ifdef KDTRACE_HOOKS
+ state->nextcyc.sec = -1;
+#endif
}
#ifdef SMP
callout_new_inserted = cpu_new_callout;
@@ -784,6 +796,43 @@ cpu_activeclock(void)
spinlock_exit();
}
+#ifdef KDTRACE_HOOKS
+void
+clocksource_cyc_set(const struct bintime *t)
+{
+ struct bintime now;
+ struct pcpu_state *state;
+
+ state = DPCPU_PTR(timerstate);
+ if (periodic)
+ now = state->now;
+ else
+ binuptime(&now);
+
+ CTR4(KTR_SPARE2, "set_cyc at %d: now %d.%08x%08x",
+ curcpu, now.sec, (unsigned int)(now.frac >> 32),
+ (unsigned int)(now.frac & 0xffffffff));
+ CTR4(KTR_SPARE2, "set_cyc at %d: t %d.%08x%08x",
+ curcpu, t->sec, (unsigned int)(t->frac >> 32),
+ (unsigned int)(t->frac & 0xffffffff));
+
+ ET_HW_LOCK(state);
+ if (bintime_cmp(t, &state->nextcyc, ==)) {
+ ET_HW_UNLOCK(state);
+ return;
+ }
+ state->nextcyc = *t;
+ if (bintime_cmp(&state->nextcyc, &state->nextevent, >=)) {
+ ET_HW_UNLOCK(state);
+ return;
+ }
+ state->nextevent = state->nextcyc;
+ if (!periodic)
+ loadtimer(&now, 0);
+ ET_HW_UNLOCK(state);
+}
+#endif
+
#ifdef SMP
static void
cpu_new_callout(int cpu, int ticks)
diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c
index b2be5cc..59b876c 100644
--- a/sys/kern/kern_conf.c
+++ b/sys/kern/kern_conf.c
@@ -981,6 +981,8 @@ destroy_devl(struct cdev *dev)
/* Remove name marking */
dev->si_flags &= ~SI_NAMED;
+ dev->si_refcount++; /* Avoid race with dev_rel() */
+
/* If we are a child, remove us from the parents list */
if (dev->si_flags & SI_CHILD) {
LIST_REMOVE(dev, si_siblings);
@@ -997,7 +999,6 @@ destroy_devl(struct cdev *dev)
dev->si_flags &= ~SI_CLONELIST;
}
- dev->si_refcount++; /* Avoid race with dev_rel() */
csw = dev->si_devsw;
dev->si_devsw = NULL; /* already NULL for SI_ALIAS */
while (csw != NULL && csw->d_purge != NULL && dev->si_threadcount) {
diff --git a/sys/kern/kern_cpuset.c b/sys/kern/kern_cpuset.c
index bf9eac7..6489ffb 100644
--- a/sys/kern/kern_cpuset.c
+++ b/sys/kern/kern_cpuset.c
@@ -676,7 +676,7 @@ cpuset_thread0(void)
* cpuset_create() due to NULL parent.
*/
set = uma_zalloc(cpuset_zone, M_WAITOK | M_ZERO);
- set->cs_mask.__bits[0] = -1;
+ CPU_FILL(&set->cs_mask);
LIST_INIT(&set->cs_children);
LIST_INSERT_HEAD(&cpuset_ids, set, cs_link);
set->cs_ref = 1;
diff --git a/sys/kern/kern_environment.c b/sys/kern/kern_environment.c
index 41a9fa8..16760ce 100644
--- a/sys/kern/kern_environment.c
+++ b/sys/kern/kern_environment.c
@@ -225,13 +225,19 @@ static void
init_dynamic_kenv(void *data __unused)
{
char *cp;
- int len, i;
+ size_t len;
+ int i;
kenvp = malloc((KENV_SIZE + 1) * sizeof(char *), M_KENV,
M_WAITOK | M_ZERO);
i = 0;
for (cp = kern_envp; cp != NULL; cp = kernenv_next(cp)) {
len = strlen(cp) + 1;
+ if (len > KENV_MNAMELEN + 1 + KENV_MVALLEN + 1) {
+ printf("WARNING: too long kenv string, ignoring %s\n",
+ cp);
+ continue;
+ }
if (i < KENV_SIZE) {
kenvp[i] = malloc(len, M_KENV, M_WAITOK);
strcpy(kenvp[i++], cp);
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index d3aef76..05fb4a1 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -400,9 +400,7 @@ mi_switch(int flags, struct thread *newtd)
if (!TD_ON_LOCK(td) && !TD_IS_RUNNING(td))
mtx_assert(&Giant, MA_NOTOWNED);
#endif
- KASSERT(td->td_critnest == 1 || (td->td_critnest == 2 &&
- (td->td_owepreempt) && (flags & SW_INVOL) != 0 &&
- newtd == NULL) || panicstr,
+ KASSERT(td->td_critnest == 1 || panicstr,
("mi_switch: switch in a critical section"));
KASSERT((flags & (SW_INVOL | SW_VOL)) != 0,
("mi_switch: switch must be voluntary or involuntary"));
diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c
index 9424f73..fef9e25 100644
--- a/sys/kern/sched_4bsd.c
+++ b/sys/kern/sched_4bsd.c
@@ -155,6 +155,8 @@ static struct runq runq;
*/
static struct runq runq_pcpu[MAXCPU];
long runq_length[MAXCPU];
+
+static cpumask_t idle_cpus_mask;
#endif
struct pcpuidlestat {
@@ -233,16 +235,6 @@ SYSCTL_INT(_kern_sched_ipiwakeup, OID_AUTO, useloop, CTLFLAG_RW,
&forward_wakeup_use_loop, 0,
"Use a loop to find idle cpus");
-static int forward_wakeup_use_single = 0;
-SYSCTL_INT(_kern_sched_ipiwakeup, OID_AUTO, onecpu, CTLFLAG_RW,
- &forward_wakeup_use_single, 0,
- "Only signal one idle cpu");
-
-static int forward_wakeup_use_htt = 0;
-SYSCTL_INT(_kern_sched_ipiwakeup, OID_AUTO, htt2, CTLFLAG_RW,
- &forward_wakeup_use_htt, 0,
- "account for htt");
-
#endif
#if 0
static int sched_followon = 0;
@@ -1062,7 +1054,7 @@ static int
forward_wakeup(int cpunum)
{
struct pcpu *pc;
- cpumask_t dontuse, id, map, map2, map3, me;
+ cpumask_t dontuse, id, map, map2, me;
mtx_assert(&sched_lock, MA_OWNED);
@@ -1087,13 +1079,13 @@ forward_wakeup(int cpunum)
return (0);
dontuse = me | stopped_cpus | hlt_cpus_mask;
- map3 = 0;
+ map2 = 0;
if (forward_wakeup_use_loop) {
SLIST_FOREACH(pc, &cpuhead, pc_allcpu) {
id = pc->pc_cpumask;
if ((id & dontuse) == 0 &&
pc->pc_curthread == pc->pc_idlethread) {
- map3 |= id;
+ map2 |= id;
}
}
}
@@ -1104,33 +1096,19 @@ forward_wakeup(int cpunum)
/* If they are both on, compare and use loop if different. */
if (forward_wakeup_use_loop) {
- if (map != map3) {
- printf("map (%02X) != map3 (%02X)\n", map,
- map3);
- map = map3;
+ if (map != map2) {
+ printf("map != map2, loop method preferred\n");
+ map = map2;
}
}
} else {
- map = map3;
+ map = map2;
}
/* If we only allow a specific CPU, then mask off all the others. */
if (cpunum != NOCPU) {
KASSERT((cpunum <= mp_maxcpus),("forward_wakeup: bad cpunum."));
map &= (1 << cpunum);
- } else {
- /* Try choose an idle die. */
- if (forward_wakeup_use_htt) {
- map2 = (map & (map >> 1)) & 0x5555;
- if (map2) {
- map = map2;
- }
- }
-
- /* Set only one bit. */
- if (forward_wakeup_use_single) {
- map = map & ((~map) + 1);
- }
}
if (map) {
forward_wakeups_delivered++;
diff --git a/sys/kern/subr_sbuf.c b/sys/kern/subr_sbuf.c
index 0d083b4..e931e65 100644
--- a/sys/kern/subr_sbuf.c
+++ b/sys/kern/subr_sbuf.c
@@ -67,7 +67,7 @@ static MALLOC_DEFINE(M_SBUF, "sbuf", "string buffers");
#define SBUF_ISDYNSTRUCT(s) ((s)->s_flags & SBUF_DYNSTRUCT)
#define SBUF_ISFINISHED(s) ((s)->s_flags & SBUF_FINISHED)
#define SBUF_HASROOM(s) ((s)->s_len < (s)->s_size - 1)
-#define SBUF_FREESPACE(s) ((s)->s_size - (s)->s_len - 1)
+#define SBUF_FREESPACE(s) ((s)->s_size - ((s)->s_len + 1))
#define SBUF_CANEXTEND(s) ((s)->s_flags & SBUF_AUTOEXTEND)
/*
@@ -77,8 +77,14 @@ static MALLOC_DEFINE(M_SBUF, "sbuf", "string buffers");
#define SBUF_CLEARFLAG(s, f) do { (s)->s_flags &= ~(f); } while (0)
#define SBUF_MINEXTENDSIZE 16 /* Should be power of 2. */
+
+#ifdef PAGE_SIZE
#define SBUF_MAXEXTENDSIZE PAGE_SIZE
#define SBUF_MAXEXTENDINCR PAGE_SIZE
+#else
+#define SBUF_MAXEXTENDSIZE 4096
+#define SBUF_MAXEXTENDINCR 4096
+#endif
/*
* Debugging support
@@ -94,7 +100,8 @@ _assert_sbuf_integrity(const char *fun, struct sbuf *s)
KASSERT(s->s_buf != NULL,
("%s called with uninitialized or corrupt sbuf", fun));
KASSERT(s->s_len < s->s_size,
- ("wrote past end of sbuf (%d >= %d)", s->s_len, s->s_size));
+ ("wrote past end of sbuf (%jd >= %jd)",
+ (intmax_t)s->s_len, (intmax_t)s->s_size));
}
static void
@@ -137,7 +144,6 @@ sbuf_extendsize(int size)
return (newsize);
}
-
/*
* Extend an sbuf.
*/
@@ -153,7 +159,7 @@ sbuf_extend(struct sbuf *s, int addlen)
newbuf = SBMALLOC(newsize);
if (newbuf == NULL)
return (-1);
- bcopy(s->s_buf, newbuf, s->s_size);
+ memcpy(newbuf, s->s_buf, s->s_size);
if (SBUF_ISDYNAMIC(s))
SBFREE(s->s_buf);
else
@@ -164,6 +170,38 @@ sbuf_extend(struct sbuf *s, int addlen)
}
/*
+ * Initialize the internals of an sbuf.
+ * If buf is non-NULL, it points to a static or already-allocated string
+ * big enough to hold at least length characters.
+ */
+static struct sbuf *
+sbuf_newbuf(struct sbuf *s, char *buf, int length, int flags)
+{
+
+ memset(s, 0, sizeof(*s));
+ s->s_flags = flags;
+ s->s_size = length;
+ s->s_buf = buf;
+
+ if ((s->s_flags & SBUF_AUTOEXTEND) == 0) {
+ KASSERT(s->s_size > 1,
+ ("attempt to create a too small sbuf"));
+ }
+
+ if (s->s_buf != NULL)
+ return (s);
+
+ if ((flags & SBUF_AUTOEXTEND) != 0)
+ s->s_size = sbuf_extendsize(s->s_size);
+
+ s->s_buf = SBMALLOC(s->s_size);
+ if (s->s_buf == NULL)
+ return (NULL);
+ SBUF_SETFLAG(s, SBUF_DYNAMIC);
+ return (s);
+}
+
+/*
* Initialize an sbuf.
* If buf is non-NULL, it points to a static or already-allocated string
* big enough to hold at least length characters.
@@ -178,31 +216,17 @@ sbuf_new(struct sbuf *s, char *buf, int length, int flags)
("%s called with invalid flags", __func__));
flags &= SBUF_USRFLAGMSK;
- if (s == NULL) {
- s = SBMALLOC(sizeof(*s));
- if (s == NULL)
- return (NULL);
- bzero(s, sizeof(*s));
- s->s_flags = flags;
- SBUF_SETFLAG(s, SBUF_DYNSTRUCT);
- } else {
- bzero(s, sizeof(*s));
- s->s_flags = flags;
- }
- s->s_size = length;
- if (buf != NULL) {
- s->s_buf = buf;
- return (s);
- }
- if ((flags & SBUF_AUTOEXTEND) != 0)
- s->s_size = sbuf_extendsize(s->s_size);
- s->s_buf = SBMALLOC(s->s_size);
- if (s->s_buf == NULL) {
- if (SBUF_ISDYNSTRUCT(s))
- SBFREE(s);
+ if (s != NULL)
+ return (sbuf_newbuf(s, buf, length, flags));
+
+ s = SBMALLOC(sizeof(*s));
+ if (s == NULL)
+ return (NULL);
+ if (sbuf_newbuf(s, buf, length, flags) == NULL) {
+ SBFREE(s);
return (NULL);
}
- SBUF_SETFLAG(s, SBUF_DYNAMIC);
+ SBUF_SETFLAG(s, SBUF_DYNSTRUCT);
return (s);
}
@@ -255,16 +279,17 @@ sbuf_clear(struct sbuf *s)
* Effectively truncates the sbuf at the new position.
*/
int
-sbuf_setpos(struct sbuf *s, int pos)
+sbuf_setpos(struct sbuf *s, ssize_t pos)
{
assert_sbuf_integrity(s);
assert_sbuf_state(s, 0);
KASSERT(pos >= 0,
- ("attempt to seek to a negative position (%d)", pos));
+ ("attempt to seek to a negative position (%jd)", (intmax_t)pos));
KASSERT(pos < s->s_size,
- ("attempt to seek past end of sbuf (%d >= %d)", pos, s->s_size));
+ ("attempt to seek past end of sbuf (%jd >= %jd)",
+ (intmax_t)pos, (intmax_t)s->s_size));
if (pos < 0 || pos > s->s_len)
return (-1);
@@ -326,7 +351,7 @@ sbuf_drain(struct sbuf *s)
* buffer and marking overflow.
*/
static void
-sbuf_put_byte(int c, struct sbuf *s)
+sbuf_put_byte(struct sbuf *s, int c)
{
assert_sbuf_integrity(s);
@@ -335,7 +360,7 @@ sbuf_put_byte(int c, struct sbuf *s)
if (s->s_error != 0)
return;
if (SBUF_FREESPACE(s) <= 0) {
- /*
+ /*
* If there is a drain, use it, otherwise extend the
* buffer.
*/
@@ -350,18 +375,6 @@ sbuf_put_byte(int c, struct sbuf *s)
}
/*
- * Append a non-NUL character to an sbuf. This prototype signature is
- * suitable for use with kvprintf(9).
- */
-static void
-sbuf_putc_func(int c, void *arg)
-{
-
- if (c != '\0')
- sbuf_put_byte(c, arg);
-}
-
-/*
* Append a byte string to an sbuf.
*/
int
@@ -376,10 +389,10 @@ sbuf_bcat(struct sbuf *s, const void *buf, size_t len)
if (s->s_error != 0)
return (-1);
for (; str < end; str++) {
- sbuf_put_byte(*str, s);
+ sbuf_put_byte(s, *str);
if (s->s_error != 0)
return (-1);
- }
+ }
return (0);
}
@@ -441,7 +454,7 @@ sbuf_cat(struct sbuf *s, const char *str)
return (-1);
while (*str != '\0') {
- sbuf_put_byte(*str++, s);
+ sbuf_put_byte(s, *str++);
if (s->s_error != 0)
return (-1);
}
@@ -505,6 +518,19 @@ sbuf_cpy(struct sbuf *s, const char *str)
* Format the given argument list and append the resulting string to an sbuf.
*/
#ifdef _KERNEL
+
+/*
+ * Append a non-NUL character to an sbuf. This prototype signature is
+ * suitable for use with kvprintf(9).
+ */
+static void
+sbuf_putc_func(int c, void *arg)
+{
+
+ if (c != '\0')
+ sbuf_put_byte(arg, c);
+}
+
int
sbuf_vprintf(struct sbuf *s, const char *fmt, va_list ap)
{
@@ -609,7 +635,7 @@ int
sbuf_putc(struct sbuf *s, int c)
{
- sbuf_putc_func(c, s);
+ sbuf_put_byte(s, c);
if (s->s_error != 0)
return (-1);
return (0);
@@ -640,7 +666,7 @@ sbuf_trim(struct sbuf *s)
* Check if an sbuf has an error.
*/
int
-sbuf_error(struct sbuf *s)
+sbuf_error(const struct sbuf *s)
{
return (s->s_error);
@@ -652,24 +678,23 @@ sbuf_error(struct sbuf *s)
int
sbuf_finish(struct sbuf *s)
{
- int error;
assert_sbuf_integrity(s);
assert_sbuf_state(s, 0);
- error = s->s_error;
if (s->s_drain_func != NULL) {
- while (s->s_len > 0 && error == 0)
- error = sbuf_drain(s);
+ while (s->s_len > 0 && s->s_error == 0)
+ s->s_error = sbuf_drain(s);
}
s->s_buf[s->s_len] = '\0';
- s->s_error = 0;
SBUF_SETFLAG(s, SBUF_FINISHED);
#ifdef _KERNEL
- return (error);
+ return (s->s_error);
#else
- errno = error;
- return (-1);
+ errno = s->s_error;
+ if (s->s_error)
+ return (-1);
+ return (0);
#endif
}
@@ -691,7 +716,7 @@ sbuf_data(struct sbuf *s)
/*
* Return the length of the sbuf data.
*/
-int
+ssize_t
sbuf_len(struct sbuf *s)
{
@@ -719,7 +744,7 @@ sbuf_delete(struct sbuf *s)
if (SBUF_ISDYNAMIC(s))
SBFREE(s->s_buf);
isdyn = SBUF_ISDYNSTRUCT(s);
- bzero(s, sizeof(*s));
+ memset(s, 0, sizeof(*s));
if (isdyn)
SBFREE(s);
}
@@ -728,7 +753,7 @@ sbuf_delete(struct sbuf *s)
* Check if an sbuf has been finished.
*/
int
-sbuf_done(struct sbuf *s)
+sbuf_done(const struct sbuf *s)
{
return (SBUF_ISFINISHED(s));
diff --git a/sys/kern/subr_smp.c b/sys/kern/subr_smp.c
index 9ae6381..67774d8 100644
--- a/sys/kern/subr_smp.c
+++ b/sys/kern/subr_smp.c
@@ -55,7 +55,6 @@ __FBSDID("$FreeBSD$");
#ifdef SMP
volatile cpumask_t stopped_cpus;
volatile cpumask_t started_cpus;
-cpumask_t idle_cpus_mask;
cpumask_t hlt_cpus_mask;
cpumask_t logical_cpus_mask;
@@ -111,6 +110,7 @@ static void (*volatile smp_rv_action_func)(void *arg);
static void (*volatile smp_rv_teardown_func)(void *arg);
static void *volatile smp_rv_func_arg;
static volatile int smp_rv_waiters[3];
+static volatile int smp_rv_generation;
/*
* Shared mutex to restrict busywaits between smp_rendezvous() and
@@ -311,41 +311,101 @@ restart_cpus(cpumask_t map)
void
smp_rendezvous_action(void)
{
- void* local_func_arg = smp_rv_func_arg;
- void (*local_setup_func)(void*) = smp_rv_setup_func;
- void (*local_action_func)(void*) = smp_rv_action_func;
- void (*local_teardown_func)(void*) = smp_rv_teardown_func;
+ struct thread *td;
+ void *local_func_arg;
+ void (*local_setup_func)(void*);
+ void (*local_action_func)(void*);
+ void (*local_teardown_func)(void*);
+ int generation;
+#ifdef INVARIANTS
+ int owepreempt;
+#endif
/* Ensure we have up-to-date values. */
atomic_add_acq_int(&smp_rv_waiters[0], 1);
while (smp_rv_waiters[0] < smp_rv_ncpus)
cpu_spinwait();
- /* setup function */
+ /* Fetch rendezvous parameters after acquire barrier. */
+ local_func_arg = smp_rv_func_arg;
+ local_setup_func = smp_rv_setup_func;
+ local_action_func = smp_rv_action_func;
+ local_teardown_func = smp_rv_teardown_func;
+ generation = smp_rv_generation;
+
+ /*
+ * Use a nested critical section to prevent any preemptions
+ * from occurring during a rendezvous action routine.
+ * Specifically, if a rendezvous handler is invoked via an IPI
+ * and the interrupted thread was in the critical_exit()
+ * function after setting td_critnest to 0 but before
+ * performing a deferred preemption, this routine can be
+ * invoked with td_critnest set to 0 and td_owepreempt true.
+ * In that case, a critical_exit() during the rendezvous
+ * action would trigger a preemption which is not permitted in
+ * a rendezvous action. To fix this, wrap all of the
+ * rendezvous action handlers in a critical section. We
+ * cannot use a regular critical section however as having
+ * critical_exit() preempt from this routine would also be
+ * problematic (the preemption must not occur before the IPI
+ * has been acknowleged via an EOI). Instead, we
+ * intentionally ignore td_owepreempt when leaving the
+ * critical setion. This should be harmless because we do not
+ * permit rendezvous action routines to schedule threads, and
+ * thus td_owepreempt should never transition from 0 to 1
+ * during this routine.
+ */
+ td = curthread;
+ td->td_critnest++;
+#ifdef INVARIANTS
+ owepreempt = td->td_owepreempt;
+#endif
+
+ /*
+ * If requested, run a setup function before the main action
+ * function. Ensure all CPUs have completed the setup
+ * function before moving on to the action function.
+ */
if (local_setup_func != smp_no_rendevous_barrier) {
if (smp_rv_setup_func != NULL)
smp_rv_setup_func(smp_rv_func_arg);
-
- /* spin on entry rendezvous */
atomic_add_int(&smp_rv_waiters[1], 1);
while (smp_rv_waiters[1] < smp_rv_ncpus)
cpu_spinwait();
}
- /* action function */
if (local_action_func != NULL)
local_action_func(local_func_arg);
- /* spin on exit rendezvous */
+ /*
+ * Signal that the main action has been completed. If a
+ * full exit rendezvous is requested, then all CPUs will
+ * wait here until all CPUs have finished the main action.
+ *
+ * Note that the write by the last CPU to finish the action
+ * may become visible to different CPUs at different times.
+ * As a result, the CPU that initiated the rendezvous may
+ * exit the rendezvous and drop the lock allowing another
+ * rendezvous to be initiated on the same CPU or a different
+ * CPU. In that case the exit sentinel may be cleared before
+ * all CPUs have noticed causing those CPUs to hang forever.
+ * Workaround this by using a generation count to notice when
+ * this race occurs and to exit the rendezvous in that case.
+ */
+ MPASS(generation == smp_rv_generation);
atomic_add_int(&smp_rv_waiters[2], 1);
- if (local_teardown_func == smp_no_rendevous_barrier)
- return;
- while (smp_rv_waiters[2] < smp_rv_ncpus)
- cpu_spinwait();
+ if (local_teardown_func != smp_no_rendevous_barrier) {
+ while (smp_rv_waiters[2] < smp_rv_ncpus &&
+ generation == smp_rv_generation)
+ cpu_spinwait();
+
+ if (local_teardown_func != NULL)
+ local_teardown_func(local_func_arg);
+ }
- /* teardown function */
- if (local_teardown_func != NULL)
- local_teardown_func(local_func_arg);
+ td->td_critnest--;
+ KASSERT(owepreempt == td->td_owepreempt,
+ ("rendezvous action changed td_owepreempt"));
}
void
@@ -374,10 +434,11 @@ smp_rendezvous_cpus(cpumask_t map,
if (ncpus == 0)
panic("ncpus is 0 with map=0x%x", map);
- /* obtain rendezvous lock */
mtx_lock_spin(&smp_ipi_mtx);
- /* set static function pointers */
+ atomic_add_acq_int(&smp_rv_generation, 1);
+
+ /* Pass rendezvous parameters via global variables. */
smp_rv_ncpus = ncpus;
smp_rv_setup_func = setup_func;
smp_rv_action_func = action_func;
@@ -387,18 +448,25 @@ smp_rendezvous_cpus(cpumask_t map,
smp_rv_waiters[2] = 0;
atomic_store_rel_int(&smp_rv_waiters[0], 0);
- /* signal other processors, which will enter the IPI with interrupts off */
+ /*
+ * Signal other processors, which will enter the IPI with
+ * interrupts off.
+ */
ipi_selected(map & ~(1 << curcpu), IPI_RENDEZVOUS);
/* Check if the current CPU is in the map */
if ((map & (1 << curcpu)) != 0)
smp_rendezvous_action();
+ /*
+ * If the caller did not request an exit barrier to be enforced
+ * on each CPU, ensure that this CPU waits for all the other
+ * CPUs to finish the rendezvous.
+ */
if (teardown_func == smp_no_rendevous_barrier)
while (atomic_load_acq_int(&smp_rv_waiters[2]) < ncpus)
cpu_spinwait();
- /* release lock */
mtx_unlock_spin(&smp_ipi_mtx);
}
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index 0b5e973..00681ca 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -654,7 +654,7 @@ bufinit(void)
* To support extreme low-memory systems, make sure hidirtybuffers cannot
* eat up all available buffer space. This occurs when our minimum cannot
* be met. We try to size hidirtybuffers to 3/4 our buffer space assuming
- * BKVASIZE'd (8K) buffers.
+ * BKVASIZE'd buffers.
*/
while ((long)hidirtybuffers * BKVASIZE > 3 * hibufspace / 4) {
hidirtybuffers >>= 1;
diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c
index e5f1254..b89d990 100644
--- a/sys/kern/vfs_default.c
+++ b/sys/kern/vfs_default.c
@@ -1081,9 +1081,10 @@ vfs_stdvget (mp, ino, flags, vpp)
}
int
-vfs_stdfhtovp (mp, fhp, vpp)
+vfs_stdfhtovp (mp, fhp, flags, vpp)
struct mount *mp;
struct fid *fhp;
+ int flags;
struct vnode **vpp;
{
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 33f7c5b..b48c6e7 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -4405,7 +4405,7 @@ fhopen(td, uap)
return (ESTALE);
vfslocked = VFS_LOCK_GIANT(mp);
/* now give me my vnode, it gets returned to me locked */
- error = VFS_FHTOVP(mp, &fhp.fh_fid, &vp);
+ error = VFS_FHTOVP(mp, &fhp.fh_fid, LK_EXCLUSIVE, &vp);
vfs_unbusy(mp);
if (error)
goto out;
@@ -4581,7 +4581,7 @@ fhstat(td, uap)
if ((mp = vfs_busyfs(&fh.fh_fsid)) == NULL)
return (ESTALE);
vfslocked = VFS_LOCK_GIANT(mp);
- error = VFS_FHTOVP(mp, &fh.fh_fid, &vp);
+ error = VFS_FHTOVP(mp, &fh.fh_fid, LK_EXCLUSIVE, &vp);
vfs_unbusy(mp);
if (error) {
VFS_UNLOCK_GIANT(vfslocked);
@@ -4641,7 +4641,7 @@ kern_fhstatfs(struct thread *td, fhandle_t fh, struct statfs *buf)
if ((mp = vfs_busyfs(&fh.fh_fsid)) == NULL)
return (ESTALE);
vfslocked = VFS_LOCK_GIANT(mp);
- error = VFS_FHTOVP(mp, &fh.fh_fid, &vp);
+ error = VFS_FHTOVP(mp, &fh.fh_fid, LK_EXCLUSIVE, &vp);
if (error) {
vfs_unbusy(mp);
VFS_UNLOCK_GIANT(vfslocked);
diff --git a/sys/mips/include/atomic.h b/sys/mips/include/atomic.h
index 7b4a82c..9a0c557 100644
--- a/sys/mips/include/atomic.h
+++ b/sys/mips/include/atomic.h
@@ -581,32 +581,47 @@ atomic_fetchadd_64(__volatile uint64_t *p, uint64_t v)
#else /* !__mips_n64 */
/* Operations on longs. */
-#define atomic_set_long atomic_set_32
-#define atomic_set_acq_long atomic_set_acq_32
-#define atomic_set_rel_long atomic_set_rel_32
-#define atomic_clear_long atomic_clear_32
-#define atomic_clear_acq_long atomic_clear_acq_32
-#define atomic_clear_rel_long atomic_clear_rel_32
-#define atomic_add_long(p, v) \
+#define atomic_set_long(p, v) \
+ atomic_set_32((volatile u_int *)(p), (u_int)(v))
+#define atomic_set_acq_long(p, v) \
+ atomic_set_acq_32((volatile u_int *)(p), (u_int)(v))
+#define atomic_set_rel_long(p, v) \
+ atomic_set_rel_32((volatile u_int *)(p), (u_int)(v))
+#define atomic_clear_long(p, v) \
+ atomic_clear_32((volatile u_int *)(p), (u_int)(v))
+#define atomic_clear_acq_long(p, v) \
+ atomic_clear_acq_32((volatile u_int *)(p), (u_int)(v))
+#define atomic_clear_rel_long(p, v) \
+ atomic_clear_rel_32((volatile u_int *)(p), (u_int)(v))
+#define atomic_add_long(p, v) \
atomic_add_32((volatile u_int *)(p), (u_int)(v))
-#define atomic_add_acq_long atomic_add_acq_32
-#define atomic_add_rel_long atomic_add_rel_32
-#define atomic_subtract_long(p, v) \
+#define atomic_add_acq_long(p, v) \
+ atomic_add_32((volatile u_int *)(p), (u_int)(v))
+#define atomic_add_rel_long(p, v) \
+ atomic_add_32((volatile u_int *)(p), (u_int)(v))
+#define atomic_subtract_long(p, v) \
atomic_subtract_32((volatile u_int *)(p), (u_int)(v))
-#define atomic_subtract_acq_long atomic_subtract_acq_32
-#define atomic_subtract_rel_long atomic_subtract_rel_32
-#define atomic_cmpset_long atomic_cmpset_32
-#define atomic_cmpset_acq_long(p, cmpval, newval) \
- atomic_cmpset_acq_32((volatile u_int *)(p), \
- (u_int)(cmpval), (u_int)(newval))
-#define atomic_cmpset_rel_long(p, cmpval, newval) \
- atomic_cmpset_rel_32((volatile u_int *)(p), \
- (u_int)(cmpval), (u_int)(newval))
-#define atomic_load_acq_long atomic_load_acq_32
-#define atomic_store_rel_long atomic_store_rel_32
-#define atomic_fetchadd_long(p, v) \
+#define atomic_subtract_acq_long(p, v) \
+ atomic_subtract_acq_32((volatile u_int *)(p), (u_int)(v))
+#define atomic_subtract_rel_long(p, v) \
+ atomic_subtract_rel_32((volatile u_int *)(p), (u_int)(v))
+#define atomic_cmpset_long(p, cmpval, newval) \
+ atomic_cmpset_32((volatile u_int *)(p), (u_int)(cmpval), \
+ (u_int)(newval))
+#define atomic_cmpset_acq_long(p, cmpval, newval) \
+ atomic_cmpset_acq_32((volatile u_int *)(p), (u_int)(cmpval), \
+ (u_int)(newval))
+#define atomic_cmpset_rel_long(p, cmpval, newval) \
+ atomic_cmpset_rel_32((volatile u_int *)(p), (u_int)(cmpval), \
+ (u_int)(newval))
+#define atomic_load_acq_long(p) \
+ (u_long)atomic_load_acq_32((volatile u_int *)(p))
+#define atomic_store_rel_long(p, v) \
+ atomic_store_rel_32((volatile u_int *)(p), (u_int)(v))
+#define atomic_fetchadd_long(p, v) \
atomic_fetchadd_32((volatile u_int *)(p), (u_int)(v))
-#define atomic_readandclear_long atomic_readandclear_32
+#define atomic_readandclear_long(p) \
+ atomic_readandclear_32((volatile u_int *)(p))
#endif /* __mips_n64 */
diff --git a/sys/modules/Makefile b/sys/modules/Makefile
index 2002e88..22e0f20 100644
--- a/sys/modules/Makefile
+++ b/sys/modules/Makefile
@@ -103,6 +103,7 @@ SUBDIR= ${_3dfx} \
fxp \
gem \
geom \
+ ${_glxiic} \
${_glxsb} \
hatm \
hifn \
@@ -421,6 +422,7 @@ _et= et
_exca= exca
_ext2fs= ext2fs
_fe= fe
+_glxiic= glxiic
_glxsb= glxsb
_i2c= i2c
_ibcs2= ibcs2
diff --git a/sys/modules/glxiic/Makefile b/sys/modules/glxiic/Makefile
new file mode 100644
index 0000000..46b0c07
--- /dev/null
+++ b/sys/modules/glxiic/Makefile
@@ -0,0 +1,10 @@
+# $FreeBSD$
+
+#CFLAGS+= -DGLXIIC_DEBUG
+
+.PATH: ${.CURDIR}/../../dev/glxiic
+KMOD= glxiic
+SRCS= glxiic.c
+SRCS+= device_if.h bus_if.h pci_if.h iicbus_if.h
+
+.include <bsd.kmod.mk>
diff --git a/sys/modules/wlan/Makefile b/sys/modules/wlan/Makefile
index 682aab3..f96ad32 100644
--- a/sys/modules/wlan/Makefile
+++ b/sys/modules/wlan/Makefile
@@ -18,7 +18,7 @@ SRCS+= bus_if.h device_if.h opt_inet.h opt_inet6.h opt_ipx.h opt_wlan.h \
.if !defined(KERNBUILDDIR)
opt_wlan.h:
echo "#define IEEE80211_DEBUG 1" > ${.TARGET}
- echo "#define IEEE80211_AMDPU_AGE 1" >> ${.TARGET}
+ echo "#define IEEE80211_AMPDU_AGE 1" >> ${.TARGET}
echo "#define IEEE80211_SUPPORT_MESH 1" >> ${.TARGET}
opt_inet.h:
echo "#define INET 1" > ${.TARGET}
diff --git a/sys/net/if_epair.c b/sys/net/if_epair.c
index 8775e6f..dff9efc 100644
--- a/sys/net/if_epair.c
+++ b/sys/net/if_epair.c
@@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$");
#include <net/ethernet.h>
#include <net/if.h>
#include <net/if_clone.h>
+#include <net/if_media.h>
#include <net/if_var.h>
#include <net/if_types.h>
#include <net/netisr.h>
@@ -92,6 +93,8 @@ static struct mbuf *epair_nh_m2cpuid(struct mbuf *, uintptr_t, u_int *);
static void epair_nh_drainedcpu(u_int);
static void epair_start_locked(struct ifnet *);
+static int epair_media_change(struct ifnet *);
+static void epair_media_status(struct ifnet *, struct ifmediareq *);
static int epair_clone_match(struct if_clone *, const char *);
static int epair_clone_create(struct if_clone *, char *, size_t, caddr_t);
@@ -127,6 +130,7 @@ SYSCTL_PROC(_net_link_epair, OID_AUTO, netisr_maxqlen, CTLTYPE_INT|CTLFLAG_RW,
struct epair_softc {
struct ifnet *ifp; /* This ifp. */
struct ifnet *oifp; /* other ifp of pair. */
+ struct ifmedia media; /* Media config (fake). */
u_int refcount; /* # of mbufs in flight. */
u_int cpuid; /* CPU ID assigned upon creation. */
void (*if_qflush)(struct ifnet *);
@@ -611,8 +615,25 @@ epair_qflush(struct ifnet *ifp)
}
static int
+epair_media_change(struct ifnet *ifp __unused)
+{
+
+ /* Do nothing. */
+ return (0);
+}
+
+static void
+epair_media_status(struct ifnet *ifp __unused, struct ifmediareq *imr)
+{
+
+ imr->ifm_status = IFM_AVALID | IFM_ACTIVE;
+ imr->ifm_active = IFM_ETHER | IFM_10G_T | IFM_FDX;
+}
+
+static int
epair_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
{
+ struct epair_softc *sc;
struct ifreq *ifr;
int error;
@@ -624,6 +645,12 @@ epair_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
error = 0;
break;
+ case SIOCSIFMEDIA:
+ case SIOCGIFMEDIA:
+ sc = ifp->if_softc;
+ error = ifmedia_ioctl(ifp, ifr, &sc->media, cmd);
+ break;
+
case SIOCSIFMTU:
/* We basically allow all kinds of MTUs. */
ifp->if_mtu = ifr->ifr_mtu;
@@ -783,6 +810,8 @@ epair_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params)
ifp->if_dname = ifc->ifc_name;
ifp->if_dunit = unit;
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
+ ifp->if_capabilities = IFCAP_VLAN_MTU;
+ ifp->if_capenable = IFCAP_VLAN_MTU;
ifp->if_start = epair_start;
ifp->if_ioctl = epair_ioctl;
ifp->if_init = epair_init;
@@ -807,6 +836,8 @@ epair_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params)
ifp->if_dname = ifc->ifc_name;
ifp->if_dunit = unit;
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
+ ifp->if_capabilities = IFCAP_VLAN_MTU;
+ ifp->if_capenable = IFCAP_VLAN_MTU;
ifp->if_start = epair_start;
ifp->if_ioctl = epair_ioctl;
ifp->if_init = epair_init;
@@ -829,6 +860,14 @@ epair_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params)
strlcpy(name, sca->ifp->if_xname, len);
DPRINTF("name='%s/%db' created sca=%p scb=%p\n", name, unit, sca, scb);
+ /* Initialise pseudo media types. */
+ ifmedia_init(&sca->media, 0, epair_media_change, epair_media_status);
+ ifmedia_add(&sca->media, IFM_ETHER | IFM_10G_T, 0, NULL);
+ ifmedia_set(&sca->media, IFM_ETHER | IFM_10G_T);
+ ifmedia_init(&scb->media, 0, epair_media_change, epair_media_status);
+ ifmedia_add(&scb->media, IFM_ETHER | IFM_10G_T, 0, NULL);
+ ifmedia_set(&scb->media, IFM_ETHER | IFM_10G_T);
+
/* Tell the world, that we are ready to rock. */
sca->ifp->if_drv_flags |= IFF_DRV_RUNNING;
scb->ifp->if_drv_flags |= IFF_DRV_RUNNING;
@@ -895,6 +934,8 @@ epair_clone_destroy(struct if_clone *ifc, struct ifnet *ifp)
if_free(oifp);
CURVNET_RESTORE();
if_free(ifp);
+ ifmedia_removeall(&sca->media);
+ ifmedia_removeall(&scb->media);
free(scb, M_EPAIR);
free(sca, M_EPAIR);
ifc_free_unit(ifc, unit);
diff --git a/sys/net/if_llatbl.c b/sys/net/if_llatbl.c
index 910d366..b19a0a4 100644
--- a/sys/net/if_llatbl.c
+++ b/sys/net/if_llatbl.c
@@ -228,7 +228,8 @@ lltable_drain(int af)
#endif
void
-lltable_prefix_free(int af, struct sockaddr *prefix, struct sockaddr *mask)
+lltable_prefix_free(int af, struct sockaddr *prefix, struct sockaddr *mask,
+ u_int flags)
{
struct lltable *llt;
@@ -237,7 +238,7 @@ lltable_prefix_free(int af, struct sockaddr *prefix, struct sockaddr *mask)
if (llt->llt_af != af)
continue;
- llt->llt_prefix_free(llt, prefix, mask);
+ llt->llt_prefix_free(llt, prefix, mask, flags);
}
LLTABLE_RUNLOCK();
}
diff --git a/sys/net/if_llatbl.h b/sys/net/if_llatbl.h
index 9ed09f4..1f30f37 100644
--- a/sys/net/if_llatbl.h
+++ b/sys/net/if_llatbl.h
@@ -155,7 +155,8 @@ struct lltable {
void (*llt_free)(struct lltable *, struct llentry *);
void (*llt_prefix_free)(struct lltable *,
const struct sockaddr *prefix,
- const struct sockaddr *mask);
+ const struct sockaddr *mask,
+ u_int flags);
struct llentry * (*llt_lookup)(struct lltable *, u_int flags,
const struct sockaddr *l3addr);
int (*llt_rtcheck)(struct ifnet *, u_int flags,
@@ -184,7 +185,7 @@ MALLOC_DECLARE(M_LLTABLE);
struct lltable *lltable_init(struct ifnet *, int);
void lltable_free(struct lltable *);
void lltable_prefix_free(int, struct sockaddr *,
- struct sockaddr *);
+ struct sockaddr *, u_int);
#if 0
void lltable_drain(int);
#endif
diff --git a/sys/net/if_media.h b/sys/net/if_media.h
index 1eb26ea..b6fd316 100644
--- a/sys/net/if_media.h
+++ b/sys/net/if_media.h
@@ -370,6 +370,7 @@ struct ifmedia_description {
}
#define IFM_SUBTYPE_ETHERNET_ALIASES { \
+ { IFM_10_T, "10baseT" }, \
{ IFM_10_T, "UTP" }, \
{ IFM_10_T, "10UTP" }, \
{ IFM_10_2, "BNC" }, \
@@ -389,6 +390,23 @@ struct ifmedia_description {
{ IFM_1000_T, "1000TX" }, \
{ IFM_1000_T, "1000T" }, \
{ IFM_2500_SX, "2500SX" }, \
+ \
+ /* \
+ * Shorthands for common media+option combinations as announced \
+ * by miibus(4) \
+ */ \
+ { IFM_10_T | IFM_FDX, "10baseT-FDX" }, \
+ { IFM_10_T | IFM_FDX | IFM_FLOW, "10baseT-FDX-flow" }, \
+ { IFM_100_TX | IFM_FDX, "100baseTX-FDX" }, \
+ { IFM_100_TX | IFM_FDX | IFM_FLOW, "100baseTX-FDX-flow" }, \
+ { IFM_1000_T | IFM_FDX, "1000baseT-FDX" }, \
+ { IFM_1000_T | IFM_FDX | IFM_FLOW, "1000baseT-FDX-flow" }, \
+ { IFM_1000_T | IFM_FDX | IFM_FLOW | IFM_ETH_MASTER, \
+ "1000baseT-FDX-flow-master" }, \
+ { IFM_1000_T | IFM_FDX | IFM_ETH_MASTER, \
+ "1000baseT-FDX-master" }, \
+ { IFM_1000_T | IFM_ETH_MASTER, "1000baseT-master" }, \
+ \
{ 0, NULL }, \
}
@@ -584,6 +602,13 @@ struct ifmedia_description {
#define IFM_SUBTYPE_SHARED_ALIASES { \
{ IFM_AUTO, "auto" }, \
+ \
+ /* \
+ * Shorthands for common media+option combinations as announced \
+ * by miibus(4) \
+ */ \
+ { IFM_AUTO | IFM_FLOW, "auto-flow" }, \
+ \
{ 0, NULL }, \
}
diff --git a/sys/net/netisr.c b/sys/net/netisr.c
index 952b463..67ec160 100644
--- a/sys/net/netisr.c
+++ b/sys/net/netisr.c
@@ -1,6 +1,6 @@
/*-
* Copyright (c) 2007-2009 Robert N. M. Watson
- * Copyright (c) 2010 Juniper Networks, Inc.
+ * Copyright (c) 2010-2011 Juniper Networks, Inc.
* All rights reserved.
*
* This software was developed by Robert N. M. Watson under contract
@@ -127,32 +127,44 @@ static struct rmlock netisr_rmlock;
SYSCTL_NODE(_net, OID_AUTO, isr, CTLFLAG_RW, 0, "netisr");
/*-
- * Three direct dispatch policies are supported:
+ * Three global direct dispatch policies are supported:
*
- * - Always defer: all work is scheduled for a netisr, regardless of context.
- * (!direct)
+ * NETISR_DISPATCH_QUEUED: All work is deferred for a netisr, regardless of
+ * context (may be overriden by protocols).
*
- * - Hybrid: if the executing context allows direct dispatch, and we're
- * running on the CPU the work would be done on, then direct dispatch if it
- * wouldn't violate ordering constraints on the workstream.
- * (direct && !direct_force)
+ * NETISR_DISPATCH_HYBRID: If the executing context allows direct dispatch,
+ * and we're running on the CPU the work would be performed on, then direct
+ * dispatch it if it wouldn't violate ordering constraints on the workstream.
*
- * - Always direct: if the executing context allows direct dispatch, always
- * direct dispatch. (direct && direct_force)
+ * NETISR_DISPATCH_DIRECT: If the executing context allows direct dispatch,
+ * always direct dispatch. (The default.)
*
* Notice that changing the global policy could lead to short periods of
* misordered processing, but this is considered acceptable as compared to
- * the complexity of enforcing ordering during policy changes.
+ * the complexity of enforcing ordering during policy changes. Protocols can
+ * override the global policy (when they're not doing that, they select
+ * NETISR_DISPATCH_DEFAULT).
*/
-static int netisr_direct_force = 1; /* Always direct dispatch. */
-TUNABLE_INT("net.isr.direct_force", &netisr_direct_force);
-SYSCTL_INT(_net_isr, OID_AUTO, direct_force, CTLFLAG_RW,
- &netisr_direct_force, 0, "Force direct dispatch");
+#define NETISR_DISPATCH_POLICY_DEFAULT NETISR_DISPATCH_DIRECT
+#define NETISR_DISPATCH_POLICY_MAXSTR 20 /* Used for temporary buffers. */
+static u_int netisr_dispatch_policy = NETISR_DISPATCH_POLICY_DEFAULT;
+static int sysctl_netisr_dispatch_policy(SYSCTL_HANDLER_ARGS);
+SYSCTL_PROC(_net_isr, OID_AUTO, dispatch, CTLTYPE_STRING | CTLFLAG_RW |
+ CTLFLAG_TUN, 0, 0, sysctl_netisr_dispatch_policy, "A",
+ "netisr dispatch policy");
-static int netisr_direct = 1; /* Enable direct dispatch. */
-TUNABLE_INT("net.isr.direct", &netisr_direct);
-SYSCTL_INT(_net_isr, OID_AUTO, direct, CTLFLAG_RW,
- &netisr_direct, 0, "Enable direct dispatch");
+/*
+ * These sysctls were used in previous versions to control and export
+ * dispatch policy state. Now, we provide read-only export via them so that
+ * older netstat binaries work. At some point they can be garbage collected.
+ */
+static int netisr_direct_force;
+SYSCTL_INT(_net_isr, OID_AUTO, direct_force, CTLFLAG_RD,
+ &netisr_direct_force, 0, "compat: force direct dispatch");
+
+static int netisr_direct;
+SYSCTL_INT(_net_isr, OID_AUTO, direct, CTLFLAG_RD, &netisr_direct, 0,
+ "compat: enable direct dispatch");
/*
* Allow the administrator to limit the number of threads (CPUs) to use for
@@ -276,6 +288,106 @@ netisr_default_flow2cpu(u_int flowid)
}
/*
+ * Dispatch tunable and sysctl configuration.
+ */
+struct netisr_dispatch_table_entry {
+ u_int ndte_policy;
+ const char *ndte_policy_str;
+};
+static const struct netisr_dispatch_table_entry netisr_dispatch_table[] = {
+ { NETISR_DISPATCH_DEFAULT, "default" },
+ { NETISR_DISPATCH_DEFERRED, "deferred" },
+ { NETISR_DISPATCH_HYBRID, "hybrid" },
+ { NETISR_DISPATCH_DIRECT, "direct" },
+};
+static const u_int netisr_dispatch_table_len =
+ (sizeof(netisr_dispatch_table) / sizeof(netisr_dispatch_table[0]));
+
+static void
+netisr_dispatch_policy_to_str(u_int dispatch_policy, char *buffer,
+ u_int buflen)
+{
+ const struct netisr_dispatch_table_entry *ndtep;
+ const char *str;
+ u_int i;
+
+ str = "unknown";
+ for (i = 0; i < netisr_dispatch_table_len; i++) {
+ ndtep = &netisr_dispatch_table[i];
+ if (ndtep->ndte_policy == dispatch_policy) {
+ str = ndtep->ndte_policy_str;
+ break;
+ }
+ }
+ snprintf(buffer, buflen, "%s", str);
+}
+
+static int
+netisr_dispatch_policy_from_str(const char *str, u_int *dispatch_policyp)
+{
+ const struct netisr_dispatch_table_entry *ndtep;
+ u_int i;
+
+ for (i = 0; i < netisr_dispatch_table_len; i++) {
+ ndtep = &netisr_dispatch_table[i];
+ if (strcmp(ndtep->ndte_policy_str, str) == 0) {
+ *dispatch_policyp = ndtep->ndte_policy;
+ return (0);
+ }
+ }
+ return (EINVAL);
+}
+
+static void
+netisr_dispatch_policy_compat(void)
+{
+
+ switch (netisr_dispatch_policy) {
+ case NETISR_DISPATCH_DEFERRED:
+ netisr_direct_force = 0;
+ netisr_direct = 0;
+ break;
+
+ case NETISR_DISPATCH_HYBRID:
+ netisr_direct_force = 0;
+ netisr_direct = 1;
+ break;
+
+ case NETISR_DISPATCH_DIRECT:
+ netisr_direct_force = 1;
+ netisr_direct = 1;
+ break;
+
+ default:
+ panic("%s: unknown policy %u", __func__,
+ netisr_dispatch_policy);
+ }
+}
+
+static int
+sysctl_netisr_dispatch_policy(SYSCTL_HANDLER_ARGS)
+{
+ char tmp[NETISR_DISPATCH_POLICY_MAXSTR];
+ u_int dispatch_policy;
+ int error;
+
+ netisr_dispatch_policy_to_str(netisr_dispatch_policy, tmp,
+ sizeof(tmp));
+ error = sysctl_handle_string(oidp, tmp, sizeof(tmp), req);
+ if (error == 0 && req->newptr != NULL) {
+ error = netisr_dispatch_policy_from_str(tmp,
+ &dispatch_policy);
+ if (error == 0 && dispatch_policy == NETISR_DISPATCH_DEFAULT)
+ error = EINVAL;
+ if (error == 0) {
+ netisr_dispatch_policy = dispatch_policy;
+ netisr_dispatch_policy_compat();
+ }
+ }
+ return (error);
+}
+
+/*
* Register a new netisr handler, which requires initializing per-protocol
* fields for each workstream. All netisr work is briefly suspended while
* the protocol is installed.
@@ -312,6 +424,12 @@ netisr_register(const struct netisr_handler *nhp)
KASSERT(nhp->nh_policy != NETISR_POLICY_CPU || nhp->nh_m2cpuid != NULL,
("%s: nh_policy == CPU but m2cpuid not defined for %s", __func__,
name));
+ KASSERT(nhp->nh_dispatch == NETISR_DISPATCH_DEFAULT ||
+ nhp->nh_dispatch == NETISR_DISPATCH_DEFERRED ||
+ nhp->nh_dispatch == NETISR_DISPATCH_HYBRID ||
+ nhp->nh_dispatch == NETISR_DISPATCH_DIRECT,
+ ("%s: invalid nh_dispatch (%u)", __func__, nhp->nh_dispatch));
+
KASSERT(proto < NETISR_MAXPROT,
("%s(%u, %s): protocol too big", __func__, proto, name));
@@ -339,6 +457,7 @@ netisr_register(const struct netisr_handler *nhp)
} else
netisr_proto[proto].np_qlimit = nhp->nh_qlimit;
netisr_proto[proto].np_policy = nhp->nh_policy;
+ netisr_proto[proto].np_dispatch = nhp->nh_dispatch;
CPU_FOREACH(i) {
npwp = &(DPCPU_ID_PTR(i, nws))->nws_work[proto];
bzero(npwp, sizeof(*npwp));
@@ -541,15 +660,32 @@ netisr_unregister(const struct netisr_handler *nhp)
}
/*
+ * Compose the global and per-protocol policies on dispatch, and return the
+ * dispatch policy to use.
+ */
+static u_int
+netisr_get_dispatch(struct netisr_proto *npp)
+{
+
+ /*
+ * Protocol-specific configuration overrides the global default.
+ */
+ if (npp->np_dispatch != NETISR_DISPATCH_DEFAULT)
+ return (npp->np_dispatch);
+ return (netisr_dispatch_policy);
+}
+
+/*
* Look up the workstream given a packet and source identifier. Do this by
* checking the protocol's policy, and optionally call out to the protocol
* for assistance if required.
*/
static struct mbuf *
-netisr_select_cpuid(struct netisr_proto *npp, uintptr_t source,
- struct mbuf *m, u_int *cpuidp)
+netisr_select_cpuid(struct netisr_proto *npp, u_int dispatch_policy,
+ uintptr_t source, struct mbuf *m, u_int *cpuidp)
{
struct ifnet *ifp;
+ u_int policy;
NETISR_LOCK_ASSERT();
@@ -567,11 +703,30 @@ netisr_select_cpuid(struct netisr_proto *npp, uintptr_t source,
* If we want to support per-interface policies, we should do that
* here first.
*/
- switch (npp->np_policy) {
- case NETISR_POLICY_CPU:
- return (npp->np_m2cpuid(m, source, cpuidp));
+ policy = npp->np_policy;
+ if (policy == NETISR_POLICY_CPU) {
+ m = npp->np_m2cpuid(m, source, cpuidp);
+ if (m == NULL)
+ return (NULL);
+
+ /*
+ * It's possible for a protocol not to have a good idea about
+ * where to process a packet, in which case we fall back on
+ * the netisr code to decide. In the hybrid case, return the
+ * current CPU ID, which will force an immediate direct
+ * dispatch. In the queued case, fall back on the SOURCE
+ * policy.
+ */
+ if (*cpuidp != NETISR_CPUID_NONE)
+ return (m);
+ if (dispatch_policy == NETISR_DISPATCH_HYBRID) {
+ *cpuidp = curcpu;
+ return (m);
+ }
+ policy = NETISR_POLICY_SOURCE;
+ }
- case NETISR_POLICY_FLOW:
+ if (policy == NETISR_POLICY_FLOW) {
if (!(m->m_flags & M_FLOWID) && npp->np_m2flow != NULL) {
m = npp->np_m2flow(m, source);
if (m == NULL)
@@ -582,21 +737,19 @@ netisr_select_cpuid(struct netisr_proto *npp, uintptr_t source,
netisr_default_flow2cpu(m->m_pkthdr.flowid);
return (m);
}
- /* FALLTHROUGH */
-
- case NETISR_POLICY_SOURCE:
- ifp = m->m_pkthdr.rcvif;
- if (ifp != NULL)
- *cpuidp = nws_array[(ifp->if_index + source) %
- nws_count];
- else
- *cpuidp = nws_array[source % nws_count];
- return (m);
-
- default:
- panic("%s: invalid policy %u for %s", __func__,
- npp->np_policy, npp->np_name);
+ policy = NETISR_POLICY_SOURCE;
}
+
+ KASSERT(policy == NETISR_POLICY_SOURCE,
+ ("%s: invalid policy %u for %s", __func__, npp->np_policy,
+ npp->np_name));
+
+ ifp = m->m_pkthdr.rcvif;
+ if (ifp != NULL)
+ *cpuidp = nws_array[(ifp->if_index + source) % nws_count];
+ else
+ *cpuidp = nws_array[source % nws_count];
+ return (m);
}
/*
@@ -795,7 +948,8 @@ netisr_queue_src(u_int proto, uintptr_t source, struct mbuf *m)
KASSERT(netisr_proto[proto].np_handler != NULL,
("%s: invalid proto %u", __func__, proto));
- m = netisr_select_cpuid(&netisr_proto[proto], source, m, &cpuid);
+ m = netisr_select_cpuid(&netisr_proto[proto], NETISR_DISPATCH_DEFERRED,
+ source, m, &cpuid);
if (m != NULL) {
KASSERT(!CPU_ABSENT(cpuid), ("%s: CPU %u absent", __func__,
cpuid));
@@ -826,23 +980,23 @@ netisr_dispatch_src(u_int proto, uintptr_t source, struct mbuf *m)
struct rm_priotracker tracker;
#endif
struct netisr_workstream *nwsp;
+ struct netisr_proto *npp;
struct netisr_work *npwp;
int dosignal, error;
- u_int cpuid;
-
- /*
- * If direct dispatch is entirely disabled, fall back on queueing.
- */
- if (!netisr_direct)
- return (netisr_queue_src(proto, source, m));
+ u_int cpuid, dispatch_policy;
KASSERT(proto < NETISR_MAXPROT,
("%s: invalid proto %u", __func__, proto));
#ifdef NETISR_LOCKING
NETISR_RLOCK(&tracker);
#endif
- KASSERT(netisr_proto[proto].np_handler != NULL,
- ("%s: invalid proto %u", __func__, proto));
+ npp = &netisr_proto[proto];
+ KASSERT(npp->np_handler != NULL, ("%s: invalid proto %u", __func__,
+ proto));
+
+ dispatch_policy = netisr_get_dispatch(npp);
+ if (dispatch_policy == NETISR_DISPATCH_DEFERRED)
+ return (netisr_queue_src(proto, source, m));
/*
* If direct dispatch is forced, then unconditionally dispatch
@@ -851,7 +1005,7 @@ netisr_dispatch_src(u_int proto, uintptr_t source, struct mbuf *m)
* nws_flags because all netisr processing will be source ordered due
* to always being forced to directly dispatch.
*/
- if (netisr_direct_force) {
+ if (dispatch_policy == NETISR_DISPATCH_DIRECT) {
nwsp = DPCPU_PTR(nws);
npwp = &nwsp->nws_work[proto];
npwp->nw_dispatched++;
@@ -861,18 +1015,22 @@ netisr_dispatch_src(u_int proto, uintptr_t source, struct mbuf *m)
goto out_unlock;
}
+ KASSERT(dispatch_policy == NETISR_DISPATCH_HYBRID,
+ ("%s: unknown dispatch policy (%u)", __func__, dispatch_policy));
+
/*
* Otherwise, we execute in a hybrid mode where we will try to direct
* dispatch if we're on the right CPU and the netisr worker isn't
* already running.
*/
- m = netisr_select_cpuid(&netisr_proto[proto], source, m, &cpuid);
+ sched_pin();
+ m = netisr_select_cpuid(&netisr_proto[proto], NETISR_DISPATCH_HYBRID,
+ source, m, &cpuid);
if (m == NULL) {
error = ENOBUFS;
- goto out_unlock;
+ goto out_unpin;
}
KASSERT(!CPU_ABSENT(cpuid), ("%s: CPU %u absent", __func__, cpuid));
- sched_pin();
if (cpuid != curcpu)
goto queue_fallback;
nwsp = DPCPU_PTR(nws);
@@ -1003,6 +1161,9 @@ netisr_start_swi(u_int cpuid, struct pcpu *pc)
static void
netisr_init(void *arg)
{
+ char tmp[NETISR_DISPATCH_POLICY_MAXSTR];
+ u_int dispatch_policy;
+ int error;
KASSERT(curcpu == 0, ("%s: not on CPU 0", __func__));
@@ -1033,6 +1194,20 @@ netisr_init(void *arg)
}
#endif
+ if (TUNABLE_STR_FETCH("net.isr.dispatch", tmp, sizeof(tmp))) {
+ error = netisr_dispatch_policy_from_str(tmp,
+ &dispatch_policy);
+ if (error == 0 && dispatch_policy == NETISR_DISPATCH_DEFAULT)
+ error = EINVAL;
+ if (error == 0) {
+ netisr_dispatch_policy = dispatch_policy;
+ netisr_dispatch_policy_compat();
+ } else
+ printf(
+ "%s: invalid dispatch policy %s, using default\n",
+ __func__, tmp);
+ }
+
netisr_start_swi(curcpu, pcpu_find(curcpu));
}
SYSINIT(netisr_init, SI_SUB_SOFTINTR, SI_ORDER_FIRST, netisr_init, NULL);
@@ -1088,6 +1263,7 @@ sysctl_netisr_proto(SYSCTL_HANDLER_ARGS)
snpp->snp_proto = proto;
snpp->snp_qlimit = npp->np_qlimit;
snpp->snp_policy = npp->np_policy;
+ snpp->snp_dispatch = npp->np_dispatch;
if (npp->np_m2flow != NULL)
snpp->snp_flags |= NETISR_SNP_FLAGS_M2FLOW;
if (npp->np_m2cpuid != NULL)
diff --git a/sys/net/netisr.h b/sys/net/netisr.h
index cd692f6..83bf9ce 100644
--- a/sys/net/netisr.h
+++ b/sys/net/netisr.h
@@ -1,6 +1,6 @@
/*-
* Copyright (c) 2007-2009 Robert N. M. Watson
- * Copyright (c) 2010 Juniper Networks, Inc.
+ * Copyright (c) 2010-2011 Juniper Networks, Inc.
* All rights reserved.
*
* This software was developed by Robert N. M. Watson under contract
@@ -71,6 +71,15 @@
#define NETISR_POLICY_CPU 3 /* Protocol determines CPU placement. */
/*
+ * Protocol dispatch policy constants; selects whether and when direct
+ * dispatch is permitted.
+ */
+#define NETISR_DISPATCH_DEFAULT 0 /* Use global default. */
+#define NETISR_DISPATCH_DEFERRED 1 /* Always defer dispatch. */
+#define NETISR_DISPATCH_HYBRID 2 /* Allow hybrid dispatch. */
+#define NETISR_DISPATCH_DIRECT 3 /* Always direct dispatch. */
+
+/*
* Monitoring data structures, exported by sysctl(2).
*
* Three sysctls are defined. First, a per-protocol structure exported by
@@ -84,7 +93,8 @@ struct sysctl_netisr_proto {
u_int snp_qlimit; /* nh_qlimit */
u_int snp_policy; /* nh_policy */
u_int snp_flags; /* Various flags. */
- u_int _snp_ispare[7];
+ u_int snp_dispatch; /* Dispatch policy. */
+ u_int _snp_ispare[6];
};
/*
@@ -173,6 +183,8 @@ typedef struct mbuf *netisr_m2cpuid_t(struct mbuf *m, uintptr_t source,
typedef struct mbuf *netisr_m2flow_t(struct mbuf *m, uintptr_t source);
typedef void netisr_drainedcpu_t(u_int cpuid);
+#define NETISR_CPUID_NONE ((u_int)-1) /* No affinity returned. */
+
/*
* Data structure describing a protocol handler.
*/
@@ -185,7 +197,8 @@ struct netisr_handler {
u_int nh_proto; /* Integer protocol ID. */
u_int nh_qlimit; /* Maximum per-CPU queue depth. */
u_int nh_policy; /* Work placement policy. */
- u_int nh_ispare[5]; /* For future use. */
+ u_int nh_dispatch; /* Dispatch policy. */
+ u_int nh_ispare[4]; /* For future use. */
void *nh_pspare[4]; /* For future use. */
};
diff --git a/sys/net/netisr_internal.h b/sys/net/netisr_internal.h
index 40afaf1..ac3ed0f 100644
--- a/sys/net/netisr_internal.h
+++ b/sys/net/netisr_internal.h
@@ -1,6 +1,6 @@
/*-
* Copyright (c) 2007-2009 Robert N. M. Watson
- * Copyright (c) 2010 Juniper Networks, Inc.
+ * Copyright (c) 2010-2011 Juniper Networks, Inc.
* All rights reserved.
*
* This software was developed by Robert N. M. Watson under contract
@@ -64,6 +64,7 @@ struct netisr_proto {
netisr_drainedcpu_t *np_drainedcpu; /* Callback when drained a queue. */
u_int np_qlimit; /* Maximum per-CPU queue depth. */
u_int np_policy; /* Work placement policy. */
+ u_int np_dispatch; /* Work dispatch policy. */
};
#define NETISR_MAXPROT 16 /* Compile-time limit. */
diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h
index 236883d..39cf347 100644
--- a/sys/net80211/ieee80211_var.h
+++ b/sys/net80211/ieee80211_var.h
@@ -578,7 +578,7 @@ MALLOC_DECLARE(M_80211_VAP);
#define IEEE80211_FHT_BITS \
"\20\1NONHT_PR" \
- "\23GF\24HT\25AMDPU_TX\26AMPDU_TX" \
+ "\23GF\24HT\25AMPDU_TX\26AMPDU_TX" \
"\27AMSDU_TX\30AMSDU_RX\31USEHT40\32PUREN\33SHORTGI20\34SHORTGI40" \
"\35HTCOMPAT\36RIFS\37STBC_TX\40STBC_RX"
diff --git a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c
index ee7fc35..a13ef4d 100644
--- a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c
+++ b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c
@@ -409,6 +409,7 @@ static int
ubt_probe(device_t dev)
{
struct usb_attach_arg *uaa = device_get_ivars(dev);
+ int error;
if (uaa->usb_mode != USB_MODE_HOST)
return (ENXIO);
@@ -416,14 +417,14 @@ ubt_probe(device_t dev)
if (uaa->info.bIfaceIndex != 0)
return (ENXIO);
- if (uaa->use_generic == 0)
- return (ENXIO);
-
if (usbd_lookup_id_by_uaa(ubt_ignore_devs,
sizeof(ubt_ignore_devs), uaa) == 0)
return (ENXIO);
- return (usbd_lookup_id_by_uaa(ubt_devs, sizeof(ubt_devs), uaa));
+ error = usbd_lookup_id_by_uaa(ubt_devs, sizeof(ubt_devs), uaa);
+ if (error == 0)
+ return (BUS_PROBE_GENERIC);
+ return (error);
} /* ubt_probe */
/*
diff --git a/sys/netgraph/ng_eiface.c b/sys/netgraph/ng_eiface.c
index cbae38f..d761a6c 100644
--- a/sys/netgraph/ng_eiface.c
+++ b/sys/netgraph/ng_eiface.c
@@ -41,6 +41,7 @@
#include <sys/syslog.h>
#include <net/if.h>
+#include <net/if_media.h>
#include <net/if_types.h>
#include <net/netisr.h>
#include <net/route.h>
@@ -76,6 +77,8 @@ static const struct ng_cmdlist ng_eiface_cmdlist[] = {
/* Node private data */
struct ng_eiface_private {
struct ifnet *ifp; /* per-interface network data */
+ struct ifmedia media; /* (fake) media information */
+ int link_status; /* fake */
int unit; /* Interface unit number */
node_p node; /* Our netgraph node */
hook_p ether; /* Hook for ethernet stream */
@@ -127,6 +130,7 @@ static VNET_DEFINE(struct unrhdr *, ng_eiface_unit);
static int
ng_eiface_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
{
+ const priv_p priv = (priv_p)ifp->if_softc;
struct ifreq *const ifr = (struct ifreq *)data;
int s, error = 0;
@@ -170,6 +174,12 @@ ng_eiface_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
ifp->if_mtu = ifr->ifr_mtu;
break;
+ /* (Fake) media type manipulation */
+ case SIOCSIFMEDIA:
+ case SIOCGIFMEDIA:
+ error = ifmedia_ioctl(ifp, ifr, &priv->media, command);
+ break;
+
/* Stuff that's not supported */
case SIOCADDMULTI:
case SIOCDELMULTI:
@@ -280,7 +290,6 @@ ng_eiface_start2(node_p node, hook_p hook, void *arg1, int arg2)
static void
ng_eiface_start(struct ifnet *ifp)
{
-
const priv_p priv = (priv_p)ifp->if_softc;
/* Don't do anything if output is active */
@@ -328,6 +337,41 @@ ng_eiface_print_ioctl(struct ifnet *ifp, int command, caddr_t data)
}
#endif /* DEBUG */
+/*
+ * ifmedia stuff
+ */
+static int
+ng_eiface_mediachange(struct ifnet *ifp)
+{
+ const priv_p priv = (priv_p)ifp->if_softc;
+ struct ifmedia *ifm = &priv->media;
+
+ if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER)
+ return (EINVAL);
+ if (IFM_SUBTYPE(ifm->ifm_media) == IFM_AUTO)
+ ifp->if_baudrate = ifmedia_baudrate(IFM_ETHER | IFM_1000_T);
+ else
+ ifp->if_baudrate = ifmedia_baudrate(ifm->ifm_media);
+
+ return (0);
+}
+
+static void
+ng_eiface_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
+{
+ const priv_p priv = (priv_p)ifp->if_softc;
+ struct ifmedia *ifm = &priv->media;
+
+ if (ifm->ifm_cur->ifm_media == (IFM_ETHER | IFM_AUTO) &&
+ (priv->link_status & IFM_ACTIVE))
+ ifmr->ifm_active = IFM_ETHER | IFM_1000_T | IFM_FDX;
+ else
+ ifmr->ifm_active = ifm->ifm_cur->ifm_media;
+ ifmr->ifm_status = priv->link_status;
+
+ return;
+}
+
/************************************************************************
NETGRAPH NODE STUFF
************************************************************************/
@@ -371,6 +415,18 @@ ng_eiface_constructor(node_p node)
ifp->if_flags = (IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST);
ifp->if_capabilities = IFCAP_VLAN_MTU | IFCAP_JUMBO_MTU;
ifp->if_capenable = IFCAP_VLAN_MTU | IFCAP_JUMBO_MTU;
+ ifmedia_init(&priv->media, 0, ng_eiface_mediachange,
+ ng_eiface_mediastatus);
+ ifmedia_add(&priv->media, IFM_ETHER | IFM_10_T, 0, NULL);
+ ifmedia_add(&priv->media, IFM_ETHER | IFM_10_T | IFM_FDX, 0, NULL);
+ ifmedia_add(&priv->media, IFM_ETHER | IFM_100_TX, 0, NULL);
+ ifmedia_add(&priv->media, IFM_ETHER | IFM_100_TX | IFM_FDX, 0, NULL);
+ ifmedia_add(&priv->media, IFM_ETHER | IFM_1000_T, 0, NULL);
+ ifmedia_add(&priv->media, IFM_ETHER | IFM_1000_T | IFM_FDX, 0, NULL);
+ ifmedia_add(&priv->media, IFM_ETHER | IFM_10G_T | IFM_FDX, 0, NULL);
+ ifmedia_add(&priv->media, IFM_ETHER | IFM_AUTO, 0, NULL);
+ ifmedia_set(&priv->media, IFM_ETHER | IFM_AUTO);
+ priv->link_status = IFM_AVALID;
/* Give this node the same name as the interface (if possible) */
if (ng_name_node(node, ifp->if_xname) != 0)
@@ -379,6 +435,7 @@ ng_eiface_constructor(node_p node)
/* Attach the interface */
ether_ifattach(ifp, eaddr);
+ ifp->if_baudrate = ifmedia_baudrate(IFM_ETHER | IFM_1000_T);
/* Done */
return (0);
@@ -401,7 +458,10 @@ ng_eiface_newhook(node_p node, hook_p hook, const char *name)
NG_HOOK_SET_PRIVATE(hook, &priv->ether);
NG_HOOK_SET_TO_INBOUND(hook);
+ priv->link_status |= IFM_ACTIVE;
+ CURVNET_SET_QUIET(ifp->if_vnet);
if_link_state_change(ifp, LINK_STATE_UP);
+ CURVNET_RESTORE();
return (0);
}
@@ -486,16 +546,20 @@ ng_eiface_rcvmsg(node_p node, item_p item, hook_p lasthook)
} /* end of inner switch() */
break;
case NGM_FLOW_COOKIE:
+ CURVNET_SET_QUIET(ifp->if_vnet);
switch (msg->header.cmd) {
case NGM_LINK_IS_UP:
+ priv->link_status |= IFM_ACTIVE;
if_link_state_change(ifp, LINK_STATE_UP);
break;
case NGM_LINK_IS_DOWN:
+ priv->link_status &= ~IFM_ACTIVE;
if_link_state_change(ifp, LINK_STATE_DOWN);
break;
default:
break;
}
+ CURVNET_RESTORE();
break;
default:
error = EINVAL;
@@ -557,6 +621,7 @@ ng_eiface_rmnode(node_p node)
* hence we have to change the current vnet context here.
*/
CURVNET_SET_QUIET(ifp->if_vnet);
+ ifmedia_removeall(&priv->media);
ether_ifdetach(ifp);
if_free(ifp);
CURVNET_RESTORE();
@@ -576,6 +641,10 @@ ng_eiface_disconnect(hook_p hook)
const priv_p priv = NG_NODE_PRIVATE(NG_HOOK_NODE(hook));
priv->ether = NULL;
+ priv->link_status &= ~IFM_ACTIVE;
+ CURVNET_SET_QUIET(priv->ifp->if_vnet);
+ if_link_state_change(priv->ifp, LINK_STATE_DOWN);
+ CURVNET_RESTORE();
return (0);
}
diff --git a/sys/netinet/in.c b/sys/netinet/in.c
index 1012012..684d808 100644
--- a/sys/netinet/in.c
+++ b/sys/netinet/in.c
@@ -70,7 +70,7 @@ static int in_lifaddr_ioctl(struct socket *, u_long, caddr_t,
struct ifnet *, struct thread *);
static int in_addprefix(struct in_ifaddr *, int);
-static int in_scrubprefix(struct in_ifaddr *);
+static int in_scrubprefix(struct in_ifaddr *, u_int);
static void in_socktrim(struct sockaddr_in *);
static int in_ifinit(struct ifnet *,
struct in_ifaddr *, struct sockaddr_in *, int);
@@ -548,7 +548,7 @@ in_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp,
* is the same as before, then the call is
* un-necessarily executed here.
*/
- in_ifscrub(ifp, ia);
+ in_ifscrub(ifp, ia, 0);
ia->ia_sockmask = ifra->ifra_mask;
ia->ia_sockmask.sin_family = AF_INET;
ia->ia_subnetmask =
@@ -557,7 +557,7 @@ in_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp,
}
if ((ifp->if_flags & IFF_POINTOPOINT) &&
(ifra->ifra_dstaddr.sin_family == AF_INET)) {
- in_ifscrub(ifp, ia);
+ in_ifscrub(ifp, ia, 0);
ia->ia_dstaddr = ifra->ifra_dstaddr;
maskIsNew = 1; /* We lie; but the effect's the same */
}
@@ -585,7 +585,7 @@ in_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp,
/*
* in_ifscrub kills the interface route.
*/
- in_ifscrub(ifp, ia);
+ in_ifscrub(ifp, ia, LLE_STATIC);
/*
* in_ifadown gets rid of all the rest of
@@ -829,10 +829,10 @@ in_lifaddr_ioctl(struct socket *so, u_long cmd, caddr_t data,
* Delete any existing route for an interface.
*/
void
-in_ifscrub(struct ifnet *ifp, struct in_ifaddr *ia)
+in_ifscrub(struct ifnet *ifp, struct in_ifaddr *ia, u_int flags)
{
- in_scrubprefix(ia);
+ in_scrubprefix(ia, flags);
}
/*
@@ -887,7 +887,7 @@ in_ifinit(struct ifnet *ifp, struct in_ifaddr *ia, struct sockaddr_in *sin,
splx(s);
if (scrub) {
ia->ia_ifa.ifa_addr = (struct sockaddr *)&oldaddr;
- in_ifscrub(ifp, ia);
+ in_ifscrub(ifp, ia, LLE_STATIC);
ia->ia_ifa.ifa_addr = (struct sockaddr *)&ia->ia_addr;
}
if (IN_CLASSA(i))
@@ -1095,7 +1095,7 @@ extern void arp_ifscrub(struct ifnet *ifp, uint32_t addr);
* otherwise.
*/
static int
-in_scrubprefix(struct in_ifaddr *target)
+in_scrubprefix(struct in_ifaddr *target, u_int flags)
{
struct in_ifaddr *ia;
struct in_addr prefix, mask, p;
@@ -1130,13 +1130,15 @@ in_scrubprefix(struct in_ifaddr *target)
RT_REMREF(ia_ro.ro_rt);
RTFREE_LOCKED(ia_ro.ro_rt);
}
- if (freeit)
+ if (freeit && (flags & LLE_STATIC)) {
error = ifa_del_loopback_route((struct ifaddr *)target,
(struct sockaddr *)&target->ia_addr);
- if (error == 0)
- target->ia_flags &= ~IFA_RTSELF;
- /* remove arp cache */
- arp_ifscrub(target->ia_ifp, IA_SIN(target)->sin_addr.s_addr);
+ if (error == 0)
+ target->ia_flags &= ~IFA_RTSELF;
+ }
+ if (flags & LLE_STATIC)
+ /* remove arp cache */
+ arp_ifscrub(target->ia_ifp, IA_SIN(target)->sin_addr.s_addr);
}
if (rtinitflags(target))
@@ -1203,7 +1205,7 @@ in_scrubprefix(struct in_ifaddr *target)
mask0.sin_family = AF_INET;
mask0.sin_addr.s_addr = target->ia_subnetmask;
lltable_prefix_free(AF_INET, (struct sockaddr *)&prefix0,
- (struct sockaddr *)&mask0);
+ (struct sockaddr *)&mask0, flags);
/*
* As no-one seem to have this prefix, we can remove the route.
@@ -1362,7 +1364,8 @@ in_lltable_free(struct lltable *llt, struct llentry *lle)
static void
in_lltable_prefix_free(struct lltable *llt,
const struct sockaddr *prefix,
- const struct sockaddr *mask)
+ const struct sockaddr *mask,
+ u_int flags)
{
const struct sockaddr_in *pfx = (const struct sockaddr_in *)prefix;
const struct sockaddr_in *msk = (const struct sockaddr_in *)mask;
@@ -1373,8 +1376,13 @@ in_lltable_prefix_free(struct lltable *llt,
for (i=0; i < LLTBL_HASHTBL_SIZE; i++) {
LIST_FOREACH_SAFE(lle, &llt->lle_head[i], lle_next, next) {
+ /*
+ * (flags & LLE_STATIC) means deleting all entries
+ * including static ARP entries
+ */
if (IN_ARE_MASKED_ADDR_EQUAL((struct sockaddr_in *)L3_ADDR(lle),
- pfx, msk)) {
+ pfx, msk) &&
+ ((flags & LLE_STATIC) || !(lle->la_flags & LLE_STATIC))) {
int canceled;
canceled = callout_drain(&lle->la_timer);
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index b3bb8d9..85e31dc 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -2,8 +2,12 @@
* Copyright (c) 1982, 1986, 1991, 1993, 1995
* The Regents of the University of California.
* Copyright (c) 2007-2009 Robert N. M. Watson
+ * Copyright (c) 2010-2011 Juniper Networks, Inc.
* All rights reserved.
*
+ * Portions of this software were developed by Robert N. M. Watson under
+ * contract to Juniper Networks, Inc.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -50,6 +54,7 @@ __FBSDID("$FreeBSD$");
#include <sys/socketvar.h>
#include <sys/priv.h>
#include <sys/proc.h>
+#include <sys/refcount.h>
#include <sys/jail.h>
#include <sys/kernel.h>
#include <sys/sysctl.h>
@@ -287,7 +292,7 @@ in_pcballoc(struct socket *so, struct inpcbinfo *pcbinfo)
#endif
INP_WLOCK(inp);
inp->inp_gencnt = ++pcbinfo->ipi_gencnt;
- inp->inp_refcount = 1; /* Reference from the inpcbinfo */
+ refcount_init(&inp->inp_refcount, 1); /* Reference from inpcbinfo */
#if defined(IPSEC) || defined(MAC)
out:
if (error != 0) {
@@ -329,7 +334,7 @@ in_pcbbind(struct inpcb *inp, struct sockaddr *nam, struct ucred *cred)
#if defined(INET) || defined(INET6)
int
in_pcb_lport(struct inpcb *inp, struct in_addr *laddrp, u_short *lportp,
- struct ucred *cred, int wild)
+ struct ucred *cred, int lookupflags)
{
struct inpcbinfo *pcbinfo;
struct inpcb *tmpinp;
@@ -424,14 +429,14 @@ in_pcb_lport(struct inpcb *inp, struct in_addr *laddrp, u_short *lportp,
#ifdef INET6
if ((inp->inp_vflag & INP_IPV6) != 0)
tmpinp = in6_pcblookup_local(pcbinfo,
- &inp->in6p_laddr, lport, wild, cred);
+ &inp->in6p_laddr, lport, lookupflags, cred);
#endif
#if defined(INET) && defined(INET6)
else
#endif
#ifdef INET
tmpinp = in_pcblookup_local(pcbinfo, laddr,
- lport, wild, cred);
+ lport, lookupflags, cred);
#endif
} while (tmpinp != NULL);
@@ -464,7 +469,7 @@ in_pcbbind_setup(struct inpcb *inp, struct sockaddr *nam, in_addr_t *laddrp,
struct inpcbinfo *pcbinfo = inp->inp_pcbinfo;
struct in_addr laddr;
u_short lport = 0;
- int wild = 0, reuseport = (so->so_options & SO_REUSEPORT);
+ int lookupflags = 0, reuseport = (so->so_options & SO_REUSEPORT);
int error;
/*
@@ -480,7 +485,7 @@ in_pcbbind_setup(struct inpcb *inp, struct sockaddr *nam, in_addr_t *laddrp,
if (nam != NULL && laddr.s_addr != INADDR_ANY)
return (EINVAL);
if ((so->so_options & (SO_REUSEADDR|SO_REUSEPORT)) == 0)
- wild = INPLOOKUP_WILDCARD;
+ lookupflags = INPLOOKUP_WILDCARD;
if (nam == NULL) {
if ((error = prison_local_ip4(cred, &laddr)) != 0)
return (error);
@@ -561,7 +566,7 @@ in_pcbbind_setup(struct inpcb *inp, struct sockaddr *nam, in_addr_t *laddrp,
return (EADDRINUSE);
}
t = in_pcblookup_local(pcbinfo, sin->sin_addr,
- lport, wild, cred);
+ lport, lookupflags, cred);
if (t && (t->inp_flags & INP_TIMEWAIT)) {
/*
* XXXRW: If an incpb has had its timewait
@@ -590,7 +595,7 @@ in_pcbbind_setup(struct inpcb *inp, struct sockaddr *nam, in_addr_t *laddrp,
if (*lportp != 0)
lport = *lportp;
if (lport == 0) {
- error = in_pcb_lport(inp, &laddr, &lport, cred, wild);
+ error = in_pcb_lport(inp, &laddr, &lport, cred, lookupflags);
if (error != 0)
return (error);
@@ -1028,56 +1033,18 @@ in_pcbdetach(struct inpcb *inp)
}
/*
- * in_pcbfree_internal() frees an inpcb that has been detached from its
- * socket, and whose reference count has reached 0. It will also remove the
- * inpcb from any global lists it might remain on.
- */
-static void
-in_pcbfree_internal(struct inpcb *inp)
-{
- struct inpcbinfo *ipi = inp->inp_pcbinfo;
-
- KASSERT(inp->inp_socket == NULL, ("%s: inp_socket != NULL", __func__));
- KASSERT(inp->inp_refcount == 0, ("%s: refcount !0", __func__));
-
- INP_INFO_WLOCK_ASSERT(ipi);
- INP_WLOCK_ASSERT(inp);
-
-#ifdef IPSEC
- if (inp->inp_sp != NULL)
- ipsec_delete_pcbpolicy(inp);
-#endif /* IPSEC */
- inp->inp_gencnt = ++ipi->ipi_gencnt;
- in_pcbremlists(inp);
-#ifdef INET6
- if (inp->inp_vflag & INP_IPV6PROTO) {
- ip6_freepcbopts(inp->in6p_outputopts);
- if (inp->in6p_moptions != NULL)
- ip6_freemoptions(inp->in6p_moptions);
- }
-#endif
- if (inp->inp_options)
- (void)m_free(inp->inp_options);
-#ifdef INET
- if (inp->inp_moptions != NULL)
- inp_freemoptions(inp->inp_moptions);
-#endif
- inp->inp_vflag = 0;
- crfree(inp->inp_cred);
-
-#ifdef MAC
- mac_inpcb_destroy(inp);
-#endif
- INP_WUNLOCK(inp);
- uma_zfree(ipi->ipi_zone, inp);
-}
-
-/*
* in_pcbref() bumps the reference count on an inpcb in order to maintain
* stability of an inpcb pointer despite the inpcb lock being released. This
* is used in TCP when the inpcbinfo lock needs to be acquired or upgraded,
* but where the inpcb lock is already held.
*
+ * in_pcbref() should be used only to provide brief memory stability, and
+ * must always be followed by a call to INP_WLOCK() and in_pcbrele() to
+ * garbage collect the inpcb if it has been in_pcbfree()'d from another
+ * context. Until in_pcbrele() has returned that the inpcb is still valid,
+ * lock and rele are the *only* safe operations that may be performed on the
+ * inpcb.
+ *
* While the inpcb will not be freed, releasing the inpcb lock means that the
* connection's state may change, so the caller should be careful to
* revalidate any cached state on reacquiring the lock. Drop the reference
@@ -1087,11 +1054,9 @@ void
in_pcbref(struct inpcb *inp)
{
- INP_WLOCK_ASSERT(inp);
-
KASSERT(inp->inp_refcount > 0, ("%s: refcount 0", __func__));
- inp->inp_refcount++;
+ refcount_acquire(&inp->inp_refcount);
}
/*
@@ -1099,47 +1064,108 @@ in_pcbref(struct inpcb *inp)
* in_pcbfree() may have been made between in_pcbref() and in_pcbrele(), we
* return a flag indicating whether or not the inpcb remains valid. If it is
* valid, we return with the inpcb lock held.
+ *
+ * Notice that, unlike in_pcbref(), the inpcb lock must be held to drop a
+ * reference on an inpcb. Historically more work was done here (actually, in
+ * in_pcbfree_internal()) but has been moved to in_pcbfree() to avoid the
+ * need for the pcbinfo lock in in_pcbrele(). Deferring the free is entirely
+ * about memory stability (and continued use of the write lock).
*/
int
-in_pcbrele(struct inpcb *inp)
+in_pcbrele_rlocked(struct inpcb *inp)
{
-#ifdef INVARIANTS
- struct inpcbinfo *ipi = inp->inp_pcbinfo;
-#endif
+ struct inpcbinfo *pcbinfo;
+
+ KASSERT(inp->inp_refcount > 0, ("%s: refcount 0", __func__));
+
+ INP_RLOCK_ASSERT(inp);
+
+ if (refcount_release(&inp->inp_refcount) == 0)
+ return (0);
+
+ KASSERT(inp->inp_socket == NULL, ("%s: inp_socket != NULL", __func__));
+
+ INP_RUNLOCK(inp);
+ pcbinfo = inp->inp_pcbinfo;
+ uma_zfree(pcbinfo->ipi_zone, inp);
+ return (1);
+}
+
+int
+in_pcbrele_wlocked(struct inpcb *inp)
+{
+ struct inpcbinfo *pcbinfo;
KASSERT(inp->inp_refcount > 0, ("%s: refcount 0", __func__));
- INP_INFO_WLOCK_ASSERT(ipi);
INP_WLOCK_ASSERT(inp);
- inp->inp_refcount--;
- if (inp->inp_refcount > 0)
+ if (refcount_release(&inp->inp_refcount) == 0)
return (0);
- in_pcbfree_internal(inp);
+
+ KASSERT(inp->inp_socket == NULL, ("%s: inp_socket != NULL", __func__));
+
+ INP_WUNLOCK(inp);
+ pcbinfo = inp->inp_pcbinfo;
+ uma_zfree(pcbinfo->ipi_zone, inp);
return (1);
}
/*
+ * Temporary wrapper.
+ */
+int
+in_pcbrele(struct inpcb *inp)
+{
+
+ return (in_pcbrele_wlocked(inp));
+}
+
+/*
* Unconditionally schedule an inpcb to be freed by decrementing its
* reference count, which should occur only after the inpcb has been detached
* from its socket. If another thread holds a temporary reference (acquired
* using in_pcbref()) then the free is deferred until that reference is
- * released using in_pcbrele(), but the inpcb is still unlocked.
+ * released using in_pcbrele(), but the inpcb is still unlocked. Almost all
+ * work, including removal from global lists, is done in this context, where
+ * the pcbinfo lock is held.
*/
void
in_pcbfree(struct inpcb *inp)
{
-#ifdef INVARIANTS
- struct inpcbinfo *ipi = inp->inp_pcbinfo;
-#endif
+ struct inpcbinfo *pcbinfo = inp->inp_pcbinfo;
- KASSERT(inp->inp_socket == NULL, ("%s: inp_socket != NULL",
- __func__));
+ KASSERT(inp->inp_socket == NULL, ("%s: inp_socket != NULL", __func__));
- INP_INFO_WLOCK_ASSERT(ipi);
+ INP_INFO_WLOCK_ASSERT(pcbinfo);
INP_WLOCK_ASSERT(inp);
- if (!in_pcbrele(inp))
+ /* XXXRW: Do as much as possible here. */
+#ifdef IPSEC
+ if (inp->inp_sp != NULL)
+ ipsec_delete_pcbpolicy(inp);
+#endif /* IPSEC */
+ inp->inp_gencnt = ++pcbinfo->ipi_gencnt;
+ in_pcbremlists(inp);
+#ifdef INET6
+ if (inp->inp_vflag & INP_IPV6PROTO) {
+ ip6_freepcbopts(inp->in6p_outputopts);
+ if (inp->in6p_moptions != NULL)
+ ip6_freemoptions(inp->in6p_moptions);
+ }
+#endif
+ if (inp->inp_options)
+ (void)m_free(inp->inp_options);
+#ifdef INET
+ if (inp->inp_moptions != NULL)
+ inp_freemoptions(inp->inp_moptions);
+#endif
+ inp->inp_vflag = 0;
+ crfree(inp->inp_cred);
+#ifdef MAC
+ mac_inpcb_destroy(inp);
+#endif
+ if (!in_pcbrele_wlocked(inp))
INP_WUNLOCK(inp);
}
@@ -1307,7 +1333,7 @@ in_pcbpurgeif0(struct inpcbinfo *pcbinfo, struct ifnet *ifp)
#define INP_LOOKUP_MAPPED_PCB_COST 3
struct inpcb *
in_pcblookup_local(struct inpcbinfo *pcbinfo, struct in_addr laddr,
- u_short lport, int wild_okay, struct ucred *cred)
+ u_short lport, int lookupflags, struct ucred *cred)
{
struct inpcb *inp;
#ifdef INET6
@@ -1317,9 +1343,12 @@ in_pcblookup_local(struct inpcbinfo *pcbinfo, struct in_addr laddr,
#endif
int wildcard;
+ KASSERT((lookupflags & ~(INPLOOKUP_WILDCARD)) == 0,
+ ("%s: invalid lookup flags %d", __func__, lookupflags));
+
INP_INFO_LOCK_ASSERT(pcbinfo);
- if (!wild_okay) {
+ if ((lookupflags & INPLOOKUP_WILDCARD) == 0) {
struct inpcbhead *head;
/*
* Look for an unconnected (wildcard foreign addr) PCB that
@@ -1425,13 +1454,16 @@ in_pcblookup_local(struct inpcbinfo *pcbinfo, struct in_addr laddr,
*/
struct inpcb *
in_pcblookup_hash(struct inpcbinfo *pcbinfo, struct in_addr faddr,
- u_int fport_arg, struct in_addr laddr, u_int lport_arg, int wildcard,
+ u_int fport_arg, struct in_addr laddr, u_int lport_arg, int lookupflags,
struct ifnet *ifp)
{
struct inpcbhead *head;
struct inpcb *inp, *tmpinp;
u_short fport = fport_arg, lport = lport_arg;
+ KASSERT((lookupflags & ~(INPLOOKUP_WILDCARD)) == 0,
+ ("%s: invalid lookup flags %d", __func__, lookupflags));
+
INP_INFO_LOCK_ASSERT(pcbinfo);
/*
@@ -1467,7 +1499,7 @@ in_pcblookup_hash(struct inpcbinfo *pcbinfo, struct in_addr faddr,
/*
* Then look for a wildcard match, if requested.
*/
- if (wildcard == INPLOOKUP_WILDCARD) {
+ if ((lookupflags & INPLOOKUP_WILDCARD) != 0) {
struct inpcb *local_wild = NULL, *local_exact = NULL;
#ifdef INET6
struct inpcb *local_wild_mapped = NULL;
@@ -1538,7 +1570,7 @@ in_pcblookup_hash(struct inpcbinfo *pcbinfo, struct in_addr faddr,
if (local_wild_mapped != NULL)
return (local_wild_mapped);
#endif /* defined(INET6) */
- } /* if (wildcard == INPLOOKUP_WILDCARD) */
+ } /* if ((lookupflags & INPLOOKUP_WILDCARD) != 0) */
return (NULL);
}
diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h
index 813011e..14d4ea2 100644
--- a/sys/netinet/in_pcb.h
+++ b/sys/netinet/in_pcb.h
@@ -1,8 +1,12 @@
/*-
* Copyright (c) 1982, 1986, 1990, 1993
* The Regents of the University of California.
+ * Copyright (c) 2010-2011 Juniper Networks, Inc.
* All rights reserved.
*
+ * Portions of this software were developed by Robert N. M. Watson under
+ * contract to Juniper Networks, Inc.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -260,53 +264,70 @@ struct inpcbport {
u_short phd_port;
};
-/*
+/*-
* Global data structure for each high-level protocol (UDP, TCP, ...) in both
* IPv4 and IPv6. Holds inpcb lists and information for managing them.
+ *
+ * Each pcbinfo is protected by ipi_lock, covering mutable global fields (such
+ * as the global pcb list) and hashed lookup tables. The lock order is:
+ *
+ * ipi_lock (before) inpcb locks
+ *
+ * Locking key:
+ *
+ * (c) Constant or nearly constant after initialisation
+ * (g) Locked by ipi_lock
+ * (h) Read using either ipi_lock or inpcb lock; write requires both.
+ * (x) Synchronisation properties poorly defined
*/
struct inpcbinfo {
/*
- * Global list of inpcbs on the protocol.
+ * Global lock protecting global inpcb list, inpcb count, hash tables,
+ * etc.
*/
- struct inpcbhead *ipi_listhead;
- u_int ipi_count;
+ struct rwlock ipi_lock;
/*
- * Global hash of inpcbs, hashed by local and foreign addresses and
- * port numbers.
+ * Global list of inpcbs on the protocol.
*/
- struct inpcbhead *ipi_hashbase;
- u_long ipi_hashmask;
+ struct inpcbhead *ipi_listhead; /* (g) */
+ u_int ipi_count; /* (g) */
/*
- * Global hash of inpcbs, hashed by only local port number.
+ * Generation count -- incremented each time a connection is allocated
+ * or freed.
*/
- struct inpcbporthead *ipi_porthashbase;
- u_long ipi_porthashmask;
+ u_quad_t ipi_gencnt; /* (g) */
/*
* Fields associated with port lookup and allocation.
*/
- u_short ipi_lastport;
- u_short ipi_lastlow;
- u_short ipi_lasthi;
+ u_short ipi_lastport; /* (x) */
+ u_short ipi_lastlow; /* (x) */
+ u_short ipi_lasthi; /* (x) */
/*
* UMA zone from which inpcbs are allocated for this protocol.
*/
- struct uma_zone *ipi_zone;
+ struct uma_zone *ipi_zone; /* (c) */
/*
- * Generation count--incremented each time a connection is allocated
- * or freed.
+ * Global hash of inpcbs, hashed by local and foreign addresses and
+ * port numbers.
*/
- u_quad_t ipi_gencnt;
- struct rwlock ipi_lock;
+ struct inpcbhead *ipi_hashbase; /* (g) */
+ u_long ipi_hashmask; /* (g) */
+
+ /*
+ * Global hash of inpcbs, hashed by only local port number.
+ */
+ struct inpcbporthead *ipi_porthashbase; /* (g) */
+ u_long ipi_porthashmask; /* (g) */
/*
* Pointer to network stack instance
*/
- struct vnet *ipi_vnet;
+ struct vnet *ipi_vnet; /* (c) */
/*
* general use 2
@@ -513,6 +534,8 @@ void in_pcbnotifyall(struct inpcbinfo *pcbinfo, struct in_addr,
void in_pcbref(struct inpcb *);
void in_pcbrehash(struct inpcb *);
int in_pcbrele(struct inpcb *);
+int in_pcbrele_rlocked(struct inpcb *);
+int in_pcbrele_wlocked(struct inpcb *);
void in_pcbsetsolabel(struct socket *so);
int in_getpeeraddr(struct socket *so, struct sockaddr **nam);
int in_getsockaddr(struct socket *so, struct sockaddr **nam);
diff --git a/sys/netinet/in_var.h b/sys/netinet/in_var.h
index cd1d904..5be07c1 100644
--- a/sys/netinet/in_var.h
+++ b/sys/netinet/in_var.h
@@ -447,7 +447,7 @@ int in_control(struct socket *, u_long, caddr_t, struct ifnet *,
void in_rtqdrain(void);
void ip_input(struct mbuf *);
int in_ifadown(struct ifaddr *ifa, int);
-void in_ifscrub(struct ifnet *, struct in_ifaddr *);
+void in_ifscrub(struct ifnet *, struct in_ifaddr *, u_int);
struct mbuf *ip_fastforward(struct mbuf *);
void *in_domifattach(struct ifnet *);
void in_domifdetach(struct ifnet *, void *);
diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c
index b196de2..be099a8 100644
--- a/sys/netinet/raw_ip.c
+++ b/sys/netinet/raw_ip.c
@@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$");
#include <netinet/in_systm.h>
#include <netinet/in_pcb.h>
#include <netinet/in_var.h>
+#include <netinet/if_ether.h>
#include <netinet/ip.h>
#include <netinet/ip_var.h>
#include <netinet/ip_mroute.h>
@@ -721,7 +722,7 @@ rip_ctlinput(int cmd, struct sockaddr *sa, void *vip)
/*
* in_ifscrub kills the interface route.
*/
- in_ifscrub(ia->ia_ifp, ia);
+ in_ifscrub(ia->ia_ifp, ia, 0);
/*
* in_ifadown gets rid of all the rest of the
* routes. This is not quite the right thing
@@ -756,12 +757,18 @@ rip_ctlinput(int cmd, struct sockaddr *sa, void *vip)
|| (ifp->if_flags & IFF_POINTOPOINT))
flags |= RTF_HOST;
+ err = ifa_del_loopback_route((struct ifaddr *)ia, sa);
+ if (err == 0)
+ ia->ia_flags &= ~IFA_RTSELF;
+
err = rtinit(&ia->ia_ifa, RTM_ADD, flags);
if (err == 0)
ia->ia_flags |= IFA_ROUTE;
+
err = ifa_add_loopback_route((struct ifaddr *)ia, sa);
if (err == 0)
ia->ia_flags |= IFA_RTSELF;
+
ifa_free(&ia->ia_ifa);
break;
}
diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c
index 0dad4e5..a7d22bd 100644
--- a/sys/netinet/sctp_output.c
+++ b/sys/netinet/sctp_output.c
@@ -2210,26 +2210,26 @@ sctp_is_ifa_addr_preferred(struct sctp_ifa *ifa,
* means it is the same scope or higher scope then the destination.
* L = loopback, P = private, G = global
* -----------------------------------------
- * src | dest | result
- * ----------------------------------------
- * L | L | yes
- * -----------------------------------------
- * P | L | yes-v4 no-v6
- * -----------------------------------------
- * G | L | yes-v4 no-v6
- * -----------------------------------------
- * L | P | no
- * -----------------------------------------
- * P | P | yes
- * -----------------------------------------
- * G | P | no
- * -----------------------------------------
- * L | G | no
- * -----------------------------------------
- * P | G | no
- * -----------------------------------------
- * G | G | yes
- * -----------------------------------------
+ * src | dest | result
+ * ----------------------------------------
+ * L | L | yes
+ * -----------------------------------------
+ * P | L | yes-v4 no-v6
+ * -----------------------------------------
+ * G | L | yes-v4 no-v6
+ * -----------------------------------------
+ * L | P | no
+ * -----------------------------------------
+ * P | P | yes
+ * -----------------------------------------
+ * G | P | no
+ * -----------------------------------------
+ * L | G | no
+ * -----------------------------------------
+ * P | G | no
+ * -----------------------------------------
+ * G | G | yes
+ * -----------------------------------------
*/
if (ifa->address.sa.sa_family != fam) {
@@ -2310,14 +2310,14 @@ sctp_is_ifa_addr_acceptable(struct sctp_ifa *ifa,
*
* L = loopback, P = private, G = global
* -----------------------------------------
- * src | dest | result
+ * src | dest | result
* -----------------------------------------
* L | L | yes
* -----------------------------------------
* P | L | yes-v4 no-v6
* -----------------------------------------
* G | L | yes
- * -----------------------------------------
+ * -----------------------------------------
* L | P | no
* -----------------------------------------
* P | P | yes
@@ -2325,7 +2325,7 @@ sctp_is_ifa_addr_acceptable(struct sctp_ifa *ifa,
* G | P | yes - May not work
* -----------------------------------------
* L | G | no
- * -----------------------------------------
+ * -----------------------------------------
* P | G | yes - May not work
* -----------------------------------------
* G | G | yes
@@ -3129,8 +3129,8 @@ plan_d:
}
#endif
out:
- if (sifa) {
#ifdef INET
+ if (sifa) {
if (retried == 1) {
LIST_FOREACH(sctp_ifn, &vrf->ifnlist, next_ifn) {
if (dest_is_loop == 0 && SCTP_IFN_IS_IFT_LOOP(sctp_ifn)) {
diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c
index c9fad80..b3eb805 100644
--- a/sys/netinet/sctp_usrreq.c
+++ b/sys/netinet/sctp_usrreq.c
@@ -2489,6 +2489,7 @@ flags_out:
paddri->spinfo_srtt = net->lastsa >> SCTP_RTT_SHIFT;
paddri->spinfo_rto = net->RTO;
paddri->spinfo_assoc_id = sctp_get_associd(stcb);
+ paddri->spinfo_mtu = net->mtu;
SCTP_TCB_UNLOCK(stcb);
} else {
if (stcb) {
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
index c522422..9e8e5cd 100644
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -2376,19 +2376,25 @@ in6_lltable_free(struct lltable *llt, struct llentry *lle)
static void
in6_lltable_prefix_free(struct lltable *llt,
const struct sockaddr *prefix,
- const struct sockaddr *mask)
+ const struct sockaddr *mask,
+ u_int flags)
{
const struct sockaddr_in6 *pfx = (const struct sockaddr_in6 *)prefix;
const struct sockaddr_in6 *msk = (const struct sockaddr_in6 *)mask;
struct llentry *lle, *next;
register int i;
+ /*
+ * (flags & LLE_STATIC) means deleting all entries
+ * including static ND6 entries
+ */
for (i=0; i < LLTBL_HASHTBL_SIZE; i++) {
LIST_FOREACH_SAFE(lle, &llt->lle_head[i], lle_next, next) {
if (IN6_ARE_MASKED_ADDR_EQUAL(
&((struct sockaddr_in6 *)L3_ADDR(lle))->sin6_addr,
&pfx->sin6_addr,
- &msk->sin6_addr)) {
+ &msk->sin6_addr) &&
+ ((flags & LLE_STATIC) || !(lle->la_flags & LLE_STATIC))) {
int canceled;
canceled = callout_drain(&lle->la_timer);
diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c
index 9e64562..eacce8c 100644
--- a/sys/netinet6/in6_pcb.c
+++ b/sys/netinet6/in6_pcb.c
@@ -111,7 +111,8 @@ in6_pcbbind(register struct inpcb *inp, struct sockaddr *nam,
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)NULL;
struct inpcbinfo *pcbinfo = inp->inp_pcbinfo;
u_short lport = 0;
- int error, wild = 0, reuseport = (so->so_options & SO_REUSEPORT);
+ int error, lookupflags = 0;
+ int reuseport = (so->so_options & SO_REUSEPORT);
INP_INFO_WLOCK_ASSERT(pcbinfo);
INP_WLOCK_ASSERT(inp);
@@ -121,7 +122,7 @@ in6_pcbbind(register struct inpcb *inp, struct sockaddr *nam,
if (inp->inp_lport || !IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr))
return (EINVAL);
if ((so->so_options & (SO_REUSEADDR|SO_REUSEPORT)) == 0)
- wild = INPLOOKUP_WILDCARD;
+ lookupflags = INPLOOKUP_WILDCARD;
if (nam == NULL) {
if ((error = prison_local_ip6(cred, &inp->in6p_laddr,
((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0))) != 0)
@@ -226,7 +227,7 @@ in6_pcbbind(register struct inpcb *inp, struct sockaddr *nam,
#endif
}
t = in6_pcblookup_local(pcbinfo, &sin6->sin6_addr,
- lport, wild, cred);
+ lport, lookupflags, cred);
if (t && (reuseport & ((t->inp_flags & INP_TIMEWAIT) ?
intotw(t)->tw_so_options :
t->inp_socket->so_options)) == 0)
@@ -238,7 +239,7 @@ in6_pcbbind(register struct inpcb *inp, struct sockaddr *nam,
in6_sin6_2_sin(&sin, sin6);
t = in_pcblookup_local(pcbinfo, sin.sin_addr,
- lport, wild, cred);
+ lport, lookupflags, cred);
if (t && t->inp_flags & INP_TIMEWAIT) {
if ((reuseport &
intotw(t)->tw_so_options) == 0 &&
@@ -652,14 +653,17 @@ in6_pcbnotify(struct inpcbinfo *pcbinfo, struct sockaddr *dst,
*/
struct inpcb *
in6_pcblookup_local(struct inpcbinfo *pcbinfo, struct in6_addr *laddr,
- u_short lport, int wild_okay, struct ucred *cred)
+ u_short lport, int lookupflags, struct ucred *cred)
{
register struct inpcb *inp;
int matchwild = 3, wildcard;
+ KASSERT((lookupflags & ~(INPLOOKUP_WILDCARD)) == 0,
+ ("%s: invalid lookup flags %d", __func__, lookupflags));
+
INP_INFO_WLOCK_ASSERT(pcbinfo);
- if (!wild_okay) {
+ if ((lookupflags & INPLOOKUP_WILDCARD) == 0) {
struct inpcbhead *head;
/*
* Look for an unconnected (wildcard foreign addr) PCB that
@@ -815,7 +819,7 @@ in6_rtchange(struct inpcb *inp, int errno)
*/
struct inpcb *
in6_pcblookup_hash(struct inpcbinfo *pcbinfo, struct in6_addr *faddr,
- u_int fport_arg, struct in6_addr *laddr, u_int lport_arg, int wildcard,
+ u_int fport_arg, struct in6_addr *laddr, u_int lport_arg, int lookupflags,
struct ifnet *ifp)
{
struct inpcbhead *head;
@@ -823,6 +827,9 @@ in6_pcblookup_hash(struct inpcbinfo *pcbinfo, struct in6_addr *faddr,
u_short fport = fport_arg, lport = lport_arg;
int faith;
+ KASSERT((lookupflags & ~(INPLOOKUP_WILDCARD)) == 0,
+ ("%s: invalid lookup flags %d", __func__, lookupflags));
+
INP_INFO_LOCK_ASSERT(pcbinfo);
if (faithprefix_p != NULL)
@@ -862,7 +869,7 @@ in6_pcblookup_hash(struct inpcbinfo *pcbinfo, struct in6_addr *faddr,
/*
* Then look for a wildcard match, if requested.
*/
- if (wildcard == INPLOOKUP_WILDCARD) {
+ if ((lookupflags & INPLOOKUP_WILDCARD) != 0) {
struct inpcb *local_wild = NULL, *local_exact = NULL;
struct inpcb *jail_wild = NULL;
int injail;
@@ -919,7 +926,7 @@ in6_pcblookup_hash(struct inpcbinfo *pcbinfo, struct in6_addr *faddr,
return (local_exact);
if (local_wild != NULL)
return (local_wild);
- } /* if (wildcard == INPLOOKUP_WILDCARD) */
+ } /* if ((lookupflags & INPLOOKUP_WILDCARD) != 0) */
/*
* Not found.
diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c
index b491e0e..5202e09 100644
--- a/sys/netinet6/in6_src.c
+++ b/sys/netinet6/in6_src.c
@@ -851,7 +851,7 @@ in6_pcbsetport(struct in6_addr *laddr, struct inpcb *inp, struct ucred *cred)
{
struct socket *so = inp->inp_socket;
u_int16_t lport = 0;
- int error, wild = 0;
+ int error, lookupflags = 0;
#ifdef INVARIANTS
struct inpcbinfo *pcbinfo = inp->inp_pcbinfo;
#endif
@@ -866,11 +866,11 @@ in6_pcbsetport(struct in6_addr *laddr, struct inpcb *inp, struct ucred *cred)
/* XXX: this is redundant when called from in6_pcbbind */
if ((so->so_options & (SO_REUSEADDR|SO_REUSEPORT)) == 0)
- wild = INPLOOKUP_WILDCARD;
+ lookupflags = INPLOOKUP_WILDCARD;
inp->inp_flags |= INP_ANONPORT;
- error = in_pcb_lport(inp, NULL, &lport, cred, wild);
+ error = in_pcb_lport(inp, NULL, &lport, cred, lookupflags);
if (error != 0)
return (error);
diff --git a/sys/nfs/nfs_common.c b/sys/nfs/nfs_common.c
index c56f31f..09dbfab 100644
--- a/sys/nfs/nfs_common.c
+++ b/sys/nfs/nfs_common.c
@@ -361,7 +361,7 @@ nfsm_adv_xx(int s, struct mbuf **md, caddr_t *dpos)
*
* We would prefer to avoid this situation entirely. The situation does not
* occur with NFS/UDP and is supposed to only occassionally occur with TCP.
- * Use vfs.nfs.realign_count and realign_test to check this.
+ * Use vfs.nfs_common.realign_count and realign_test to check this.
*/
int
nfs_realign(struct mbuf **pm, int how)
diff --git a/sys/nfsclient/nfs.h b/sys/nfsclient/nfs.h
index 99b86f8..22a291a 100644
--- a/sys/nfsclient/nfs.h
+++ b/sys/nfsclient/nfs.h
@@ -107,7 +107,7 @@
#endif
/*
- * vfs.nfs sysctl(3) identifiers
+ * vfs.oldnfs sysctl(3) identifiers
*/
#define NFS_NFSSTATS 1 /* struct: struct nfsstats */
diff --git a/sys/nfsclient/nfs_krpc.c b/sys/nfsclient/nfs_krpc.c
index bfb1ea1..242d425 100644
--- a/sys/nfsclient/nfs_krpc.c
+++ b/sys/nfsclient/nfs_krpc.c
@@ -93,16 +93,16 @@ static int nfs3_jukebox_delay = 10;
static int nfs_skip_wcc_data_onerr = 1;
static int fake_wchan;
-SYSCTL_DECL(_vfs_nfs);
+SYSCTL_DECL(_vfs_oldnfs);
-SYSCTL_INT(_vfs_nfs, OID_AUTO, bufpackets, CTLFLAG_RW, &nfs_bufpackets, 0,
+SYSCTL_INT(_vfs_oldnfs, OID_AUTO, bufpackets, CTLFLAG_RW, &nfs_bufpackets, 0,
"Buffer reservation size 2 < x < 64");
-SYSCTL_INT(_vfs_nfs, OID_AUTO, reconnects, CTLFLAG_RD, &nfs_reconnects, 0,
+SYSCTL_INT(_vfs_oldnfs, OID_AUTO, reconnects, CTLFLAG_RD, &nfs_reconnects, 0,
"Number of times the nfs client has had to reconnect");
-SYSCTL_INT(_vfs_nfs, OID_AUTO, nfs3_jukebox_delay, CTLFLAG_RW,
+SYSCTL_INT(_vfs_oldnfs, OID_AUTO, nfs3_jukebox_delay, CTLFLAG_RW,
&nfs3_jukebox_delay, 0,
"Number of seconds to delay a retry after receiving EJUKEBOX");
-SYSCTL_INT(_vfs_nfs, OID_AUTO, skip_wcc_data_onerr, CTLFLAG_RW,
+SYSCTL_INT(_vfs_oldnfs, OID_AUTO, skip_wcc_data_onerr, CTLFLAG_RW,
&nfs_skip_wcc_data_onerr, 0,
"Disable weak cache consistency checking when server returns an error");
diff --git a/sys/nfsclient/nfs_nfsiod.c b/sys/nfsclient/nfs_nfsiod.c
index fcb987e..d34c205 100644
--- a/sys/nfsclient/nfs_nfsiod.c
+++ b/sys/nfsclient/nfs_nfsiod.c
@@ -78,11 +78,11 @@ static void nfssvc_iod(void *);
static int nfs_asyncdaemon[NFS_MAXASYNCDAEMON];
-SYSCTL_DECL(_vfs_nfs);
+SYSCTL_DECL(_vfs_oldnfs);
/* Maximum number of seconds a nfsiod kthread will sleep before exiting */
static unsigned int nfs_iodmaxidle = 120;
-SYSCTL_UINT(_vfs_nfs, OID_AUTO, iodmaxidle, CTLFLAG_RW, &nfs_iodmaxidle, 0,
+SYSCTL_UINT(_vfs_oldnfs, OID_AUTO, iodmaxidle, CTLFLAG_RW, &nfs_iodmaxidle, 0,
"Max number of seconds an nfsiod kthread will sleep before exiting");
/* Maximum number of nfsiod kthreads */
@@ -121,7 +121,7 @@ out:
mtx_unlock(&nfs_iod_mtx);
return (0);
}
-SYSCTL_PROC(_vfs_nfs, OID_AUTO, iodmin, CTLTYPE_UINT | CTLFLAG_RW, 0,
+SYSCTL_PROC(_vfs_oldnfs, OID_AUTO, iodmin, CTLTYPE_UINT | CTLFLAG_RW, 0,
sizeof (nfs_iodmin), sysctl_iodmin, "IU",
"Min number of nfsiod kthreads to keep as spares");
@@ -158,7 +158,7 @@ out:
mtx_unlock(&nfs_iod_mtx);
return (0);
}
-SYSCTL_PROC(_vfs_nfs, OID_AUTO, iodmax, CTLTYPE_UINT | CTLFLAG_RW, 0,
+SYSCTL_PROC(_vfs_oldnfs, OID_AUTO, iodmax, CTLTYPE_UINT | CTLFLAG_RW, 0,
sizeof (nfs_iodmax), sysctl_iodmax, "IU",
"Max number of nfsiod kthreads");
@@ -213,7 +213,7 @@ nfsiod_setup(void *dummy)
{
int error;
- TUNABLE_INT_FETCH("vfs.nfs.iodmin", &nfs_iodmin);
+ TUNABLE_INT_FETCH("vfs.oldnfs.iodmin", &nfs_iodmin);
mtx_lock(&nfs_iod_mtx);
/* Silently limit the start number of nfsiod's */
if (nfs_iodmin > NFS_MAXASYNCDAEMON)
@@ -229,7 +229,7 @@ nfsiod_setup(void *dummy)
SYSINIT(nfsiod, SI_SUB_KTHREAD_IDLE, SI_ORDER_ANY, nfsiod_setup, NULL);
static int nfs_defect = 0;
-SYSCTL_INT(_vfs_nfs, OID_AUTO, defect, CTLFLAG_RW, &nfs_defect, 0,
+SYSCTL_INT(_vfs_oldnfs, OID_AUTO, defect, CTLFLAG_RW, &nfs_defect, 0,
"Allow nfsiods to migrate serving different mounts");
/*
diff --git a/sys/nfsclient/nfs_subs.c b/sys/nfsclient/nfs_subs.c
index fe4f5cc..19fde06 100644
--- a/sys/nfsclient/nfs_subs.c
+++ b/sys/nfsclient/nfs_subs.c
@@ -653,9 +653,9 @@ out:
#ifdef NFS_ACDEBUG
#include <sys/sysctl.h>
-SYSCTL_DECL(_vfs_nfs);
+SYSCTL_DECL(_vfs_oldnfs);
static int nfs_acdebug;
-SYSCTL_INT(_vfs_nfs, OID_AUTO, acdebug, CTLFLAG_RW, &nfs_acdebug, 0,
+SYSCTL_INT(_vfs_oldnfs, OID_AUTO, acdebug, CTLFLAG_RW, &nfs_acdebug, 0,
"Toggle acdebug (attribute cache debug) flag");
#endif
diff --git a/sys/nfsclient/nfs_vfsops.c b/sys/nfsclient/nfs_vfsops.c
index ba3f41d..79659d0 100644
--- a/sys/nfsclient/nfs_vfsops.c
+++ b/sys/nfsclient/nfs_vfsops.c
@@ -90,25 +90,25 @@ uma_zone_t nfsmount_zone;
struct nfsstats nfsstats;
-SYSCTL_NODE(_vfs, OID_AUTO, nfs, CTLFLAG_RW, 0, "NFS filesystem");
-SYSCTL_STRUCT(_vfs_nfs, NFS_NFSSTATS, nfsstats, CTLFLAG_RW,
+SYSCTL_NODE(_vfs, OID_AUTO, oldnfs, CTLFLAG_RW, 0, "Old NFS filesystem");
+SYSCTL_STRUCT(_vfs_oldnfs, NFS_NFSSTATS, nfsstats, CTLFLAG_RW,
&nfsstats, nfsstats, "S,nfsstats");
static int nfs_ip_paranoia = 1;
-SYSCTL_INT(_vfs_nfs, OID_AUTO, nfs_ip_paranoia, CTLFLAG_RW,
+SYSCTL_INT(_vfs_oldnfs, OID_AUTO, nfs_ip_paranoia, CTLFLAG_RW,
&nfs_ip_paranoia, 0,
"Disallow accepting replies from IPs which differ from those sent");
#ifdef NFS_DEBUG
int nfs_debug;
-SYSCTL_INT(_vfs_nfs, OID_AUTO, debug, CTLFLAG_RW, &nfs_debug, 0,
+SYSCTL_INT(_vfs_oldnfs, OID_AUTO, debug, CTLFLAG_RW, &nfs_debug, 0,
"Toggle debug flag");
#endif
static int nfs_tprintf_initial_delay = NFS_TPRINTF_INITIAL_DELAY;
-SYSCTL_INT(_vfs_nfs, NFS_TPRINTF_INITIAL_DELAY,
+SYSCTL_INT(_vfs_oldnfs, NFS_TPRINTF_INITIAL_DELAY,
downdelayinitial, CTLFLAG_RW, &nfs_tprintf_initial_delay, 0,
"Delay before printing \"nfs server not responding\" messages");
/* how long between console messages "nfs server foo not responding" */
static int nfs_tprintf_delay = NFS_TPRINTF_DELAY;
-SYSCTL_INT(_vfs_nfs, NFS_TPRINTF_DELAY,
+SYSCTL_INT(_vfs_oldnfs, NFS_TPRINTF_DELAY,
downdelayinterval, CTLFLAG_RW, &nfs_tprintf_delay, 0,
"Delay between printing \"nfs server not responding\" messages");
@@ -176,14 +176,14 @@ struct nfsv3_diskless nfsv3_diskless = { { { 0 } } };
int nfs_diskless_valid = 0;
#endif
-SYSCTL_INT(_vfs_nfs, OID_AUTO, diskless_valid, CTLFLAG_RD,
+SYSCTL_INT(_vfs_oldnfs, OID_AUTO, diskless_valid, CTLFLAG_RD,
&nfs_diskless_valid, 0,
"Has the diskless struct been filled correctly");
-SYSCTL_STRING(_vfs_nfs, OID_AUTO, diskless_rootpath, CTLFLAG_RD,
+SYSCTL_STRING(_vfs_oldnfs, OID_AUTO, diskless_rootpath, CTLFLAG_RD,
nfsv3_diskless.root_hostnam, 0, "Path to nfs root");
-SYSCTL_OPAQUE(_vfs_nfs, OID_AUTO, diskless_rootaddr, CTLFLAG_RD,
+SYSCTL_OPAQUE(_vfs_oldnfs, OID_AUTO, diskless_rootaddr, CTLFLAG_RD,
&nfsv3_diskless.root_saddr, sizeof nfsv3_diskless.root_saddr,
"%Ssockaddr_in", "Diskless root nfs address");
@@ -1149,6 +1149,10 @@ nfs_mount(struct mount *mp)
goto out;
}
}
+ } else if (has_addr_opt == 0) {
+ vfs_mount_error(mp, "No server address");
+ error = EINVAL;
+ goto out;
}
error = mountnfs(&args, mp, nam, args.hostname, &vp,
curthread->td_ucred, negnametimeo);
diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c
index fb3a746..bb81f6b 100644
--- a/sys/nfsclient/nfs_vnops.c
+++ b/sys/nfsclient/nfs_vnops.c
@@ -64,7 +64,6 @@ __FBSDID("$FreeBSD$");
#include <sys/signalvar.h>
#include <vm/vm.h>
-#include <vm/vm_object.h>
#include <vm/vm_extern.h>
#include <vm/vm_object.h>
@@ -217,27 +216,27 @@ struct nfsmount *nfs_iodmount[NFS_MAXASYNCDAEMON];
int nfs_numasync = 0;
#define DIRHDSIZ (sizeof (struct dirent) - (MAXNAMLEN + 1))
-SYSCTL_DECL(_vfs_nfs);
+SYSCTL_DECL(_vfs_oldnfs);
static int nfsaccess_cache_timeout = NFS_MAXATTRTIMO;
-SYSCTL_INT(_vfs_nfs, OID_AUTO, access_cache_timeout, CTLFLAG_RW,
+SYSCTL_INT(_vfs_oldnfs, OID_AUTO, access_cache_timeout, CTLFLAG_RW,
&nfsaccess_cache_timeout, 0, "NFS ACCESS cache timeout");
static int nfs_prime_access_cache = 0;
-SYSCTL_INT(_vfs_nfs, OID_AUTO, prime_access_cache, CTLFLAG_RW,
+SYSCTL_INT(_vfs_oldnfs, OID_AUTO, prime_access_cache, CTLFLAG_RW,
&nfs_prime_access_cache, 0,
"Prime NFS ACCESS cache when fetching attributes");
static int nfsv3_commit_on_close = 0;
-SYSCTL_INT(_vfs_nfs, OID_AUTO, nfsv3_commit_on_close, CTLFLAG_RW,
+SYSCTL_INT(_vfs_oldnfs, OID_AUTO, nfsv3_commit_on_close, CTLFLAG_RW,
&nfsv3_commit_on_close, 0, "write+commit on close, else only write");
static int nfs_clean_pages_on_close = 1;
-SYSCTL_INT(_vfs_nfs, OID_AUTO, clean_pages_on_close, CTLFLAG_RW,
+SYSCTL_INT(_vfs_oldnfs, OID_AUTO, clean_pages_on_close, CTLFLAG_RW,
&nfs_clean_pages_on_close, 0, "NFS clean dirty pages on close");
int nfs_directio_enable = 0;
-SYSCTL_INT(_vfs_nfs, OID_AUTO, nfs_directio_enable, CTLFLAG_RW,
+SYSCTL_INT(_vfs_oldnfs, OID_AUTO, nfs_directio_enable, CTLFLAG_RW,
&nfs_directio_enable, 0, "Enable NFS directio");
/*
@@ -252,14 +251,14 @@ SYSCTL_INT(_vfs_nfs, OID_AUTO, nfs_directio_enable, CTLFLAG_RW,
* meaningful.
*/
int nfs_directio_allow_mmap = 1;
-SYSCTL_INT(_vfs_nfs, OID_AUTO, nfs_directio_allow_mmap, CTLFLAG_RW,
+SYSCTL_INT(_vfs_oldnfs, OID_AUTO, nfs_directio_allow_mmap, CTLFLAG_RW,
&nfs_directio_allow_mmap, 0, "Enable mmaped IO on file with O_DIRECT opens");
#if 0
-SYSCTL_INT(_vfs_nfs, OID_AUTO, access_cache_hits, CTLFLAG_RD,
+SYSCTL_INT(_vfs_oldnfs, OID_AUTO, access_cache_hits, CTLFLAG_RD,
&nfsstats.accesscache_hits, 0, "NFS ACCESS cache hit count");
-SYSCTL_INT(_vfs_nfs, OID_AUTO, access_cache_misses, CTLFLAG_RD,
+SYSCTL_INT(_vfs_oldnfs, OID_AUTO, access_cache_misses, CTLFLAG_RD,
&nfsstats.accesscache_misses, 0, "NFS ACCESS cache miss count");
#endif
diff --git a/sys/nfsserver/nfs_srvsubs.c b/sys/nfsserver/nfs_srvsubs.c
index 5a92376..66a85c4 100644
--- a/sys/nfsserver/nfs_srvsubs.c
+++ b/sys/nfsserver/nfs_srvsubs.c
@@ -1128,7 +1128,7 @@ nfsrv_fhtovp(fhandle_t *fhp, int flags, struct vnode **vpp, int *vfslockedp,
goto out;
}
}
- error = VFS_FHTOVP(mp, &fhp->fh_fid, vpp);
+ error = VFS_FHTOVP(mp, &fhp->fh_fid, LK_EXCLUSIVE, vpp);
if (error) {
/* Make sure the server replies ESTALE to the client. */
error = ESTALE;
diff --git a/sys/nlm/nlm_prot_impl.c b/sys/nlm/nlm_prot_impl.c
index 070fdf9..afbb9dd 100644
--- a/sys/nlm/nlm_prot_impl.c
+++ b/sys/nlm/nlm_prot_impl.c
@@ -1797,7 +1797,7 @@ nlm_get_vfs_state(struct nlm_host *host, struct svc_req *rqstp,
goto out;
}
- error = VFS_FHTOVP(vs->vs_mp, &fhp->fh_fid, &vs->vs_vp);
+ error = VFS_FHTOVP(vs->vs_mp, &fhp->fh_fid, LK_EXCLUSIVE, &vs->vs_vp);
if (error)
goto out;
vs->vs_vnlocked = TRUE;
diff --git a/sys/powerpc/aim/mmu_oea64.c b/sys/powerpc/aim/mmu_oea64.c
index d20de53..c33a094 100644
--- a/sys/powerpc/aim/mmu_oea64.c
+++ b/sys/powerpc/aim/mmu_oea64.c
@@ -1141,8 +1141,6 @@ moea64_zero_page_area(mmu_t mmu, vm_page_t m, int off, int size)
{
vm_offset_t pa = VM_PAGE_TO_PHYS(m);
- if (!moea64_initialized)
- panic("moea64_zero_page: can't zero pa %#" PRIxPTR, pa);
if (size + off > PAGE_SIZE)
panic("moea64_zero_page: size + off > PAGE_SIZE");
@@ -1165,9 +1163,6 @@ moea64_zero_page(mmu_t mmu, vm_page_t m)
vm_offset_t pa = VM_PAGE_TO_PHYS(m);
vm_offset_t va, off;
- if (!moea64_initialized)
- panic("moea64_zero_page: can't zero pa %#zx", pa);
-
if (!hw_direct_map) {
mtx_lock(&moea64_scratchpage_mtx);
diff --git a/sys/powerpc/include/atomic.h b/sys/powerpc/include/atomic.h
index c3dc3cc..77f5732 100644
--- a/sys/powerpc/include/atomic.h
+++ b/sys/powerpc/include/atomic.h
@@ -48,13 +48,7 @@
* { *p += v; }
*/
-#define __ATOMIC_ADD_8(p, v, t) \
- 8-bit atomic_add not implemented
-
-#define __ATOMIC_ADD_16(p, v, t) \
- 16-bit atomic_add not implemented
-
-#define __ATOMIC_ADD_32(p, v, t) \
+#define __atomic_add_int(p, v, t) \
__asm __volatile( \
"1: lwarx %0, 0, %2\n" \
" add %0, %3, %0\n" \
@@ -63,10 +57,10 @@
: "=&r" (t), "=m" (*p) \
: "r" (p), "r" (v), "m" (*p) \
: "cc", "memory") \
- /* __ATOMIC_ADD_32 */
+ /* __atomic_add_int */
#ifdef __powerpc64__
-#define __ATOMIC_ADD_64(p, v, t) \
+#define __atomic_add_long(p, v, t) \
__asm __volatile( \
"1: ldarx %0, 0, %2\n" \
" add %0, %3, %0\n" \
@@ -75,69 +69,72 @@
: "=&r" (t), "=m" (*p) \
: "r" (p), "r" (v), "m" (*p) \
: "cc", "memory") \
- /* __ATOMIC_ADD_64 */
+ /* __atomic_add_long */
#else
-#define __ATOMIC_ADD_64(p, v, t) \
- 64-bit atomic_add not implemented
+#define __atomic_add_long(p, v, t) \
+ __asm __volatile( \
+ "1: lwarx %0, 0, %2\n" \
+ " add %0, %3, %0\n" \
+ " stwcx. %0, 0, %2\n" \
+ " bne- 1b\n" \
+ : "=&r" (t), "=m" (*p) \
+ : "r" (p), "r" (v), "m" (*p) \
+ : "cc", "memory") \
+ /* __atomic_add_long */
#endif
-#define _ATOMIC_ADD(width, suffix, type) \
+#define _ATOMIC_ADD(type) \
static __inline void \
- atomic_add_##suffix(volatile type *p, type v) { \
- type t; \
- __ATOMIC_ADD_##width(p, v, t); \
+ atomic_add_##type(volatile u_##type *p, u_##type v) { \
+ u_##type t; \
+ __atomic_add_##type(p, v, t); \
} \
\
static __inline void \
- atomic_add_acq_##suffix(volatile type *p, type v) { \
- type t; \
- __ATOMIC_ADD_##width(p, v, t); \
+ atomic_add_acq_##type(volatile u_##type *p, u_##type v) { \
+ u_##type t; \
+ __atomic_add_##type(p, v, t); \
__ATOMIC_BARRIER; \
} \
\
static __inline void \
- atomic_add_rel_##suffix(volatile type *p, type v) { \
- type t; \
+ atomic_add_rel_##type(volatile u_##type *p, u_##type v) { \
+ u_##type t; \
__ATOMIC_BARRIER; \
- __ATOMIC_ADD_##width(p, v, t); \
+ __atomic_add_##type(p, v, t); \
} \
/* _ATOMIC_ADD */
-#if 0
-_ATOMIC_ADD(8, 8, uint8_t)
-_ATOMIC_ADD(8, char, u_char)
-_ATOMIC_ADD(16, 16, uint16_t)
-_ATOMIC_ADD(16, short, u_short)
-#endif
-_ATOMIC_ADD(32, 32, uint32_t)
-_ATOMIC_ADD(32, int, u_int)
+_ATOMIC_ADD(int)
+_ATOMIC_ADD(long)
+
+#define atomic_add_32 atomic_add_int
+#define atomic_add_acq_32 atomic_add_acq_int
+#define atomic_add_rel_32 atomic_add_rel_int
+
#ifdef __powerpc64__
-_ATOMIC_ADD(64, 64, uint64_t)
-_ATOMIC_ADD(64, long, u_long)
-_ATOMIC_ADD(64, ptr, uintptr_t)
+#define atomic_add_64 atomic_add_long
+#define atomic_add_acq_64 atomic_add_acq_long
+#define atomic_add_rel_64 atomic_add_rel_long
+
+#define atomic_add_ptr atomic_add_long
+#define atomic_add_acq_ptr atomic_add_acq_long
+#define atomic_add_rel_ptr atomic_add_rel_long
#else
-_ATOMIC_ADD(32, long, u_long)
-_ATOMIC_ADD(32, ptr, uintptr_t)
+#define atomic_add_ptr atomic_add_int
+#define atomic_add_acq_ptr atomic_add_acq_int
+#define atomic_add_rel_ptr atomic_add_rel_int
#endif
-
#undef _ATOMIC_ADD
-#undef __ATOMIC_ADD_64
-#undef __ATOMIC_ADD_32
-#undef __ATOMIC_ADD_16
-#undef __ATOMIC_ADD_8
+#undef __atomic_add_long
+#undef __atomic_add_int
/*
* atomic_clear(p, v)
* { *p &= ~v; }
*/
-#define __ATOMIC_CLEAR_8(p, v, t) \
- 8-bit atomic_clear not implemented
-
-#define __ATOMIC_CLEAR_16(p, v, t) \
- 16-bit atomic_clear not implemented
-
-#define __ATOMIC_CLEAR_32(p, v, t) \
+#define __atomic_clear_int(p, v, t) \
__asm __volatile( \
"1: lwarx %0, 0, %2\n" \
" andc %0, %0, %3\n" \
@@ -146,10 +143,10 @@ _ATOMIC_ADD(32, ptr, uintptr_t)
: "=&r" (t), "=m" (*p) \
: "r" (p), "r" (v), "m" (*p) \
: "cc", "memory") \
- /* __ATOMIC_CLEAR_32 */
+ /* __atomic_clear_int */
#ifdef __powerpc64__
-#define __ATOMIC_CLEAR_64(p, v, t) \
+#define __atomic_clear_long(p, v, t) \
__asm __volatile( \
"1: ldarx %0, 0, %2\n" \
" andc %0, %0, %3\n" \
@@ -158,56 +155,66 @@ _ATOMIC_ADD(32, ptr, uintptr_t)
: "=&r" (t), "=m" (*p) \
: "r" (p), "r" (v), "m" (*p) \
: "cc", "memory") \
- /* __ATOMIC_CLEAR_64 */
+ /* __atomic_clear_long */
#else
-#define __ATOMIC_CLEAR_64(p, v, t) \
- 64-bit atomic_clear not implemented
+#define __atomic_clear_long(p, v, t) \
+ __asm __volatile( \
+ "1: lwarx %0, 0, %2\n" \
+ " andc %0, %0, %3\n" \
+ " stwcx. %0, 0, %2\n" \
+ " bne- 1b\n" \
+ : "=&r" (t), "=m" (*p) \
+ : "r" (p), "r" (v), "m" (*p) \
+ : "cc", "memory") \
+ /* __atomic_clear_long */
#endif
-#define _ATOMIC_CLEAR(width, suffix, type) \
+#define _ATOMIC_CLEAR(type) \
static __inline void \
- atomic_clear_##suffix(volatile type *p, type v) { \
- type t; \
- __ATOMIC_CLEAR_##width(p, v, t); \
+ atomic_clear_##type(volatile u_##type *p, u_##type v) { \
+ u_##type t; \
+ __atomic_clear_##type(p, v, t); \
} \
\
static __inline void \
- atomic_clear_acq_##suffix(volatile type *p, type v) { \
- type t; \
- __ATOMIC_CLEAR_##width(p, v, t); \
+ atomic_clear_acq_##type(volatile u_##type *p, u_##type v) { \
+ u_##type t; \
+ __atomic_clear_##type(p, v, t); \
__ATOMIC_BARRIER; \
} \
\
static __inline void \
- atomic_clear_rel_##suffix(volatile type *p, type v) { \
- type t; \
+ atomic_clear_rel_##type(volatile u_##type *p, u_##type v) { \
+ u_##type t; \
__ATOMIC_BARRIER; \
- __ATOMIC_CLEAR_##width(p, v, t); \
+ __atomic_clear_##type(p, v, t); \
} \
/* _ATOMIC_CLEAR */
-#if 0
-_ATOMIC_CLEAR(8, 8, uint8_t)
-_ATOMIC_CLEAR(8, char, u_char)
-_ATOMIC_CLEAR(16, 16, uint16_t)
-_ATOMIC_CLEAR(16, short, u_short)
-#endif
-_ATOMIC_CLEAR(32, 32, uint32_t)
-_ATOMIC_CLEAR(32, int, u_int)
+
+_ATOMIC_CLEAR(int)
+_ATOMIC_CLEAR(long)
+
+#define atomic_clear_32 atomic_clear_int
+#define atomic_clear_acq_32 atomic_clear_acq_int
+#define atomic_clear_rel_32 atomic_clear_rel_int
+
#ifdef __powerpc64__
-_ATOMIC_CLEAR(64, 64, uint64_t)
-_ATOMIC_CLEAR(64, long, u_long)
-_ATOMIC_CLEAR(64, ptr, uintptr_t)
+#define atomic_clear_64 atomic_clear_long
+#define atomic_clear_acq_64 atomic_clear_acq_long
+#define atomic_clear_rel_64 atomic_clear_rel_long
+
+#define atomic_clear_ptr atomic_clear_long
+#define atomic_clear_acq_ptr atomic_clear_acq_long
+#define atomic_clear_rel_ptr atomic_clear_rel_long
#else
-_ATOMIC_CLEAR(32, long, u_long)
-_ATOMIC_CLEAR(32, ptr, uintptr_t)
+#define atomic_clear_ptr atomic_clear_int
+#define atomic_clear_acq_ptr atomic_clear_acq_int
+#define atomic_clear_rel_ptr atomic_clear_rel_int
#endif
-
#undef _ATOMIC_CLEAR
-#undef __ATOMIC_CLEAR_64
-#undef __ATOMIC_CLEAR_32
-#undef __ATOMIC_CLEAR_16
-#undef __ATOMIC_CLEAR_8
+#undef __atomic_clear_long
+#undef __atomic_clear_int
/*
* atomic_cmpset(p, o, n)
@@ -229,13 +236,7 @@ _ATOMIC_CLEAR(32, ptr, uintptr_t)
* { *p |= v; }
*/
-#define __ATOMIC_SET_8(p, v, t) \
- 8-bit atomic_set not implemented
-
-#define __ATOMIC_SET_16(p, v, t) \
- 16-bit atomic_set not implemented
-
-#define __ATOMIC_SET_32(p, v, t) \
+#define __atomic_set_int(p, v, t) \
__asm __volatile( \
"1: lwarx %0, 0, %2\n" \
" or %0, %3, %0\n" \
@@ -244,10 +245,10 @@ _ATOMIC_CLEAR(32, ptr, uintptr_t)
: "=&r" (t), "=m" (*p) \
: "r" (p), "r" (v), "m" (*p) \
: "cc", "memory") \
- /* __ATOMIC_SET_32 */
+ /* __atomic_set_int */
#ifdef __powerpc64__
-#define __ATOMIC_SET_64(p, v, t) \
+#define __atomic_set_long(p, v, t) \
__asm __volatile( \
"1: ldarx %0, 0, %2\n" \
" or %0, %3, %0\n" \
@@ -256,69 +257,72 @@ _ATOMIC_CLEAR(32, ptr, uintptr_t)
: "=&r" (t), "=m" (*p) \
: "r" (p), "r" (v), "m" (*p) \
: "cc", "memory") \
- /* __ATOMIC_SET_64 */
+ /* __atomic_set_long */
#else
-#define __ATOMIC_SET_64(p, v, t) \
- 64-bit atomic_set not implemented
+#define __atomic_set_long(p, v, t) \
+ __asm __volatile( \
+ "1: lwarx %0, 0, %2\n" \
+ " or %0, %3, %0\n" \
+ " stwcx. %0, 0, %2\n" \
+ " bne- 1b\n" \
+ : "=&r" (t), "=m" (*p) \
+ : "r" (p), "r" (v), "m" (*p) \
+ : "cc", "memory") \
+ /* __atomic_set_long */
#endif
-#define _ATOMIC_SET(width, suffix, type) \
+#define _ATOMIC_SET(type) \
static __inline void \
- atomic_set_##suffix(volatile type *p, type v) { \
- type t; \
- __ATOMIC_SET_##width(p, v, t); \
+ atomic_set_##type(volatile u_##type *p, u_##type v) { \
+ u_##type t; \
+ __atomic_set_##type(p, v, t); \
} \
\
static __inline void \
- atomic_set_acq_##suffix(volatile type *p, type v) { \
- type t; \
- __ATOMIC_SET_##width(p, v, t); \
+ atomic_set_acq_##type(volatile u_##type *p, u_##type v) { \
+ u_##type t; \
+ __atomic_set_##type(p, v, t); \
__ATOMIC_BARRIER; \
} \
\
static __inline void \
- atomic_set_rel_##suffix(volatile type *p, type v) { \
- type t; \
+ atomic_set_rel_##type(volatile u_##type *p, u_##type v) { \
+ u_##type t; \
__ATOMIC_BARRIER; \
- __ATOMIC_SET_##width(p, v, t); \
+ __atomic_set_##type(p, v, t); \
} \
/* _ATOMIC_SET */
-#if 0
-_ATOMIC_SET(8, 8, uint8_t)
-_ATOMIC_SET(8, char, u_char)
-_ATOMIC_SET(16, 16, uint16_t)
-_ATOMIC_SET(16, short, u_short)
-#endif
-_ATOMIC_SET(32, 32, uint32_t)
-_ATOMIC_SET(32, int, u_int)
+_ATOMIC_SET(int)
+_ATOMIC_SET(long)
+
+#define atomic_set_32 atomic_set_int
+#define atomic_set_acq_32 atomic_set_acq_int
+#define atomic_set_rel_32 atomic_set_rel_int
+
#ifdef __powerpc64__
-_ATOMIC_SET(64, 64, uint64_t)
-_ATOMIC_SET(64, long, u_long)
-_ATOMIC_SET(64, ptr, uintptr_t)
+#define atomic_set_64 atomic_set_long
+#define atomic_set_acq_64 atomic_set_acq_long
+#define atomic_set_rel_64 atomic_set_rel_long
+
+#define atomic_set_ptr atomic_set_long
+#define atomic_set_acq_ptr atomic_set_acq_long
+#define atomic_set_rel_ptr atomic_set_rel_long
#else
-_ATOMIC_SET(32, long, u_long)
-_ATOMIC_SET(32, ptr, uintptr_t)
+#define atomic_set_ptr atomic_set_int
+#define atomic_set_acq_ptr atomic_set_acq_int
+#define atomic_set_rel_ptr atomic_set_rel_int
#endif
-
#undef _ATOMIC_SET
-#undef __ATOMIC_SET_64
-#undef __ATOMIC_SET_32
-#undef __ATOMIC_SET_16
-#undef __ATOMIC_SET_8
+#undef __atomic_set_long
+#undef __atomic_set_int
/*
* atomic_subtract(p, v)
* { *p -= v; }
*/
-#define __ATOMIC_SUBTRACT_8(p, v, t) \
- 8-bit atomic_subtract not implemented
-
-#define __ATOMIC_SUBTRACT_16(p, v, t) \
- 16-bit atomic_subtract not implemented
-
-#define __ATOMIC_SUBTRACT_32(p, v, t) \
+#define __atomic_subtract_int(p, v, t) \
__asm __volatile( \
"1: lwarx %0, 0, %2\n" \
" subf %0, %3, %0\n" \
@@ -327,10 +331,10 @@ _ATOMIC_SET(32, ptr, uintptr_t)
: "=&r" (t), "=m" (*p) \
: "r" (p), "r" (v), "m" (*p) \
: "cc", "memory") \
- /* __ATOMIC_SUBTRACT_32 */
+ /* __atomic_subtract_int */
#ifdef __powerpc64__
-#define __ATOMIC_SUBTRACT_64(p, v, t) \
+#define __atomic_subtract_long(p, v, t) \
__asm __volatile( \
"1: ldarx %0, 0, %2\n" \
" subf %0, %3, %0\n" \
@@ -339,56 +343,65 @@ _ATOMIC_SET(32, ptr, uintptr_t)
: "=&r" (t), "=m" (*p) \
: "r" (p), "r" (v), "m" (*p) \
: "cc", "memory") \
- /* __ATOMIC_SUBTRACT_64 */
+ /* __atomic_subtract_long */
#else
-#define __ATOMIC_SUBTRACT_64(p, v, t) \
- 64-bit atomic_subtract not implemented
+#define __atomic_subtract_long(p, v, t) \
+ __asm __volatile( \
+ "1: lwarx %0, 0, %2\n" \
+ " subf %0, %3, %0\n" \
+ " stwcx. %0, 0, %2\n" \
+ " bne- 1b\n" \
+ : "=&r" (t), "=m" (*p) \
+ : "r" (p), "r" (v), "m" (*p) \
+ : "cc", "memory") \
+ /* __atomic_subtract_long */
#endif
-#define _ATOMIC_SUBTRACT(width, suffix, type) \
- static __inline void \
- atomic_subtract_##suffix(volatile type *p, type v) { \
- type t; \
- __ATOMIC_SUBTRACT_##width(p, v, t); \
- } \
- \
- static __inline void \
- atomic_subtract_acq_##suffix(volatile type *p, type v) { \
- type t; \
- __ATOMIC_SUBTRACT_##width(p, v, t); \
- __ATOMIC_BARRIER; \
- } \
- \
- static __inline void \
- atomic_subtract_rel_##suffix(volatile type *p, type v) { \
- type t; \
- __ATOMIC_BARRIER; \
- __ATOMIC_SUBTRACT_##width(p, v, t); \
- } \
+#define _ATOMIC_SUBTRACT(type) \
+ static __inline void \
+ atomic_subtract_##type(volatile u_##type *p, u_##type v) { \
+ u_##type t; \
+ __atomic_subtract_##type(p, v, t); \
+ } \
+ \
+ static __inline void \
+ atomic_subtract_acq_##type(volatile u_##type *p, u_##type v) { \
+ u_##type t; \
+ __atomic_subtract_##type(p, v, t); \
+ __ATOMIC_BARRIER; \
+ } \
+ \
+ static __inline void \
+ atomic_subtract_rel_##type(volatile u_##type *p, u_##type v) { \
+ u_##type t; \
+ __ATOMIC_BARRIER; \
+ __atomic_subtract_##type(p, v, t); \
+ } \
/* _ATOMIC_SUBTRACT */
-#if 0
-_ATOMIC_SUBTRACT(8, 8, uint8_t)
-_ATOMIC_SUBTRACT(8, char, u_char)
-_ATOMIC_SUBTRACT(16, 16, uint16_t)
-_ATOMIC_SUBTRACT(16, short, u_short)
-#endif
-_ATOMIC_SUBTRACT(32, 32, uint32_t)
-_ATOMIC_SUBTRACT(32, int, u_int)
+_ATOMIC_SUBTRACT(int)
+_ATOMIC_SUBTRACT(long)
+
+#define atomic_subtract_32 atomic_subtract_int
+#define atomic_subtract_acq_32 atomic_subtract_acq_int
+#define atomic_subtract_rel_32 atomic_subtract_rel_int
+
#ifdef __powerpc64__
-_ATOMIC_SUBTRACT(64, 64, uint64_t)
-_ATOMIC_SUBTRACT(64, long, u_long)
-_ATOMIC_SUBTRACT(64, ptr, uintptr_t)
+#define atomic_subtract_64 atomic_subtract_long
+#define atomic_subtract_acq_64 atomic_subract_acq_long
+#define atomic_subtract_rel_64 atomic_subtract_rel_long
+
+#define atomic_subtract_ptr atomic_subtract_long
+#define atomic_subtract_acq_ptr atomic_subtract_acq_long
+#define atomic_subtract_rel_ptr atomic_subtract_rel_long
#else
-_ATOMIC_SUBTRACT(32, long, u_long)
-_ATOMIC_SUBTRACT(32, ptr, uintptr_t)
+#define atomic_subtract_ptr atomic_subtract_int
+#define atomic_subtract_acq_ptr atomic_subtract_acq_int
+#define atomic_subtract_rel_ptr atomic_subtract_rel_int
#endif
-
#undef _ATOMIC_SUBTRACT
-#undef __ATOMIC_SUBTRACT_64
-#undef __ATOMIC_SUBTRACT_32
-#undef __ATOMIC_SUBTRACT_16
-#undef __ATOMIC_SUBTRACT_8
+#undef __atomic_subtract_long
+#undef __atomic_subtract_int
/*
* atomic_store_rel(p, v)
@@ -399,10 +412,10 @@ _ATOMIC_SUBTRACT(32, ptr, uintptr_t)
* Old/original implementations that still need revisiting.
*/
-static __inline uint32_t
-atomic_readandclear_32(volatile uint32_t *addr)
+static __inline u_int
+atomic_readandclear_int(volatile u_int *addr)
{
- uint32_t result,temp;
+ u_int result,temp;
#ifdef __GNUCLIKE_ASM
__asm __volatile (
@@ -420,10 +433,10 @@ atomic_readandclear_32(volatile uint32_t *addr)
}
#ifdef __powerpc64__
-static __inline uint64_t
-atomic_readandclear_64(volatile uint64_t *addr)
+static __inline u_long
+atomic_readandclear_long(volatile u_long *addr)
{
- uint64_t result,temp;
+ u_long result,temp;
#ifdef __GNUCLIKE_ASM
__asm __volatile (
@@ -441,37 +454,27 @@ atomic_readandclear_64(volatile uint64_t *addr)
}
#endif
-#define atomic_readandclear_int atomic_readandclear_32
+#define atomic_readandclear_32 atomic_readandclear_int
#ifdef __powerpc64__
-#define atomic_readandclear_long atomic_readandclear_64
-#define atomic_readandclear_ptr atomic_readandclear_64
+#define atomic_readandclear_64 atomic_readandclear_long
+
+#define atomic_readandclear_ptr atomic_readandclear_long
#else
-#define atomic_readandclear_long atomic_readandclear_32
-#define atomic_readandclear_ptr atomic_readandclear_32
+static __inline u_long
+atomic_readandclear_long(volatile u_long *addr)
+{
+
+ return ((u_long)atomic_readandclear_int((volatile u_int *)addr));
+}
+
+#define atomic_readandclear_ptr atomic_readandclear_int
#endif
/*
* We assume that a = b will do atomic loads and stores.
*/
-#define ATOMIC_STORE_LOAD(TYPE, WIDTH) \
-static __inline u_##TYPE \
-atomic_load_acq_##WIDTH(volatile u_##TYPE *p) \
-{ \
- u_##TYPE v; \
- \
- v = *p; \
- __ATOMIC_BARRIER; \
- return (v); \
-} \
- \
-static __inline void \
-atomic_store_rel_##WIDTH(volatile u_##TYPE *p, u_##TYPE v) \
-{ \
- __ATOMIC_BARRIER; \
- *p = v; \
-} \
- \
+#define ATOMIC_STORE_LOAD(TYPE) \
static __inline u_##TYPE \
atomic_load_acq_##TYPE(volatile u_##TYPE *p) \
{ \
@@ -489,25 +492,37 @@ atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v) \
*p = v; \
}
-ATOMIC_STORE_LOAD(char, 8)
-ATOMIC_STORE_LOAD(short, 16)
-ATOMIC_STORE_LOAD(int, 32)
-#ifdef __powerpc64__
-ATOMIC_STORE_LOAD(long, 64)
-#endif
+ATOMIC_STORE_LOAD(int)
+
+#define atomic_load_acq_32 atomic_load_acq_int
+#define atomic_store_rel_32 atomic_store_rel_int
#ifdef __powerpc64__
-#define atomic_load_acq_long atomic_load_acq_64
-#define atomic_store_rel_long atomic_store_rel_64
-#define atomic_load_acq_ptr atomic_load_acq_64
-#define atomic_store_rel_ptr atomic_store_rel_64
+ATOMIC_STORE_LOAD(long)
+
+#define atomic_load_acq_64 atomic_load_acq_long
+#define atomic_store_rel_64 atomic_store_rel_long
+
+#define atomic_load_acq_ptr atomic_load_acq_long
+#define atomic_store_rel_ptr atomic_store_rel_long
#else
-#define atomic_load_acq_long atomic_load_acq_32
-#define atomic_store_rel_long atomic_store_rel_32
-#define atomic_load_acq_ptr atomic_load_acq_32
-#define atomic_store_rel_ptr atomic_store_rel_32
-#endif
+static __inline u_long
+atomic_load_acq_long(volatile u_long *addr)
+{
+ return ((u_long)atomic_load_acq_int((volatile u_int *)addr));
+}
+
+static __inline void
+atomic_store_rel_long(volatile u_long *addr, u_long val)
+{
+
+ atomic_store_rel_int((volatile u_int *)addr, (u_int)val);
+}
+
+#define atomic_load_acq_ptr atomic_load_acq_int
+#define atomic_store_rel_ptr atomic_store_rel_int
+#endif
#undef ATOMIC_STORE_LOAD
/*
@@ -516,7 +531,7 @@ ATOMIC_STORE_LOAD(long, 64)
* zero if the compare failed, nonzero otherwise.
*/
static __inline int
-atomic_cmpset_32(volatile uint32_t* p, uint32_t cmpval, uint32_t newval)
+atomic_cmpset_int(volatile u_int* p, u_int cmpval, u_int newval)
{
int ret;
@@ -540,7 +555,6 @@ atomic_cmpset_32(volatile uint32_t* p, uint32_t cmpval, uint32_t newval)
return (ret);
}
-
static __inline int
atomic_cmpset_long(volatile u_long* p, u_long cmpval, u_long newval)
{
@@ -552,21 +566,21 @@ atomic_cmpset_long(volatile u_long* p, u_long cmpval, u_long newval)
"1:\tldarx %0, 0, %2\n\t" /* load old value */
"cmpld %3, %0\n\t" /* compare */
"bne 2f\n\t" /* exit if not equal */
- "stdcx. %4, 0, %2\n\t" /* attempt to store */
+ "stdcx. %4, 0, %2\n\t" /* attempt to store */
#else
"1:\tlwarx %0, 0, %2\n\t" /* load old value */
"cmplw %3, %0\n\t" /* compare */
"bne 2f\n\t" /* exit if not equal */
- "stwcx. %4, 0, %2\n\t" /* attempt to store */
+ "stwcx. %4, 0, %2\n\t" /* attempt to store */
#endif
"bne- 1b\n\t" /* spin if failed */
"li %0, 1\n\t" /* success - retval = 1 */
"b 3f\n\t" /* we've succeeded */
"2:\n\t"
#ifdef __powerpc64__
- "stdcx. %0, 0, %2\n\t" /* clear reservation (74xx) */
+ "stdcx. %0, 0, %2\n\t" /* clear reservation (74xx) */
#else
- "stwcx. %0, 0, %2\n\t" /* clear reservation (74xx) */
+ "stwcx. %0, 0, %2\n\t" /* clear reservation (74xx) */
#endif
"li %0, 0\n\t" /* failure - retval = 0 */
"3:\n\t"
@@ -578,31 +592,21 @@ atomic_cmpset_long(volatile u_long* p, u_long cmpval, u_long newval)
return (ret);
}
-#define atomic_cmpset_int atomic_cmpset_32
-
-#ifdef __powerpc64__
-#define atomic_cmpset_ptr(dst, old, new) \
- atomic_cmpset_long((volatile u_long *)(dst), (u_long)(old), (u_long)(new))
-#else
-#define atomic_cmpset_ptr(dst, old, new) \
- atomic_cmpset_32((volatile u_int *)(dst), (u_int)(old), (u_int)(new))
-#endif
-
static __inline int
-atomic_cmpset_acq_32(volatile uint32_t *p, uint32_t cmpval, uint32_t newval)
+atomic_cmpset_acq_int(volatile u_int *p, u_int cmpval, u_int newval)
{
int retval;
- retval = atomic_cmpset_32(p, cmpval, newval);
+ retval = atomic_cmpset_int(p, cmpval, newval);
__ATOMIC_BARRIER;
return (retval);
}
static __inline int
-atomic_cmpset_rel_32(volatile uint32_t *p, uint32_t cmpval, uint32_t newval)
+atomic_cmpset_rel_int(volatile u_int *p, u_int cmpval, u_int newval)
{
__ATOMIC_BARRIER;
- return (atomic_cmpset_32(p, cmpval, newval));
+ return (atomic_cmpset_int(p, cmpval, newval));
}
static __inline int
@@ -622,39 +626,39 @@ atomic_cmpset_rel_long(volatile u_long *p, u_long cmpval, u_long newval)
return (atomic_cmpset_long(p, cmpval, newval));
}
-#define atomic_cmpset_acq_int atomic_cmpset_acq_32
-#define atomic_cmpset_rel_int atomic_cmpset_rel_32
+#define atomic_cmpset_32 atomic_cmpset_int
+#define atomic_cmpset_acq_32 atomic_cmpset_acq_int
+#define atomic_cmpset_rel_32 atomic_cmpset_rel_int
#ifdef __powerpc64__
-#define atomic_cmpset_acq_ptr(dst, old, new) \
- atomic_cmpset_acq_long((volatile u_long *)(dst), (u_long)(old), (u_long)(new))
-#define atomic_cmpset_rel_ptr(dst, old, new) \
- atomic_cmpset_rel_long((volatile u_long *)(dst), (u_long)(old), (u_long)(new))
+#define atomic_cmpset_64 atomic_cmpset_long
+#define atomic_cmpset_acq_64 atomic_cmpset_acq_long
+#define atomic_cmpset_rel_64 atomic_cmpset_rel_long
+
+#define atomic_cmpset_ptr atomic_cmpset_long
+#define atomic_cmpset_acq_ptr atomic_cmpset_acq_long
+#define atomic_cmpset_rel_ptr atomic_cmpset_rel_long
#else
-#define atomic_cmpset_acq_ptr(dst, old, new) \
- atomic_cmpset_acq_32((volatile u_int *)(dst), (u_int)(old), (u_int)(new))
-#define atomic_cmpset_rel_ptr(dst, old, new) \
- atomic_cmpset_rel_32((volatile u_int *)(dst), (u_int)(old), (u_int)(new))
+#define atomic_cmpset_ptr atomic_cmpset_int
+#define atomic_cmpset_acq_ptr atomic_cmpset_acq_int
+#define atomic_cmpset_rel_ptr atomic_cmpset_rel_int
#endif
-static __inline uint32_t
-atomic_fetchadd_32(volatile uint32_t *p, uint32_t v)
+static __inline u_int
+atomic_fetchadd_int(volatile u_int *p, u_int v)
{
- uint32_t value;
+ u_int value;
do {
value = *p;
- } while (!atomic_cmpset_32(p, value, value + v));
+ } while (!atomic_cmpset_int(p, value, value + v));
return (value);
}
-#define atomic_fetchadd_int atomic_fetchadd_32
-
-#ifdef __powerpc64__
-static __inline uint64_t
-atomic_fetchadd_64(volatile uint64_t *p, uint64_t v)
+static __inline u_long
+atomic_fetchadd_long(volatile u_long *p, u_long v)
{
- uint64_t value;
+ u_long value;
do {
value = *p;
@@ -662,10 +666,10 @@ atomic_fetchadd_64(volatile uint64_t *p, uint64_t v)
return (value);
}
-#define atomic_fetchadd_long atomic_fetchadd_64
-#else
-#define atomic_fetchadd_long(p, v) \
- (u_long)atomic_fetchadd_32((volatile u_int *)(p), (u_int)(v))
+#define atomic_fetchadd_32 atomic_fetchadd_int
+
+#ifdef __powerpc64__
+#define atomic_fetchadd_64 atomic_fetchadd_long
#endif
#endif /* ! _MACHINE_ATOMIC_H_ */
diff --git a/sys/powerpc/powerpc/platform.c b/sys/powerpc/powerpc/platform.c
index 02d89ee..9eb8f30 100644
--- a/sys/powerpc/powerpc/platform.c
+++ b/sys/powerpc/powerpc/platform.c
@@ -93,7 +93,7 @@ mem_valid(vm_offset_t addr, int len)
for (i = 0; i < npregions; i++)
if ((addr >= pregions[i].mr_start)
- && (addr + len < pregions[i].mr_start + pregions[i].mr_size))
+ && (addr + len <= pregions[i].mr_start + pregions[i].mr_size))
return (0);
return (EFAULT);
diff --git a/sys/powerpc/ps3/ps3bus.c b/sys/powerpc/ps3/ps3bus.c
index 11dbba5..6a5120a 100644
--- a/sys/powerpc/ps3/ps3bus.c
+++ b/sys/powerpc/ps3/ps3bus.c
@@ -31,6 +31,7 @@
#include <sys/module.h>
#include <sys/malloc.h>
#include <sys/bus.h>
+#include <sys/clock.h>
#include <sys/cpu.h>
#include <sys/resource.h>
#include <sys/rman.h>
@@ -46,6 +47,7 @@
#include "ps3bus.h"
#include "ps3-hvcall.h"
#include "iommu_if.h"
+#include "clock_if.h"
static void ps3bus_identify(driver_t *, device_t);
static int ps3bus_probe(device_t);
@@ -63,6 +65,8 @@ static int ps3_iommu_map(device_t dev, bus_dma_segment_t *segs, int *nsegs,
bus_size_t boundary, void *cookie);
static int ps3_iommu_unmap(device_t dev, bus_dma_segment_t *segs,
int nsegs, void *cookie);
+static int ps3_gettime(device_t dev, struct timespec *ts);
+static int ps3_settime(device_t dev, struct timespec *ts);
struct ps3bus_devinfo {
int bus;
@@ -106,6 +110,10 @@ static device_method_t ps3bus_methods[] = {
DEVMETHOD(iommu_map, ps3_iommu_map),
DEVMETHOD(iommu_unmap, ps3_iommu_unmap),
+ /* Clock interface */
+ DEVMETHOD(clock_gettime, ps3_gettime),
+ DEVMETHOD(clock_settime, ps3_settime),
+
{ 0, 0 }
};
@@ -312,6 +320,8 @@ ps3bus_attach(device_t self)
device_set_ivars(cdev, dinfo);
}
}
+
+ clock_register(self, 1000);
return (bus_generic_attach(self));
}
@@ -551,7 +561,6 @@ ps3_iommu_map(device_t dev, bus_dma_segment_t *segs, int *nsegs,
return (0);
}
-
static int
ps3_iommu_unmap(device_t dev, bus_dma_segment_t *segs, int nsegs, void *cookie)
{
@@ -559,3 +568,26 @@ ps3_iommu_unmap(device_t dev, bus_dma_segment_t *segs, int nsegs, void *cookie)
return (0);
}
+#define Y2K 946684800
+
+static int
+ps3_gettime(device_t dev, struct timespec *ts)
+{
+ uint64_t rtc, tb;
+ int result;
+
+ result = lv1_get_rtc(&rtc, &tb);
+ if (result)
+ return (result);
+
+ ts->tv_sec = rtc + Y2K;
+ ts->tv_nsec = 0;
+ return (0);
+}
+
+static int
+ps3_settime(device_t dev, struct timespec *ts)
+{
+ return (-1);
+}
+
diff --git a/sys/sparc64/sparc64/eeprom.c b/sys/sparc64/sparc64/eeprom.c
index da9909a..e90aecb 100644
--- a/sys/sparc64/sparc64/eeprom.c
+++ b/sys/sparc64/sparc64/eeprom.c
@@ -107,8 +107,11 @@ DRIVER_MODULE(eeprom, sbus, eeprom_driver, eeprom_devclass, 0, 0);
static int
eeprom_probe(device_t dev)
{
+ const char *name;
- if (strcmp("eeprom", ofw_bus_get_name(dev)) == 0) {
+ name = ofw_bus_get_name(dev);
+ if (strcmp(name, "eeprom") == 0 ||
+ strcmp(name, "FJSV,eeprom") == 0) {
device_set_desc(dev, "EEPROM/clock");
return (0);
}
diff --git a/sys/sys/dtrace_bsd.h b/sys/sys/dtrace_bsd.h
index 2eded7b..15e1be9 100644
--- a/sys/sys/dtrace_bsd.h
+++ b/sys/sys/dtrace_bsd.h
@@ -44,14 +44,9 @@ struct reg;
* subsystem into the appropriate timer interrupt.
*/
typedef void (*cyclic_clock_func_t)(struct trapframe *);
+extern cyclic_clock_func_t cyclic_clock_func;
-/*
- * These external variables are actually machine-dependent, so
- * they might not actually exist.
- *
- * Defining them here avoids a proliferation of header files.
- */
-extern cyclic_clock_func_t cyclic_clock_func[];
+void clocksource_cyc_set(const struct bintime *t);
/*
* The dtrace module handles traps that occur during a DTrace probe.
diff --git a/sys/sys/mount.h b/sys/sys/mount.h
index 231e3d6..d636607 100644
--- a/sys/sys/mount.h
+++ b/sys/sys/mount.h
@@ -566,7 +566,8 @@ typedef int vfs_statfs_t(struct mount *mp, struct statfs *sbp);
typedef int vfs_sync_t(struct mount *mp, int waitfor);
typedef int vfs_vget_t(struct mount *mp, ino_t ino, int flags,
struct vnode **vpp);
-typedef int vfs_fhtovp_t(struct mount *mp, struct fid *fhp, struct vnode **vpp);
+typedef int vfs_fhtovp_t(struct mount *mp, struct fid *fhp,
+ int flags, struct vnode **vpp);
typedef int vfs_checkexp_t(struct mount *mp, struct sockaddr *nam,
int *extflagsp, struct ucred **credanonp,
int *numsecflavors, int **secflavors);
@@ -610,8 +611,8 @@ vfs_statfs_t __vfs_statfs;
#define VFS_SYNC(MP, WAIT) (*(MP)->mnt_op->vfs_sync)(MP, WAIT)
#define VFS_VGET(MP, INO, FLAGS, VPP) \
(*(MP)->mnt_op->vfs_vget)(MP, INO, FLAGS, VPP)
-#define VFS_FHTOVP(MP, FIDP, VPP) \
- (*(MP)->mnt_op->vfs_fhtovp)(MP, FIDP, VPP)
+#define VFS_FHTOVP(MP, FIDP, FLAGS, VPP) \
+ (*(MP)->mnt_op->vfs_fhtovp)(MP, FIDP, FLAGS, VPP)
#define VFS_CHECKEXP(MP, NAM, EXFLG, CRED, NUMSEC, SEC) \
(*(MP)->mnt_op->vfs_checkexp)(MP, NAM, EXFLG, CRED, NUMSEC, SEC)
#define VFS_EXTATTRCTL(MP, C, FN, NS, N) \
diff --git a/sys/sys/param.h b/sys/sys/param.h
index 7fbcde5..838769f 100644
--- a/sys/sys/param.h
+++ b/sys/sys/param.h
@@ -58,7 +58,7 @@
* in the range 5 to 9.
*/
#undef __FreeBSD_version
-#define __FreeBSD_version 900037 /* Master, propagated to newvers */
+#define __FreeBSD_version 900038 /* Master, propagated to newvers */
#ifdef _KERNEL
#define P_OSREL_SIGSEGV 700004
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index e74da83..4d7b540 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -157,21 +157,21 @@ struct pargs {
* either lock is sufficient for read access, but both locks must be held
* for write access.
*/
-struct racct;
+struct cpuset;
+struct kaioinfo;
struct kaudit_record;
-struct td_sched;
+struct kdtrace_proc;
+struct kdtrace_thread;
+struct mqueue_notifier;
struct nlminfo;
-struct kaioinfo;
struct p_sched;
struct proc;
+struct racct;
struct sleepqueue;
+struct td_sched;
struct thread;
struct trapframe;
struct turnstile;
-struct mqueue_notifier;
-struct kdtrace_proc;
-struct kdtrace_thread;
-struct cpuset;
/*
* XXX: Does this belong in resource.h or resourcevar.h instead?
@@ -185,13 +185,13 @@ struct cpuset;
* Locking for td_rux: (t) for all fields.
*/
struct rusage_ext {
- u_int64_t rux_runtime; /* (cj) Real time. */
- u_int64_t rux_uticks; /* (cj) Statclock hits in user mode. */
- u_int64_t rux_sticks; /* (cj) Statclock hits in sys mode. */
- u_int64_t rux_iticks; /* (cj) Statclock hits in intr mode. */
- u_int64_t rux_uu; /* (c) Previous user time in usec. */
- u_int64_t rux_su; /* (c) Previous sys time in usec. */
- u_int64_t rux_tu; /* (c) Previous total time in usec. */
+ uint64_t rux_runtime; /* (cj) Real time. */
+ uint64_t rux_uticks; /* (cj) Statclock hits in user mode. */
+ uint64_t rux_sticks; /* (cj) Statclock hits in sys mode. */
+ uint64_t rux_iticks; /* (cj) Statclock hits in intr mode. */
+ uint64_t rux_uu; /* (c) Previous user time in usec. */
+ uint64_t rux_su; /* (c) Previous sys time in usec. */
+ uint64_t rux_tu; /* (c) Previous total time in usec. */
};
/*
diff --git a/sys/sys/sbuf.h b/sys/sys/sbuf.h
index eeb3814..2a9cb0e 100644
--- a/sys/sys/sbuf.h
+++ b/sys/sys/sbuf.h
@@ -44,8 +44,8 @@ struct sbuf {
sbuf_drain_func *s_drain_func; /* drain function */
void *s_drain_arg; /* user-supplied drain argument */
int s_error; /* current error code */
- int s_size; /* size of storage buffer */
- int s_len; /* current length of string */
+ ssize_t s_size; /* size of storage buffer */
+ ssize_t s_len; /* current length of string */
#define SBUF_FIXEDLEN 0x00000000 /* fixed length buffer (default) */
#define SBUF_AUTOEXTEND 0x00000001 /* automatically extend buffer */
#define SBUF_USRFLAGMSK 0x0000ffff /* mask of flags the user may specify */
@@ -63,7 +63,7 @@ struct sbuf *sbuf_new(struct sbuf *, char *, int, int);
#define sbuf_new_auto() \
sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND)
void sbuf_clear(struct sbuf *);
-int sbuf_setpos(struct sbuf *, int);
+int sbuf_setpos(struct sbuf *, ssize_t);
int sbuf_bcat(struct sbuf *, const void *, size_t);
int sbuf_bcpy(struct sbuf *, const void *, size_t);
int sbuf_cat(struct sbuf *, const char *);
@@ -75,11 +75,11 @@ int sbuf_vprintf(struct sbuf *, const char *, __va_list)
int sbuf_putc(struct sbuf *, int);
void sbuf_set_drain(struct sbuf *, sbuf_drain_func *, void *);
int sbuf_trim(struct sbuf *);
-int sbuf_error(struct sbuf *);
+int sbuf_error(const struct sbuf *);
int sbuf_finish(struct sbuf *);
char *sbuf_data(struct sbuf *);
-int sbuf_len(struct sbuf *);
-int sbuf_done(struct sbuf *);
+ssize_t sbuf_len(struct sbuf *);
+int sbuf_done(const struct sbuf *);
void sbuf_delete(struct sbuf *);
#ifdef _KERNEL
diff --git a/sys/sys/smp.h b/sys/sys/smp.h
index 6104d3e..f8cce5f 100644
--- a/sys/sys/smp.h
+++ b/sys/sys/smp.h
@@ -33,8 +33,8 @@ struct cpu_group {
struct cpu_group *cg_parent; /* Our parent group. */
struct cpu_group *cg_child; /* Optional children groups. */
cpumask_t cg_mask; /* Mask of cpus in this group. */
- int8_t cg_count; /* Count of cpus in this group. */
- int8_t cg_children; /* Number of children groups. */
+ int32_t cg_count; /* Count of cpus in this group. */
+ int16_t cg_children; /* Number of children groups. */
int8_t cg_level; /* Shared cache level. */
int8_t cg_flags; /* Traversal modifiers. */
};
@@ -73,7 +73,6 @@ extern int smp_active;
extern int smp_cpus;
extern volatile cpumask_t started_cpus;
extern volatile cpumask_t stopped_cpus;
-extern cpumask_t idle_cpus_mask;
extern cpumask_t hlt_cpus_mask;
extern cpumask_t logical_cpus_mask;
#endif /* SMP */
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index 573c364..68b9619 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -1640,9 +1640,10 @@ ffs_vgetf(mp, ino, flags, vpp, ffs_flags)
* those rights via. exflagsp and credanonp
*/
static int
-ffs_fhtovp(mp, fhp, vpp)
+ffs_fhtovp(mp, fhp, flags, vpp)
struct mount *mp;
struct fid *fhp;
+ int flags;
struct vnode **vpp;
{
struct ufid *ufhp;
@@ -1653,7 +1654,7 @@ ffs_fhtovp(mp, fhp, vpp)
if (ufhp->ufid_ino < ROOTINO ||
ufhp->ufid_ino >= fs->fs_ncg * fs->fs_ipg)
return (ESTALE);
- return (ufs_fhtovp(mp, ufhp, vpp));
+ return (ufs_fhtovp(mp, ufhp, flags, vpp));
}
/*
diff --git a/sys/ufs/ufs/ufs_extern.h b/sys/ufs/ufs/ufs_extern.h
index 528b03b..c590748 100644
--- a/sys/ufs/ufs/ufs_extern.h
+++ b/sys/ufs/ufs/ufs_extern.h
@@ -56,7 +56,7 @@ extern struct vop_vector ufs_vnodeops;
int ufs_bmap(struct vop_bmap_args *);
int ufs_bmaparray(struct vnode *, ufs2_daddr_t, ufs2_daddr_t *,
struct buf *, int *, int *);
-int ufs_fhtovp(struct mount *, struct ufid *, struct vnode **);
+int ufs_fhtovp(struct mount *, struct ufid *, int, struct vnode **);
int ufs_checkpath(ino_t, ino_t, struct inode *, struct ucred *, ino_t *);
void ufs_dirbad(struct inode *, doff_t, char *);
int ufs_dirbadentry(struct vnode *, struct direct *, int);
diff --git a/sys/ufs/ufs/ufs_vfsops.c b/sys/ufs/ufs/ufs_vfsops.c
index 0eeb14f..74a863a 100644
--- a/sys/ufs/ufs/ufs_vfsops.c
+++ b/sys/ufs/ufs/ufs_vfsops.c
@@ -208,16 +208,17 @@ ufs_uninit(vfsp)
* Call the VFS_CHECKEXP beforehand to verify access.
*/
int
-ufs_fhtovp(mp, ufhp, vpp)
+ufs_fhtovp(mp, ufhp, flags, vpp)
struct mount *mp;
struct ufid *ufhp;
+ int flags;
struct vnode **vpp;
{
struct inode *ip;
struct vnode *nvp;
int error;
- error = VFS_VGET(mp, ufhp->ufid_ino, LK_EXCLUSIVE, &nvp);
+ error = VFS_VGET(mp, ufhp->ufid_ino, flags, &nvp);
if (error) {
*vpp = NULLVP;
return (error);
diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c
index 4434cdf..8da5b8e 100644
--- a/sys/vm/uma_core.c
+++ b/sys/vm/uma_core.c
@@ -86,8 +86,6 @@ __FBSDID("$FreeBSD$");
#include <vm/uma_int.h>
#include <vm/uma_dbg.h>
-#include <machine/vmparam.h>
-
#include <ddb/ddb.h>
/*
@@ -136,6 +134,8 @@ static struct mtx uma_boot_pages_mtx;
/* Is the VM done starting up? */
static int booted = 0;
+#define UMA_STARTUP 1
+#define UMA_STARTUP2 2
/* Maximum number of allowed items-per-slab if the slab header is OFFPAGE */
static u_int uma_max_ipers;
@@ -961,7 +961,7 @@ startup_alloc(uma_zone_t zone, int bytes, u_int8_t *pflag, int wait)
return (tmps->us_data);
}
mtx_unlock(&uma_boot_pages_mtx);
- if (booted == 0)
+ if (booted < UMA_STARTUP2)
panic("UMA: Increase vm.boot_pages");
/*
* Now that we've booted reset these users to their real allocator.
@@ -1318,10 +1318,15 @@ keg_ctor(void *mem, int size, void *udata, int flags)
#ifdef UMA_MD_SMALL_ALLOC
keg->uk_allocf = uma_small_alloc;
keg->uk_freef = uma_small_free;
-#endif
- if (booted == 0)
+
+ if (booted < UMA_STARTUP)
keg->uk_allocf = startup_alloc;
- } else if (booted == 0 && (keg->uk_flags & UMA_ZFLAG_INTERNAL))
+#else
+ if (booted < UMA_STARTUP2)
+ keg->uk_allocf = startup_alloc;
+#endif
+ } else if (booted < UMA_STARTUP2 &&
+ (keg->uk_flags & UMA_ZFLAG_INTERNAL))
keg->uk_allocf = startup_alloc;
/*
@@ -1754,9 +1759,7 @@ uma_startup(void *bootmem, int boot_pages)
bucket_init();
-#if defined(UMA_MD_SMALL_ALLOC) && !defined(UMA_MD_SMALL_ALLOC_NEEDS_VM)
- booted = 1;
-#endif
+ booted = UMA_STARTUP;
#ifdef UMA_DEBUG
printf("UMA startup complete.\n");
@@ -1767,7 +1770,7 @@ uma_startup(void *bootmem, int boot_pages)
void
uma_startup2(void)
{
- booted = 1;
+ booted = UMA_STARTUP2;
bucket_enable();
#ifdef UMA_DEBUG
printf("UMA startup2 complete.\n");
diff --git a/sys/vm/uma_int.h b/sys/vm/uma_int.h
index 7713593..b2b5bac 100644
--- a/sys/vm/uma_int.h
+++ b/sys/vm/uma_int.h
@@ -45,7 +45,7 @@
*
* The uma_slab_t may be embedded in a UMA_SLAB_SIZE chunk of memory or it may
* be allocated off the page from a special slab zone. The free list within a
- * slab is managed with a linked list of indexes, which are 8 bit values. If
+ * slab is managed with a linked list of indices, which are 8 bit values. If
* UMA_SLAB_SIZE is defined to be too large I will have to switch to 16bit
* values. Currently on alpha you can get 250 or so 32 byte items and on x86
* you can get 250 or so 16byte items. For item sizes that would yield more
@@ -56,9 +56,9 @@
* wasted between items due to alignment problems. This may yield a much better
* memory footprint for certain sizes of objects. Another alternative is to
* increase the UMA_SLAB_SIZE, or allow for dynamic slab sizes. I prefer
- * dynamic slab sizes because we could stick with 8 bit indexes and only use
+ * dynamic slab sizes because we could stick with 8 bit indices and only use
* large slab sizes for zones with a lot of waste per slab. This may create
- * ineffeciencies in the vm subsystem due to fragmentation in the address space.
+ * inefficiencies in the vm subsystem due to fragmentation in the address space.
*
* The only really gross cases, with regards to memory waste, are for those
* items that are just over half the page size. You can get nearly 50% waste,
@@ -118,7 +118,7 @@
#define UMA_SLAB_MASK (PAGE_SIZE - 1) /* Mask to get back to the page */
#define UMA_SLAB_SHIFT PAGE_SHIFT /* Number of bits PAGE_MASK */
-#define UMA_BOOT_PAGES 48 /* Pages allocated for startup */
+#define UMA_BOOT_PAGES 64 /* Pages allocated for startup */
/* Max waste before going to off page slab management */
#define UMA_MAX_WASTE (UMA_SLAB_SIZE / 10)
diff --git a/tools/build/options/WITHOUT_BINUTILS b/tools/build/options/WITHOUT_BINUTILS
new file mode 100644
index 0000000..9d57c62
--- /dev/null
+++ b/tools/build/options/WITHOUT_BINUTILS
@@ -0,0 +1,7 @@
+.\" $FreeBSD$
+Set to not install binutils (as, c++-filt, gconv, gnu-ar, gnu-randlib,
+ld, nm, objcopy, objdump, readelf, size and strip)
+.Bf -symbolic
+The option does not generally work for build targets, unless some alternative
+toolchain is enabled.
+.Ef
diff --git a/tools/build/options/WITHOUT_GCC b/tools/build/options/WITHOUT_GCC
new file mode 100644
index 0000000..5717f64
--- /dev/null
+++ b/tools/build/options/WITHOUT_GCC
@@ -0,0 +1,6 @@
+.\" $FreeBSD$
+Set to not install gcc and g++.
+.Bf -symbolic
+The option does not generally work for build targets, unless some alternative
+toolchain is enabled.
+.Ef
diff --git a/tools/build/options/WITHOUT_KERNEL_SYMBOLS b/tools/build/options/WITHOUT_KERNEL_SYMBOLS
new file mode 100644
index 0000000..e2b3926
--- /dev/null
+++ b/tools/build/options/WITHOUT_KERNEL_SYMBOLS
@@ -0,0 +1,5 @@
+.\" $FreeBSD$
+Set to not install kernel symbol files.
+.Bf -symbolic
+This option is recommended for those people who have small root partitions.
+.Ef
diff --git a/tools/build/options/WITH_OFED b/tools/build/options/WITH_OFED
new file mode 100644
index 0000000..a995fb8
--- /dev/null
+++ b/tools/build/options/WITH_OFED
@@ -0,0 +1,4 @@
+.\" $FreeBSD$
+Set to build the
+.Dq "OpenFabrics Enterprise Distribution"
+Infiniband software stack.
diff --git a/tools/regression/bin/sh/builtins/cd3.0 b/tools/regression/bin/sh/builtins/cd3.0
new file mode 100644
index 0000000..7729c54
--- /dev/null
+++ b/tools/regression/bin/sh/builtins/cd3.0
@@ -0,0 +1,21 @@
+# $FreeBSD$
+
+# If fully successful, cd -Pe must be like cd -P.
+
+set -e
+
+cd "${TMPDIR:-/tmp}"
+cd -Pe /
+[ "$PWD" = / ]
+[ "$(pwd)" = / ]
+cd "${TMPDIR:-/tmp}"
+cd -eP /
+[ "$PWD" = / ]
+[ "$(pwd)" = / ]
+
+set +e
+
+# If cd -Pe cannot chdir, the exit status must be greater than 1.
+
+v=$( (cd -Pe /var/empty/nonexistent) 2>&1 >/dev/null)
+[ $? -gt 1 ] && [ -n "$v" ]
diff --git a/tools/regression/bin/sh/builtins/cd4.0 b/tools/regression/bin/sh/builtins/cd4.0
new file mode 100644
index 0000000..df3a9a4
--- /dev/null
+++ b/tools/regression/bin/sh/builtins/cd4.0
@@ -0,0 +1,38 @@
+# $FreeBSD$
+
+# This test assumes that whatever mechanism cd -P uses to determine the
+# pathname to the current directory if it is longer than PATH_MAX requires
+# read permission on all parent directories. It also works if this
+# requirement always applies.
+
+set -e
+L=$(getconf PATH_MAX / 2>/dev/null) || L=4096
+[ "$L" -lt 100000 ] 2>/dev/null || L=4096
+L=$((L+100))
+T=$(mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXX)
+trap 'chmod u+r ${T}; rm -rf ${T}' 0
+cd -Pe $T
+D=$(pwd)
+chmod u-r "$D"
+if [ -r "$D" ]; then
+ # Running as root, cannot test.
+ exit 0
+fi
+set +e
+while [ ${#D} -lt $L ]; do
+ mkdir veryverylongdirectoryname || exit
+ cd -Pe veryverylongdirectoryname 2>/dev/null
+ r=$?
+ [ $r -gt 1 ] && exit $r
+ if [ $r -eq 1 ]; then
+ # Verify that the directory was changed correctly.
+ cd -Pe .. || exit
+ [ "$(pwd)" = "$D" ] || exit
+ # Verify that omitting -e results in success.
+ cd -P veryverylongdirectoryname 2>/dev/null || exit
+ exit 0
+ fi
+ D=$D/veryverylongdirectoryname
+done
+echo "cd -Pe never returned 1"
+exit 0
diff --git a/tools/regression/bin/sh/builtins/dot4.0 b/tools/regression/bin/sh/builtins/dot4.0
new file mode 100644
index 0000000..b898131
--- /dev/null
+++ b/tools/regression/bin/sh/builtins/dot4.0
@@ -0,0 +1,12 @@
+# $FreeBSD$
+
+v=abcd
+v=$v$v$v$v
+v=$v$v$v$v
+v=$v$v$v$v
+v=$v$v$v$v
+v=$v$v$v$v
+r=$( (
+ trap 'exit 0' 0
+ . "$v"
+) 2>&1 >/dev/null) && [ -n "$r" ]
diff --git a/tools/regression/bin/sh/parameters/positional1.0 b/tools/regression/bin/sh/parameters/positional1.0
new file mode 100644
index 0000000..67d1951
--- /dev/null
+++ b/tools/regression/bin/sh/parameters/positional1.0
@@ -0,0 +1,13 @@
+# $FreeBSD$
+
+set -- a b c d e f g h i j
+[ "$1" = a ] || echo "error at line $LINENO"
+[ "${1}" = a ] || echo "error at line $LINENO"
+[ "${1-foo}" = a ] || echo "error at line $LINENO"
+[ "${1+foo}" = foo ] || echo "error at line $LINENO"
+[ "$1+foo" = a+foo ] || echo "error at line $LINENO"
+[ "$10" = a0 ] || echo "error at line $LINENO"
+[ "$100" = a00 ] || echo "error at line $LINENO"
+[ "${10}" = j ] || echo "error at line $LINENO"
+[ "${10-foo}" = j ] || echo "error at line $LINENO"
+[ "${100-foo}" = foo ] || echo "error at line $LINENO"
diff --git a/tools/regression/bin/sh/parser/alias4.0 b/tools/regression/bin/sh/parser/alias4.0
new file mode 100644
index 0000000..19332ed
--- /dev/null
+++ b/tools/regression/bin/sh/parser/alias4.0
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+alias alias0=exit
+eval 'x=1 alias0 0'
+exit 1
diff --git a/tools/regression/bin/sh/parser/alias5.0 b/tools/regression/bin/sh/parser/alias5.0
new file mode 100644
index 0000000..3d0205f
--- /dev/null
+++ b/tools/regression/bin/sh/parser/alias5.0
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+alias alias0=exit
+eval '</dev/null alias0 0'
+exit 1
diff --git a/tools/regression/bin/sh/parser/heredoc11.0 b/tools/regression/bin/sh/parser/heredoc11.0
new file mode 100644
index 0000000..5839e46
--- /dev/null
+++ b/tools/regression/bin/sh/parser/heredoc11.0
@@ -0,0 +1,26 @@
+# $FreeBSD$
+
+failures=''
+
+check() {
+ if eval "[ $* ]"; then
+ :
+ else
+ echo "Failed: $*"
+ failures=x$failures
+ fi
+}
+
+check '`cat <<EOF
+foo
+EOF` = foo'
+
+check '"`cat <<EOF
+foo
+EOF`" = foo'
+
+check '`eval "cat <<EOF
+foo
+EOF"` = foo'
+
+test "x$failures" = x
diff --git a/tools/tools/iso/check-iso3166.pl b/tools/tools/iso/check-iso3166.pl
index b85c188..a8baf4e 100755
--- a/tools/tools/iso/check-iso3166.pl
+++ b/tools/tools/iso/check-iso3166.pl
@@ -4,8 +4,8 @@
# $FreeBSD$
#
# This script compares the file iso3166 (from head/share/misc) with the files
-# list-en1-semic-2.txt (from
-# http://www.iso.org/iso/list-en1-semic-2.txt) and iso3166-countrycodes.txt
+# list-en1-semic-3.txt (from
+# http://www.iso.org/iso/list-en1-semic-3.txt) and iso3166-countrycodes.txt
# (from ftp://ftp.ripe.net/) to see if there any differences.
#
# Created by Edwin Groothuis <edwin@FreeBSD.org> for the FreeBSD project.
@@ -41,7 +41,7 @@ my %old = ();
my %new1 = ();
{
- open(FIN, "iso3166-countrycodes.txt") or die "Cannot open iso3166-countrycodes.txt, which can be retrieved from ftp://ftp.ripe.net/";
+ open(FIN, "iso3166-countrycodes.txt") or die "Cannot open iso3166-countrycodes.txt, which can be retrieved from ftp://ftp.ripe.net/iso3166-countrycodes.txt";
my @lines = <FIN>;
close(FIN);
chomp(@lines);
@@ -56,7 +56,7 @@ my %new1 = ();
next if ($l eq "");
die "Invalid line: $l\n"
- if ($l !~ /^(.+?)[\t ][\t ]+([A-Z]{2})[\t ]+([A-Z]{3})[\t ]+(\d+)[\t ]*$/);
+ if ($l !~ /^(.+?)[\t ]+([A-Z]{2})[\t ]+([A-Z]{3})[\t ]+(\d+)[\t ]*$/);
my $two = $2;
my $three = $3;
my $number = $4;
@@ -71,7 +71,7 @@ my %new1 = ();
my %new2 = ();
{
- open(FIN, "list-en1-semic-2.txt") or die "Cannot open list-en1-semic-2.txt, which can be retrieved from http://www.iso.org/iso/list-en1-semic-2.txt";
+ open(FIN, "list-en1-semic-3.txt") or die "Cannot open list-en1-semic-3.txt, which can be retrieved from http://www.iso.org/iso/list-en1-semic-3.txt";
my @lines = <FIN>;
close(FIN);
chomp(@lines);
diff --git a/usr.bin/ar/acpyacc.y b/usr.bin/ar/acpyacc.y
index e1a6e6d..99a23c7 100644
--- a/usr.bin/ar/acpyacc.y
+++ b/usr.bin/ar/acpyacc.y
@@ -358,7 +358,7 @@ arscp_copy(int ifd, int ofd)
/*
* Add all modules of archive to current archive, if list != NULL,
- * only those modules speicifed in 'list' will be added.
+ * only those modules specified in 'list' will be added.
*/
static void
arscp_addlib(char *archive, struct list *list)
@@ -545,7 +545,7 @@ arscp_end(int eval)
}
/*
- * Check if target spcified, i.e, whether OPEN or CREATE has been
+ * Check if target specified, i.e, whether OPEN or CREATE has been
* issued by user.
*/
static int
diff --git a/usr.bin/ar/ar.c b/usr.bin/ar/ar.c
index bb53aa4..4b1b7a0 100644
--- a/usr.bin/ar/ar.c
+++ b/usr.bin/ar/ar.c
@@ -109,7 +109,7 @@ main(int argc, char **argv)
bsdar->progname = "ar";
/* Act like ranlib if our name ends in "ranlib"; this
- * accomodates arm-freebsd7.1-ranlib, bsdranlib, etc. */
+ * accommodates arm-freebsd7.1-ranlib, bsdranlib, etc. */
len = strlen(bsdar->progname);
if (len >= strlen("ranlib") &&
strcmp(bsdar->progname + len - strlen("ranlib"), "ranlib") == 0) {
diff --git a/usr.bin/ar/write.c b/usr.bin/ar/write.c
index d27a767..5b6d369 100644
--- a/usr.bin/ar/write.c
+++ b/usr.bin/ar/write.c
@@ -113,7 +113,7 @@ ar_mode_A(struct bsdar *bsdar)
/*
* Create object from file, return created obj upon success, or NULL
* when an error occurs or the member is not newer than existing
- * one while -u is specifed.
+ * one while -u is specified.
*/
static struct ar_obj *
create_obj_from_file(struct bsdar *bsdar, const char *name, time_t mtime)
@@ -220,7 +220,7 @@ insert_obj(struct bsdar *bsdar, struct ar_obj *obj, struct ar_obj *pos)
if (pos == NULL || obj == pos)
/*
- * If the object to move happens to be the posistion obj,
+ * If the object to move happens to be the position obj,
* or if there is not a pos obj, move it to tail.
*/
goto tail;
@@ -418,7 +418,7 @@ write_archive(struct bsdar *bsdar, char mode)
if (mode == 'A') {
/*
* Read objects from the target archive of ADDLIB command.
- * If there are members spcified in argv, read those members
+ * If there are members specified in argv, read those members
* only, otherwise the entire archive will be read.
*/
read_objs(bsdar, bsdar->addlib, 1);
@@ -438,7 +438,7 @@ write_archive(struct bsdar *bsdar, char mode)
/*
* If can't find `pos' specified by user,
- * sliently insert objects at tail.
+ * silently insert objects at tail.
*/
if (pos == NULL)
bsdar->options &= ~(AR_A | AR_B);
@@ -699,7 +699,7 @@ create_symtab_entry(struct bsdar *bsdar, void *maddr, size_t size)
return;
}
if (elf_kind(e) != ELF_K_ELF) {
- /* Sliently ignore non-elf member. */
+ /* Silently ignore non-elf member. */
elf_end(e);
return;
}
diff --git a/usr.bin/gzip/Makefile b/usr.bin/gzip/Makefile
index 0480337..16a825f 100644
--- a/usr.bin/gzip/Makefile
+++ b/usr.bin/gzip/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.10 2006/05/12 02:01:15 mrg Exp $
+# $NetBSD: Makefile,v 1.13 2009/04/14 22:15:20 lukem Exp $
# $FreeBSD$
.include <bsd.own.mk>
diff --git a/usr.bin/gzip/gzip.1 b/usr.bin/gzip/gzip.1
index 848a4b3..c0dc670 100644
--- a/usr.bin/gzip/gzip.1
+++ b/usr.bin/gzip/gzip.1
@@ -25,7 +25,7 @@
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
-.Dd April 27, 2010
+.Dd May 23, 2011
.Dt GZIP 1
.Os
.Sh NAME
@@ -127,9 +127,9 @@ stream, leaving files intact.
This option selects decompression rather than compression.
.It Fl f , -force
This option turns on force mode.
-This allows files with multiple links, overwriting of pre-existing
-files, reading from or writing to a terminal, and when combined
-with the
+This allows files with multiple links, symbolic links to regular files,
+overwriting of pre-existing files, reading from or writing to a terminal,
+and when combined with the
.Fl c
option, allowing non-compressed data to pass through unchanged.
.It Fl h , -help
diff --git a/usr.bin/gzip/gzip.c b/usr.bin/gzip/gzip.c
index d86e84b..927493e 100644
--- a/usr.bin/gzip/gzip.c
+++ b/usr.bin/gzip/gzip.c
@@ -1,4 +1,4 @@
-/* $NetBSD: gzip.c,v 1.97 2009/10/11 09:17:21 mrg Exp $ */
+/* $NetBSD: gzip.c,v 1.99 2011/03/23 12:59:44 tsutsui Exp $ */
/*-
* Copyright (c) 1997, 1998, 2003, 2004, 2006 Matthew R. Green
@@ -31,7 +31,7 @@
#ifndef lint
__COPYRIGHT("@(#) Copyright (c) 1997, 1998, 2003, 2004, 2006\
Matthew R. Green. All rights reserved.");
-__RCSID("$FreeBSD$");
+__FBSDID("$FreeBSD$");
#endif /* not lint */
/*
@@ -146,7 +146,7 @@ static suffixes_t suffixes[] = {
#define NUM_SUFFIXES (sizeof suffixes / sizeof suffixes[0])
#define SUFFIX_MAXLEN 30
-static const char gzip_version[] = "FreeBSD gzip 20100407";
+static const char gzip_version[] = "FreeBSD gzip 20110523";
#ifndef SMALL
static const char gzip_copyright[] = \
@@ -314,7 +314,7 @@ main(int argc, char **argv)
dflag = cflag = 1;
#ifdef SMALL
-#define OPT_LIST "123456789cdhltV"
+#define OPT_LIST "123456789cdhlV"
#else
#define OPT_LIST "123456789acdfhklLNnqrS:tVv"
#endif
@@ -918,6 +918,7 @@ gz_uncompress(int in, int out, char *pre, size_t prelen, off_t *gsizep,
case Z_BUF_ERROR:
if (z.avail_out > 0 && !done_reading)
continue;
+
case Z_STREAM_END:
case Z_OK:
break;
@@ -1781,7 +1782,7 @@ handle_pathname(char *path)
}
retry:
- if (stat(path, &sb) != 0) {
+ if (stat(path, &sb) != 0 || (fflag == 0 && lstat(path, &sb) != 0)) {
/* lets try <path>.gz if we're decompressing */
if (dflag && s == NULL && errno == ENOENT) {
len = strlen(path);
diff --git a/usr.bin/gzip/zdiff b/usr.bin/gzip/zdiff
index 34caf2b..9e9aca6 100644
--- a/usr.bin/gzip/zdiff
+++ b/usr.bin/gzip/zdiff
@@ -1,10 +1,12 @@
#!/bin/sh -
#
-# $NetBSD: zdiff,v 1.3 2004/03/29 10:01:00 wiz Exp $
+# $NetBSD: zdiff,v 1.5 2010/04/14 20:30:28 joerg Exp $
+#
# $OpenBSD: zdiff,v 1.2 2003/07/29 07:42:44 otto Exp $
#
#-
# Copyright (c) 2003 Todd C. Miller <Todd.Miller@courtesan.com>
+# Copyright (c) 2010 Joerg Sonnenberger <joerg@NetBSD.org>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
@@ -31,7 +33,57 @@ case $0 in
*) prog=diff
;;
esac
-USAGE="usage: z$prog [options] file1 [file2]"
+USAGE="usage: $0 [options] file1 [file2]"
+
+check_suffix() {
+ case "$1" in
+ *[._-][Zz])
+ setvar $2 "${1%??}"
+ setvar $3 "gzip -cdqf"
+ ;;
+ *[._-]bz)
+ setvar $2 "${1%???}"
+ setvar $3 "bzip2 -cdqf"
+ ;;
+ *[._-]gz)
+ setvar $2 "${1%???}"
+ setvar $3 "gzip -cdqf"
+ ;;
+ *[._-]xz)
+ setvar $2 "${1%???}"
+ setvar $3 "xz -cdqf"
+ ;;
+ *[._-]bz2)
+ setvar $2 "${1%????}"
+ setvar $3 "bzip2 -cdqf"
+ ;;
+ *[._-]lzma)
+ setvar $2 "${1%?????}"
+ setvar $3 "xz -cdqf"
+ ;;
+ *.t[ag]z)
+ setvar $2 "${1%??}"ar
+ setvar $3 "gzip -cdqf"
+ ;;
+ *.tbz)
+ setvar $2 "${1%??}"ar
+ setvar $3 "bzip2 -cdqf"
+ ;;
+ *.tbz2)
+ setvar $2 "${1%???}"ar
+ setvar $3 "bzip2 -cdqf"
+ ;;
+ *.t[lx]z)
+ setvar $2 "${1%??}"ar
+ setvar $3 "xz -cdqf"
+ ;;
+ *)
+ setvar $2 "$1"
+ setvar $3 ""
+ ;;
+ esac
+}
+
# Pull out any command line flags so we can pass them to diff/cmp
# XXX - assumes there is no optarg
@@ -42,6 +94,9 @@ while test $# -ne 0; do
shift
break
;;
+ -)
+ break
+ ;;
-*)
flags="$flags $1"
shift
@@ -55,52 +110,28 @@ done
if [ $# -eq 1 ]; then
# One file given, compare compressed to uncompressed
files="$1"
- case "$1" in
- *[._-][Zz])
- files="${1%??}"
- ;;
- *[._-]gz)
- files="${1%???}"
- ;;
- *.t[ag]z)
- files="${1%??}"ar
- ;;
- *) echo "z$prog: unknown suffix" 1>&2
- exit 1
- esac
- gzip -cdfq "$1" | $prog $flags - "$files"
+ check_suffix "$1" files filt
+ if [ -z "$filt" ]; then
+ echo "z$prog: unknown suffix" 1>&2
+ exit 1
+ fi
+ $filt -- "$1" | $prog $flags -- - "$files"
status=$?
elif [ $# -eq 2 ]; then
# Two files given, compare the two uncompressing as needed
- case "$1" in
- *[._-][Zz]|*[._-]gz|*.t[ag]z)
- files=-
- filt="gzip -cdfq $1"
- ;;
- *)
- files="$1"
- ;;
- esac
- case "$2" in
- *[._-][Zz]|*[._-]gz|*.t[ag]z)
- if [ "$files" = "-" ]; then
- tmp=`mktemp -t z$prog.XXXXXXXXXX` || exit 1
- trap "rm -f $tmp" 0 1 2 3 13 15
- gzip -cdfq "$2" > $tmp
- files="$files $tmp"
- else
- files="$files -"
- filt="gzip -cdfq $2"
- fi
- ;;
- *)
- files="$files $2"
- ;;
- esac
- if [ -n "$filt" ]; then
- $filt | $prog $flags $files
+ check_suffix "$1" files filt
+ check_suffix "$2" files2 filt2
+ if [ -z "$filt" -a -z "$filt2" ]; then
+ $prog $flags -- "$1" "$2"
+ elif [ -z "$filt" -a -n "$filt2" -a "$1" != "-" ]; then
+ $filt2 -- "$2" | $prog $flags -- "$1" -
+ elif [ -n "$filt" -a -z "$filt2" -a "$2" != "-" ]; then
+ $filt -- "$1" | $prog $flags -- - "$2"
else
- $prog $flags $files
+ tmp=`mktemp -t z$prog.XXXXXXXXXX` || exit 1
+ trap "rm -f $tmp" 0 1 2 3 13 15
+ ${filt2:-cat} -- "$2" > $tmp || exit $?
+ ${filt:-cat} -- "$1" | $prog $flags -- - "$tmp"
fi
status=$?
else
diff --git a/usr.bin/gzip/zdiff.1 b/usr.bin/gzip/zdiff.1
index 2a6a4c8..52b5fbd 100644
--- a/usr.bin/gzip/zdiff.1
+++ b/usr.bin/gzip/zdiff.1
@@ -1,7 +1,8 @@
-.\" $NetBSD: zdiff.1,v 1.3 2003/12/28 12:48:03 wiz Exp $
+.\" $NetBSD: zdiff.1,v 1.5 2010/04/14 19:52:05 wiz Exp $
.\" $OpenBSD: zdiff.1,v 1.2 2003/07/13 17:39:14 millert Exp $
.\"
.\" Copyright (c) 2003 Todd C. Miller <Todd.Miller@courtesan.com>
+.\" Copyright (c) 2010 Joerg Sonnenberger <joerg@NetBSD.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
@@ -20,7 +21,7 @@
.\" Materiel Command, USAF, under agreement number F39502-99-1-0512.
.\"
.\" $FreeBSD$
-.Dd January 26, 2007
+.Dd May 23, 2011
.Dt ZDIFF 1
.Os
.Sh NAME
@@ -45,15 +46,6 @@ are filters that invoke
or
.Xr diff 1
respectively to compare compressed files.
-Such files generally have a
-.Dq Z
-or
-.Dq gz
-extension (both the
-.Xr compress 1
-and
-.Xr gzip 1
-formats are supported).
Any
.Ar options
that are specified are passed to
@@ -70,6 +62,45 @@ When both
or
.Ar file2
are specified, either file may be compressed.
+.Pp
+Extensions handled by
+.Xr gzip 1 :
+.Bl -bullet -compact
+.It
+z, Z,
+.It
+gz,
+.It
+taz,
+.It
+tgz.
+.El
+.Pp
+Extensions handled by
+.Xr bzip2 1 :
+.Bl -bullet -compact
+.It
+bz,
+.It
+bz2,
+.It
+tbz,
+.It
+tbz2.
+.El
+.Pp
+Extensions handled by
+.Xr xz 1 :
+.Bl -bullet -compact
+.It
+lzma,
+.It
+xz,
+.It
+tlz,
+.It
+txz.
+.El
.Sh ENVIRONMENT
.Bl -tag -width "TMPDIR"
.It Ev TMPDIR
@@ -88,9 +119,11 @@ Temporary file for
.Nm zdiff .
.El
.Sh SEE ALSO
+.Xr bzip2 1 ,
.Xr cmp 1 ,
-.Xr compress 1 ,
-.Xr diff 1
+.Xr diff 1 ,
+.Xr gzip 1 ,
+.Xr xz 1
.Sh CAVEATS
.Nm zcmp
and
diff --git a/usr.bin/gzip/zuncompress.c b/usr.bin/gzip/zuncompress.c
index 8e619bd..f68ba59 100644
--- a/usr.bin/gzip/zuncompress.c
+++ b/usr.bin/gzip/zuncompress.c
@@ -1,4 +1,4 @@
-/* $NetBSD: zuncompress.c,v 1.7 2009/04/12 10:31:14 lukem Exp $ */
+/* $NetBSD: zuncompress.c,v 1.8 2010/11/06 21:42:32 mrg Exp $ */
/*-
* Copyright (c) 1985, 1986, 1992, 1993
diff --git a/usr.bin/netstat/netisr.c b/usr.bin/netstat/netisr.c
index 25f341c..cc05c38 100644
--- a/usr.bin/netstat/netisr.c
+++ b/usr.bin/netstat/netisr.c
@@ -60,8 +60,7 @@ static u_int numthreads;
static u_int defaultqlimit;
static u_int maxqlimit;
-static u_int direct;
-static u_int direct_force;
+static char dispatch_policy[20];
static struct sysctl_netisr_proto *proto_array;
static u_int proto_array_len;
@@ -77,6 +76,32 @@ static u_int *nws_array;
static u_int maxprot;
static void
+netisr_dispatch_policy_to_string(u_int dispatch_policy, char *buf,
+ size_t buflen)
+{
+ const char *str;
+
+ switch (dispatch_policy) {
+ case NETISR_DISPATCH_DEFAULT:
+ str = "default";
+ break;
+ case NETISR_DISPATCH_DEFERRED:
+ str = "deferred";
+ break;
+ case NETISR_DISPATCH_HYBRID:
+ str = "hybrid";
+ break;
+ case NETISR_DISPATCH_DIRECT:
+ str = "direct";
+ break;
+ default:
+ str = "unknown";
+ break;
+ }
+ snprintf(buf, buflen, "%s", str);
+}
+
+static void
netisr_load_kvm_uint(kvm_t *kd, char *name, u_int *p)
{
struct nlist nl[] = {
@@ -144,6 +169,7 @@ netisr_protoispresent(u_int proto)
static void
netisr_load_kvm_config(kvm_t *kd)
{
+ u_int tmp;
netisr_load_kvm_uint(kd, "_netisr_bindthreads", &bindthreads);
netisr_load_kvm_uint(kd, "_netisr_maxthreads", &maxthreads);
@@ -152,8 +178,9 @@ netisr_load_kvm_config(kvm_t *kd)
netisr_load_kvm_uint(kd, "_netisr_defaultqlimit", &defaultqlimit);
netisr_load_kvm_uint(kd, "_netisr_maxqlimit", &maxqlimit);
- netisr_load_kvm_uint(kd, "_netisr_direct", &direct);
- netisr_load_kvm_uint(kd, "_netisr_direct_force", &direct_force);
+ netisr_load_kvm_uint(kd, "_netisr_dispatch_policy", &tmp);
+ netisr_dispatch_policy_to_string(tmp, dispatch_policy,
+ sizeof(dispatch_policy));
}
static void
@@ -169,6 +196,17 @@ netisr_load_sysctl_uint(const char *name, u_int *p)
}
static void
+netisr_load_sysctl_string(const char *name, char *p, size_t len)
+{
+ size_t retlen;
+
+ retlen = len;
+ if (sysctlbyname(name, p, &retlen, NULL, 0) < 0)
+ err(-1, "%s", name);
+ p[len - 1] = '\0';
+}
+
+static void
netisr_load_sysctl_config(void)
{
@@ -179,8 +217,8 @@ netisr_load_sysctl_config(void)
netisr_load_sysctl_uint("net.isr.defaultqlimit", &defaultqlimit);
netisr_load_sysctl_uint("net.isr.maxqlimit", &maxqlimit);
- netisr_load_sysctl_uint("net.isr.direct", &direct);
- netisr_load_sysctl_uint("net.isr.direct_force", &direct_force);
+ netisr_load_sysctl_string("net.isr.dispatch", dispatch_policy,
+ sizeof(dispatch_policy));
}
static void
@@ -244,6 +282,7 @@ netisr_load_kvm_proto(kvm_t *kd)
snpp->snp_proto = i;
snpp->snp_qlimit = npp->np_qlimit;
snpp->snp_policy = npp->np_policy;
+ snpp->snp_dispatch = npp->np_dispatch;
if (npp->np_m2flow != NULL)
snpp->snp_flags |= NETISR_SNP_FLAGS_M2FLOW;
if (npp->np_m2cpuid != NULL)
@@ -418,6 +457,7 @@ netisr_load_sysctl_work(void)
static void
netisr_print_proto(struct sysctl_netisr_proto *snpp)
{
+ char tmp[20];
printf("%-6s", snpp->snp_name);
printf(" %5u", snpp->snp_proto);
@@ -426,6 +466,9 @@ netisr_print_proto(struct sysctl_netisr_proto *snpp)
(snpp->snp_policy == NETISR_POLICY_SOURCE) ? "source" :
(snpp->snp_policy == NETISR_POLICY_FLOW) ? "flow" :
(snpp->snp_policy == NETISR_POLICY_CPU) ? "cpu" : "-");
+ netisr_dispatch_policy_to_string(snpp->snp_dispatch, tmp,
+ sizeof(tmp));
+ printf(" %8s", tmp);
printf(" %s%s%s\n",
(snpp->snp_flags & NETISR_SNP_FLAGS_M2CPUID) ? "C" : "-",
(snpp->snp_flags & NETISR_SNP_FLAGS_DRAINEDCPU) ? "D" : "-",
@@ -483,17 +526,15 @@ netisr_stats(void *kvmd)
printf("%-25s %12u %12u\n", "Thread count", numthreads, maxthreads);
printf("%-25s %12u %12u\n", "Default queue limit", defaultqlimit,
maxqlimit);
- printf("%-25s %12s %12s\n", "Direct dispatch",
- direct ? "enabled" : "disabled", "n/a");
- printf("%-25s %12s %12s\n", "Forced direct dispatch",
- direct_force ? "enabled" : "disabled", "n/a");
+ printf("%-25s %12s %12s\n", "Dispatch policy", dispatch_policy,
+ "n/a");
printf("%-25s %12s %12s\n", "Threads bound to CPUs",
bindthreads ? "enabled" : "disabled", "n/a");
printf("\n");
printf("Protocols:\n");
- printf("%-6s %5s %6s %-6s %-5s\n", "Name", "Proto", "QLimit",
- "Policy", "Flags");
+ printf("%-6s %5s %6s %-6s %-8s %-5s\n", "Name", "Proto", "QLimit",
+ "Policy", "Dispatch", "Flags");
for (i = 0; i < proto_array_len; i++) {
snpp = &proto_array[i];
netisr_print_proto(snpp);
diff --git a/usr.bin/nfsstat/nfsstat.c b/usr.bin/nfsstat/nfsstat.c
index b833123..b8f29e6 100644
--- a/usr.bin/nfsstat/nfsstat.c
+++ b/usr.bin/nfsstat/nfsstat.c
@@ -221,10 +221,10 @@ readstats(struct nfsstats **stp, struct nfsrvstats **srvstp, int zero)
if (zero)
bzero(&zerostat, sizeof(zerostat));
buflen = sizeof(struct nfsstats);
- if (*stp != NULL && sysctlbyname("vfs.nfs.nfsstats", *stp,
+ if (*stp != NULL && sysctlbyname("vfs.oldnfs.nfsstats", *stp,
&buflen, zero ? &zerostat : NULL, zero ? buflen : 0) < 0) {
if (errno != ENOENT)
- err(1, "sysctl: vfs.nfs.nfsstats");
+ err(1, "sysctl: vfs.oldnfs.nfsstats");
*stp = NULL;
}
buflen = sizeof(struct nfsrvstats);
diff --git a/usr.bin/rpcgen/rpc_hout.c b/usr.bin/rpcgen/rpc_hout.c
index 7607ef7..6aa6ff7 100644
--- a/usr.bin/rpcgen/rpc_hout.c
+++ b/usr.bin/rpcgen/rpc_hout.c
@@ -500,7 +500,7 @@ pdeclaration(const char *name, declaration *dec, int tab, const char *separator)
break;
}
}
- f_print(fout, separator);
+ fputs(separator, fout);
}
static int
diff --git a/usr.bin/rpcgen/rpc_svcout.c b/usr.bin/rpcgen/rpc_svcout.c
index 40fc61c..122408b 100644
--- a/usr.bin/rpcgen/rpc_svcout.c
+++ b/usr.bin/rpcgen/rpc_svcout.c
@@ -349,7 +349,7 @@ write_real_program(definition *def)
f_print(fout, "(");
/* arg name */
if (proc->arg_num > 1)
- f_print(fout, proc->args.argname);
+ fputs(proc->args.argname, fout);
else
ptype(proc->args.decls->decl.prefix,
proc->args.decls->decl.type, 0);
diff --git a/usr.bin/rpcgen/rpc_tblout.c b/usr.bin/rpcgen/rpc_tblout.c
index f96bdfc..618d1f9 100644
--- a/usr.bin/rpcgen/rpc_tblout.c
+++ b/usr.bin/rpcgen/rpc_tblout.c
@@ -103,7 +103,7 @@ write_table(definition *def)
expected = 0;
} else {
expected = 1;
- f_print(fout, null_entry);
+ fputs(null_entry, fout);
}
for (proc = vp->procs; proc != NULL; proc = proc->next) {
current = atoi(proc->proc_num);
@@ -141,7 +141,7 @@ write_table(definition *def)
}
/* print the table trailer */
- f_print(fout, tbl_end);
+ fputs(tbl_end, fout);
f_print(fout, tbl_nproc, progvers, progvers, progvers);
}
}
diff --git a/usr.bin/showmount/showmount.c b/usr.bin/showmount/showmount.c
index f4372b5..2635250 100644
--- a/usr.bin/showmount/showmount.c
+++ b/usr.bin/showmount/showmount.c
@@ -185,7 +185,7 @@ main(int argc, char **argv)
printf("Exports list on %s:\n", host);
exp = exportslist;
while (exp) {
- printf("%-35s", exp->ex_dirp);
+ printf("%-34s ", exp->ex_dirp);
grp = exp->ex_groups;
if (grp == NULL) {
printf("Everyone\n");
diff --git a/usr.bin/top/machine.c b/usr.bin/top/machine.c
index bd0f7d8..f98f64e 100644
--- a/usr.bin/top/machine.c
+++ b/usr.bin/top/machine.c
@@ -35,6 +35,7 @@
#include <sys/user.h>
#include <sys/vmmeter.h>
+#include <err.h>
#include <kvm.h>
#include <math.h>
#include <nlist.h>
diff --git a/usr.bin/truss/amd64-fbsd.c b/usr.bin/truss/amd64-fbsd.c
index a4e5311..6ed3812 100644
--- a/usr.bin/truss/amd64-fbsd.c
+++ b/usr.bin/truss/amd64-fbsd.c
@@ -128,7 +128,7 @@ amd64_syscall_entry(struct trussinfo *trussinfo, int nargs) {
/*
* FreeBSD has two special kinds of system call redirctions --
* SYS_syscall, and SYS___syscall. The former is the old syscall()
- * routine, basicly; the latter is for quad-aligned arguments.
+ * routine, basically; the latter is for quad-aligned arguments.
*/
reg = 0;
syscall_num = regs.r_rax;
diff --git a/usr.bin/truss/amd64-fbsd32.c b/usr.bin/truss/amd64-fbsd32.c
index b25b818..c3dd183 100644
--- a/usr.bin/truss/amd64-fbsd32.c
+++ b/usr.bin/truss/amd64-fbsd32.c
@@ -136,7 +136,7 @@ amd64_fbsd32_syscall_entry(struct trussinfo *trussinfo, int nargs) {
/*
* FreeBSD has two special kinds of system call redirctions --
* SYS_syscall, and SYS___syscall. The former is the old syscall()
- * routine, basicly; the latter is for quad-aligned arguments.
+ * routine, basically; the latter is for quad-aligned arguments.
*/
syscall_num = regs.r_rax;
switch (syscall_num) {
diff --git a/usr.bin/truss/i386-fbsd.c b/usr.bin/truss/i386-fbsd.c
index 70b051c..82f1db0 100644
--- a/usr.bin/truss/i386-fbsd.c
+++ b/usr.bin/truss/i386-fbsd.c
@@ -131,7 +131,7 @@ i386_syscall_entry(struct trussinfo *trussinfo, int nargs) {
/*
* FreeBSD has two special kinds of system call redirctions --
* SYS_syscall, and SYS___syscall. The former is the old syscall()
- * routine, basicly; the latter is for quad-aligned arguments.
+ * routine, basically; the latter is for quad-aligned arguments.
*/
syscall_num = regs.r_eax;
switch (syscall_num) {
diff --git a/usr.bin/truss/ia64-fbsd.c b/usr.bin/truss/ia64-fbsd.c
index 285e314..8fc06c6 100644
--- a/usr.bin/truss/ia64-fbsd.c
+++ b/usr.bin/truss/ia64-fbsd.c
@@ -128,7 +128,7 @@ ia64_syscall_entry(struct trussinfo *trussinfo, int nargs) {
/*
* FreeBSD has two special kinds of system call redirctions --
* SYS_syscall, and SYS___syscall. The former is the old syscall()
- * routine, basicly; the latter is for quad-aligned arguments.
+ * routine, basically; the latter is for quad-aligned arguments.
*/
syscall_num = regs.r_scratch.gr15; /* XXX double-check. */
if (syscall_num == SYS_syscall || syscall_num == SYS___syscall)
diff --git a/usr.bin/truss/main.c b/usr.bin/truss/main.c
index e828046..a74fe1c 100644
--- a/usr.bin/truss/main.c
+++ b/usr.bin/truss/main.c
@@ -33,7 +33,7 @@
__FBSDID("$FreeBSD$");
/*
- * The main module for truss. Suprisingly simple, but, then, the other
+ * The main module for truss. Surprisingly simple, but, then, the other
* files handle the bulk of the work. And, of course, the kernel has to
* do a lot of the work :).
*/
diff --git a/usr.bin/truss/powerpc-fbsd.c b/usr.bin/truss/powerpc-fbsd.c
index 5643f72..285b10a 100644
--- a/usr.bin/truss/powerpc-fbsd.c
+++ b/usr.bin/truss/powerpc-fbsd.c
@@ -137,7 +137,7 @@ powerpc_syscall_entry(struct trussinfo *trussinfo, int nargs) {
/*
* FreeBSD has two special kinds of system call redirctions --
* SYS_syscall, and SYS___syscall. The former is the old syscall()
- * routine, basicly; the latter is for quad-aligned arguments.
+ * routine, basically; the latter is for quad-aligned arguments.
*/
regargs = NARGREG;
syscall_num = regs.fixreg[0];
diff --git a/usr.bin/truss/powerpc64-fbsd.c b/usr.bin/truss/powerpc64-fbsd.c
index f072544..145c330 100644
--- a/usr.bin/truss/powerpc64-fbsd.c
+++ b/usr.bin/truss/powerpc64-fbsd.c
@@ -129,7 +129,7 @@ powerpc64_syscall_entry(struct trussinfo *trussinfo, int nargs) {
/*
* FreeBSD has two special kinds of system call redirctions --
* SYS_syscall, and SYS___syscall. The former is the old syscall()
- * routine, basicly; the latter is for quad-aligned arguments.
+ * routine, basically; the latter is for quad-aligned arguments.
*/
regargs = NARGREG;
syscall_num = regs.fixreg[0];
diff --git a/usr.bin/truss/sparc64-fbsd.c b/usr.bin/truss/sparc64-fbsd.c
index 779d6d8..47302cc 100644
--- a/usr.bin/truss/sparc64-fbsd.c
+++ b/usr.bin/truss/sparc64-fbsd.c
@@ -135,7 +135,7 @@ sparc64_syscall_entry(struct trussinfo *trussinfo, int nargs) {
/*
* FreeBSD has two special kinds of system call redirctions --
* SYS_syscall, and SYS___syscall. The former is the old syscall()
- * routine, basicly; the latter is for quad-aligned arguments.
+ * routine, basically; the latter is for quad-aligned arguments.
*/
syscall_num = regs.r_global[1];
if (syscall_num == SYS_syscall || syscall_num == SYS___syscall) {
diff --git a/usr.sbin/ifmcstat/ifmcstat.8 b/usr.sbin/ifmcstat/ifmcstat.8
index 5a6956d..9794d70 100644
--- a/usr.sbin/ifmcstat/ifmcstat.8
+++ b/usr.sbin/ifmcstat/ifmcstat.8
@@ -125,7 +125,7 @@ This support is recommended for debugging purposes.
It requires super-user privilege if used to inspect a running kernel.
.Pp
.Sh SEE ALSO
+.Xr netstat 1 ,
.Xr getifaddrs 3 ,
.Xr getifmaddrs 3 ,
-.Xr kvm 3 ,
-.Xr netstat 8
+.Xr kvm 3
diff --git a/usr.sbin/makefs/cd9660.c b/usr.sbin/makefs/cd9660.c
index bed764f..59b9ef4 100644
--- a/usr.sbin/makefs/cd9660.c
+++ b/usr.sbin/makefs/cd9660.c
@@ -207,6 +207,7 @@ cd9660_set_defaults(void)
diskStructure.rr_moved_dir = 0;
diskStructure.archimedes_enabled = 0;
+ diskStructure.chrp_boot = 0;
diskStructure.include_padding_areas = 1;
@@ -391,6 +392,8 @@ cd9660_parse_opts(const char *option, fsinfo_t *fsopts)
diskStructure.rock_ridge_enabled = 1;
else if (CD9660_IS_COMMAND_ARG_DUAL(var, "A", "archimedes"))
diskStructure.archimedes_enabled = 1;
+ else if (CD9660_IS_COMMAND_ARG(var, "chrp-boot"))
+ diskStructure.chrp_boot = 1;
else if (CD9660_IS_COMMAND_ARG_DUAL(var, "K", "keep-bad-images"))
diskStructure.keep_bad_images = 1;
else if (CD9660_IS_COMMAND_ARG(var, "allow-deep-trees"))
diff --git a/usr.sbin/makefs/cd9660.h b/usr.sbin/makefs/cd9660.h
index 16c0d64..79f0a9d 100644
--- a/usr.sbin/makefs/cd9660.h
+++ b/usr.sbin/makefs/cd9660.h
@@ -285,6 +285,7 @@ typedef struct _iso9660_disk {
cd9660node *rr_moved_dir;
int archimedes_enabled;
+ int chrp_boot;
/* Spec breaking options */
u_char allow_deep_trees;
diff --git a/usr.sbin/makefs/cd9660/cd9660_eltorito.c b/usr.sbin/makefs/cd9660/cd9660_eltorito.c
index 09aa3a5..2f45e9d 100644
--- a/usr.sbin/makefs/cd9660/cd9660_eltorito.c
+++ b/usr.sbin/makefs/cd9660/cd9660_eltorito.c
@@ -32,7 +32,7 @@
* OF SUCH DAMAGE.
*/
-#include <netinet/in.h>
+#include <sys/endian.h>
#include "cd9660.h"
#include "cd9660_eltorito.h"
@@ -501,27 +501,62 @@ cd9660_setup_boot_volume_descriptor(volume_descriptor *bvd)
}
static int
+cd9660_write_mbr_partition_entry(FILE *fd, int index, off_t sector_start,
+ off_t nsectors, int type)
+{
+ uint8_t val;
+ uint32_t lba;
+
+ fseeko(fd, (off_t)(index) * 16 + 0x1be, SEEK_SET);
+
+ val = 0x80; /* Bootable */
+ fwrite(&val, sizeof(val), 1, fd);
+
+ val = 0xff; /* CHS begin */
+ fwrite(&val, sizeof(val), 1, fd);
+ fwrite(&val, sizeof(val), 1, fd);
+ fwrite(&val, sizeof(val), 1, fd);
+
+ val = type; /* Part type */
+ fwrite(&val, sizeof(val), 1, fd);
+
+ val = 0xff; /* CHS end */
+ fwrite(&val, sizeof(val), 1, fd);
+ fwrite(&val, sizeof(val), 1, fd);
+ fwrite(&val, sizeof(val), 1, fd);
+
+ /* LBA extent */
+ lba = htole32(sector_start);
+ fwrite(&lba, sizeof(lba), 1, fd);
+ lba = htole32(nsectors);
+ fwrite(&lba, sizeof(lba), 1, fd);
+
+ return (0);
+}
+
+static int
cd9660_write_apm_partition_entry(FILE *fd, int index, int total_partitions,
off_t sector_start, off_t nsectors, off_t sector_size,
- const char *part_name, const char *part_type) {
+ const char *part_name, const char *part_type)
+{
uint32_t apm32;
uint16_t apm16;
fseeko(fd, (off_t)(index + 1) * sector_size, SEEK_SET);
/* Signature */
- apm16 = htons(0x504d);
+ apm16 = htobe16(0x504d);
fwrite(&apm16, sizeof(apm16), 1, fd);
apm16 = 0;
fwrite(&apm16, sizeof(apm16), 1, fd);
/* Total number of partitions */
- apm32 = htonl(total_partitions);
+ apm32 = htobe32(total_partitions);
fwrite(&apm32, sizeof(apm32), 1, fd);
/* Bounds */
- apm32 = htonl(sector_start);
+ apm32 = htobe32(sector_start);
fwrite(&apm32, sizeof(apm32), 1, fd);
- apm32 = htonl(nsectors);
+ apm32 = htobe32(nsectors);
fwrite(&apm32, sizeof(apm32), 1, fd);
fwrite(part_name, strlen(part_name) + 1, 1, fd);
@@ -537,6 +572,7 @@ cd9660_write_boot(FILE *fd)
struct boot_catalog_entry *e;
struct cd9660_boot_image *t;
int apm_partitions = 0;
+ int mbr_partitions = 0;
/* write boot catalog */
if (fseeko(fd, (off_t)diskStructure.boot_catalog_sector *
@@ -571,6 +607,35 @@ cd9660_write_boot(FILE *fd)
if (t->system == ET_SYS_MAC)
apm_partitions++;
+ if (t->system == ET_SYS_PPC)
+ mbr_partitions++;
+ }
+
+ /* some systems need partition tables as well */
+ if (mbr_partitions > 0 || diskStructure.chrp_boot) {
+ uint16_t sig;
+
+ fseek(fd, 0x1fe, SEEK_SET);
+ sig = htole16(0xaa55);
+ fwrite(&sig, sizeof(sig), 1, fd);
+
+ mbr_partitions = 0;
+
+ /* Write ISO9660 descriptor, enclosing the whole disk */
+ if (diskStructure.chrp_boot)
+ cd9660_write_mbr_partition_entry(fd, mbr_partitions++,
+ 0, diskStructure.totalSectors *
+ (diskStructure.sectorSize / 512), 0x96);
+
+ /* Write all partition entries */
+ TAILQ_FOREACH(t, &diskStructure.boot_images, image_list) {
+ if (t->system != ET_SYS_PPC)
+ continue;
+ cd9660_write_mbr_partition_entry(fd, mbr_partitions++,
+ t->sector * (diskStructure.sectorSize / 512),
+ t->num_sectors * (diskStructure.sectorSize / 512),
+ 0x41 /* PReP Boot */);
+ }
}
if (apm_partitions > 0) {
@@ -580,17 +645,17 @@ cd9660_write_boot(FILE *fd)
int total_parts;
fseek(fd, 0, SEEK_SET);
- apm16 = htons(0x4552);
+ apm16 = htobe16(0x4552);
fwrite(&apm16, sizeof(apm16), 1, fd);
/* Device block size */
- apm16 = htons(512);
+ apm16 = htobe16(512);
fwrite(&apm16, sizeof(apm16), 1, fd);
/* Device block count */
- apm32 = htonl(diskStructure.totalSectors *
+ apm32 = htobe32(diskStructure.totalSectors *
(diskStructure.sectorSize / 512));
fwrite(&apm32, sizeof(apm32), 1, fd);
/* Device type/id */
- apm16 = htons(1);
+ apm16 = htobe16(1);
fwrite(&apm16, sizeof(apm16), 1, fd);
fwrite(&apm16, sizeof(apm16), 1, fd);
diff --git a/usr.sbin/makefs/makefs.8 b/usr.sbin/makefs/makefs.8
index 974477c..b9fb10e 100644
--- a/usr.sbin/makefs/makefs.8
+++ b/usr.sbin/makefs/makefs.8
@@ -285,6 +285,9 @@ Use the
extension to encode
.Tn RISC OS
metadata.
+.It Sy chrp-boot
+Write an MBR partition table to the image to allow older CHRP hardware to
+boot.
.It Sy boot-load-segment
Set load segment for the boot image.
.It Sy bootimage
diff --git a/usr.sbin/nfsd/nfsv4.4 b/usr.sbin/nfsd/nfsv4.4
index 071a646..ba855d2 100644
--- a/usr.sbin/nfsd/nfsv4.4
+++ b/usr.sbin/nfsd/nfsv4.4
@@ -24,14 +24,14 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 10, 2011
+.Dd May 15, 2011
.Dt NFSV4 4
.Os
.Sh NAME
.Nm NFSv4
.Nd NFS Version 4 Protocol
.Sh DESCRIPTION
-The experimental NFS client and server provides support for the
+The NFS client and server provides support for the
.Tn NFSv4
specification; see
.%T "Network File System (NFS) Version 4 Protocol RFC 3530" .
@@ -153,36 +153,26 @@ with RPCSEC_GSS (sec=krb5, krb5i, krb5p), only names and KerberosV tickets
will go on the wire.
.Sh SERVER SETUP
.Pp
-To set up the experimental NFS server that supports
+To set up the NFS server that supports
.Nm ,
-you will need to either build a kernel with:
+you will need to either set the variables in
+.Xr rc.conf 5
+as follows:
.sp
.Bd -literal -offset indent -compact
-options NFSD
-.Ed
-and not
-.Bd -literal -offset indent -compact
-options NFSSERVER
+nfs_server_enable="YES"
+nfsv4_server_enable="YES"
+nfsuserd_enable="YES"
.Ed
.sp
or start
.Xr mountd 8
and
.Xr nfsd 8
-with the ``-e'' option to force use of the experimental server.
+without the ``-o'' option, which would force use of the old server.
The
.Xr nfsuserd 8
daemon must also be running.
-This will occur if
-.sp
-.Bd -literal -offset indent -compact
-nfs_server_enable="YES"
-nfsv4_server_enable="YES"
-nfsuserd_enable="YES"
-.Ed
-.sp
-are set in
-.Xr rc.conf 5 .
.Pp
You will also need to add at least one ``V4:'' line to the
.Xr exports 5
@@ -196,7 +186,7 @@ there are a couple of
.Xr sysctl 8
variables that you can change, which might improve performance.
.Bl -tag -width Ds
-.It Cm vfs.newnfs.issue_delegations
+.It Cm vfs.nfsd.issue_delegations
when set non-zero, allows the server to issue Open Delegations to
clients.
These delegations permit the client to manipulate the file
@@ -208,7 +198,7 @@ This can only be enabled when the file systems being exported to
clients are not being accessed locally on the server and, if being
accessed via NFS Version 2 or 3 clients, these clients cannot be
using the NLM.
-.It Cm vfs.newnfs.enable_locallocks
+.It Cm vfs.nfsd.enable_locallocks
can be set to 0 to disable acquisition of local byte range locks.
Disabling local locking can only be done if neither local accesses
to the exported file systems nor the NLM is operating on them.
@@ -217,7 +207,7 @@ to the exported file systems nor the NLM is operating on them.
Note that Samba server access would be considered ``local access'' for the above
discussion.
.Pp
-To build a kernel with the experimental
+To build a kernel with the NFS server that supports
.Nm
linked into it, the
.sp
@@ -235,7 +225,9 @@ To do an
mount, specify the ``nfsv4'' option on the
.Xr mount_nfs 8
command line.
-This will force use of the experimental client plus set ``tcp'' and
+This will force use of the client that supports
+.Nm
+plus set ``tcp'' and
.Nm .
.Pp
The
@@ -269,16 +261,16 @@ To get callbacks to work when behind a NAT gateway, a port for the callback
service will need to be set up on the NAT gateway and then the address
of the NAT gateway (host IP plus port#) will need to be set by assigning the
.Xr sysctl 8
-variable vfs.newnfs.callback_addr to a string of the form:
+variable vfs.nfs.callback_addr to a string of the form:
.sp
N.N.N.N.N.N
.sp
where the first 4 Ns are the host IP address and the last two are the
port# in network byte order (all decimal #s in the range 0-255).
.Pp
-To build a kernel with the experimental
+To build a kernel with the client that supports
.Nm
-client linked into it, the option
+linked into it, the option
.sp
.Bd -literal -offset indent -compact
options NFSCL
diff --git a/usr.sbin/pc-sysinstall/backend/functions-disk.sh b/usr.sbin/pc-sysinstall/backend/functions-disk.sh
index 94fb436..c63f7af 100755
--- a/usr.sbin/pc-sysinstall/backend/functions-disk.sh
+++ b/usr.sbin/pc-sysinstall/backend/functions-disk.sh
@@ -582,17 +582,9 @@ stop_gjournal()
# Function to wipe the potential backup gpt table from a disk
clear_backup_gpt_table()
{
- # Get the disk block size
- local dSize="`gpart show $1 | grep $1 | tr -s ' ' | cut -d ' ' -f 3`"
-
- # Make sure this is a valid number
- is_num "${dSize}" >/dev/null 2>/dev/null
- [ $? -ne 0 ] && return
-
- # Die backup label, DIE
echo_log "Clearing gpt backup table location on disk"
- rc_nohalt "dd if=/dev/zero of=${1} bs=512 seek=${dSize}"
-
+ rc_nohalt "dd if=/dev/zero of=${1} bs=1m count=1"
+ rc_nohalt "dd if=/dev/zero of=${1} bs=1m oseek=`diskinfo ${1} | awk '{print int($3 / (1024*1024)) - 4;}'`"
} ;
diff --git a/usr.sbin/pc-sysinstall/backend/functions-installcomponents.sh b/usr.sbin/pc-sysinstall/backend/functions-installcomponents.sh
index c46c9c5..05e4d49 100755
--- a/usr.sbin/pc-sysinstall/backend/functions-installcomponents.sh
+++ b/usr.sbin/pc-sysinstall/backend/functions-installcomponents.sh
@@ -120,9 +120,11 @@ COMPTMPDIR=\"${COMPTMPDIR}\"
export COMPTMPDIR
CFILE=\"${CFILE}\"
export CFILE
+mount -t devfs devfs /dev
sh ${COMPTMPDIR}/install.sh
+umount /dev
" >${FSMNT}/.componentwrapper.sh
chmod 755 ${FSMNT}/.componentwrapper.sh
diff --git a/usr.sbin/pkg_install/Makefile b/usr.sbin/pkg_install/Makefile
index 0aa1941..bf1a213 100644
--- a/usr.sbin/pkg_install/Makefile
+++ b/usr.sbin/pkg_install/Makefile
@@ -2,11 +2,11 @@
.include <bsd.own.mk>
-SUBDIR= add create delete info updating version
+SUBDIR= lib add create delete info updating version
.include <bsd.subdir.mk>
-DATE!= grep PKG_INSTALL_VERSION ${.CURDIR}/Makefile.inc | sed 's|.*=||'
+DATE!= grep PKG_INSTALL_VERSION ${.CURDIR}/lib/lib.h | sed 's|.*[ ]||'
distfile: clean
@(cd ${.CURDIR}/..; \
diff --git a/usr.sbin/pkg_install/Makefile.inc b/usr.sbin/pkg_install/Makefile.inc
index d929f24..2fa20aa 100644
--- a/usr.sbin/pkg_install/Makefile.inc
+++ b/usr.sbin/pkg_install/Makefile.inc
@@ -2,11 +2,16 @@
.include <bsd.own.mk>
-CFLAGS+= -DPKG_INSTALL_VERSION=20101012
-CFLAGS+= -DYES_I_KNOW_THE_API_IS_RUBBISH_AND_IS_DOOMED_TO_CHANGE
+LIBINSTALL= ${.OBJDIR}/../lib/libinstall.a
-DPADD+= ${LIBPKG}
-LDADD+= -lpkg
+DPADD+= ${LIBUTIL}
+LDADD+= -lutil
+
+.if ${MK_OPENSSL} != "no" && \
+ defined(LDADD) && ${LDADD:M-lfetch} != ""
+DPADD+= ${LIBSSL} ${LIBCRYPTO}
+LDADD+= -lssl -lcrypto
+.endif
# Inherit BINDIR from one level up.
.include "../Makefile.inc"
diff --git a/usr.sbin/pkg_install/add/Makefile b/usr.sbin/pkg_install/add/Makefile
index 03a43f0..89988e7 100644
--- a/usr.sbin/pkg_install/add/Makefile
+++ b/usr.sbin/pkg_install/add/Makefile
@@ -1,11 +1,14 @@
# $FreeBSD$
-.include <bsd.own.mk>
-
PROG= pkg_add
SRCS= main.c perform.c futil.c extract.c
+CFLAGS+= -I${.CURDIR}/../lib
+
WARNS?= 3
WFORMAT?= 1
+DPADD= ${LIBINSTALL} ${LIBFETCH} ${LIBMD}
+LDADD= ${LIBINSTALL} -lfetch -lmd
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/pkg_install/add/extract.c b/usr.sbin/pkg_install/add/extract.c
index 6c2c4fc..732a13f 100644
--- a/usr.sbin/pkg_install/add/extract.c
+++ b/usr.sbin/pkg_install/add/extract.c
@@ -23,7 +23,7 @@ __FBSDID("$FreeBSD$");
#include <ctype.h>
#include <err.h>
-#include <pkg.h>
+#include "lib.h"
#include "add.h"
diff --git a/usr.sbin/pkg_install/add/futil.c b/usr.sbin/pkg_install/add/futil.c
index c525320..ca095ea 100644
--- a/usr.sbin/pkg_install/add/futil.c
+++ b/usr.sbin/pkg_install/add/futil.c
@@ -22,7 +22,7 @@
__FBSDID("$FreeBSD$");
#include <err.h>
-#include <pkg.h>
+#include "lib.h"
#include "add.h"
/*
diff --git a/usr.sbin/pkg_install/add/main.c b/usr.sbin/pkg_install/add/main.c
index b8b9b54..f73312a 100644
--- a/usr.sbin/pkg_install/add/main.c
+++ b/usr.sbin/pkg_install/add/main.c
@@ -26,7 +26,7 @@ __FBSDID("$FreeBSD$");
#include <err.h>
#include <getopt.h>
-#include <pkg.h>
+#include "lib.h"
#include "add.h"
char *Prefix = NULL;
@@ -132,8 +132,6 @@ main(int argc, char **argv)
static char temppackageroot[MAXPATHLEN];
static char pkgaddpath[MAXPATHLEN];
- pkg_wrap(PKG_INSTALL_VERSION, argv);
-
if (*argv[0] != '/' && strchr(argv[0], '/') != NULL)
PkgAddCmd = realpath(argv[0], pkgaddpath);
else
diff --git a/usr.sbin/pkg_install/add/perform.c b/usr.sbin/pkg_install/add/perform.c
index 653a1d6..b23cd52 100644
--- a/usr.sbin/pkg_install/add/perform.c
+++ b/usr.sbin/pkg_install/add/perform.c
@@ -23,7 +23,7 @@ __FBSDID("$FreeBSD$");
#include <err.h>
#include <paths.h>
-#include <pkg.h>
+#include "lib.h"
#include "add.h"
#include <libgen.h>
diff --git a/usr.sbin/pkg_install/create/Makefile b/usr.sbin/pkg_install/create/Makefile
index 3334037..42718c6 100644
--- a/usr.sbin/pkg_install/create/Makefile
+++ b/usr.sbin/pkg_install/create/Makefile
@@ -3,10 +3,12 @@
PROG= pkg_create
SRCS= main.c perform.c pl.c
+CFLAGS+= -I${.CURDIR}/../lib
+
WARNS?= 3
WFORMAT?= 1
-DPADD= ${LIBMD}
-LDADD= -lmd
+DPADD= ${LIBINSTALL} ${LIBMD}
+LDADD= ${LIBINSTALL} -lmd
.include <bsd.prog.mk>
diff --git a/usr.sbin/pkg_install/create/main.c b/usr.sbin/pkg_install/create/main.c
index 5e999da..e4af621 100644
--- a/usr.sbin/pkg_install/create/main.c
+++ b/usr.sbin/pkg_install/create/main.c
@@ -15,7 +15,7 @@ __FBSDID("$FreeBSD$");
#include <getopt.h>
#include <err.h>
-#include <pkg.h>
+#include "lib.h"
#include "create.h"
match_t MatchType = MATCH_GLOB;
@@ -72,8 +72,6 @@ main(int argc, char **argv)
int ch;
char **pkgs, **start, *tmp;
- pkg_wrap(PKG_INSTALL_VERSION, argv);
-
pkgs = start = argv;
while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1)
switch(ch) {
diff --git a/usr.sbin/pkg_install/create/perform.c b/usr.sbin/pkg_install/create/perform.c
index 149bcbd..45786b6 100644
--- a/usr.sbin/pkg_install/create/perform.c
+++ b/usr.sbin/pkg_install/create/perform.c
@@ -21,7 +21,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <pkg.h>
+#include "lib.h"
#include "create.h"
#include <err.h>
diff --git a/usr.sbin/pkg_install/create/pl.c b/usr.sbin/pkg_install/create/pl.c
index fe62d42..18bbaf2 100644
--- a/usr.sbin/pkg_install/create/pl.c
+++ b/usr.sbin/pkg_install/create/pl.c
@@ -21,7 +21,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <pkg.h>
+#include "lib.h"
#include "create.h"
#include <errno.h>
#include <err.h>
diff --git a/usr.sbin/pkg_install/delete/Makefile b/usr.sbin/pkg_install/delete/Makefile
index 4f3b390..c9a0fde 100644
--- a/usr.sbin/pkg_install/delete/Makefile
+++ b/usr.sbin/pkg_install/delete/Makefile
@@ -3,6 +3,11 @@
PROG= pkg_delete
SRCS= main.c perform.c
+CFLAGS+= -I${.CURDIR}/../lib
+
WFORMAT?= 1
+DPADD= ${LIBINSTALL} ${LIBMD}
+LDADD= ${LIBINSTALL} -lmd
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/pkg_install/delete/main.c b/usr.sbin/pkg_install/delete/main.c
index 7677fe9..f09a432 100644
--- a/usr.sbin/pkg_install/delete/main.c
+++ b/usr.sbin/pkg_install/delete/main.c
@@ -27,7 +27,7 @@ __FBSDID("$FreeBSD$");
#include <getopt.h>
#include <err.h>
-#include <pkg.h>
+#include "lib.h"
#include "delete.h"
char *Prefix = NULL;
@@ -67,8 +67,6 @@ main(int argc, char **argv)
const char *tmp;
struct stat stat_s;
- pkg_wrap(PKG_INSTALL_VERSION, argv);
-
pkgs = start = argv;
while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1)
switch(ch) {
diff --git a/usr.sbin/pkg_install/delete/perform.c b/usr.sbin/pkg_install/delete/perform.c
index 02f9717..2557dbc 100644
--- a/usr.sbin/pkg_install/delete/perform.c
+++ b/usr.sbin/pkg_install/delete/perform.c
@@ -22,7 +22,7 @@
__FBSDID("$FreeBSD$");
#include <err.h>
-#include <pkg.h>
+#include "lib.h"
#include "delete.h"
static int pkg_do(char *);
diff --git a/usr.sbin/pkg_install/info/Makefile b/usr.sbin/pkg_install/info/Makefile
index ba3909d..485cb22 100644
--- a/usr.sbin/pkg_install/info/Makefile
+++ b/usr.sbin/pkg_install/info/Makefile
@@ -3,9 +3,11 @@
PROG= pkg_info
SRCS= main.c perform.c show.c
+CFLAGS+= -I${.CURDIR}/../lib
+
WFORMAT?= 1
-DPADD= ${LIBMD}
-LDADD= -lmd
+DPADD= ${LIBINSTALL} ${LIBFETCH} ${LIBMD}
+LDADD= ${LIBINSTALL} -lfetch -lmd
.include <bsd.prog.mk>
diff --git a/usr.sbin/pkg_install/info/info.h b/usr.sbin/pkg_install/info/info.h
index 68ec710..46e29b1 100644
--- a/usr.sbin/pkg_install/info/info.h
+++ b/usr.sbin/pkg_install/info/info.h
@@ -33,26 +33,25 @@
#define MAXNAMESIZE 20
#endif
-#define SHOW_COMMENT 0x000001
-#define SHOW_DESC 0x000002
-#define SHOW_PLIST 0x000004
-#define SHOW_INSTALL 0x000008
-#define SHOW_DEINSTALL 0x000010
-#define SHOW_REQUIRE 0x000020
-#define SHOW_PREFIX 0x000040
-#define SHOW_INDEX 0x000080
-#define SHOW_FILES 0x000100
-#define SHOW_DISPLAY 0x000200
-#define SHOW_REQBY 0x000400
-#define SHOW_MTREE 0x000800
-#define SHOW_SIZE 0x001000
-#define SHOW_ORIGIN 0x002000
-#define SHOW_CKSUM 0x004000
-#define SHOW_FMTREV 0x008000
-#define SHOW_PTREV 0x010000
-#define SHOW_DEPEND 0x020000
-#define SHOW_PKGNAME 0x040000
-#define SHOW_LPREV 0x100000
+#define SHOW_COMMENT 0x00001
+#define SHOW_DESC 0x00002
+#define SHOW_PLIST 0x00004
+#define SHOW_INSTALL 0x00008
+#define SHOW_DEINSTALL 0x00010
+#define SHOW_REQUIRE 0x00020
+#define SHOW_PREFIX 0x00040
+#define SHOW_INDEX 0x00080
+#define SHOW_FILES 0x00100
+#define SHOW_DISPLAY 0x00200
+#define SHOW_REQBY 0x00400
+#define SHOW_MTREE 0x00800
+#define SHOW_SIZE 0x01000
+#define SHOW_ORIGIN 0x02000
+#define SHOW_CKSUM 0x04000
+#define SHOW_FMTREV 0x08000
+#define SHOW_PTREV 0x10000
+#define SHOW_DEPEND 0x20000
+#define SHOW_PKGNAME 0x40000
struct which_entry {
TAILQ_ENTRY(which_entry) next;
diff --git a/usr.sbin/pkg_install/info/main.c b/usr.sbin/pkg_install/info/main.c
index ca4e477..2de638e 100644
--- a/usr.sbin/pkg_install/info/main.c
+++ b/usr.sbin/pkg_install/info/main.c
@@ -25,7 +25,7 @@ __FBSDID("$FreeBSD$");
#include <getopt.h>
#include <err.h>
-#include <pkg.h>
+#include "lib.h"
#include "info.h"
int Flags = 0;
@@ -68,8 +68,6 @@ main(int argc, char **argv)
char **pkgs, **start;
char *pkgs_split;
- pkg_wrap(PKG_INSTALL_VERSION, argv);
-
whead = malloc(sizeof(struct which_head));
if (whead == NULL)
err(2, NULL);
@@ -227,10 +225,7 @@ main(int argc, char **argv)
}
case 'P':
- if (Flags & SHOW_PTREV)
- Flags |= SHOW_LPREV;
- else
- Flags = SHOW_PTREV;
+ Flags = SHOW_PTREV;
break;
case 'h':
@@ -247,11 +242,6 @@ main(int argc, char **argv)
if (!Quiet)
printf("Package tools revision: ");
printf("%d\n", PKG_INSTALL_VERSION);
- if (Flags & SHOW_LPREV) {
- if (!Quiet)
- printf("Libpkg revision: ");
- printf("%d\n", libpkg_version());
- }
exit(0);
}
diff --git a/usr.sbin/pkg_install/info/perform.c b/usr.sbin/pkg_install/info/perform.c
index d295612..09cad78 100644
--- a/usr.sbin/pkg_install/info/perform.c
+++ b/usr.sbin/pkg_install/info/perform.c
@@ -21,7 +21,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <pkg.h>
+#include "lib.h"
#include "info.h"
#include <err.h>
#include <signal.h>
diff --git a/usr.sbin/pkg_install/info/show.c b/usr.sbin/pkg_install/info/show.c
index 0d3b4ad..c65c312 100644
--- a/usr.sbin/pkg_install/info/show.c
+++ b/usr.sbin/pkg_install/info/show.c
@@ -21,7 +21,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <pkg.h>
+#include "lib.h"
#include "info.h"
#include <err.h>
#include <stdlib.h>
diff --git a/usr.sbin/pkg_install/lib/Makefile b/usr.sbin/pkg_install/lib/Makefile
new file mode 100644
index 0000000..84a41b8
--- /dev/null
+++ b/usr.sbin/pkg_install/lib/Makefile
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+LIB= install
+INTERNALLIB=
+SRCS= file.c msg.c plist.c str.c exec.c global.c pen.c match.c \
+ deps.c version.c pkgwrap.c url.c
+
+WARNS?= 3
+WFORMAT?= 1
+
+.include <bsd.lib.mk>
diff --git a/lib/libpkg/deps.c b/usr.sbin/pkg_install/lib/deps.c
index 101d046..66f44a9 100644
--- a/lib/libpkg/deps.c
+++ b/usr.sbin/pkg_install/lib/deps.c
@@ -22,7 +22,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "pkg.h"
+#include "lib.h"
#include <err.h>
#include <stdio.h>
diff --git a/lib/libpkg/exec.c b/usr.sbin/pkg_install/lib/exec.c
index 04891d3..fc8220c 100644
--- a/lib/libpkg/exec.c
+++ b/usr.sbin/pkg_install/lib/exec.c
@@ -21,7 +21,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "pkg.h"
+#include "lib.h"
#include <err.h>
/*
diff --git a/lib/libpkg/file.c b/usr.sbin/pkg_install/lib/file.c
index 7c95f99..c7ab9d6 100644
--- a/lib/libpkg/file.c
+++ b/usr.sbin/pkg_install/lib/file.c
@@ -21,7 +21,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "pkg.h"
+#include "lib.h"
#include <err.h>
#include <pwd.h>
#include <time.h>
diff --git a/lib/libpkg/global.c b/usr.sbin/pkg_install/lib/global.c
index 8103126..e136ec8 100644
--- a/lib/libpkg/global.c
+++ b/usr.sbin/pkg_install/lib/global.c
@@ -22,7 +22,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "pkg.h"
+#include "lib.h"
/* These are global for all utils */
Boolean Quiet = FALSE;
diff --git a/lib/libpkg/pkg.h b/usr.sbin/pkg_install/lib/lib.h
index 12e3562..089bfa3 100644
--- a/lib/libpkg/pkg.h
+++ b/usr.sbin/pkg_install/lib/lib.h
@@ -23,10 +23,6 @@
#ifndef _INST_LIB_LIB_H_
#define _INST_LIB_LIB_H_
-#ifndef YES_I_KNOW_THE_API_IS_RUBBISH_AND_IS_DOOMED_TO_CHANGE
-#error "You obviously have no idea what you're doing."
-#endif
-
/* Includes */
#include <sys/param.h>
#include <sys/file.h>
@@ -100,12 +96,13 @@
#define PKG_PREFIX_VNAME "PKG_PREFIX"
/*
- * Version of the package library - increase whenever you make a change
+ * Version of the package tools - increase whenever you make a change
* in the code that is not cosmetic only.
*/
-#define LIBPKG_VERSION 20100423
+#define PKG_INSTALL_VERSION 20100403
#define PKG_WRAPCONF_FNAME "/var/db/pkg_install.conf"
+#define main(argc, argv) real_main(argc, argv)
/* Version numbers to assist with changes in package file format */
#define PLIST_FMT_VER_MAJOR 1
@@ -217,7 +214,7 @@ Boolean make_preserve_name(char *, int, const char *, const char *);
/* For all */
int pkg_perform(char **);
-void pkg_wrap(long, char **);
+int real_main(int, char **);
/* Query installed packages */
char **matchinstalled(match_t, char **, int *);
@@ -232,7 +229,6 @@ int chkifdepends(const char *, const char *);
int requiredby(const char *, struct reqr_by_head **, Boolean, Boolean);
/* Version */
-int libpkg_version(void);
int verscmp(Package *, int, int);
int version_cmp(const char *, const char *);
diff --git a/lib/libpkg/match.c b/usr.sbin/pkg_install/lib/match.c
index ba65442..6c1b2bf 100644
--- a/lib/libpkg/match.c
+++ b/usr.sbin/pkg_install/lib/match.c
@@ -21,7 +21,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "pkg.h"
+#include "lib.h"
#include <err.h>
#include <fnmatch.h>
#include <fts.h>
@@ -292,7 +292,7 @@ matchallbyorigin(const char **origins, int *retval)
break;
}
}
- if (cmd != PLIST_ORIGIN && 0 != strncmp("bsdpan-", installed[i], 7))
+ if (cmd != PLIST_ORIGIN && ( Verbose || 0 != strncmp("bsdpan-", installed[i], 7 ) ) )
warnx("package %s has no origin recorded", installed[i]);
fclose(fp);
}
diff --git a/lib/libpkg/msg.c b/usr.sbin/pkg_install/lib/msg.c
index 0d25ad1..5b17624 100644
--- a/lib/libpkg/msg.c
+++ b/usr.sbin/pkg_install/lib/msg.c
@@ -21,7 +21,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "pkg.h"
+#include "lib.h"
#include <err.h>
#include <paths.h>
@@ -61,7 +61,12 @@ y_or_n(Boolean def, const char *msg, ...)
else
fprintf(stderr, " [no]? ");
fflush(stderr);
- ch = toupper(fgetc(tty));
+ if (AutoAnswer) {
+ ch = (AutoAnswer == YES) ? 'Y' : 'N';
+ fprintf(stderr, "%c\n", ch);
+ }
+ else
+ ch = toupper(fgetc(tty));
if (ch == '\n')
ch = (def) ? 'Y' : 'N';
}
diff --git a/lib/libpkg/pen.c b/usr.sbin/pkg_install/lib/pen.c
index 6e30445..2b405a3 100644
--- a/lib/libpkg/pen.c
+++ b/usr.sbin/pkg_install/lib/pen.c
@@ -21,7 +21,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "pkg.h"
+#include "lib.h"
#include <err.h>
#include <libutil.h>
#include <libgen.h>
@@ -103,7 +103,7 @@ popPen(char *pen)
const char *
make_playpen(char *pen, off_t sz)
{
- char humbuf[6];
+ char humbuf1[6], humbuf2[6];
char cwd[FILENAME_MAX];
if (!find_play_pen(pen, sz))
@@ -114,15 +114,22 @@ make_playpen(char *pen, off_t sz)
errx(2, "%s: can't mktemp '%s'", __func__, pen);
}
- humanize_number(humbuf, sizeof humbuf, sz, "", HN_AUTOSCALE, HN_NOSPACE);
+ if (Verbose) {
+ if (sz) {
+ humanize_number(humbuf1, sizeof humbuf1, sz, "", HN_AUTOSCALE,
+ HN_NOSPACE);
+ humanize_number(humbuf2, sizeof humbuf2, min_free(pen),
+ "", HN_AUTOSCALE, HN_NOSPACE);
+ fprintf(stderr, "Requested space: %s bytes, free space: %s bytes in %s\n", humbuf1, humbuf2, pen);
+ }
+ }
if (min_free(pen) < sz) {
rmdir(pen);
cleanup(0);
errx(2, "%s: not enough free space to create '%s'.\n"
"Please set your PKG_TMPDIR environment variable to a location\n"
- "with at least %s and try the command again",
- __func__, humbuf, pen);
+ "with more space and\ntry the command again", __func__, pen);
}
if (!getcwd(cwd, FILENAME_MAX)) {
diff --git a/usr.sbin/pkg_install/lib/pkgwrap.c b/usr.sbin/pkg_install/lib/pkgwrap.c
new file mode 100644
index 0000000..cbd15cd
--- /dev/null
+++ b/usr.sbin/pkg_install/lib/pkgwrap.c
@@ -0,0 +1,89 @@
+/*
+ * FreeBSD install - a package for the installation and maintenance
+ * of non-core utilities.
+ *
+ * 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.
+ *
+ * Maxim Sobolev
+ * 8 September 2002
+ *
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "lib.h"
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#undef main
+
+#define SEPARATORS " \t"
+
+extern char **environ;
+
+int
+main(int argc, char **argv)
+{
+ FILE *f;
+ char buffer[FILENAME_MAX], *cp, *verstr;
+ int len;
+
+ if (getenv("PKG_NOWRAP") != NULL)
+ goto nowrap;
+ f = fopen(PKG_WRAPCONF_FNAME, "r");
+ if (f == NULL)
+ goto nowrap;
+ cp = fgets(buffer, 256, f);
+ fclose(f);
+ if (cp == NULL)
+ goto nowrap;
+ len = strlen(cp);
+ if (cp[len - 1] == '\n')
+ cp[len - 1] = '\0';
+ while (strchr(SEPARATORS, *cp) != NULL)
+ cp++;
+ verstr = cp;
+ cp = strpbrk(cp, SEPARATORS);
+ if (cp == NULL)
+ goto nowrap;
+ *cp = '\0';
+ for (cp = verstr; *cp != '\0'; cp++)
+ if (isdigit(*cp) == 0)
+ goto nowrap;
+ if (atoi(verstr) < PKG_INSTALL_VERSION)
+ goto nowrap;
+ cp++;
+ while (*cp != '\0' && strchr(SEPARATORS, *cp) != NULL)
+ cp++;
+ if (*cp == '\0')
+ goto nowrap;
+ bcopy(cp, buffer, strlen(cp) + 1);
+ cp = strpbrk(buffer, SEPARATORS);
+ if (cp != NULL)
+ *cp = '\0';
+ if (!isdir(buffer))
+ goto nowrap;
+ cp = strrchr(argv[0], '/');
+ if (cp == NULL)
+ cp = argv[0];
+ else
+ cp++;
+ strlcat(buffer, "/", sizeof(buffer));
+ strlcat(buffer, cp, sizeof(buffer));
+ setenv("PKG_NOWRAP", "1", 1);
+ execve(buffer, argv, environ);
+
+nowrap:
+ unsetenv("PKG_NOWRAP");
+ return(real_main(argc, argv));
+}
diff --git a/lib/libpkg/plist.c b/usr.sbin/pkg_install/lib/plist.c
index b14ac20..545b541 100644
--- a/lib/libpkg/plist.c
+++ b/usr.sbin/pkg_install/lib/plist.c
@@ -21,7 +21,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "pkg.h"
+#include "lib.h"
#include <err.h>
#include <md5.h>
diff --git a/lib/libpkg/str.c b/usr.sbin/pkg_install/lib/str.c
index c26e6cc..0d9e288 100644
--- a/lib/libpkg/str.c
+++ b/usr.sbin/pkg_install/lib/str.c
@@ -21,7 +21,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "pkg.h"
+#include "lib.h"
char *
strconcat(const char *s1, const char *s2)
diff --git a/lib/libpkg/url.c b/usr.sbin/pkg_install/lib/url.c
index 4c10849..8c55347 100644
--- a/lib/libpkg/url.c
+++ b/usr.sbin/pkg_install/lib/url.c
@@ -21,7 +21,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "pkg.h"
+#include "lib.h"
#include <err.h>
#include <fetch.h>
#include <libgen.h>
@@ -109,7 +109,7 @@ fileGetURL(const char *base, const char *spec, int keep_package)
printf("Error: Unable to get %s: %s\n",
fname, fetchLastErrString);
/* If the fetch fails, yank the package. */
- if (keep_package && unlink(pkg) < 0) {
+ if (keep_package && unlink(pkg) < 0 && Verbose) {
warnx("failed to remove partially fetched package: %s", pkg);
}
return NULL;
diff --git a/lib/libpkg/version.c b/usr.sbin/pkg_install/lib/version.c
index 123fd5d2..d9c4fe7 100644
--- a/lib/libpkg/version.c
+++ b/usr.sbin/pkg_install/lib/version.c
@@ -19,20 +19,10 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "pkg.h"
+#include "lib.h"
#include <err.h>
/*
- * This routine could easily go somewhere else.
- *
- */
-int
-libpkg_version(void)
-{
- return LIBPKG_VERSION;
-}
-
-/*
* Routines to assist with PLIST_FMT_VER numbers in the packing
* lists.
*
@@ -76,7 +66,7 @@ split_version(const char *pkgname, const char **endname, unsigned long *epoch, u
if (pkgname == NULL)
errx(2, "%s: Passed NULL pkgname.", __func__);
- /* Look for the last '-' the pkgname */
+ /* Look for the last '-' the the pkgname */
ch = strrchr(pkgname, '-');
/* Cheat if we are just passed a version, not a valid package name */
versionstr = ch ? ch + 1 : pkgname;
diff --git a/usr.sbin/pkg_install/updating/Makefile b/usr.sbin/pkg_install/updating/Makefile
index f5b7525..b0d3689 100644
--- a/usr.sbin/pkg_install/updating/Makefile
+++ b/usr.sbin/pkg_install/updating/Makefile
@@ -3,6 +3,11 @@
PROG= pkg_updating
SRCS= main.c
+CFLAGS+= -I${.CURDIR}/../lib
+
WFORMAT?= 1
+DPADD= ${LIBINSTALL} ${LIBFETCH} ${LIBMD}
+LDADD= ${LIBINSTALL} -lfetch -lmd
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/pkg_install/updating/main.c b/usr.sbin/pkg_install/updating/main.c
index 993ccd5..0ab2ec0 100644
--- a/usr.sbin/pkg_install/updating/main.c
+++ b/usr.sbin/pkg_install/updating/main.c
@@ -19,7 +19,7 @@ __FBSDID("$FreeBSD$");
#include <sysexits.h>
#include <getopt.h>
-#include <pkg.h>
+#include "lib.h"
#include "pathnames.h"
typedef struct installedport {
@@ -87,8 +87,6 @@ main(int argc, char *argv[])
DIR *dir;
FILE *fd;
- pkg_wrap(PKG_INSTALL_VERSION, argv);
-
while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1) {
switch (ch) {
case 'd':
diff --git a/usr.sbin/pkg_install/version/Makefile b/usr.sbin/pkg_install/version/Makefile
index fb079e3..3e1d7a5 100644
--- a/usr.sbin/pkg_install/version/Makefile
+++ b/usr.sbin/pkg_install/version/Makefile
@@ -3,8 +3,13 @@
PROG= pkg_version
SRCS= main.c perform.c
+CFLAGS+= -I${.CURDIR}/../lib
+
WFORMAT?= 1
+DPADD= ${LIBINSTALL} ${LIBFETCH} ${LIBMD}
+LDADD= ${LIBINSTALL} -lfetch -lmd
+
test:
sh ${.CURDIR}/test-pkg_version.sh
diff --git a/usr.sbin/pkg_install/version/main.c b/usr.sbin/pkg_install/version/main.c
index 4238497..cad8583 100644
--- a/usr.sbin/pkg_install/version/main.c
+++ b/usr.sbin/pkg_install/version/main.c
@@ -25,7 +25,7 @@ __FBSDID("$FreeBSD$");
#include <getopt.h>
#include <err.h>
-#include <pkg.h>
+#include "lib.h"
#include "version.h"
char *LimitChars = NULL;
@@ -58,8 +58,6 @@ main(int argc, char **argv)
{
int ch, cmp = 0;
- pkg_wrap(PKG_INSTALL_VERSION, argv);
-
if (argc == 4 && !strcmp(argv[1], "-t")) {
cmp = version_cmp(argv[2], argv[3]);
printf(cmp > 0 ? ">\n" : (cmp < 0 ? "<\n" : "=\n"));
diff --git a/usr.sbin/pkg_install/version/perform.c b/usr.sbin/pkg_install/version/perform.c
index 79575a3..dc85696 100644
--- a/usr.sbin/pkg_install/version/perform.c
+++ b/usr.sbin/pkg_install/version/perform.c
@@ -21,7 +21,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <pkg.h>
+#include "lib.h"
#include "version.h"
#include <err.h>
#include <fetch.h>
diff --git a/usr.sbin/tzsetup/tzsetup.8 b/usr.sbin/tzsetup/tzsetup.8
index 4d548fd..727207e 100644
--- a/usr.sbin/tzsetup/tzsetup.8
+++ b/usr.sbin/tzsetup/tzsetup.8
@@ -23,7 +23,8 @@
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
-.Dd July 4, 2009
+.\"
+.Dd October 21, 2009
.Dt TZSETUP 8
.Os
.Sh NAME
@@ -32,8 +33,8 @@
.Sh SYNOPSIS
.Nm
.Op Fl nrs
-.Op Fl C Ar chroot directory
-.Op Ar zoneinfo file | zoneinfo name
+.Op Fl C Ar chroot_directory
+.Op Ar zoneinfo_file | zoneinfo_name
.Sh DESCRIPTION
The
.Nm
@@ -50,24 +51,25 @@ the hardware clock does not keep
.Pp
The following option is available:
.Bl -tag -offset indent -width Fl
-.It Fl C Ar chroot directory
+.It Fl C Ar chroot_directory
Open all files and directories relative to
-.Ar chroot directory .
+.Ar chroot_directory .
.It Fl n
Do not create or copy files.
.It Fl r
-Reinstall the zoneinfo file installed last time. The name is obtained from
+Reinstall the zoneinfo file installed last time.
+The name is obtained from
.Pa /var/db/zoneinfo .
-.It Fl s
+.It Fl s
Skip the initial question about adjusting the clock if not set to
.Tn UTC .
.El
.Pp
It is possible to short-circuit the menu system by specifying the
location of a
-.Ar zoneinfo file
+.Ar zoneinfo_file
or the name of the
-.Ar zoneinfo name
+.Ar zoneinfo_name
on the command line; this is intended mainly for pre-configured installation
scripts or people who know which zoneinfo they want to install.
.Sh TIMEZONE DATABASE
@@ -101,38 +103,41 @@ The source code to the database
contains many additional comments and documentation references for the
historically minded.
.Sh FILES
-.Bl -tag -width /usr/share/zoneinfo/zone.tab -compact
+.Bl -tag -width ".Pa /usr/share/zoneinfo/zone.tab" -compact
.It Pa /etc/localtime
-current time zone file.
+current time zone file
.It Pa /etc/wall_cmos_clock
see
-.Xr adjkerntz 8 .
+.Xr adjkerntz 8
.It Pa /usr/share/misc/iso3166
mapping of
.Tn ISO
-3166 territory codes to names.
+3166 territory codes to names
.It Pa /usr/share/zoneinfo
-directory for zoneinfo files.
+directory for zoneinfo files
.It Pa /usr/share/zoneinfo/zone.tab
-mapping of timezone file to country and location.
+mapping of timezone file to country and location
.It Pa /var/db/zoneinfo
-saved name of the timezone file installed last.
+saved name of the timezone file installed last
.El
.Sh EXAMPLES
Normal usage, to select the right zoneinfo file via the dialog-based
user interface:
-.Dl # tzsetup
+.Dl tzsetup
+.Pp
Install the file
.Pa /usr/share/zoneinfo/Australia/Sydney :
-.Dl # tzsetup /usr/share/zoneinfo/Australia/Sydney
+.Dl "tzsetup /usr/share/zoneinfo/Australia/Sydney"
+.Pp
Install the zoneinfo file for Australia/Sydney, assumed to be located
in
.Pa /usr/share/zoneinfo :
-.Dl # tzsetup Australia/Sydney
+.Dl "tzsetup Australia/Sydney"
+.Pp
After a reinstall of the zoneinfo files, you can reinstall the
-latest installed zoneinfo file: (as specified in
-.Pa /var/db/zoneinfo )
-.Dl # tzsetup -r
+latest installed zoneinfo file (as specified in
+.Pa /var/db/zoneinfo ) :
+.Dl "tzsetup -r"
.Sh SEE ALSO
.Xr date 1 ,
.Xr adjtime 2 ,
diff --git a/usr.sbin/tzsetup/tzsetup.c b/usr.sbin/tzsetup/tzsetup.c
index 3162200..8251470 100644
--- a/usr.sbin/tzsetup/tzsetup.c
+++ b/usr.sbin/tzsetup/tzsetup.c
@@ -731,7 +731,8 @@ static void
usage(void)
{
- fprintf(stderr, "usage: tzsetup [-nrs] [zoneinfo file]\n");
+ fprintf(stderr, "usage: tzsetup [-nrs] [-C chroot_directory]"
+ " [zoneinfo_file | zoneinfo_name]\n");
exit(1);
}
OpenPOWER on IntegriCloud