summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/dtrace.c45
-rw-r--r--etc/rc.d/automount2
-rw-r--r--etc/rc.d/automountd2
-rw-r--r--etc/rc.d/autounmountd2
-rwxr-xr-xetc/rc.d/ugidfw11
-rw-r--r--gnu/usr.bin/binutils/ld/Makefile10
-rw-r--r--gnu/usr.bin/binutils/ld/Makefile.amd641
-rw-r--r--gnu/usr.bin/binutils/ld/Makefile.mips1
-rw-r--r--gnu/usr.bin/binutils/ld/Makefile.powerpc641
-rw-r--r--gnu/usr.bin/binutils/ld/Makefile.sparc641
-rw-r--r--gnu/usr.bin/groff/tmac/Makefile66
-rw-r--r--gnu/usr.bin/groff/tmac/fr.ISO8859-1.in (renamed from gnu/usr.bin/groff/tmac/fr.ISO8859-1)0
-rw-r--r--gnu/usr.bin/groff/tmac/mdoc.local.in (renamed from gnu/usr.bin/groff/tmac/mdoc.local)0
-rw-r--r--gnu/usr.bin/groff/tmac/ru.KOI8-R.in (renamed from gnu/usr.bin/groff/tmac/ru.KOI8-R)0
-rw-r--r--kerberos5/Makefile4
-rw-r--r--kerberos5/lib/Makefile2
-rw-r--r--kerberos5/libexec/Makefile1
-rw-r--r--kerberos5/tools/Makefile1
-rw-r--r--kerberos5/usr.bin/Makefile1
-rw-r--r--kerberos5/usr.sbin/Makefile1
-rw-r--r--lib/libc/net/getaddrinfo.313
-rw-r--r--release/Makefile2
-rw-r--r--release/Makefile.mirrors2
-rw-r--r--release/Makefile.vm8
-rwxr-xr-xrelease/release.sh4
-rw-r--r--sbin/geom/class/nop/geom_nop.c6
-rw-r--r--sbin/geom/class/nop/gnop.88
-rw-r--r--sbin/init/init.83
-rw-r--r--sbin/ipf/Makefile5
-rw-r--r--sbin/ipf/ipftest/Makefile24
-rw-r--r--sbin/ipf/iptest/Makefile11
-rw-r--r--sbin/ipf/rules/Makefile17
-rw-r--r--sbin/mdconfig/mdconfig.8103
-rw-r--r--sbin/mdconfig/mdconfig.c10
-rw-r--r--sbin/mount_unionfs/mount_unionfs.84
-rw-r--r--sbin/newfs_msdos/newfs_msdos.c62
-rw-r--r--sbin/sysctl/sysctl.c12
-rw-r--r--sys/arm/freescale/imx/imx_i2c.c291
-rw-r--r--sys/arm/freescale/vybrid/vf_i2c.c4
-rw-r--r--sys/arm/samsung/exynos/exynos5_i2c.c4
-rw-r--r--sys/boot/common/loader.812
-rw-r--r--sys/boot/forth/loader.conf10
-rw-r--r--sys/boot/i386/gptboot/gptldr.S39
-rw-r--r--sys/cam/ctl/ctl_backend_block.c21
-rw-r--r--sys/compat/linprocfs/linprocfs.c22
-rw-r--r--sys/compat/linux/linux_file.c92
-rw-r--r--sys/compat/linux/linux_fork.c32
-rw-r--r--sys/contrib/ipfilter/netinet/ip_state.c3
-rw-r--r--sys/dev/e1000/if_lem.c2
-rw-r--r--sys/dev/e1000/if_lem.h16
-rw-r--r--sys/dev/iicbus/icee.c49
-rw-r--r--sys/dev/iicbus/iic.c437
-rw-r--r--sys/dev/iicbus/iic.h1
-rw-r--r--sys/dev/iicbus/iicbus_if.m4
-rw-r--r--sys/dev/iicbus/iicoc.c2
-rw-r--r--sys/dev/iicbus/iiconf.c129
-rw-r--r--sys/dev/iicbus/iiconf.h11
-rw-r--r--sys/dev/iscsi/iscsi.c27
-rw-r--r--sys/dev/md/md.c39
-rw-r--r--sys/dev/mmc/mmc.c23
-rw-r--r--sys/dev/pcf/pcf.c2
-rw-r--r--sys/fs/devfs/devfs_vnops.c3
-rw-r--r--sys/geom/geom_dev.c21
-rw-r--r--sys/geom/nop/g_nop.c42
-rw-r--r--sys/geom/nop/g_nop.h2
-rw-r--r--sys/kern/kern_exit.c4
-rw-r--r--sys/kern/kern_fork.c70
-rw-r--r--sys/kern/vfs_cache.c4
-rw-r--r--sys/kern/vfs_subr.c6
-rw-r--r--sys/net/paravirt.h157
-rw-r--r--sys/net/pfvar.h5
-rw-r--r--sys/netinet/tcp_input.c10
-rw-r--r--sys/netpfil/pf/pf.c112
-rw-r--r--sys/netpfil/pf/pf_ioctl.c13
-rw-r--r--sys/netpfil/pf/pf_norm.c13
-rw-r--r--sys/powerpc/mpc85xx/i2c.c2
-rw-r--r--sys/sys/elf_common.h6
-rw-r--r--sys/sys/mdioctl.h2
-rw-r--r--sys/sys/vnode.h1
-rw-r--r--usr.bin/rctl/rctl.84
-rw-r--r--usr.bin/svn/Makefile5
-rw-r--r--usr.bin/truss/setup.c6
-rw-r--r--usr.sbin/Makefile1
-rw-r--r--usr.sbin/amd/Makefile4
-rw-r--r--usr.sbin/bsdinstall/Makefile1
-rw-r--r--usr.sbin/fifolog/Makefile4
-rw-r--r--usr.sbin/freebsd-update/freebsd-update.85
-rw-r--r--usr.sbin/freebsd-update/freebsd-update.sh5
-rw-r--r--usr.sbin/lpr/Makefile4
-rw-r--r--usr.sbin/pc-sysinstall/Makefile1
-rw-r--r--usr.sbin/pw/pw.c22
-rw-r--r--usr.sbin/unbound/Makefile1
-rw-r--r--usr.sbin/wpa/Makefile1
94 files changed, 1373 insertions, 886 deletions
diff --git a/Makefile b/Makefile
index 99e08af..6693c33 100644
--- a/Makefile
+++ b/Makefile
@@ -245,9 +245,9 @@ cleanworld:
# Handle the user-driven targets, using the source relative mk files.
#
-.if empty(.MAKEFLAGS:M-n)
+.if !(!empty(.MAKEFLAGS:M-n) && ${.MAKEFLAGS:M-n} == "-n")
# skip this for -n to avoid changing previous behavior of
-# 'make -n buildworld' etc.
+# 'make -n buildworld' etc. Using -n -n will run it.
${TGTS}: .MAKE
tinderbox toolchains kernel-toolchains: .MAKE
.endif
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c
index 4cbb866..3a954ed 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c
+++ b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c
@@ -710,6 +710,9 @@ list_probe(dtrace_hdl_t *dtp, const dtrace_probedesc_t *pdp, void *arg)
if (g_verbose && dtrace_probe_info(dtp, pdp, &p) == 0)
print_probe_info(&p);
+ if (g_intr != 0)
+ return (1);
+
return (0);
}
@@ -1220,11 +1223,34 @@ intr(int signo)
g_impatient = 1;
}
+static void
+installsighands(void)
+{
+ struct sigaction act, oact;
+
+ (void) sigemptyset(&act.sa_mask);
+ act.sa_flags = 0;
+ act.sa_handler = intr;
+
+ if (sigaction(SIGINT, NULL, &oact) == 0 && oact.sa_handler != SIG_IGN)
+ (void) sigaction(SIGINT, &act, NULL);
+
+ if (sigaction(SIGTERM, NULL, &oact) == 0 && oact.sa_handler != SIG_IGN)
+ (void) sigaction(SIGTERM, &act, NULL);
+
+#if !defined(sun)
+ if (sigaction(SIGPIPE, NULL, &oact) == 0 && oact.sa_handler != SIG_IGN)
+ (void) sigaction(SIGPIPE, &act, NULL);
+
+ if (sigaction(SIGUSR1, NULL, &oact) == 0 && oact.sa_handler != SIG_IGN)
+ (void) sigaction(SIGUSR1, &act, NULL);
+#endif
+}
+
int
main(int argc, char *argv[])
{
dtrace_bufdesc_t buf;
- struct sigaction act, oact;
dtrace_status_t status[2];
dtrace_optval_t opt;
dtrace_cmd_t *dcp;
@@ -1776,6 +1802,8 @@ main(int argc, char *argv[])
if (g_ofile != NULL && (g_ofp = fopen(g_ofile, "a")) == NULL)
fatal("failed to open output file '%s'", g_ofile);
+ installsighands();
+
oprintf("%5s %10s %17s %33s %s\n",
"ID", "PROVIDER", "MODULE", "FUNCTION", "NAME");
@@ -1861,20 +1889,7 @@ main(int argc, char *argv[])
if (opt != DTRACEOPT_UNSET)
notice("allowing destructive actions\n");
- (void) sigemptyset(&act.sa_mask);
- act.sa_flags = 0;
- act.sa_handler = intr;
-
- if (sigaction(SIGINT, NULL, &oact) == 0 && oact.sa_handler != SIG_IGN)
- (void) sigaction(SIGINT, &act, NULL);
-
- if (sigaction(SIGTERM, NULL, &oact) == 0 && oact.sa_handler != SIG_IGN)
- (void) sigaction(SIGTERM, &act, NULL);
-
-#if !defined(sun)
- if (sigaction(SIGUSR1, NULL, &oact) == 0 && oact.sa_handler != SIG_IGN)
- (void) sigaction(SIGUSR1, &act, NULL);
-#endif
+ installsighands();
/*
* Now that tracing is active and we are ready to consume trace data,
diff --git a/etc/rc.d/automount b/etc/rc.d/automount
index c394694..7f43b45 100644
--- a/etc/rc.d/automount
+++ b/etc/rc.d/automount
@@ -4,7 +4,7 @@
#
# PROVIDE: automount
-# REQUIRE: nfsclient
+# REQUIRE: nfsclient automountd
# KEYWORD: nojail shutdown
. /etc/rc.subr
diff --git a/etc/rc.d/automountd b/etc/rc.d/automountd
index 6d74665..01a2e0b 100644
--- a/etc/rc.d/automountd
+++ b/etc/rc.d/automountd
@@ -4,7 +4,7 @@
#
# PROVIDE: automountd
-# REQUIRE: automount
+# REQUIRE: DAEMON
# KEYWORD: nojail
. /etc/rc.subr
diff --git a/etc/rc.d/autounmountd b/etc/rc.d/autounmountd
index c57f90d..49a27ba 100644
--- a/etc/rc.d/autounmountd
+++ b/etc/rc.d/autounmountd
@@ -4,7 +4,7 @@
#
# PROVIDE: autounmountd
-# REQUIRE: nfsclient
+# REQUIRE: DAEMON
# KEYWORD: nojail
. /etc/rc.subr
diff --git a/etc/rc.d/ugidfw b/etc/rc.d/ugidfw
index d65d6a3..09171e4 100755
--- a/etc/rc.d/ugidfw
+++ b/etc/rc.d/ugidfw
@@ -3,6 +3,7 @@
# $FreeBSD$
# PROVIDE: ugidfw
+# REQUIRE: FILESYSTEMS
# BEFORE: LOGIN
# KEYWORD: nojail shutdown
@@ -33,9 +34,17 @@ ugidfw_start()
ugidfw_stop()
{
+ local rulecount
+
# Disable the policy
#
- kldunload mac_bsdextended
+ # Check for the existence of rules and flush them if needed.
+ rulecount=$(sysctl -in security.mac.bsdextended.rule_count)
+ if [ ${rulecount:-0} -gt 0 ]; then
+ ugidfw list | sed -n '2,$p' | cut -d ' ' -f 1 | sort -r -n |
+ xargs -n 1 ugidfw remove
+ echo "MAC bsdextended rules flushed."
+ fi
}
load_rc_config $name
diff --git a/gnu/usr.bin/binutils/ld/Makefile b/gnu/usr.bin/binutils/ld/Makefile
index dff1121..2af5e29 100644
--- a/gnu/usr.bin/binutils/ld/Makefile
+++ b/gnu/usr.bin/binutils/ld/Makefile
@@ -1,5 +1,6 @@
# $FreeBSD$
+ELF_SCR_EXT= x xbn xc xd xdc xdw xn xr xs xsc xsw xu xw
.include "../Makefile.inc0"
.include <bsd.own.mk>
@@ -49,11 +50,14 @@ LDADD= ${DPADD}
CLEANDIRS+= ldscripts
CLEANFILES+= ldemul-list.h stringify.sed
+FILES= ${LDSCRIPTS:S|^|ldscripts/|}
+FILESDIR= ${SCRIPTDIR}
+
HOST= ${TARGET_TUPLE}
LIBSEARCHPATH= \"${TOOLS_PREFIX}/lib\":\"${TOOLS_PREFIX}/usr/lib\"
-ELF_SCR_EXT= x xbn xc xd xdc xdw xn xr xs xsc xsw xu xw
.for ext in ${ELF_SCR_EXT}
LDSCRIPTS+= ${NATIVE_EMULATION}.${ext}
+ldscripts/${NATIVE_EMULATION}.${ext}: e${NATIVE_EMULATION}.c
.endfor
EMXFR=
@@ -70,8 +74,4 @@ ldemul-list.h:
stringify.sed:
ln -sf ${SRCDIR}/ld/emultempl/astring.sed ${.TARGET}
-afterinstall:
- ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
- ${LDSCRIPTS:S|^|ldscripts/|} ${DESTDIR}${SCRIPTDIR}
-
.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/binutils/ld/Makefile.amd64 b/gnu/usr.bin/binutils/ld/Makefile.amd64
index 0175820..c9919bf 100644
--- a/gnu/usr.bin/binutils/ld/Makefile.amd64
+++ b/gnu/usr.bin/binutils/ld/Makefile.amd64
@@ -16,6 +16,7 @@ _i386_path= \"${TOOLS_PREFIX}/usr/lib32\"
EMS+= ${X86_EMULATION}
.for ext in ${ELF_SCR_EXT}
LDSCRIPTS+= ${X86_EMULATION}.${ext}
+ldscripts/${X86_EMULATION}.${ext}: e${X86_EMULATION}.c
.endfor
SRCS+= e${X86_EMULATION}.c
diff --git a/gnu/usr.bin/binutils/ld/Makefile.mips b/gnu/usr.bin/binutils/ld/Makefile.mips
index c6cd69f..8a7dfbb 100644
--- a/gnu/usr.bin/binutils/ld/Makefile.mips
+++ b/gnu/usr.bin/binutils/ld/Makefile.mips
@@ -22,6 +22,7 @@ EMS+= ${abi}
#.endif
.for ext in ${ELF_SCR_EXT}
LDSCRIPTS+= ${abi}.${ext}
+ldscripts/${abi}.${ext}: e${abi}.c
.endfor
SRCS+= e${abi}.c
CLEANFILES+= e${abi}.c
diff --git a/gnu/usr.bin/binutils/ld/Makefile.powerpc64 b/gnu/usr.bin/binutils/ld/Makefile.powerpc64
index 29fba2a..9e18cb4 100644
--- a/gnu/usr.bin/binutils/ld/Makefile.powerpc64
+++ b/gnu/usr.bin/binutils/ld/Makefile.powerpc64
@@ -16,6 +16,7 @@ _ppc32_path= \"${TOOLS_PREFIX}/usr/lib32\"
EMS+= ${PPC32_EMULATION}
.for ext in ${ELF_SCR_EXT}
LDSCRIPTS+= ${PPC32_EMULATION}.${ext}
+ldscripts/${PPC32_EMULATION}.${ext}: e${PPC32_EMULATION}.c
.endfor
SRCS+= e${PPC32_EMULATION}.c
diff --git a/gnu/usr.bin/binutils/ld/Makefile.sparc64 b/gnu/usr.bin/binutils/ld/Makefile.sparc64
index d28a235..9ce6c6f 100644
--- a/gnu/usr.bin/binutils/ld/Makefile.sparc64
+++ b/gnu/usr.bin/binutils/ld/Makefile.sparc64
@@ -17,6 +17,7 @@ e${NATIVE_EMULATION}.c: emulparams/${NATIVE_EMULATION}.sh emultempl/elf32.em \
EMS+= elf${BITS}_sparc
.for ext in ${ELF_SCR_EXT}
LDSCRIPTS+= elf${BITS}_sparc.${ext}
+ldscripts/elf${BITS}_sparc.${ext}: eelf${BITS}_sparc.c
.endfor
SRCS+= eelf${BITS}_sparc.c
diff --git a/gnu/usr.bin/groff/tmac/Makefile b/gnu/usr.bin/groff/tmac/Makefile
index 195d32f..930fe73 100644
--- a/gnu/usr.bin/groff/tmac/Makefile
+++ b/gnu/usr.bin/groff/tmac/Makefile
@@ -15,7 +15,7 @@ MLINKS+= groff_man.7 man.7
MLINKS+= groff_me.7 me.7
MLINKS+= groff_mdoc.7 mdoc.7 groff_mdoc.7 mdoc.samples.7
-CLEANFILES= ${MAN} ${MDOCFILES:S/$/-s/} ${STRIPFILES:S/$/-s/} ${SPECIALFILES:S/$/-s/}
+CLEANFILES= ${MAN}
NORMALFILES= mandoc.tmac andoc.tmac an-old.tmac \
me.tmac \
@@ -40,45 +40,59 @@ NORMALFILES= mandoc.tmac andoc.tmac an-old.tmac \
composite.tmac \
eqnrc \
troffrc troffrc-end \
+ koi8-r.tmac hyphen.ru \
hyphen.us hyphenex.us
+# These are all generated into the OBJDIR.
SPECIALFILES= an.tmac man.tmac s.tmac ms.tmac www.tmac
STRIPFILES= e.tmac doc.tmac mdoc.local
MDOCFILES= doc-common doc-ditroff doc-nroff doc-syms \
fr.ISO8859-1 ru.KOI8-R
+# These are in srcdir and must be built special to avoid colliding with
+# CURDIR=OBJDIR.
+SRCFILES= fr.ISO8859-1 mdoc.local ru.KOI8-R
+CLEANFILES+= ${SRCFILES}
-all: ${MDOCFILES:S/$/-s/} ${STRIPFILES:S/$/-s/} ${SPECIALFILES:S/$/-s/}
+FILESGROUPS= FILES
+FILES= ${NORMALFILES}
+FILESOWN= ${TMACOWN}
+FILESGRP= ${TMACGRP}
+FILESMODE= ${TMACMODE}
+FILESDIR= ${TMACDIR}
+MDOCFILESDIR= ${MDOCDIR}
+# Setup handling for the generated and special file groups
+.for var in SPECIAL STRIP MDOC
+FILESGROUPS+= ${var}FILES
+CLEANFILES+= ${${var}FILES}
+${var}FILESOWN?=${TMACOWN}
+${var}FILESGRP?=${TMACGRP}
+${var}FILESMODE?=${TMACMODE}
+${var}FILESDIR?=${TMACDIR}
+.endfor
+
+beforeinstall:
+.if !exists(${DESTDIR}${TMACDIR}/man.local)
+ ${INSTALL} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \
+ ${DIST_DIR}/man.local ${DESTDIR}${TMACDIR}
+.endif
+
+.include <bsd.prog.mk>
+
+# Do this after ../Makefile.inc gets included so DIST_DIR is defined.
.for f in ${MDOCFILES} ${STRIPFILES}
-$f-s: $f
+# Generate the file from the contrib dir or src dir as needed.
+.if ${SRCFILES:M${f}} != ""
+${f}: ${.CURDIR}/${f}.in
+.else
+${f}: ${DIST_DIR}/${f}
+.endif
sed -f ${DIST_DIR}/strip.sed ${.ALLSRC} > ${.TARGET}
.endfor
.for f in ${SPECIALFILES}
-$f-s: $f
+${f}: ${DIST_DIR}/${f}
sed -e "s;@TMAC_AN_PREFIX@;${tmac_an_prefix};g" \
-e "s;@TMAC_S_PREFIX@;${tmac_s_prefix};g" \
-e "s;@PNMTOPS_NOSETPAGE@;pnmtops;g" \
${.ALLSRC} > ${.TARGET}
.endfor
-
-beforeinstall:
- (cd ${DIST_DIR} && \
- ${INSTALL} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \
- ${NORMALFILES} ${DESTDIR}${TMACDIR})
- (cd ${.CURDIR} && \
- ${INSTALL} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \
- koi8-r.tmac hyphen.ru ${DESTDIR}${TMACDIR})
-.for f in ${STRIPFILES} ${SPECIALFILES}
- ${INSTALL} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \
- $f-s ${DESTDIR}${TMACDIR}/$f
-.endfor
-.for f in ${MDOCFILES}
- ${INSTALL} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \
- $f-s ${DESTDIR}${MDOCDIR}/$f
-.endfor
-.if !exists(${DESTDIR}${TMACDIR}/man.local)
- ${INSTALL} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \
- ${DIST_DIR}/man.local ${DESTDIR}${TMACDIR}
-.endif
-
-.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/groff/tmac/fr.ISO8859-1 b/gnu/usr.bin/groff/tmac/fr.ISO8859-1.in
index 88dda0d..88dda0d 100644
--- a/gnu/usr.bin/groff/tmac/fr.ISO8859-1
+++ b/gnu/usr.bin/groff/tmac/fr.ISO8859-1.in
diff --git a/gnu/usr.bin/groff/tmac/mdoc.local b/gnu/usr.bin/groff/tmac/mdoc.local.in
index 6d3708f..6d3708f 100644
--- a/gnu/usr.bin/groff/tmac/mdoc.local
+++ b/gnu/usr.bin/groff/tmac/mdoc.local.in
diff --git a/gnu/usr.bin/groff/tmac/ru.KOI8-R b/gnu/usr.bin/groff/tmac/ru.KOI8-R.in
index 0d3eb0f..0d3eb0f 100644
--- a/gnu/usr.bin/groff/tmac/ru.KOI8-R
+++ b/gnu/usr.bin/groff/tmac/ru.KOI8-R.in
diff --git a/kerberos5/Makefile b/kerberos5/Makefile
index 401957b..c4418ec 100644
--- a/kerberos5/Makefile
+++ b/kerberos5/Makefile
@@ -1,6 +1,8 @@
# $FreeBSD$
-SUBDIR= doc lib libexec tools usr.bin usr.sbin
+SUBDIR= lib .WAIT \
+ doc libexec tools usr.bin usr.sbin
+SUBDIR_PARALLEL=
# These are the programs which depend on Kerberos.
KPROGS= lib/libpam \
diff --git a/kerberos5/lib/Makefile b/kerberos5/lib/Makefile
index d1d44e0..238fe90 100644
--- a/kerberos5/lib/Makefile
+++ b/kerberos5/lib/Makefile
@@ -5,4 +5,6 @@ SUBDIR= libasn1 libgssapi_krb5 libgssapi_ntlm libgssapi_spnego libhdb \
libheimntlm libhx509 libkadm5clnt libkadm5srv libkafs5 libkrb5 \
libroken libsl libvers libkdc libwind libheimsqlite libheimbase libheimipcc libheimipcs
+SUBDIR_DEPEND_libkafs5= libkrb5
+
.include <bsd.subdir.mk>
diff --git a/kerberos5/libexec/Makefile b/kerberos5/libexec/Makefile
index e6735ca..26a830d 100644
--- a/kerberos5/libexec/Makefile
+++ b/kerberos5/libexec/Makefile
@@ -2,5 +2,6 @@
SUBDIR= digest-service ipropd-master ipropd-slave hprop hpropd kadmind kdc \
kdigest kfd kimpersonate kpasswdd kcm
+SUBDIR_PARALLEL=
.include <bsd.subdir.mk>
diff --git a/kerberos5/tools/Makefile b/kerberos5/tools/Makefile
index 0bbf2d4..b623a25 100644
--- a/kerberos5/tools/Makefile
+++ b/kerberos5/tools/Makefile
@@ -1,5 +1,6 @@
# $FreeBSD$
SUBDIR= make-roken asn1_compile slc
+SUBDIR_PARALLEL=
.include <bsd.subdir.mk>
diff --git a/kerberos5/usr.bin/Makefile b/kerberos5/usr.bin/Makefile
index da141e5..e9c5030 100644
--- a/kerberos5/usr.bin/Makefile
+++ b/kerberos5/usr.bin/Makefile
@@ -2,5 +2,6 @@
SUBDIR= hxtool kadmin kcc kdestroy kgetcred kf kinit kpasswd krb5-config ksu \
string2key verify_krb5_conf
+SUBDIR_PARALLEL=
.include <bsd.subdir.mk>
diff --git a/kerberos5/usr.sbin/Makefile b/kerberos5/usr.sbin/Makefile
index 5e8d58e..a7a69ce 100644
--- a/kerberos5/usr.sbin/Makefile
+++ b/kerberos5/usr.sbin/Makefile
@@ -1,5 +1,6 @@
# $FreeBSD$
SUBDIR= iprop-log kstash ktutil
+SUBDIR_PARALLEL=
.include <bsd.subdir.mk>
diff --git a/lib/libc/net/getaddrinfo.3 b/lib/libc/net/getaddrinfo.3
index 5d03aab..07fefc0 100644
--- a/lib/libc/net/getaddrinfo.3
+++ b/lib/libc/net/getaddrinfo.3
@@ -18,7 +18,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd February 14, 2013
+.Dd October 5, 2015
.Dt GETADDRINFO 3
.Os
.Sh NAME
@@ -236,15 +236,14 @@ The list can be traversed by following the
pointer in each
.Li addrinfo
structure until a null pointer is encountered.
-The three members
+Each returned
+.Li addrinfo
+structure contains three members that are suitable for a call to
+.Xr socket 2 :
.Fa ai_family,
.Fa ai_socktype,
and
-.Fa ai_protocol
-in each returned
-.Li addrinfo
-structure are suitable for a call to
-.Xr socket 2 .
+.Fa ai_protocol .
For each
.Li addrinfo
structure in the list, the
diff --git a/release/Makefile b/release/Makefile
index e959760..6e522e4 100644
--- a/release/Makefile
+++ b/release/Makefile
@@ -335,7 +335,7 @@ release-install:
${XZCMD} -k ${DESTDIR}/${OSRELEASE}-${I}
. endif
.endfor
+ cd ${DESTDIR} && sha512 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.SHA512
cd ${DESTDIR} && sha256 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.SHA256
- cd ${DESTDIR} && md5 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.MD5
.include "${.CURDIR}/Makefile.vm"
diff --git a/release/Makefile.mirrors b/release/Makefile.mirrors
index d5e8949..92e5eda 100644
--- a/release/Makefile.mirrors
+++ b/release/Makefile.mirrors
@@ -76,7 +76,7 @@ VM_DIR= ${TLD}/VM-IMAGES/${REVISION}-${BRANCH}/${TARGET_ARCH}
.endif
CLEANFILES+= ${STAGE_TARGETS}
-CHECKSUM_FILES?= SHA256 MD5
+CHECKSUM_FILES?= SHA512 SHA256
SNAP_SUFFIX!= echo ${_SNAP_SUFFIX:S,^-,,1} | tr -d ' '
ISO_DIR= ${TLD}/${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}
FTP_DIR= ${TLD}/${TARGET}/${TARGET_ARCH}/${REVISION}-${BRANCH}
diff --git a/release/Makefile.vm b/release/Makefile.vm
index f576d9c..f4de633 100644
--- a/release/Makefile.vm
+++ b/release/Makefile.vm
@@ -68,10 +68,10 @@ cw${_CW:tl}-install:
mkdir -p ${DESTDIR}/${_CW:tl}
cp -p ${${_CW}IMAGE} \
${DESTDIR}/${_CW:tl}/${${_CW}_DISK}
+ cd ${DESTDIR}/${_CW:tl} && sha512 ${${_CW}_DISK}* > \
+ ${DESTDIR}/${_CW:tl}/CHECKSUM.SHA512
cd ${DESTDIR}/${_CW:tl} && sha256 ${${_CW}_DISK}* > \
${DESTDIR}/${_CW:tl}/CHECKSUM.SHA256
- cd ${DESTDIR}/${_CW:tl} && md5 ${${_CW}_DISK}* > \
- ${DESTDIR}/${_CW:tl}/CHECKSUM.MD5
cw${_CW:tl}-package:
@# Special target to handle packaging cloud images in the formats
@@ -140,10 +140,10 @@ vm-install:
${XZCMD} ${DESTDIR}/vmimages/${OSRELEASE}.${FORMAT}
. endfor
. endif
+ cd ${DESTDIR}/vmimages && sha512 ${OSRELEASE}* > \
+ ${DESTDIR}/vmimages/CHECKSUM.SHA512
cd ${DESTDIR}/vmimages && sha256 ${OSRELEASE}* > \
${DESTDIR}/vmimages/CHECKSUM.SHA256
- cd ${DESTDIR}/vmimages && md5 ${OSRELEASE}* > \
- ${DESTDIR}/vmimages/CHECKSUM.MD5
.endif
vm-release:
diff --git a/release/release.sh b/release/release.sh
index e168422..313a16c 100755
--- a/release/release.sh
+++ b/release/release.sh
@@ -362,10 +362,10 @@ chroot_arm_armv6_build_release() {
chroot ${CHROOTDIR} cp -p ${OBJDIR}/${OSRELEASE}-${KERNEL}.img \
/R/${OSRELEASE}-${KERNEL}.img
chroot ${CHROOTDIR} xz -T ${XZ_THREADS} /R/${OSRELEASE}-${KERNEL}.img
+ cd ${CHROOTDIR}/R && sha512 ${OSRELEASE}* \
+ > CHECKSUM.SHA512
cd ${CHROOTDIR}/R && sha256 ${OSRELEASE}* \
> CHECKSUM.SHA256
- cd ${CHROOTDIR}/R && md5 ${OSRELEASE}* \
- > CHECKSUM.MD5
return 0
} # chroot_arm_armv6_build_release()
diff --git a/sbin/geom/class/nop/geom_nop.c b/sbin/geom/class/nop/geom_nop.c
index 25163cc..f05a522 100644
--- a/sbin/geom/class/nop/geom_nop.c
+++ b/sbin/geom/class/nop/geom_nop.c
@@ -43,14 +43,16 @@ struct g_command class_commands[] = {
{
{ 'e', "error", "-1", G_TYPE_NUMBER },
{ 'o', "offset", "0", G_TYPE_NUMBER },
+ { 'p', "stripesize", "0", G_TYPE_NUMBER },
+ { 'P', "stripeoffset", "0", G_TYPE_NUMBER },
{ 'r', "rfailprob", "-1", G_TYPE_NUMBER },
{ 's', "size", "0", G_TYPE_NUMBER },
{ 'S', "secsize", "0", G_TYPE_NUMBER },
{ 'w', "wfailprob", "-1", G_TYPE_NUMBER },
G_OPT_SENTINEL
},
- "[-v] [-e error] [-o offset] [-r rfailprob] [-s size] "
- "[-S secsize] [-w wfailprob] dev ..."
+ "[-v] [-e error] [-o offset] [-p stripesize] [-P stripeoffset] "
+ "[-r rfailprob] [-s size] [-S secsize] [-w wfailprob] dev ..."
},
{ "configure", G_FLAG_VERBOSE, NULL,
{
diff --git a/sbin/geom/class/nop/gnop.8 b/sbin/geom/class/nop/gnop.8
index 2bcbef3..0103579 100644
--- a/sbin/geom/class/nop/gnop.8
+++ b/sbin/geom/class/nop/gnop.8
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 14, 2013
+.Dd September 15, 2015
.Dt GNOP 8
.Os
.Sh NAME
@@ -36,6 +36,8 @@
.Op Fl v
.Op Fl e Ar error
.Op Fl o Ar offset
+.Op Fl p Ar stripesize
+.Op Fl P Ar stripeoffset
.Op Fl r Ar rfailprob
.Op Fl s Ar size
.Op Fl S Ar secsize
@@ -115,6 +117,10 @@ Specifies the error number to return on failure.
Force the removal of the specified provider.
.It Fl o Ar offset
Where to begin on the original provider.
+.It Fl p Ar stripesize
+Value of the stripesize property of the transparent provider.
+.It Fl P Ar stripeoffset
+Value of the stripeoffset property of the transparent provider.
.It Fl r Ar rfailprob
Specifies read failure probability in percent.
.It Fl s Ar size
diff --git a/sbin/init/init.8 b/sbin/init/init.8
index a7488a9..13659e3 100644
--- a/sbin/init/init.8
+++ b/sbin/init/init.8
@@ -31,7 +31,7 @@
.\" @(#)init.8 8.3 (Berkeley) 4/18/94
.\" $FreeBSD$
.\"
-.Dd March 14, 2012
+.Dd July 24, 2015
.Dt INIT 8
.Os
.Sh NAME
@@ -284,6 +284,7 @@ will signal the original
as follows:
.Bl -column Run-level SIGTERM
.It Sy "Run-level Signal Action"
+.It Cm 0 Ta Dv SIGUSR1 Ta "Halt"
.It Cm 0 Ta Dv SIGUSR2 Ta "Halt and turn the power off"
.It Cm 1 Ta Dv SIGTERM Ta "Go to single-user mode"
.It Cm 6 Ta Dv SIGINT Ta "Reboot the machine"
diff --git a/sbin/ipf/Makefile b/sbin/ipf/Makefile
index df57c80..8b10c98 100644
--- a/sbin/ipf/Makefile
+++ b/sbin/ipf/Makefile
@@ -1,8 +1,7 @@
# $FreeBSD$
-#.WAIT
-SUBDIR= libipf
+SUBDIR= libipf .WAIT
SUBDIR+= ipf ipfs ipfstat ipftest ipmon ipnat ippool ipresend
-#SUBDIR+= ipsend iptest rules
+SUBDIR_PARALLEL=
.include <bsd.subdir.mk>
diff --git a/sbin/ipf/ipftest/Makefile b/sbin/ipf/ipftest/Makefile
index 32b074c..7d8260a 100644
--- a/sbin/ipf/ipftest/Makefile
+++ b/sbin/ipf/ipftest/Makefile
@@ -32,15 +32,19 @@ CLEANFILES+= ipnat.tab.c ipnat.tab.h
CLEANFILES+= ippool_y.c ippool_l.c
CLEANFILES+= ippool.tab.c ippool.tab.h
-ipnat_y.c: ipnat_y.y
+ipnat.tab.c ipnat.tab.h: ipnat_y.y
${YACC} -b ipnat -d ${.ALLSRC}
+
+ipnat_y.c: ipnat.tab.c
sed -e 's/yy/ipnat_yy/g' \
-e 's/y.tab.c/ipnat_y.c/' \
-e s/\"ipnat_y.y\"/\"..\\/tools\\/ipnat_y.y\"/ \
ipnat.tab.c > ${.TARGET}
+
+ipnat_y.h: ipnat.tab.h
sed -e 's/yy/ipnat_yy/g' \
-e 's/y.tab.h/ipnat_y.h/' \
- ipnat.tab.h > ${.TARGET:.c=.h}
+ ipnat.tab.h > ${.TARGET}
ipnat_y.h: ipnat_y.c
@@ -54,13 +58,17 @@ ipnat_l.h: lexer.h
sed -e 's/yy/ipnat_yy/g' \
${.ALLSRC} > ${.TARGET}
-ippool_y.c: ippool_y.y
+ippool.tab.c ippool.tab.h: ippool_y.y
${YACC} -b ippool -d ${.ALLSRC}
+
+ippool_y.c: ippool.tab.c
sed -e 's/yy/ippool_yy/g' \
-e 's/"ippool_y.y"/"..\/tools\/ippool_y.y"/' \
ippool.tab.c > ${.TARGET}
+
+ippool_y.h: ippool.tab.h
sed -e 's/yy/ippool_yy/g' \
- ippool.tab.h > ${.TARGET:.c=.h}
+ ippool.tab.h > ${.TARGET}
ippool_y.h: ippool_y.c
@@ -74,13 +82,17 @@ ippool_l.h: lexer.h
sed -e 's/yy/ippool_yy/g' \
${.ALLSRC} > ${.TARGET}
-ipf_y.c: ipf_y.y
+ipf.tab.c ipf.tab.h: ipf_y.y
${YACC} -b ipf -d ${.ALLSRC}
+
+ipf_y.c: ipf.tab.c
sed -e 's/yy/ipf_yy/g' \
-e 's/"ipf_y.y"/"..\/tools\/ipf_y.y"/' \
ipf.tab.c > ${.TARGET}
+
+ipf_y.h: ipf.tab.h
sed -e 's/yy/ipf_yy/g' \
- ipf.tab.h > ${.TARGET:.c=.h}
+ ipf.tab.h > ${.TARGET}
ipf_y.h: ipf_y.c
diff --git a/sbin/ipf/iptest/Makefile b/sbin/ipf/iptest/Makefile
deleted file mode 100644
index 647471c..0000000
--- a/sbin/ipf/iptest/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# $FreeBSD$
-
-.include <bsd.own.mk>
-
-PROG= iptest
-SRCS= iptest.c iptests.c ip.c sbpf.c sock.c 44arp.c
-MAN= iptest.1
-
-.PATH: ${NETBSDSRCDIR}/dist/ipf/ipsend
-
-.include <bsd.prog.mk>
diff --git a/sbin/ipf/rules/Makefile b/sbin/ipf/rules/Makefile
deleted file mode 100644
index a90907f..0000000
--- a/sbin/ipf/rules/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-# $FreeBSD$
-
-.include <bsd.own.mk>
-
-MAN= mkfilters.1
-.if ${MKSHARE} != "no"
-FILESDIR= /usr/share/examples/ipf
-
-FILES= BASIC.NAT BASIC_1.FW BASIC_2.FW example.1 example.2 example.3 \
- example.4 example.5 example.6 example.7 example.8 example.9 \
- example.10 example.11 example.12 example.13 example.sr \
- firewall ftp-proxy ftppxy mediaone nat-setup \
- nat.eg server tcpstate mkfilters
-.endif
-
-.PATH: ${NETBSDSRCDIR}/dist/ipf/rules
-.include <bsd.prog.mk>
diff --git a/sbin/mdconfig/mdconfig.8 b/sbin/mdconfig/mdconfig.8
index 9e30896..8cb9a69 100644
--- a/sbin/mdconfig/mdconfig.8
+++ b/sbin/mdconfig/mdconfig.8
@@ -41,12 +41,12 @@
.\"
.\" $FreeBSD$
.\"
-.Dd June 20, 2013
+.Dd August 6, 2015
.Dt MDCONFIG 8
.Os
.Sh NAME
.Nm mdconfig
-.Nd configure and enable memory disks
+.Nd create and control memory disks
.Sh SYNOPSIS
.Nm
.Fl a
@@ -79,7 +79,7 @@
.Sh DESCRIPTION
The
.Nm
-utility configures and enables
+utility creates and controls
.Xr md 4
devices.
.Pp
@@ -89,6 +89,9 @@ Options indicate an action to be performed:
Attach a memory disk.
This will configure and attach a memory disk with the
parameters specified and attach it to the system.
+If the
+.Fl u Ar unit
+option is not provided, the newly created device name will be printed on stdout.
.It Fl d
Detach a memory disk from the system and release all resources.
.It Fl r
@@ -104,7 +107,7 @@ If the
.Fl o Cm reserve
option is not set, creating and filling a large
malloc-backed memory disk is a very easy way to
-panic a system.
+panic the system.
.It Cm vnode
A file specified with
.Fl f Ar file
@@ -119,6 +122,8 @@ Using
backing is generally preferred instead of using
.Cm malloc
backing.
+.It Cm null
+Bitsink; all writes do nothing, all reads return zeroes.
.El
.It Fl f Ar file
Filename to use for the vnode type memory disk.
@@ -163,7 +168,9 @@ or
.Cm t
which
denotes byte, kilobyte, megabyte, gigabyte and terabyte respectively.
-The
+When used without the
+.Fl r
+option, the
.Fl a
and
.Fl t Ar swap
@@ -205,13 +212,21 @@ Enable/disable compression features to reduce memory usage.
.It Oo Cm no Oc Ns Cm force
Disable/enable extra sanity checks to prevent the user from doing something
that might adversely affect the system.
+This can be used with the
+.Fl d
+flag to forcibly destroy an
+.Xr md 4
+disk that is still in use.
.It Oo Cm no Oc Ns Cm readonly
Enable/disable readonly mode.
.El
.It Fl u Ar unit
-Request a specific unit number for the
+Request a specific unit number or device name for the
.Xr md 4
device instead of automatic allocation.
+If a device name is specified, it must be start with
+.Dq md
+followed by the unit number.
.El
.Pp
The last form,
@@ -223,66 +238,58 @@ is provided for convenience as an abbreviation of
.Fl t Ar vnode
.Fl f Ar file .
.Sh EXAMPLES
-Create a 4 megabyte
-.Xr malloc 9
-backed memory disk.
-The name of the allocated unit will be printed on stdout, such as
-.Dq Li md3 :
-.Pp
-.Dl mdconfig -a -t malloc -s 4m
-.Pp
-Create a disk named
-.Pa /dev/md4
-with
+Create a disk with
.Pa /tmp/boot.flp
-as backing storage:
+as backing storage.
+The name of the allocated unit will be printed on stdout, such as
+.Dq Li md0 :
+.Bd -literal -offset indent
+mdconfig /tmp/boot.flp
+.Ed
.Pp
-.Dl mdconfig -a -t vnode -f /tmp/boot.flp -u 4
+Create a 1 gigabyte swap backed memory disk named
+.Dq Li md3 :
+.Bd -literal -offset indent
+mdconfig -s 1g -u md3
+.Ed
.Pp
Detach and free all resources used by
-.Pa /dev/md4 :
+.Pa /dev/md3 :
+.Bd -literal -offset indent
+mdconfig -du md3
+.Ed
.Pp
-.Dl mdconfig -d -u 4
+Show detailed information on current memory disks:
+.Bd -literal -offset indent
+mdconfig -lv
+.Ed
.Pp
-Create a 128MByte swap backed disk, initialize an
+Resize the
+.Dq Li md3
+memory disk to 2 gigabytes:
+.Bd -literal -offset indent
+mdconfig -rs 2g -u md3
+.Ed
+.Pp
+Create a 1 gigabyte swap backed disk, initialize an
.Xr ffs 7
file system on it, and mount it on
.Pa /tmp :
.Bd -literal -offset indent
-mdconfig -a -t swap -s 128M -u 10
+mdconfig -s 1g -u md10
newfs -U /dev/md10
mount /dev/md10 /tmp
chmod 1777 /tmp
.Ed
.Pp
-Create a 5MB file-backed disk
-.Po Fl a
-and
-.Fl t Ar vnode
-are implied
-.Pc :
-.Bd -literal -offset indent
-dd if=/dev/zero of=somebackingfile bs=1k count=5k
-mdconfig -f somebackingfile -u 0
-bsdlabel -w md0 auto
-newfs md0c
-mount /dev/md0c /mnt
-.Ed
-.Pp
-Create an
-.Xr md 4
-device out of an ISO 9660 CD image file
-.Po Fl a
-and
-.Fl t Ar vnode
-are implied
-.Pc , using the first available
+Create a memory disk out of an ISO 9660 CD image file,
+using the first available
.Xr md 4
-device, and then mount the new memory disk:
+device, and then mount it:
.Bd -literal -offset indent
mount -t cd9660 /dev/`mdconfig -f cdimage.iso` /mnt
-.Pp
.Ed
+.Pp
Create a file-backed device from a hard disk image that begins
with 512K of raw header information.
.Xr gnop 8
@@ -290,7 +297,7 @@ is used to skip over the header information, positioning
.Pa md1.nop
to the start of the filesystem in the image.
.Bd -literal -offset indent
-mdconfig -f diskimage.img -u 1
+mdconfig -u md1 -f diskimage.img
gnop create -o 512K md1
mount /dev/md1.nop /mnt
.Ed
diff --git a/sbin/mdconfig/mdconfig.c b/sbin/mdconfig/mdconfig.c
index 4257dd7..d741c77 100644
--- a/sbin/mdconfig/mdconfig.c
+++ b/sbin/mdconfig/mdconfig.c
@@ -155,6 +155,9 @@ main(int argc, char **argv)
} else if (!strcmp(optarg, "swap")) {
mdio.md_type = MD_SWAP;
mdio.md_options |= MD_CLUSTER | MD_AUTOUNIT | MD_COMPRESS;
+ } else if (!strcmp(optarg, "null")) {
+ mdio.md_type = MD_NULL;
+ mdio.md_options |= MD_CLUSTER | MD_AUTOUNIT | MD_COMPRESS;
} else
errx(1, "unknown type: %s", optarg);
break;
@@ -287,9 +290,10 @@ main(int argc, char **argv)
}
}
- if ((mdio.md_type == MD_MALLOC || mdio.md_type == MD_SWAP) &&
- sflag == NULL)
- errx(1, "must specify -s for -t malloc or -t swap");
+ if ((mdio.md_type == MD_MALLOC || mdio.md_type == MD_SWAP ||
+ mdio.md_type == MD_NULL) && sflag == NULL)
+ errx(1, "must specify -s for -t malloc, -t swap, "
+ "or -t null");
if (mdio.md_type == MD_VNODE && mdio.md_file[0] == '\0')
errx(1, "must specify -f for -t vnode");
} else {
diff --git a/sbin/mount_unionfs/mount_unionfs.8 b/sbin/mount_unionfs/mount_unionfs.8
index b613a94..b9290db 100644
--- a/sbin/mount_unionfs/mount_unionfs.8
+++ b/sbin/mount_unionfs/mount_unionfs.8
@@ -83,7 +83,7 @@ becomes the upper layer.
However,
.Ar uniondir
remains the mount point.
-.It Sm Cm copymode No = Cm traditional | transparent | masquerade Sm
+.It Cm copymode No = Cm traditional | transparent | masquerade
Specifies the way to create a file or a directory in the upper layer
automatically when needed.
The
@@ -98,7 +98,7 @@ For behavior of the
mode, see
.Sx MASQUERADE MODE
below.
-.It Sm Cm whiteout No = Cm always | whenneeded Sm
+.It Cm whiteout No = Cm always | whenneeded
Specifies whether whiteouts should always be made in the upper layer
when removing a file or directory or only when it already exists in the
lower layer.
diff --git a/sbin/newfs_msdos/newfs_msdos.c b/sbin/newfs_msdos/newfs_msdos.c
index 69b92d0..f315d98 100644
--- a/sbin/newfs_msdos/newfs_msdos.c
+++ b/sbin/newfs_msdos/newfs_msdos.c
@@ -51,50 +51,50 @@ static const char rcsid[] =
#include <time.h>
#include <unistd.h>
-#define MAXU16 0xffff /* maximum unsigned 16-bit quantity */
-#define BPN 4 /* bits per nibble */
-#define NPB 2 /* nibbles per byte */
+#define MAXU16 0xffff /* maximum unsigned 16-bit quantity */
+#define BPN 4 /* bits per nibble */
+#define NPB 2 /* nibbles per byte */
-#define DOSMAGIC 0xaa55 /* DOS magic number */
-#define MINBPS 512 /* minimum bytes per sector */
-#define MAXSPC 128 /* maximum sectors per cluster */
-#define MAXNFT 16 /* maximum number of FATs */
-#define DEFBLK 4096 /* default block size */
-#define DEFBLK16 2048 /* default block size FAT16 */
-#define DEFRDE 512 /* default root directory entries */
-#define RESFTE 2 /* reserved FAT entries */
-#define MINCLS12 1U /* minimum FAT12 clusters */
-#define MINCLS16 0x1000U /* minimum FAT16 clusters */
-#define MINCLS32 2U /* minimum FAT32 clusters */
-#define MAXCLS12 0xfedU /* maximum FAT12 clusters */
-#define MAXCLS16 0xfff5U /* maximum FAT16 clusters */
-#define MAXCLS32 0xffffff5U /* maximum FAT32 clusters */
+#define DOSMAGIC 0xaa55 /* DOS magic number */
+#define MINBPS 512 /* minimum bytes per sector */
+#define MAXSPC 128 /* maximum sectors per cluster */
+#define MAXNFT 16 /* maximum number of FATs */
+#define DEFBLK 4096 /* default block size */
+#define DEFBLK16 2048 /* default block size FAT16 */
+#define DEFRDE 512 /* default root directory entries */
+#define RESFTE 2 /* reserved FAT entries */
+#define MINCLS12 1U /* minimum FAT12 clusters */
+#define MINCLS16 0xff5U /* minimum FAT16 clusters */
+#define MINCLS32 0xfff5U /* minimum FAT32 clusters */
+#define MAXCLS12 0xff4U /* maximum FAT12 clusters */
+#define MAXCLS16 0xfff4U /* maximum FAT16 clusters */
+#define MAXCLS32 0xffffff4U /* maximum FAT32 clusters */
-#define mincls(fat) ((fat) == 12 ? MINCLS12 : \
+#define mincls(fat) ((fat) == 12 ? MINCLS12 : \
(fat) == 16 ? MINCLS16 : \
MINCLS32)
-#define maxcls(fat) ((fat) == 12 ? MAXCLS12 : \
+#define maxcls(fat) ((fat) == 12 ? MAXCLS12 : \
(fat) == 16 ? MAXCLS16 : \
MAXCLS32)
-#define mk1(p, x) \
+#define mk1(p, x) \
(p) = (u_int8_t)(x)
-#define mk2(p, x) \
+#define mk2(p, x) \
(p)[0] = (u_int8_t)(x), \
(p)[1] = (u_int8_t)((x) >> 010)
-#define mk4(p, x) \
+#define mk4(p, x) \
(p)[0] = (u_int8_t)(x), \
(p)[1] = (u_int8_t)((x) >> 010), \
(p)[2] = (u_int8_t)((x) >> 020), \
(p)[3] = (u_int8_t)((x) >> 030)
-#define argto1(arg, lo, msg) argtou(arg, lo, 0xff, msg)
-#define argto2(arg, lo, msg) argtou(arg, lo, 0xffff, msg)
-#define argto4(arg, lo, msg) argtou(arg, lo, 0xffffffff, msg)
-#define argtox(arg, lo, msg) argtou(arg, lo, UINT_MAX, msg)
+#define argto1(arg, lo, msg) argtou(arg, lo, 0xff, msg)
+#define argto2(arg, lo, msg) argtou(arg, lo, 0xffff, msg)
+#define argto4(arg, lo, msg) argtou(arg, lo, 0xffffffff, msg)
+#define argtox(arg, lo, msg) argtou(arg, lo, UINT_MAX, msg)
struct bs {
u_int8_t bsJump[3]; /* bootstrap entry point */
@@ -131,7 +131,7 @@ struct bsx {
u_int8_t exReserved1; /* reserved */
u_int8_t exBootSignature; /* extended boot signature */
u_int8_t exVolumeID[4]; /* volume ID number */
- u_int8_t exVolumeLabel[11]; /* volume label */
+ u_int8_t exVolumeLabel[11]; /* volume label */
u_int8_t exFileSysType[8]; /* file system type */
} __packed;
@@ -164,7 +164,7 @@ struct bpb {
u_int bpbBackup; /* backup boot sector */
};
-#define BPBGAP 0, 0, 0, 0, 0, 0
+#define BPBGAP 0, 0, 0, 0, 0, 0
static struct {
const char *name;
@@ -174,10 +174,10 @@ static struct {
{"180", {512, 1, 1, 2, 64, 360, 0xfc, 2, 9, 1, BPBGAP}},
{"320", {512, 2, 1, 2, 112, 640, 0xff, 1, 8, 2, BPBGAP}},
{"360", {512, 2, 1, 2, 112, 720, 0xfd, 2, 9, 2, BPBGAP}},
- {"640", {512, 2, 1, 2, 112, 1280, 0xfb, 2, 8, 2, BPBGAP}},
+ {"640", {512, 2, 1, 2, 112, 1280, 0xfb, 2, 8, 2, BPBGAP}},
{"720", {512, 2, 1, 2, 112, 1440, 0xf9, 3, 9, 2, BPBGAP}},
{"1200", {512, 1, 1, 2, 224, 2400, 0xf9, 7, 15, 2, BPBGAP}},
- {"1232", {1024,1, 1, 2, 192, 1232, 0xfe, 2, 8, 2, BPBGAP}},
+ {"1232", {1024,1, 1, 2, 192, 1232, 0xfe, 2, 8, 2, BPBGAP}},
{"1440", {512, 1, 1, 2, 224, 2880, 0xf0, 9, 18, 2, BPBGAP}},
{"2880", {512, 2, 1, 2, 240, 5760, 0xf0, 9, 36, 2, BPBGAP}}
};
@@ -1029,7 +1029,7 @@ usage(void)
fprintf(stderr,
"usage: newfs_msdos [ -options ] special [disktype]\n"
"where the options are:\n"
- "\t-@ create file system at specified offset\n"
+ "\t-@ create file system at specified offset\n"
"\t-B get bootstrap from file\n"
"\t-C create image file with specified size\n"
"\t-F FAT type (12, 16, or 32)\n"
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c
index f9207f1..c0bcc81 100644
--- a/sbin/sysctl/sysctl.c
+++ b/sbin/sysctl/sysctl.c
@@ -233,6 +233,12 @@ parse(const char *string, int lineno)
newval = cp;
newsize = strlen(cp);
}
+ /* Trim spaces */
+ cp = bufp + strlen(bufp) - 1;
+ while (cp >= bufp && isspace((int)*cp)) {
+ *cp = '\0';
+ cp--;
+ }
len = name2oid(bufp, mib);
if (len < 0) {
@@ -241,7 +247,11 @@ parse(const char *string, int lineno)
if (qflag)
return (1);
else {
- warn("unknown oid '%s'%s", bufp, line);
+ if (errno == ENOENT) {
+ warnx("unknown oid '%s'%s", bufp, line);
+ } else {
+ warn("unknown oid '%s'%s", bufp, line);
+ }
return (1);
}
}
diff --git a/sys/arm/freescale/imx/imx_i2c.c b/sys/arm/freescale/imx/imx_i2c.c
index abcb014..0249275 100644
--- a/sys/arm/freescale/imx/imx_i2c.c
+++ b/sys/arm/freescale/imx/imx_i2c.c
@@ -1,6 +1,7 @@
/*-
* Copyright (C) 2008-2009 Semihalf, Michal Hajduk
* Copyright (c) 2012, 2013 The FreeBSD Foundation
+ * Copyright (c) 2015 Ian Lepore <ian@FreeBSD.org>
* All rights reserved.
*
* Portions of this software were developed by Oleksandr Rybalko
@@ -28,6 +29,19 @@
* SUCH DAMAGE.
*/
+/*
+ * I2C driver for Freescale i.MX hardware.
+ *
+ * Note that the hardware is capable of running as both a master and a slave.
+ * This driver currently implements only master-mode operations.
+ *
+ * This driver supports multi-master i2c busses, by detecting bus arbitration
+ * loss and returning IIC_EBUSBSY status. Notably, it does not do any kind of
+ * retries if some other master jumps onto the bus and interrupts one of our
+ * transfer cycles resulting in arbitration loss in mid-transfer. The caller
+ * must handle retries in a way that makes sense for the slave being addressed.
+ */
+
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
@@ -43,9 +57,6 @@ __FBSDID("$FreeBSD$");
#include <machine/resource.h>
#include <sys/rman.h>
-#include <sys/lock.h>
-#include <sys/mutex.h>
-
#include <arm/freescale/imx/imx_ccmvar.h>
#include <dev/iicbus/iiconf.h>
@@ -108,13 +119,6 @@ static struct clkdiv clkdiv_table[] = {
{ 2560, 0x1d }, { 3072, 0x1e }, { 3840, 0x1f }, {UINT_MAX, 0x1f}
};
-#ifdef DEBUG
-#define debugf(fmt, args...) do { printf("%s(): ", __func__); \
- printf(fmt,##args); } while (0)
-#else
-#define debugf(fmt, args...)
-#endif
-
static struct ofw_compat_data compat_data[] = {
{"fsl,imx6q-i2c", 1},
{"fsl,imx-i2c", 1},
@@ -125,10 +129,8 @@ struct i2c_softc {
device_t dev;
device_t iicbus;
struct resource *res;
- struct mtx mutex;
int rid;
- bus_space_handle_t bsh;
- bus_space_tag_t bst;
+ sbintime_t byte_time_sbt;
};
static phandle_t i2c_get_node(device_t, device_t);
@@ -158,7 +160,7 @@ static device_method_t i2c_methods[] = {
DEVMETHOD(iicbus_write, i2c_write),
DEVMETHOD(iicbus_transfer, iicbus_transfer_gen),
- { 0, 0 }
+ DEVMETHOD_END
};
static driver_t i2c_driver = {
@@ -184,14 +186,14 @@ static __inline void
i2c_write_reg(struct i2c_softc *sc, bus_size_t off, uint8_t val)
{
- bus_space_write_1(sc->bst, sc->bsh, off, val);
+ bus_write_1(sc->res, off, val);
}
static __inline uint8_t
i2c_read_reg(struct i2c_softc *sc, bus_size_t off)
{
- return (bus_space_read_1(sc->bst, sc->bsh, off));
+ return (bus_read_1(sc->res, off));
}
static __inline void
@@ -204,60 +206,77 @@ i2c_flag_set(struct i2c_softc *sc, bus_size_t off, uint8_t mask)
i2c_write_reg(sc, off, status);
}
-/* Wait for transfer interrupt flag */
+/* Wait for bus to become busy or not-busy. */
static int
-wait_for_iif(struct i2c_softc *sc)
+wait_for_busbusy(struct i2c_softc *sc, int wantbusy)
{
- int retry;
+ int retry, srb;
retry = 1000;
while (retry --) {
- if (i2c_read_reg(sc, I2C_STATUS_REG) & I2CSR_MIF)
+ srb = i2c_read_reg(sc, I2C_STATUS_REG) & I2CSR_MBB;
+ if ((srb && wantbusy) || (!srb && !wantbusy))
return (IIC_NOERR);
- DELAY(10);
+ DELAY(1);
}
-
return (IIC_ETIMEOUT);
}
-/* Wait for free bus */
+/* Wait for transfer to complete, optionally check RXAK. */
static int
-wait_for_nibb(struct i2c_softc *sc)
+wait_for_xfer(struct i2c_softc *sc, int checkack)
{
- int retry;
+ int retry, sr;
- retry = 1000;
+ /*
+ * Sleep for about the time it takes to transfer a byte (with precision
+ * set to tolerate 5% oversleep). We calculate the approximate byte
+ * transfer time when we set the bus speed divisor. Slaves are allowed
+ * to do clock-stretching so the actual transfer time can be larger, but
+ * this gets the bulk of the waiting out of the way without tying up the
+ * processor the whole time.
+ */
+ pause_sbt("imxi2c", sc->byte_time_sbt, sc->byte_time_sbt / 20, 0);
+
+ retry = 10000;
while (retry --) {
- if ((i2c_read_reg(sc, I2C_STATUS_REG) & I2CSR_MBB) == 0)
- return (IIC_NOERR);
- DELAY(10);
+ sr = i2c_read_reg(sc, I2C_STATUS_REG);
+ if (sr & I2CSR_MIF) {
+ if (sr & I2CSR_MAL)
+ return (IIC_EBUSERR);
+ else if (checkack && (sr & I2CSR_RXAK))
+ return (IIC_ENOACK);
+ else
+ return (IIC_NOERR);
+ }
+ DELAY(1);
}
-
return (IIC_ETIMEOUT);
}
-/* Wait for transfer complete+interrupt flag */
+/*
+ * Implement the error handling shown in the state diagram of the imx6 reference
+ * manual. If there was an error, then:
+ * - Clear master mode (MSTA and MTX).
+ * - Wait for the bus to become free or for a timeout to happen.
+ * - Disable the controller.
+ */
static int
-wait_for_icf(struct i2c_softc *sc)
+i2c_error_handler(struct i2c_softc *sc, int error)
{
- int retry;
- retry = 1000;
- while (retry --) {
-
- if ((i2c_read_reg(sc, I2C_STATUS_REG) &
- (I2CSR_MCF|I2CSR_MIF)) == (I2CSR_MCF|I2CSR_MIF))
- return (IIC_NOERR);
- DELAY(10);
+ if (error != 0) {
+ i2c_write_reg(sc, I2C_STATUS_REG, 0);
+ i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN);
+ wait_for_busbusy(sc, false);
+ i2c_write_reg(sc, I2C_CONTROL_REG, 0);
}
-
- return (IIC_ETIMEOUT);
+ return (error);
}
static int
i2c_probe(device_t dev)
{
- struct i2c_softc *sc;
if (!ofw_bus_status_okay(dev))
return (ENXIO);
@@ -265,23 +284,7 @@ i2c_probe(device_t dev)
if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
return (ENXIO);
- sc = device_get_softc(dev);
- sc->rid = 0;
-
- sc->res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->rid,
- RF_ACTIVE);
- if (sc->res == NULL) {
- device_printf(dev, "could not allocate resources\n");
- return (ENXIO);
- }
-
- sc->bst = rman_get_bustag(sc->res);
- sc->bsh = rman_get_bushandle(sc->res);
-
- /* Enable I2C */
- i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN);
- bus_release_resource(dev, SYS_RES_MEMORY, sc->rid, sc->res);
- device_set_desc(dev, "Freescale i.MX I2C bus controller");
+ device_set_desc(dev, "Freescale i.MX I2C");
return (BUS_PROBE_DEFAULT);
}
@@ -295,28 +298,21 @@ i2c_attach(device_t dev)
sc->dev = dev;
sc->rid = 0;
- mtx_init(&sc->mutex, device_get_nameunit(dev), "I2C", MTX_DEF);
-
sc->res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->rid,
RF_ACTIVE);
if (sc->res == NULL) {
device_printf(dev, "could not allocate resources");
- mtx_destroy(&sc->mutex);
return (ENXIO);
}
- sc->bst = rman_get_bustag(sc->res);
- sc->bsh = rman_get_bushandle(sc->res);
-
sc->iicbus = device_add_child(dev, "iicbus", -1);
if (sc->iicbus == NULL) {
device_printf(dev, "could not add iicbus child");
- mtx_destroy(&sc->mutex);
return (ENXIO);
}
bus_generic_attach(dev);
- return (IIC_NOERR);
+ return (0);
}
static int
@@ -327,34 +323,20 @@ i2c_repeated_start(device_t dev, u_char slave, int timeout)
sc = device_get_softc(dev);
- mtx_lock(&sc->mutex);
-
- i2c_write_reg(sc, I2C_ADDR_REG, slave);
if ((i2c_read_reg(sc, I2C_STATUS_REG) & I2CSR_MBB) == 0) {
- mtx_unlock(&sc->mutex);
- return (IIC_EBUSBSY);
+ return (IIC_EBUSERR);
}
- /* Set repeated start condition */
- DELAY(10);
+ /*
+ * Set repeated start condition, delay (per reference manual, min 156nS)
+ * before writing slave address, wait for ack after write.
+ */
i2c_flag_set(sc, I2C_CONTROL_REG, I2CCR_RSTA);
- DELAY(10);
- /* Clear status */
+ DELAY(1);
i2c_write_reg(sc, I2C_STATUS_REG, 0x0);
- /* Write target address - LSB is R/W bit */
i2c_write_reg(sc, I2C_DATA_REG, slave);
-
- error = wait_for_iif(sc);
-
- /* Clear status */
- i2c_write_reg(sc, I2C_STATUS_REG, 0x0);
-
- mtx_unlock(&sc->mutex);
-
- if (error)
- return (error);
-
- return (IIC_NOERR);
+ error = wait_for_xfer(sc, true);
+ return (i2c_error_handler(sc, error));
}
static int
@@ -365,53 +347,30 @@ i2c_start(device_t dev, u_char slave, int timeout)
sc = device_get_softc(dev);
- mtx_lock(&sc->mutex);
- i2c_write_reg(sc, I2C_ADDR_REG, slave);
+ i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN);
+ DELAY(10); /* Delay for controller to sample bus state. */
if (i2c_read_reg(sc, I2C_STATUS_REG) & I2CSR_MBB) {
- mtx_unlock(&sc->mutex);
- return (IIC_EBUSBSY);
+ return (i2c_error_handler(sc, IIC_EBUSERR));
}
-
- /* Set start condition */
- i2c_write_reg(sc, I2C_CONTROL_REG,
- I2CCR_MEN | I2CCR_MSTA | I2CCR_TXAK);
- DELAY(100);
- i2c_write_reg(sc, I2C_CONTROL_REG,
- I2CCR_MEN | I2CCR_MSTA | I2CCR_MTX | I2CCR_TXAK);
- /* Clear status */
- i2c_write_reg(sc, I2C_STATUS_REG, 0x0);
- /* Write target address - LSB is R/W bit */
+ i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN | I2CCR_MSTA | I2CCR_MTX);
+ if ((error = wait_for_busbusy(sc, true)) != IIC_NOERR)
+ return (i2c_error_handler(sc, error));
+ i2c_write_reg(sc, I2C_STATUS_REG, 0);
i2c_write_reg(sc, I2C_DATA_REG, slave);
-
- error = wait_for_iif(sc);
-
- mtx_unlock(&sc->mutex);
- if (error)
- return (error);
-
- return (IIC_NOERR);
+ error = wait_for_xfer(sc, true);
+ return (i2c_error_handler(sc, error));
}
-
static int
i2c_stop(device_t dev)
{
struct i2c_softc *sc;
sc = device_get_softc(dev);
- mtx_lock(&sc->mutex);
- i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN | I2CCR_TXAK);
- DELAY(100);
- /* Reset controller if bus still busy after STOP */
- if (wait_for_nibb(sc) == IIC_ETIMEOUT) {
- i2c_write_reg(sc, I2C_CONTROL_REG, 0);
- DELAY(1000);
- i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN | I2CCR_TXAK);
-
- i2c_write_reg(sc, I2C_STATUS_REG, 0x0);
- }
- mtx_unlock(&sc->mutex);
+ i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN);
+ wait_for_busbusy(sc, false);
+ i2c_write_reg(sc, I2C_CONTROL_REG, 0);
return (IIC_NOERR);
}
@@ -434,19 +393,23 @@ i2c_reset(device_t dev, u_char speed, u_char addr, u_char *oldadr)
if (clkdiv_table[i].divisor >= div)
break;
}
- div = clkdiv_table[i].regcode;
- mtx_lock(&sc->mutex);
- i2c_write_reg(sc, I2C_CONTROL_REG, 0x0);
- i2c_write_reg(sc, I2C_STATUS_REG, 0x0);
- DELAY(1000);
+ /*
+ * Calculate roughly how long it will take to transfer a byte (which
+ * requires 9 clock cycles) at the new bus speed. This value is used to
+ * pause() while waiting for transfer-complete. With a 66MHz IPG clock
+ * and the actual i2c bus speeds that leads to, for nominal 100KHz and
+ * 400KHz bus speeds the transfer times are roughly 104uS and 22uS.
+ */
+ busfreq = ipgfreq / clkdiv_table[i].divisor;
+ sc->byte_time_sbt = SBT_1US * (9000000 / busfreq);
- i2c_write_reg(sc, I2C_FDR_REG, (uint8_t)div);
- i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN);
- DELAY(1000);
+ /*
+ * Disable the controller (do the reset), and set the new clock divisor.
+ */
i2c_write_reg(sc, I2C_STATUS_REG, 0x0);
- mtx_unlock(&sc->mutex);
-
+ i2c_write_reg(sc, I2C_CONTROL_REG, 0x0);
+ i2c_write_reg(sc, I2C_FDR_REG, (uint8_t)clkdiv_table[i].regcode);
return (IIC_NOERR);
}
@@ -459,48 +422,42 @@ i2c_read(device_t dev, char *buf, int len, int *read, int last, int delay)
sc = device_get_softc(dev);
*read = 0;
- mtx_lock(&sc->mutex);
-
if (len) {
if (len == 1)
i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN |
I2CCR_MSTA | I2CCR_TXAK);
-
else
i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN |
I2CCR_MSTA);
-
- /* dummy read */
+ /* Dummy read to prime the receiver. */
+ i2c_write_reg(sc, I2C_STATUS_REG, 0x0);
i2c_read_reg(sc, I2C_DATA_REG);
- DELAY(1000);
}
+ error = 0;
+ *read = 0;
while (*read < len) {
- error = wait_for_icf(sc);
- if (error) {
- mtx_unlock(&sc->mutex);
- return (error);
- }
+ if ((error = wait_for_xfer(sc, false)) != IIC_NOERR)
+ break;
i2c_write_reg(sc, I2C_STATUS_REG, 0x0);
- if ((*read == len - 2) && last) {
- /* NO ACK on last byte */
- i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN |
- I2CCR_MSTA | I2CCR_TXAK);
+ if (last) {
+ if (*read == len - 2) {
+ /* NO ACK on last byte */
+ i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN |
+ I2CCR_MSTA | I2CCR_TXAK);
+ } else if (*read == len - 1) {
+ /* Transfer done, signal stop. */
+ i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN |
+ I2CCR_TXAK);
+ wait_for_busbusy(sc, false);
+ }
}
-
- if ((*read == len - 1) && last) {
- /* Transfer done, remove master bit */
- i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN |
- I2CCR_TXAK);
- }
-
reg = i2c_read_reg(sc, I2C_DATA_REG);
*buf++ = reg;
(*read)++;
}
- mtx_unlock(&sc->mutex);
- return (IIC_NOERR);
+ return (i2c_error_handler(sc, error));
}
static int
@@ -510,22 +467,16 @@ i2c_write(device_t dev, const char *buf, int len, int *sent, int timeout)
int error;
sc = device_get_softc(dev);
- *sent = 0;
- mtx_lock(&sc->mutex);
+ error = 0;
+ *sent = 0;
while (*sent < len) {
i2c_write_reg(sc, I2C_STATUS_REG, 0x0);
i2c_write_reg(sc, I2C_DATA_REG, *buf++);
-
- error = wait_for_iif(sc);
- if (error) {
- mtx_unlock(&sc->mutex);
- return (error);
- }
-
+ if ((error = wait_for_xfer(sc, true)) != IIC_NOERR)
+ break;
(*sent)++;
}
- mtx_unlock(&sc->mutex);
- return (IIC_NOERR);
+ return (i2c_error_handler(sc, error));
}
diff --git a/sys/arm/freescale/vybrid/vf_i2c.c b/sys/arm/freescale/vybrid/vf_i2c.c
index 2eb6726..92a48d7 100644
--- a/sys/arm/freescale/vybrid/vf_i2c.c
+++ b/sys/arm/freescale/vybrid/vf_i2c.c
@@ -233,7 +233,7 @@ i2c_repeated_start(device_t dev, u_char slave, int timeout)
if ((READ1(sc, I2C_IBSR) & IBSR_IBB) == 0) {
mtx_unlock(&sc->mutex);
- return (IIC_EBUSBSY);
+ return (IIC_EBUSERR);
}
/* Set repeated start condition */
@@ -276,7 +276,7 @@ i2c_start(device_t dev, u_char slave, int timeout)
if (READ1(sc, I2C_IBSR) & IBSR_IBB) {
mtx_unlock(&sc->mutex);
vf_i2c_dbg(sc, "cant i2c start: IIC_EBUSBSY\n");
- return (IIC_EBUSBSY);
+ return (IIC_EBUSERR);
}
/* Set start condition */
diff --git a/sys/arm/samsung/exynos/exynos5_i2c.c b/sys/arm/samsung/exynos/exynos5_i2c.c
index bf7548f..a73beed 100644
--- a/sys/arm/samsung/exynos/exynos5_i2c.c
+++ b/sys/arm/samsung/exynos/exynos5_i2c.c
@@ -265,8 +265,8 @@ i2c_start(device_t dev, u_char slave, int timeout)
error = wait_for_nibb(sc);
if (error) {
mtx_unlock(&sc->mutex);
- DPRINTF("cant i2c start: IIC_EBUSBSY\n");
- return (IIC_EBUSBSY);
+ DPRINTF("cant i2c start: IIC_EBUSERR\n");
+ return (IIC_EBUSERR);
}
reg = READ1(sc, I2CCON);
diff --git a/sys/boot/common/loader.8 b/sys/boot/common/loader.8
index 1b60637..d931ef4 100644
--- a/sys/boot/common/loader.8
+++ b/sys/boot/common/loader.8
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd December 22, 2014
+.Dd July 25, 2015
.Dt LOADER 8
.Os
.Sh NAME
@@ -207,12 +207,18 @@ returns an error itself (see
.Op Fl t Ar type
.Ar file Cm ...
.Xc
-Loads a kernel, kernel loadable module (kld), or file of opaque
-contents tagged as being of the type
+Loads a kernel, kernel loadable module (kld), disk image,
+or file of opaque contents tagged as being of the type
.Ar type .
Kernel and modules can be either in a.out or ELF format.
Any arguments passed after the name of the file to be loaded
will be passed as arguments to that file.
+Use the
+.Li md_image
+type to make the kernel create a file-backed
+.Xr md 4
+disk.
+This is useful for booting from a temporary rootfs.
Currently, argument passing does not work for the kernel.
.Pp
.It Ic load_geli Xo
diff --git a/sys/boot/forth/loader.conf b/sys/boot/forth/loader.conf
index 72bc35e..020239a 100644
--- a/sys/boot/forth/loader.conf
+++ b/sys/boot/forth/loader.conf
@@ -50,6 +50,16 @@ entropy_cache_type="/boot/entropy"
##############################################################
+### Initial memory disk settings ###########################
+##############################################################
+
+#initmd_load="YES" # The "initmd" prefix is arbitrary.
+#initmd_type="md_image" # Create md(4) disk at boot.
+#initmd_name="/boot/root.img" # Path to a file containing the image.
+#rootdev="ufs:/dev/md0" # Set the root filesystem to md(4) device.
+
+
+##############################################################
### Loader settings ########################################
##############################################################
diff --git a/sys/boot/i386/gptboot/gptldr.S b/sys/boot/i386/gptboot/gptldr.S
index 4471a3a..bbd32ba 100644
--- a/sys/boot/i386/gptboot/gptldr.S
+++ b/sys/boot/i386/gptboot/gptldr.S
@@ -45,6 +45,10 @@
/* Misc. Constants */
.set SIZ_PAG,0x1000 # Page size
.set SIZ_SEC,0x200 # Sector size
+ .set COPY_BLKS,0x4 # Number of blocks
+ # to copy for boot2
+ .set COPY_BLK_SZ,0x8000 # Copy in 32k blocks; must be
+ # a multiple of 16 bytes
.globl start
.code16
@@ -68,26 +72,39 @@ start: xor %cx,%cx # Zero
* its header to find boot2. We need to copy boot2 to MEM_USR and BTX
* to MEM_BTX. Since those might overlap, we have to copy boot2
* backwards first and then copy BTX. We aren't sure exactly how long
- * boot2 is, but we assume it can't be longer than 64k, so we just always
- * copy 64k.
+ * boot2 is, but it's currently under 128kB so we'll copy 4 blocks of 32kB
+ * each; this can be adjusted via COPY_BLK and COPY_BLK_SZ above.
*/
mov $end,%bx # BTX
mov 0xa(%bx),%si # Get BTX length and set
add %bx,%si # %si to start of boot2
- mov %si,%ax # Align %ds:%si on a
- shr $4,%ax # paragraph boundary
- and $0xf,%si # with the smallest
- mov %ax,%ds # possible %si
- add $(64 * 1024 - 16),%si
- mov $MEM_USR/16,%ax # Point %es:%di at end of
- mov $(64 * 1024 - 16),%di # largest boot2 range
+ dec %si # Set %ds:%si to point at the
+ mov %si,%ax # last byte we want to copy
+ shr $4,%ax # from boot2, with %si made as
+ add $(COPY_BLKS*COPY_BLK_SZ/16),%ax # small as possible.
+ and $0xf,%si #
+ mov %ax,%ds #
+ mov $MEM_USR/16,%ax # Set %es:(-1) to point at
+ add $(COPY_BLKS*COPY_BLK_SZ/16),%ax # the last byte we
+ mov %ax,%es # want to copy boot2 into.
+ mov $COPY_BLKS,%bx # Copy COPY_BLKS 32k blocks
+copyloop:
+ add $COPY_BLK_SZ,%si # Adjust %ds:%si to point at
+ mov %ds,%ax # the end of the next 32k to
+ sub $COPY_BLK_SZ/16,%ax # copy from boot2
+ mov %ax,%ds
+ mov $COPY_BLK_SZ-1,%di # Adjust %es:%di to point at
+ mov %es,%ax # the end of the next 32k into
+ sub $COPY_BLK_SZ/16,%ax # which we want boot2 copied
mov %ax,%es
+ mov $COPY_BLK_SZ,%cx # Copy 32k
std
- mov %di,%cx # Copy 64k - paragraph + 1
- inc %cx # bytes
rep movsb
+ dec %bx
+ jnz copyloop
mov %cx,%ds # Reset %ds and %es
mov %cx,%es
+ mov $end,%bx # BTX
mov 0xa(%bx),%cx # Get BTX length and set
mov %bx,%si # %si to end of BTX
mov $MEM_BTX,%di # %di -> end of BTX at
diff --git a/sys/cam/ctl/ctl_backend_block.c b/sys/cam/ctl/ctl_backend_block.c
index 7e0dc74..b8ff26b 100644
--- a/sys/cam/ctl/ctl_backend_block.c
+++ b/sys/cam/ctl/ctl_backend_block.c
@@ -1843,21 +1843,6 @@ ctl_be_block_open_file(struct ctl_be_block_lun *be_lun, struct ctl_lun_req *req)
return (error);
}
- /*
- * Verify that we have the ability to upgrade to exclusive
- * access on this file so we can trap errors at open instead
- * of reporting them during first access.
- */
- if (VOP_ISLOCKED(be_lun->vn) != LK_EXCLUSIVE) {
- vn_lock(be_lun->vn, LK_UPGRADE | LK_RETRY);
- if (be_lun->vn->v_iflag & VI_DOOMED) {
- error = EBADF;
- snprintf(req->error_str, sizeof(req->error_str),
- "error locking file %s", be_lun->dev_path);
- return (error);
- }
- }
-
file_data->cred = crhold(curthread->td_ucred);
if (params->lun_size_bytes != 0)
be_lun->size_bytes = params->lun_size_bytes;
@@ -2637,9 +2622,11 @@ ctl_be_block_modify(struct ctl_be_block_softc *softc, struct ctl_lun_req *req)
error = ctl_be_block_open(be_lun, req);
else if (vn_isdisk(be_lun->vn, &error))
error = ctl_be_block_open_dev(be_lun, req);
- else if (be_lun->vn->v_type == VREG)
+ else if (be_lun->vn->v_type == VREG) {
+ vn_lock(be_lun->vn, LK_SHARED | LK_RETRY);
error = ctl_be_block_open_file(be_lun, req);
- else
+ VOP_UNLOCK(be_lun->vn, 0);
+ } else
error = EINVAL;
if ((cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) &&
be_lun->vn != NULL) {
diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c
index 47bb13b..4aae77e 100644
--- a/sys/compat/linprocfs/linprocfs.c
+++ b/sys/compat/linprocfs/linprocfs.c
@@ -393,7 +393,6 @@ linprocfs_domtab(PFS_FILL_ARGS)
/*
* Filler function for proc/partitions
- *
*/
static int
linprocfs_dopartitions(PFS_FILL_ARGS)
@@ -401,27 +400,9 @@ linprocfs_dopartitions(PFS_FILL_ARGS)
struct g_class *cp;
struct g_geom *gp;
struct g_provider *pp;
- struct nameidata nd;
- const char *lep;
- char *dlep, *flep;
- size_t lep_len;
- int error;
int major, minor;
- /* resolve symlinks etc. in the emulation tree prefix */
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, linux_emul_path, td);
- flep = NULL;
- error = namei(&nd);
- lep = linux_emul_path;
- if (error == 0) {
- if (vn_fullpath(td, nd.ni_vp, &dlep, &flep) == 0)
- lep = dlep;
- vrele(nd.ni_vp);
- }
- lep_len = strlen(lep);
-
g_topology_lock();
- error = 0;
sbuf_printf(sb, "major minor #blocks name rio rmerge rsect "
"ruse wio wmerge wsect wuse running use aveq\n");
@@ -447,8 +428,7 @@ linprocfs_dopartitions(PFS_FILL_ARGS)
}
g_topology_unlock();
- free(flep, M_TEMP);
- return (error);
+ return (0);
}
diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c
index e56e61f..19104a4 100644
--- a/sys/compat/linux/linux_file.c
+++ b/sys/compat/linux/linux_file.c
@@ -55,10 +55,6 @@ __FBSDID("$FreeBSD$");
#include <security/mac/mac_framework.h>
-#include <ufs/ufs/extattr.h>
-#include <ufs/ufs/quota.h>
-#include <ufs/ufs/ufsmount.h>
-
#ifdef COMPAT_LINUX32
#include <machine/../linux32/linux.h>
#include <machine/../linux32/linux32_proto.h>
@@ -136,39 +132,39 @@ linux_common_open(struct thread *td, int dirfd, char *path, int l_flags, int mod
/* XXX LINUX_O_NOATIME: unable to be easily implemented. */
error = kern_openat(td, dirfd, path, UIO_SYSSPACE, bsd_flags, mode);
-
- if (!error) {
- fd = td->td_retval[0];
- /*
- * XXX In between kern_open() and fget(), another process
- * having the same filedesc could use that fd without
- * checking below.
- */
- error = fget(td, fd, cap_rights_init(&rights, CAP_IOCTL), &fp);
- if (!error) {
- sx_slock(&proctree_lock);
- PROC_LOCK(p);
- if (!(bsd_flags & O_NOCTTY) &&
- SESS_LEADER(p) && !(p->p_flag & P_CONTROLT)) {
- PROC_UNLOCK(p);
- sx_unlock(&proctree_lock);
- /* XXXPJD: Verify if TIOCSCTTY is allowed. */
- if (fp->f_type == DTYPE_VNODE)
- (void) fo_ioctl(fp, TIOCSCTTY, (caddr_t) 0,
- td->td_ucred, td);
- } else {
- PROC_UNLOCK(p);
- sx_sunlock(&proctree_lock);
- }
+ if (error != 0)
+ goto done;
+
+ if (bsd_flags & O_NOCTTY)
+ goto done;
+
+ /*
+ * XXX In between kern_open() and fget(), another process
+ * having the same filedesc could use that fd without
+ * checking below.
+ */
+ fd = td->td_retval[0];
+ if (fget(td, fd, cap_rights_init(&rights, CAP_IOCTL), &fp) == 0) {
+ if (fp->f_type != DTYPE_VNODE) {
fdrop(fp, td);
- /*
- * XXX as above, fdrop()/kern_close() pair is racy.
- */
- if (error)
- kern_close(td, fd);
+ goto done;
+ }
+ sx_slock(&proctree_lock);
+ PROC_LOCK(p);
+ if (SESS_LEADER(p) && !(p->p_flag & P_CONTROLT)) {
+ PROC_UNLOCK(p);
+ sx_sunlock(&proctree_lock);
+ /* XXXPJD: Verify if TIOCSCTTY is allowed. */
+ (void) fo_ioctl(fp, TIOCSCTTY, (caddr_t) 0,
+ td->td_ucred, td);
+ } else {
+ PROC_UNLOCK(p);
+ sx_sunlock(&proctree_lock);
}
+ fdrop(fp, td);
}
+done:
#ifdef DEBUG
if (ldebug(open))
printf(LMSG("open returns error %d"), error);
@@ -1072,12 +1068,10 @@ linux_pwrite(td, uap)
int
linux_mount(struct thread *td, struct linux_mount_args *args)
{
- struct ufs_args ufs;
char fstypename[MFSNAMELEN];
char mntonname[MNAMELEN], mntfromname[MNAMELEN];
int error;
int fsflags;
- void *fsdata;
error = copyinstr(args->filesystemtype, fstypename, MFSNAMELEN - 1,
NULL);
@@ -1098,20 +1092,10 @@ linux_mount(struct thread *td, struct linux_mount_args *args)
if (strcmp(fstypename, "ext2") == 0) {
strcpy(fstypename, "ext2fs");
- fsdata = &ufs;
- ufs.fspec = mntfromname;
-#define DEFAULT_ROOTID -2
- ufs.export.ex_root = DEFAULT_ROOTID;
- ufs.export.ex_flags =
- args->rwflag & LINUX_MS_RDONLY ? MNT_EXRDONLY : 0;
} else if (strcmp(fstypename, "proc") == 0) {
strcpy(fstypename, "linprocfs");
- fsdata = NULL;
} else if (strcmp(fstypename, "vfat") == 0) {
strcpy(fstypename, "msdosfs");
- fsdata = NULL;
- } else {
- return (ENODEV);
}
fsflags = 0;
@@ -1131,19 +1115,11 @@ linux_mount(struct thread *td, struct linux_mount_args *args)
fsflags |= MNT_UPDATE;
}
- if (strcmp(fstypename, "linprocfs") == 0) {
- error = kernel_vmount(fsflags,
- "fstype", fstypename,
- "fspath", mntonname,
- NULL);
- } else if (strcmp(fstypename, "msdosfs") == 0) {
- error = kernel_vmount(fsflags,
- "fstype", fstypename,
- "fspath", mntonname,
- "from", mntfromname,
- NULL);
- } else
- error = EOPNOTSUPP;
+ error = kernel_vmount(fsflags,
+ "fstype", fstypename,
+ "fspath", mntonname,
+ "from", mntfromname,
+ NULL);
return (error);
}
diff --git a/sys/compat/linux/linux_fork.c b/sys/compat/linux/linux_fork.c
index 2103636..0ab7d3a 100644
--- a/sys/compat/linux/linux_fork.c
+++ b/sys/compat/linux/linux_fork.c
@@ -111,9 +111,8 @@ linux_vfork(struct thread *td, struct linux_vfork_args *args)
printf(ARGS(vfork, ""));
#endif
- /* Exclude RFPPWAIT */
- if ((error = fork1(td, RFFDG | RFPROC | RFMEM | RFSTOPPED, 0, &p2,
- NULL, 0)) != 0)
+ if ((error = fork1(td, RFFDG | RFPROC | RFMEM | RFPPWAIT | RFSTOPPED,
+ 0, &p2, NULL, 0)) != 0)
return (error);
td->td_retval[0] = p2->p_pid;
@@ -122,10 +121,6 @@ linux_vfork(struct thread *td, struct linux_vfork_args *args)
if (error)
return (error);
- PROC_LOCK(p2);
- p2->p_flag |= P_PPWAIT;
- PROC_UNLOCK(p2);
-
td2 = FIRST_THREAD_IN_PROC(p2);
/*
@@ -136,12 +131,6 @@ linux_vfork(struct thread *td, struct linux_vfork_args *args)
sched_add(td2, SRQ_BORING);
thread_unlock(td2);
- /* wait for the children to exit, ie. emulate vfork */
- PROC_LOCK(p2);
- while (p2->p_flag & P_PPWAIT)
- cv_wait(&p2->p_pwait, &p2->p_mtx);
- PROC_UNLOCK(p2);
-
return (0);
}
@@ -203,6 +192,9 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
if (args->parent_tidptr == NULL)
return (EINVAL);
+ if (args->flags & LINUX_CLONE_VFORK)
+ ff |= RFPPWAIT;
+
error = fork1(td, ff, 0, &p2, NULL, 0);
if (error)
return (error);
@@ -271,12 +263,6 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
"stack %p sig = %d"), (int)p2->p_pid, args->stack,
exit_signal);
#endif
- if (args->flags & LINUX_CLONE_VFORK) {
- PROC_LOCK(p2);
- p2->p_flag |= P_PPWAIT;
- PROC_UNLOCK(p2);
- }
-
/*
* Make this runnable after we are finished with it.
*/
@@ -288,13 +274,5 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
td->td_retval[0] = p2->p_pid;
td->td_retval[1] = 0;
- if (args->flags & LINUX_CLONE_VFORK) {
- /* wait for the children to exit, ie. emulate vfork */
- PROC_LOCK(p2);
- while (p2->p_flag & P_PPWAIT)
- cv_wait(&p2->p_pwait, &p2->p_mtx);
- PROC_UNLOCK(p2);
- }
-
return (0);
}
diff --git a/sys/contrib/ipfilter/netinet/ip_state.c b/sys/contrib/ipfilter/netinet/ip_state.c
index a3930ea..2ceec32 100644
--- a/sys/contrib/ipfilter/netinet/ip_state.c
+++ b/sys/contrib/ipfilter/netinet/ip_state.c
@@ -3650,7 +3650,6 @@ ipf_state_del(softc, is, why)
if (is->is_ref > 0) {
int refs;
- is->is_ref--;
refs = is->is_ref;
MUTEX_EXIT(&is->is_lock);
if (!orphan)
@@ -3667,7 +3666,7 @@ ipf_state_del(softc, is, why)
}
}
- is->is_ref = 0;
+ ASSERT(is->is_ref == 0);
MUTEX_EXIT(&is->is_lock);
if (is->is_tqehead[0] != NULL) {
diff --git a/sys/dev/e1000/if_lem.c b/sys/dev/e1000/if_lem.c
index 7dc7d84..903cc28 100644
--- a/sys/dev/e1000/if_lem.c
+++ b/sys/dev/e1000/if_lem.c
@@ -951,7 +951,7 @@ lem_start_locked(struct ifnet *ifp)
if (adapter->num_tx_desc_avail <= EM_TX_OP_THRESHOLD)
ifp->if_drv_flags |= IFF_DRV_OACTIVE;
#ifdef NIC_PARAVIRT
- if (if_getdrvflags(ifp) & IFF_DRV_OACTIVE && adapter->csb &&
+ if ((ifp->if_drv_flags & IFF_DRV_OACTIVE) && adapter->csb &&
adapter->csb->guest_csb_on &&
!(adapter->csb->guest_need_txkick & 1)) {
adapter->csb->guest_need_txkick = 1;
diff --git a/sys/dev/e1000/if_lem.h b/sys/dev/e1000/if_lem.h
index 235277d..c67a761 100644
--- a/sys/dev/e1000/if_lem.h
+++ b/sys/dev/e1000/if_lem.h
@@ -265,6 +265,13 @@
#define PICOSECS_PER_TICK 20833
#define TSYNC_PORT 319 /* UDP port for the protocol */
+#ifdef NIC_PARAVIRT
+#define E1000_PARA_SUBDEV 0x1101 /* special id */
+#define E1000_CSBAL 0x02830 /* csb phys. addr. low */
+#define E1000_CSBAH 0x02834 /* csb phys. addr. hi */
+#include <net/paravirt.h>
+#endif
+
/*
* Bus dma allocation structure used by
* e1000_dma_malloc and e1000_dma_free.
@@ -437,6 +444,15 @@ struct adapter {
boolean_t pcix_82544;
boolean_t in_detach;
+#ifdef NIC_PARAVIRT
+ struct em_dma_alloc csb_mem;
+ struct paravirt_csb *csb;
+ uint32_t rx_retries;
+ uint32_t tdt_csb_count;
+ uint32_t tdt_reg_count;
+ uint32_t tdt_int_count;
+ uint32_t guest_need_kick_count;
+#endif
struct e1000_hw_stats stats;
};
diff --git a/sys/dev/iicbus/icee.c b/sys/dev/iicbus/icee.c
index 2e26d0e..800ec4c 100644
--- a/sys/dev/iicbus/icee.c
+++ b/sys/dev/iicbus/icee.c
@@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$");
struct icee_softc {
device_t sc_dev; /* Myself */
- struct sx sc_lock; /* basically a perimeter lock */
+ device_t sc_busdev; /* Parent bus */
struct cdev *cdev; /* user interface */
int addr;
int size; /* How big am I? */
@@ -57,12 +57,6 @@ struct icee_softc {
int wr_sz; /* What's the write page size */
};
-#define ICEE_LOCK(_sc) sx_xlock(&(_sc)->sc_lock)
-#define ICEE_UNLOCK(_sc) sx_xunlock(&(_sc)->sc_lock)
-#define ICEE_LOCK_INIT(_sc) sx_init(&_sc->sc_lock, "icee")
-#define ICEE_LOCK_DESTROY(_sc) sx_destroy(&_sc->sc_lock);
-#define ICEE_ASSERT_LOCKED(_sc) sx_assert(&_sc->sc_lock, SA_XLOCKED);
-#define ICEE_ASSERT_UNLOCKED(_sc) sx_assert(&_sc->sc_lock, SA_UNLOCKED);
#define CDEV2SOFTC(dev) ((dev)->si_drv1)
/* cdev routines */
@@ -84,7 +78,7 @@ static struct cdevsw icee_cdevsw =
static int
icee_probe(device_t dev)
{
- /* XXX really probe? -- not until we know the size... */
+
device_set_desc(dev, "I2C EEPROM");
return (BUS_PROBE_NOWILDCARD);
}
@@ -97,6 +91,7 @@ icee_attach(device_t dev)
int dunit, err;
sc->sc_dev = dev;
+ sc->sc_busdev = device_get_parent(sc->sc_dev);
sc->addr = iicbus_get_addr(dev);
err = 0;
dname = device_get_name(dev);
@@ -117,8 +112,7 @@ icee_attach(device_t dev)
goto out;
}
sc->cdev->si_drv1 = sc;
- ICEE_LOCK_INIT(sc);
-out:;
+out:
return (err);
}
@@ -126,7 +120,7 @@ static int
icee_open(struct cdev *dev, int oflags, int devtype, struct thread *td)
{
- return (0);
+ return (0);
}
static int
@@ -155,7 +149,9 @@ icee_read(struct cdev *dev, struct uio *uio, int ioflag)
return (EIO);
if (sc->type != 8 && sc->type != 16)
return (EINVAL);
- ICEE_LOCK(sc);
+ error = iicbus_request_bus(sc->sc_busdev, sc->sc_dev, IIC_INTRWAIT);
+ if (error!= 0)
+ return (iic2errno(error));
slave = error = 0;
while (uio->uio_resid > 0) {
if (uio->uio_offset >= sc->size)
@@ -180,13 +176,15 @@ icee_read(struct cdev *dev, struct uio *uio, int ioflag)
for (i = 0; i < 2; i++)
msgs[i].slave = slave;
error = iicbus_transfer(sc->sc_dev, msgs, 2);
- if (error)
+ if (error) {
+ error = iic2errno(error);
break;
+ }
error = uiomove(data, len, uio);
if (error)
break;
}
- ICEE_UNLOCK(sc);
+ iicbus_release_bus(sc->sc_busdev, sc->sc_dev);
return (error);
}
@@ -214,7 +212,10 @@ icee_write(struct cdev *dev, struct uio *uio, int ioflag)
return (EIO);
if (sc->type != 8 && sc->type != 16)
return (EINVAL);
- ICEE_LOCK(sc);
+
+ error = iicbus_request_bus(sc->sc_busdev, sc->sc_dev, IIC_INTRWAIT);
+ if (error!= 0)
+ return (iic2errno(error));
slave = error = 0;
while (uio->uio_resid > 0) {
if (uio->uio_offset >= sc->size)
@@ -239,22 +240,22 @@ icee_write(struct cdev *dev, struct uio *uio, int ioflag)
if (error)
break;
error = iicbus_transfer(sc->sc_dev, wr, 1);
- if (error)
+ if (error) {
+ error = iic2errno(error);
break;
- // Now wait for the write to be done by trying to read
- // the part.
+ }
+ /* Read after write to wait for write-done. */
waitlimit = 10000;
rd[0].slave = slave;
- do
- {
- error = iicbus_transfer(sc->sc_dev, rd, 1);
+ do {
+ error = iicbus_transfer(sc->sc_dev, rd, 1);
} while (waitlimit-- > 0 && error != 0);
if (error) {
- printf("waiting for write failed %d\n", error);
- break;
+ error = iic2errno(error);
+ break;
}
}
- ICEE_UNLOCK(sc);
+ iicbus_release_bus(sc->sc_busdev, sc->sc_dev);
return error;
}
diff --git a/sys/dev/iicbus/iic.c b/sys/dev/iicbus/iic.c
index 16d113ee..84e1314 100644
--- a/sys/dev/iicbus/iic.c
+++ b/sys/dev/iicbus/iic.c
@@ -37,6 +37,7 @@
#include <sys/sx.h>
#include <sys/systm.h>
#include <sys/uio.h>
+#include <sys/errno.h>
#include <dev/iicbus/iiconf.h>
#include <dev/iicbus/iicbus.h>
@@ -44,28 +45,32 @@
#include "iicbus_if.h"
-#define BUFSIZE 1024
-
struct iic_softc {
-
device_t sc_dev;
- u_char sc_addr; /* 7 bit address on iicbus */
- int sc_count; /* >0 if device opened */
-
- char sc_buffer[BUFSIZE]; /* output buffer */
- char sc_inbuf[BUFSIZE]; /* input buffer */
-
struct cdev *sc_devnode;
- struct sx sc_lock;
};
-#define IIC_LOCK(sc) sx_xlock(&(sc)->sc_lock)
-#define IIC_UNLOCK(sc) sx_xunlock(&(sc)->sc_lock)
+struct iic_cdevpriv {
+ struct sx lock;
+ struct iic_softc *sc;
+ bool started;
+ uint8_t addr;
+};
+
+
+#define IIC_LOCK(cdp) sx_xlock(&(cdp)->lock)
+#define IIC_UNLOCK(cdp) sx_xunlock(&(cdp)->lock)
+
+static MALLOC_DEFINE(M_IIC, "iic", "I2C device data");
static int iic_probe(device_t);
static int iic_attach(device_t);
static int iic_detach(device_t);
static void iic_identify(driver_t *driver, device_t parent);
+static void iicdtor(void *data);
+static int iicuio_move(struct iic_cdevpriv *priv, struct uio *uio, int last);
+static int iicuio(struct cdev *dev, struct uio *uio, int ioflag);
+static int iicrdwr(struct iic_cdevpriv *priv, struct iic_rdwr_data *d, int flags);
static devclass_t iic_devclass;
@@ -89,18 +94,13 @@ static driver_t iic_driver = {
};
static d_open_t iicopen;
-static d_close_t iicclose;
-static d_write_t iicwrite;
-static d_read_t iicread;
static d_ioctl_t iicioctl;
static struct cdevsw iic_cdevsw = {
.d_version = D_VERSION,
- .d_flags = D_TRACKCLOSE,
.d_open = iicopen,
- .d_close = iicclose,
- .d_read = iicread,
- .d_write = iicwrite,
+ .d_read = iicuio,
+ .d_write = iicuio,
.d_ioctl = iicioctl,
.d_name = "iic",
};
@@ -127,16 +127,15 @@ iic_probe(device_t dev)
static int
iic_attach(device_t dev)
{
- struct iic_softc *sc = (struct iic_softc *)device_get_softc(dev);
+ struct iic_softc *sc;
+ sc = device_get_softc(dev);
sc->sc_dev = dev;
- sx_init(&sc->sc_lock, "iic");
sc->sc_devnode = make_dev(&iic_cdevsw, device_get_unit(dev),
UID_ROOT, GID_WHEEL,
0600, "iic%d", device_get_unit(dev));
if (sc->sc_devnode == NULL) {
device_printf(dev, "failed to create character device\n");
- sx_destroy(&sc->sc_lock);
return (ENXIO);
}
sc->sc_devnode->si_drv1 = sc;
@@ -147,11 +146,12 @@ iic_attach(device_t dev)
static int
iic_detach(device_t dev)
{
- struct iic_softc *sc = (struct iic_softc *)device_get_softc(dev);
+ struct iic_softc *sc;
+
+ sc = device_get_softc(dev);
if (sc->sc_devnode)
destroy_dev(sc->sc_devnode);
- sx_destroy(&sc->sc_lock);
return (0);
}
@@ -159,238 +159,331 @@ iic_detach(device_t dev)
static int
iicopen(struct cdev *dev, int flags, int fmt, struct thread *td)
{
- struct iic_softc *sc = dev->si_drv1;
+ struct iic_cdevpriv *priv;
+ int error;
- IIC_LOCK(sc);
- if (sc->sc_count > 0) {
- IIC_UNLOCK(sc);
- return (EBUSY);
- }
+ priv = malloc(sizeof(*priv), M_IIC, M_WAITOK | M_ZERO);
- sc->sc_count++;
- IIC_UNLOCK(sc);
+ sx_init(&priv->lock, "iic");
+ priv->sc = dev->si_drv1;
- return (0);
+ error = devfs_set_cdevpriv(priv, iicdtor);
+ if (error != 0)
+ free(priv, M_IIC);
+
+ return (error);
}
-static int
-iicclose(struct cdev *dev, int flags, int fmt, struct thread *td)
+static void
+iicdtor(void *data)
{
- struct iic_softc *sc = dev->si_drv1;
+ device_t iicdev, parent;
+ struct iic_cdevpriv *priv;
- IIC_LOCK(sc);
- if (!sc->sc_count) {
- /* XXX: I don't think this can happen. */
- IIC_UNLOCK(sc);
- return (EINVAL);
- }
+ priv = data;
+ KASSERT(priv != NULL, ("iic cdevpriv should not be NULL!"));
- sc->sc_count--;
+ iicdev = priv->sc->sc_dev;
+ parent = device_get_parent(iicdev);
- if (sc->sc_count < 0)
- panic("%s: iic_count < 0!", __func__);
- IIC_UNLOCK(sc);
+ if (priv->started) {
+ iicbus_stop(parent);
+ iicbus_reset(parent, IIC_UNKNOWN, 0, NULL);
+ iicbus_release_bus(parent, iicdev);
+ }
- return (0);
+ sx_destroy(&priv->lock);
+ free(priv, M_IIC);
}
static int
-iicwrite(struct cdev *dev, struct uio * uio, int ioflag)
+iicuio_move(struct iic_cdevpriv *priv, struct uio *uio, int last)
{
- struct iic_softc *sc = dev->si_drv1;
- device_t iicdev = sc->sc_dev;
- int sent, error, count;
-
- IIC_LOCK(sc);
- if (!sc->sc_addr) {
- IIC_UNLOCK(sc);
- return (EINVAL);
+ device_t parent;
+ int error, num_bytes, transferred_bytes, written_bytes;
+ char buffer[128];
+
+ parent = device_get_parent(priv->sc->sc_dev);
+ error = 0;
+
+ /*
+ * We can only transfer up to sizeof(buffer) bytes in 1 shot, so loop until
+ * everything has been transferred.
+ */
+ while ((error == 0) && (uio->uio_resid > 0)) {
+
+ num_bytes = MIN(uio->uio_resid, sizeof(buffer));
+ transferred_bytes = 0;
+
+ if (uio->uio_rw == UIO_WRITE) {
+ error = uiomove(buffer, num_bytes, uio);
+
+ while ((error == 0) && (transferred_bytes < num_bytes)) {
+ written_bytes = 0;
+ error = iicbus_write(parent, &buffer[transferred_bytes],
+ num_bytes - transferred_bytes, &written_bytes, 0);
+ transferred_bytes += written_bytes;
+ }
+
+ } else if (uio->uio_rw == UIO_READ) {
+ error = iicbus_read(parent, buffer,
+ num_bytes, &transferred_bytes,
+ ((uio->uio_resid <= sizeof(buffer)) ? last : 0), 0);
+ if (error == 0)
+ error = uiomove(buffer, transferred_bytes, uio);
+ }
}
- if (sc->sc_count == 0) {
- /* XXX: I don't think this can happen. */
- IIC_UNLOCK(sc);
- return (EINVAL);
- }
+ return (error);
+}
- error = iicbus_request_bus(device_get_parent(iicdev), iicdev,
- IIC_DONTWAIT);
- if (error) {
- IIC_UNLOCK(sc);
+static int
+iicuio(struct cdev *dev, struct uio *uio, int ioflag)
+{
+ device_t parent;
+ struct iic_cdevpriv *priv;
+ int error;
+ uint8_t addr;
+
+ priv = NULL;
+ error = devfs_get_cdevpriv((void**)&priv);
+
+ if (error != 0)
return (error);
+ KASSERT(priv != NULL, ("iic cdevpriv should not be NULL!"));
+
+ IIC_LOCK(priv);
+ if (priv->started || (priv->addr == 0)) {
+ IIC_UNLOCK(priv);
+ return (ENXIO);
}
+ parent = device_get_parent(priv->sc->sc_dev);
- count = min(uio->uio_resid, BUFSIZE);
- error = uiomove(sc->sc_buffer, count, uio);
- if (error) {
- IIC_UNLOCK(sc);
+ error = iicbus_request_bus(parent, priv->sc->sc_dev,
+ (ioflag & O_NONBLOCK) ? IIC_DONTWAIT : (IIC_WAIT | IIC_INTR));
+ if (error != 0) {
+ IIC_UNLOCK(priv);
return (error);
}
- error = iicbus_block_write(device_get_parent(iicdev), sc->sc_addr,
- sc->sc_buffer, count, &sent);
+ if (uio->uio_rw == UIO_READ)
+ addr = priv->addr | LSB;
+ else
+ addr = priv->addr & ~LSB;
+
+ error = iicbus_start(parent, addr, 0);
+ if (error != 0)
+ {
+ iicbus_release_bus(parent, priv->sc->sc_dev);
+ IIC_UNLOCK(priv);
+ return (error);
+ }
- iicbus_release_bus(device_get_parent(iicdev), iicdev);
- IIC_UNLOCK(sc);
+ error = iicuio_move(priv, uio, IIC_LAST_READ);
+ iicbus_stop(parent);
+ iicbus_release_bus(parent, priv->sc->sc_dev);
+ IIC_UNLOCK(priv);
return (error);
}
static int
-iicread(struct cdev *dev, struct uio * uio, int ioflag)
+iicrdwr(struct iic_cdevpriv *priv, struct iic_rdwr_data *d, int flags)
{
- struct iic_softc *sc = dev->si_drv1;
- device_t iicdev = sc->sc_dev;
- int len, error = 0;
- int bufsize;
-
- IIC_LOCK(sc);
- if (!sc->sc_addr) {
- IIC_UNLOCK(sc);
- return (EINVAL);
- }
+ struct iic_msg *buf, *m;
+ void **usrbufs;
+ device_t iicdev, parent;
+ int error, i;
- if (sc->sc_count == 0) {
- /* XXX: I don't think this can happen. */
- IIC_UNLOCK(sc);
- return (EINVAL);
- }
+ iicdev = priv->sc->sc_dev;
+ parent = device_get_parent(iicdev);
+ error = 0;
- error = iicbus_request_bus(device_get_parent(iicdev), iicdev,
- IIC_DONTWAIT);
- if (error) {
- IIC_UNLOCK(sc);
- return (error);
- }
+ buf = malloc(sizeof(*d->msgs) * d->nmsgs, M_IIC, M_WAITOK);
- /* max amount of data to read */
- len = min(uio->uio_resid, BUFSIZE);
+ error = copyin(d->msgs, buf, sizeof(*d->msgs) * d->nmsgs);
- error = iicbus_block_read(device_get_parent(iicdev), sc->sc_addr,
- sc->sc_inbuf, len, &bufsize);
- if (error) {
- IIC_UNLOCK(sc);
- return (error);
+ /* Alloc kernel buffers for userland data, copyin write data */
+ usrbufs = malloc(sizeof(void *) * d->nmsgs, M_IIC, M_WAITOK | M_ZERO);
+
+ for (i = 0; i < d->nmsgs; i++) {
+ m = &(buf[i]);
+ usrbufs[i] = m->buf;
+
+ /*
+ * At least init the buffer to NULL so we can safely free() it later.
+ * If the copyin() to buf failed, don't try to malloc bogus m->len.
+ */
+ m->buf = NULL;
+ if (error != 0)
+ continue;
+ m->buf = malloc(m->len, M_IIC, M_WAITOK);
+ if (!(m->flags & IIC_M_RD))
+ error = copyin(usrbufs[i], m->buf, m->len);
}
- if (bufsize > uio->uio_resid)
- panic("%s: too much data read!", __func__);
+ if (error == 0)
+ error = iicbus_request_bus(parent, iicdev,
+ (flags & O_NONBLOCK) ? IIC_DONTWAIT : (IIC_WAIT | IIC_INTR));
- iicbus_release_bus(device_get_parent(iicdev), iicdev);
+ if (error == 0) {
+ error = iicbus_transfer(iicdev, buf, d->nmsgs);
+ iicbus_release_bus(parent, iicdev);
+ }
+
+ /* Copyout all read segments, free up kernel buffers */
+ for (i = 0; i < d->nmsgs; i++) {
+ m = &(buf[i]);
+ if ((error == 0) && (m->flags & IIC_M_RD))
+ error = copyout(m->buf, usrbufs[i], m->len);
+ free(m->buf, M_IIC);
+ }
- error = uiomove(sc->sc_inbuf, bufsize, uio);
- IIC_UNLOCK(sc);
+ free(usrbufs, M_IIC);
+ free(buf, M_IIC);
return (error);
}
static int
iicioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *td)
{
- struct iic_softc *sc = dev->si_drv1;
- device_t iicdev = sc->sc_dev;
- device_t parent = device_get_parent(iicdev);
- struct iiccmd *s = (struct iiccmd *)data;
- struct iic_rdwr_data *d = (struct iic_rdwr_data *)data;
- struct iic_msg *m;
- int error, count, i;
- char *buf = NULL;
- void **usrbufs = NULL;
-
- if ((error = iicbus_request_bus(parent, iicdev,
- (flags & O_NONBLOCK) ? IIC_DONTWAIT : (IIC_WAIT | IIC_INTR))))
+ device_t parent, iicdev;
+ struct iiccmd *s;
+ struct uio ubuf;
+ struct iovec uvec;
+ struct iic_cdevpriv *priv;
+ int error;
+
+ s = (struct iiccmd *)data;
+ error = devfs_get_cdevpriv((void**)&priv);
+ if (error != 0)
return (error);
+ KASSERT(priv != NULL, ("iic cdevpriv should not be NULL!"));
+
+ iicdev = priv->sc->sc_dev;
+ parent = device_get_parent(iicdev);
+ IIC_LOCK(priv);
+
+
switch (cmd) {
case I2CSTART:
- IIC_LOCK(sc);
- error = iicbus_start(parent, s->slave, 0);
+ if (priv->started) {
+ error = EINVAL;
+ break;
+ }
+ error = iicbus_request_bus(parent, iicdev,
+ (flags & O_NONBLOCK) ? IIC_DONTWAIT : (IIC_WAIT | IIC_INTR));
- /*
- * Implicitly set the chip addr to the slave addr passed as
- * parameter. Consequently, start/stop shall be called before
- * the read or the write of a block.
- */
- if (!error)
- sc->sc_addr = s->slave;
- IIC_UNLOCK(sc);
+ if (error == 0)
+ error = iicbus_start(parent, s->slave, 0);
+
+ if (error == 0) {
+ priv->addr = s->slave;
+ priv->started = true;
+ } else
+ iicbus_release_bus(parent, iicdev);
break;
case I2CSTOP:
- error = iicbus_stop(parent);
+ if (priv->started) {
+ error = iicbus_stop(parent);
+ iicbus_release_bus(parent, iicdev);
+ priv->started = false;
+ }
+
break;
case I2CRSTCARD:
- error = iicbus_reset(parent, IIC_UNKNOWN, 0, NULL);
/*
- * Ignore IIC_ENOADDR as it only means we have a master-only
- * controller.
- */
- if (error == IIC_ENOADDR)
- error = 0;
+ * Bus should be owned before we reset it.
+ * We allow the bus to be already owned as the result of an in-progress
+ * sequence; however, bus reset will always be followed by release
+ * (a new start is presumably needed for I/O anyway). */
+ if (!priv->started)
+ error = iicbus_request_bus(parent, iicdev,
+ (flags & O_NONBLOCK) ? IIC_DONTWAIT : (IIC_WAIT | IIC_INTR));
+
+ if (error == 0) {
+ error = iicbus_reset(parent, IIC_UNKNOWN, 0, NULL);
+ /*
+ * Ignore IIC_ENOADDR as it only means we have a master-only
+ * controller.
+ */
+ if (error == IIC_ENOADDR)
+ error = 0;
+
+ iicbus_release_bus(parent, iicdev);
+ priv->started = false;
+ }
break;
case I2CWRITE:
- if (s->count <= 0) {
+ if (!priv->started) {
error = EINVAL;
break;
}
- buf = malloc((unsigned long)s->count, M_TEMP, M_WAITOK);
- error = copyin(s->buf, buf, s->count);
- if (error)
- break;
- error = iicbus_write(parent, buf, s->count, &count, 10);
+ uvec.iov_base = s->buf;
+ uvec.iov_len = s->count;
+ ubuf.uio_iov = &uvec;
+ ubuf.uio_iovcnt = 1;
+ ubuf.uio_segflg = UIO_USERSPACE;
+ ubuf.uio_td = td;
+ ubuf.uio_resid = s->count;
+ ubuf.uio_offset = 0;
+ ubuf.uio_rw = UIO_WRITE;
+ error = iicuio_move(priv, &ubuf, 0);
break;
case I2CREAD:
- if (s->count <= 0) {
+ if (!priv->started) {
error = EINVAL;
break;
}
- buf = malloc((unsigned long)s->count, M_TEMP, M_WAITOK);
- error = iicbus_read(parent, buf, s->count, &count, s->last, 10);
- if (error)
- break;
- error = copyout(buf, s->buf, s->count);
+ uvec.iov_base = s->buf;
+ uvec.iov_len = s->count;
+ ubuf.uio_iov = &uvec;
+ ubuf.uio_iovcnt = 1;
+ ubuf.uio_segflg = UIO_USERSPACE;
+ ubuf.uio_td = td;
+ ubuf.uio_resid = s->count;
+ ubuf.uio_offset = 0;
+ ubuf.uio_rw = UIO_READ;
+ error = iicuio_move(priv, &ubuf, s->last);
break;
case I2CRDWR:
- buf = malloc(sizeof(*d->msgs) * d->nmsgs, M_TEMP, M_WAITOK);
- error = copyin(d->msgs, buf, sizeof(*d->msgs) * d->nmsgs);
- if (error)
+ /*
+ * The rdwr list should be a self-contained set of
+ * transactions. Fail if another transaction is in progress.
+ */
+ if (priv->started) {
+ error = EINVAL;
break;
- /* Alloc kernel buffers for userland data, copyin write data */
- usrbufs = malloc(sizeof(void *) * d->nmsgs, M_TEMP, M_ZERO | M_WAITOK);
- for (i = 0; i < d->nmsgs; i++) {
- m = &((struct iic_msg *)buf)[i];
- usrbufs[i] = m->buf;
- m->buf = malloc(m->len, M_TEMP, M_WAITOK);
- if (!(m->flags & IIC_M_RD))
- copyin(usrbufs[i], m->buf, m->len);
- }
- error = iicbus_transfer(iicdev, (struct iic_msg *)buf, d->nmsgs);
- /* Copyout all read segments, free up kernel buffers */
- for (i = 0; i < d->nmsgs; i++) {
- m = &((struct iic_msg *)buf)[i];
- if (m->flags & IIC_M_RD)
- copyout(m->buf, usrbufs[i], m->len);
- free(m->buf, M_TEMP);
}
- free(usrbufs, M_TEMP);
+
+ error = iicrdwr(priv, (struct iic_rdwr_data *)data, flags);
+
break;
case I2CRPTSTART:
+ if (!priv->started) {
+ error = EINVAL;
+ break;
+ }
error = iicbus_repeated_start(parent, s->slave, 0);
break;
+ case I2CSADDR:
+ priv->addr = *((uint8_t*)data);
+ break;
+
default:
error = ENOTTY;
}
- iicbus_release_bus(parent, iicdev);
-
- if (buf != NULL)
- free(buf, M_TEMP);
+ IIC_UNLOCK(priv);
return (error);
}
diff --git a/sys/dev/iicbus/iic.h b/sys/dev/iicbus/iic.h
index ab58abf..ba98d28 100644
--- a/sys/dev/iicbus/iic.h
+++ b/sys/dev/iicbus/iic.h
@@ -63,5 +63,6 @@ struct iic_rdwr_data {
#define I2CREAD _IOW('i', 5, struct iiccmd) /* receive data */
#define I2CRDWR _IOW('i', 6, struct iic_rdwr_data) /* General read/write interface */
#define I2CRPTSTART _IOW('i', 7, struct iiccmd) /* repeated start */
+#define I2CSADDR _IOW('i', 8, uint8_t) /* set slave address for future I/O */
#endif
diff --git a/sys/dev/iicbus/iicbus_if.m b/sys/dev/iicbus/iicbus_if.m
index 120b5e7..3f58168 100644
--- a/sys/dev/iicbus/iicbus_if.m
+++ b/sys/dev/iicbus/iicbus_if.m
@@ -51,6 +51,10 @@ METHOD int intr {
#
# iicbus callback
+# Request ownership of bus
+# index: IIC_REQUEST_BUS or IIC_RELEASE_BUS
+# data: pointer to int containing IIC_WAIT or IIC_DONTWAIT and either IIC_INTR or IIC_NOINTR
+# This function is allowed to sleep if *data contains IIC_WAIT.
#
METHOD int callback {
device_t dev;
diff --git a/sys/dev/iicbus/iicoc.c b/sys/dev/iicbus/iicoc.c
index de17e74..45f1692 100644
--- a/sys/dev/iicbus/iicoc.c
+++ b/sys/dev/iicbus/iicoc.c
@@ -236,7 +236,7 @@ iicoc_detach(device_t dev)
static int
iicoc_start(device_t dev, u_char slave, int timeout)
{
- int error = IIC_EBUSBSY;
+ int error = IIC_EBUSERR;
struct iicoc_softc *sc;
sc = device_get_softc(dev);
diff --git a/sys/dev/iicbus/iiconf.c b/sys/dev/iicbus/iiconf.c
index 940760b..e28d341 100644
--- a/sys/dev/iicbus/iiconf.c
+++ b/sys/dev/iicbus/iiconf.c
@@ -40,6 +40,28 @@ __FBSDID("$FreeBSD$");
#include "iicbus_if.h"
/*
+ * Translate IIC_Exxxxx status values to vaguely-equivelent errno values.
+ */
+int
+iic2errno(int iic_status)
+{
+ switch (iic_status) {
+ case IIC_NOERR: return (0);
+ case IIC_EBUSERR: return (EALREADY);
+ case IIC_ENOACK: return (EIO);
+ case IIC_ETIMEOUT: return (ETIMEDOUT);
+ case IIC_EBUSBSY: return (EWOULDBLOCK);
+ case IIC_ESTATUS: return (EPROTO);
+ case IIC_EUNDERFLOW: return (EIO);
+ case IIC_EOVERFLOW: return (EOVERFLOW);
+ case IIC_ENOTSUPP: return (EOPNOTSUPP);
+ case IIC_ENOADDR: return (EADDRNOTAVAIL);
+ case IIC_ERESOURCE: return (ENOMEM);
+ default: return (EIO);
+ }
+}
+
+/*
* iicbus_intr()
*/
void
@@ -70,8 +92,7 @@ iicbus_poll(struct iicbus_softc *sc, int how)
break;
default:
- return (EWOULDBLOCK);
- break;
+ return (IIC_EBUSBSY);
}
return (error);
@@ -90,31 +111,32 @@ iicbus_request_bus(device_t bus, device_t dev, int how)
struct iicbus_softc *sc = (struct iicbus_softc *)device_get_softc(bus);
int error = 0;
- /* first, ask the underlying layers if the request is ok */
IICBUS_LOCK(sc);
- do {
- error = IICBUS_CALLBACK(device_get_parent(bus),
- IIC_REQUEST_BUS, (caddr_t)&how);
- if (error)
- error = iicbus_poll(sc, how);
- } while (error == EWOULDBLOCK);
-
- while (!error) {
- if (sc->owner && sc->owner != dev) {
- error = iicbus_poll(sc, how);
- } else {
- sc->owner = dev;
+ while ((error == 0) && (sc->owner != NULL))
+ error = iicbus_poll(sc, how);
+
+ if (error == 0) {
+ sc->owner = dev;
+ /*
+ * Drop the lock around the call to the bus driver.
+ * This call should be allowed to sleep in the IIC_WAIT case.
+ * Drivers might also need to grab locks that would cause LOR
+ * if our lock is held.
+ */
+ IICBUS_UNLOCK(sc);
+ /* Ask the underlying layers if the request is ok */
+ error = IICBUS_CALLBACK(device_get_parent(bus),
+ IIC_REQUEST_BUS, (caddr_t)&how);
+ IICBUS_LOCK(sc);
- IICBUS_UNLOCK(sc);
- return (0);
+ if (error != 0) {
+ sc->owner = NULL;
+ wakeup_one(sc);
}
-
- /* free any allocated resource */
- if (error)
- IICBUS_CALLBACK(device_get_parent(bus), IIC_RELEASE_BUS,
- (caddr_t)&how);
}
+
+
IICBUS_UNLOCK(sc);
return (error);
@@ -131,26 +153,33 @@ iicbus_release_bus(device_t bus, device_t dev)
struct iicbus_softc *sc = (struct iicbus_softc *)device_get_softc(bus);
int error;
- /* first, ask the underlying layers if the release is ok */
- error = IICBUS_CALLBACK(device_get_parent(bus), IIC_RELEASE_BUS, NULL);
-
- if (error)
- return (error);
-
IICBUS_LOCK(sc);
if (sc->owner != dev) {
IICBUS_UNLOCK(sc);
- return (EACCES);
+ return (IIC_EBUSBSY);
}
- sc->owner = NULL;
-
- /* wakeup waiting processes */
- wakeup(sc);
+ /*
+ * Drop the lock around the call to the bus driver.
+ * This call should be allowed to sleep in the IIC_WAIT case.
+ * Drivers might also need to grab locks that would cause LOR
+ * if our lock is held.
+ */
IICBUS_UNLOCK(sc);
+ /* Ask the underlying layers if the release is ok */
+ error = IICBUS_CALLBACK(device_get_parent(bus), IIC_RELEASE_BUS, NULL);
- return (0);
+ if (error == 0) {
+ IICBUS_LOCK(sc);
+ sc->owner = NULL;
+
+ /* wakeup a waiting thread */
+ wakeup_one(sc);
+ IICBUS_UNLOCK(sc);
+ }
+
+ return (error);
}
/*
@@ -178,7 +207,7 @@ iicbus_start(device_t bus, u_char slave, int timeout)
int error = 0;
if (sc->started)
- return (EINVAL); /* bus already started */
+ return (IIC_ESTATUS); /* protocol error, bus already started */
if (!(error = IICBUS_START(device_get_parent(bus), slave, timeout)))
sc->started = slave;
@@ -200,7 +229,7 @@ iicbus_repeated_start(device_t bus, u_char slave, int timeout)
int error = 0;
if (!sc->started)
- return (EINVAL); /* bus should have been already started */
+ return (IIC_ESTATUS); /* protocol error, bus not started */
if (!(error = IICBUS_REPEATED_START(device_get_parent(bus), slave, timeout)))
sc->started = slave;
@@ -222,7 +251,7 @@ iicbus_stop(device_t bus)
int error = 0;
if (!sc->started)
- return (EINVAL); /* bus not started */
+ return (IIC_ESTATUS); /* protocol error, bus not started */
error = IICBUS_STOP(device_get_parent(bus));
@@ -245,7 +274,7 @@ iicbus_write(device_t bus, const char *buf, int len, int *sent, int timeout)
/* a slave must have been started for writing */
if (sc->started == 0 || (sc->strict != 0 && (sc->started & LSB) != 0))
- return (EINVAL);
+ return (IIC_ESTATUS);
return (IICBUS_WRITE(device_get_parent(bus), buf, len, sent, timeout));
}
@@ -263,7 +292,7 @@ iicbus_read(device_t bus, char *buf, int len, int *read, int last, int delay)
/* a slave must have been started for reading */
if (sc->started == 0 || (sc->strict != 0 && (sc->started & LSB) == 0))
- return (EINVAL);
+ return (IIC_ESTATUS);
return (IICBUS_READ(device_get_parent(bus), buf, len, read, last, delay));
}
@@ -276,9 +305,14 @@ iicbus_read(device_t bus, char *buf, int len, int *read, int last, int delay)
int
iicbus_write_byte(device_t bus, char byte, int timeout)
{
+ struct iicbus_softc *sc = device_get_softc(bus);
char data = byte;
int sent;
+ /* a slave must have been started for writing */
+ if (sc->started == 0 || (sc->strict != 0 && (sc->started & LSB) != 0))
+ return (IIC_ESTATUS);
+
return (iicbus_write(bus, &data, 1, &sent, timeout));
}
@@ -290,8 +324,13 @@ iicbus_write_byte(device_t bus, char byte, int timeout)
int
iicbus_read_byte(device_t bus, char *byte, int timeout)
{
+ struct iicbus_softc *sc = device_get_softc(bus);
int read;
+ /* a slave must have been started for reading */
+ if (sc->started == 0 || (sc->strict != 0 && (sc->started & LSB) == 0))
+ return (IIC_ESTATUS);
+
return (iicbus_read(bus, byte, 1, &read, IIC_LAST_READ, timeout));
}
@@ -352,6 +391,7 @@ iicbus_block_read(device_t bus, u_char slave, char *buf, int len, int *read)
int
iicbus_transfer(device_t bus, struct iic_msg *msgs, uint32_t nmsgs)
{
+
return (IICBUS_TRANSFER(device_get_parent(bus), msgs, nmsgs));
}
@@ -368,10 +408,10 @@ iicbus_transfer_gen(device_t dev, struct iic_msg *msgs, uint32_t nmsgs)
bool nostop;
if ((error = device_get_children(dev, &children, &nkid)) != 0)
- return (error);
+ return (IIC_ERESOURCE);
if (nkid != 1) {
free(children, M_TEMP);
- return (EIO);
+ return (IIC_ENOTSUPP);
}
bus = children[0];
rpstart = 0;
@@ -390,8 +430,7 @@ iicbus_transfer_gen(device_t dev, struct iic_msg *msgs, uint32_t nmsgs)
else
error = iicbus_start(bus, addr, 0);
}
-
- if (error)
+ if (error != 0)
break;
if (msgs[i].flags & IIC_M_RD)
@@ -400,6 +439,8 @@ iicbus_transfer_gen(device_t dev, struct iic_msg *msgs, uint32_t nmsgs)
else
error = iicbus_write(bus, msgs[i].buf, msgs[i].len,
&lenwrote, 0);
+ if (error != 0)
+ break;
if ((msgs[i].flags & IIC_M_NOSTOP) != 0 ||
(nostop && i + 1 < nmsgs)) {
@@ -409,5 +450,7 @@ iicbus_transfer_gen(device_t dev, struct iic_msg *msgs, uint32_t nmsgs)
iicbus_stop(bus);
}
}
+ if (error != 0 && !nostop)
+ iicbus_stop(bus);
return (error);
}
diff --git a/sys/dev/iicbus/iiconf.h b/sys/dev/iicbus/iiconf.h
index 092ba8d..aca0137 100644
--- a/sys/dev/iicbus/iiconf.h
+++ b/sys/dev/iicbus/iiconf.h
@@ -43,6 +43,7 @@
#define IIC_NOINTR 0
#define IIC_WAIT 0x1
#define IIC_INTR 0x2
+#define IIC_INTRWAIT (IIC_INTR | IIC_WAIT)
/*
* i2c modes
@@ -82,16 +83,22 @@
* adapter layer errors
*/
#define IIC_NOERR 0x0 /* no error occured */
-#define IIC_EBUSERR 0x1 /* bus error */
+#define IIC_EBUSERR 0x1 /* bus error (hardware not in expected state) */
#define IIC_ENOACK 0x2 /* ack not received until timeout */
#define IIC_ETIMEOUT 0x3 /* timeout */
-#define IIC_EBUSBSY 0x4 /* bus busy */
+#define IIC_EBUSBSY 0x4 /* bus busy (reserved by another client) */
#define IIC_ESTATUS 0x5 /* status error */
#define IIC_EUNDERFLOW 0x6 /* slave ready for more data */
#define IIC_EOVERFLOW 0x7 /* too much data */
#define IIC_ENOTSUPP 0x8 /* request not supported */
#define IIC_ENOADDR 0x9 /* no address assigned to the interface */
+#define IIC_ERESOURCE 0xa /* resources (memory, whatever) unavailable */
+/*
+ * Note that all iicbus functions return IIC_Exxxxx status values,
+ * except iic2errno() (obviously) and iicbus_started() (returns bool).
+ */
+extern int iic2errno(int);
extern int iicbus_request_bus(device_t, device_t, int);
extern int iicbus_release_bus(device_t, device_t);
extern device_t iicbus_alloc_bus(device_t);
diff --git a/sys/dev/iscsi/iscsi.c b/sys/dev/iscsi/iscsi.c
index 4386675..63abafc 100644
--- a/sys/dev/iscsi/iscsi.c
+++ b/sys/dev/iscsi/iscsi.c
@@ -2324,11 +2324,23 @@ iscsi_shutdown(struct iscsi_softc *sc)
{
struct iscsi_session *is;
- ISCSI_DEBUG("removing all sessions due to shutdown");
+ /*
+ * Trying to reconnect during system shutdown would lead to hang.
+ */
+ fail_on_disconnection = 1;
+ /*
+ * If we have any sessions waiting for reconnection, request
+ * maintenance thread to fail them immediately instead of waiting
+ * for reconnect timeout.
+ */
sx_slock(&sc->sc_lock);
- TAILQ_FOREACH(is, &sc->sc_sessions, is_next)
- iscsi_session_terminate(is);
+ TAILQ_FOREACH(is, &sc->sc_sessions, is_next) {
+ ISCSI_SESSION_LOCK(is);
+ if (is->is_waiting_for_iscsid)
+ iscsi_session_reconnect(is);
+ ISCSI_SESSION_UNLOCK(is);
+ }
sx_sunlock(&sc->sc_lock);
}
@@ -2354,12 +2366,7 @@ iscsi_load(void)
}
sc->sc_cdev->si_drv1 = sc;
- /*
- * Note that this needs to get run before dashutdown(). Otherwise,
- * when rebooting with iSCSI session with outstanding requests,
- * but disconnected, dashutdown() will hang on cam_periph_runccb().
- */
- sc->sc_shutdown_eh = EVENTHANDLER_REGISTER(shutdown_post_sync,
+ sc->sc_shutdown_eh = EVENTHANDLER_REGISTER(shutdown_pre_sync,
iscsi_shutdown, sc, SHUTDOWN_PRI_FIRST);
return (0);
@@ -2377,7 +2384,7 @@ iscsi_unload(void)
}
if (sc->sc_shutdown_eh != NULL)
- EVENTHANDLER_DEREGISTER(shutdown_post_sync, sc->sc_shutdown_eh);
+ EVENTHANDLER_DEREGISTER(shutdown_pre_sync, sc->sc_shutdown_eh);
sx_slock(&sc->sc_lock);
TAILQ_FOREACH_SAFE(is, &sc->sc_sessions, is_next, tmp)
diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c
index a2c7a78..dccd5b3 100644
--- a/sys/dev/md/md.c
+++ b/sys/dev/md/md.c
@@ -911,6 +911,22 @@ mdstart_swap(struct md_s *sc, struct bio *bp)
return (rv != VM_PAGER_ERROR ? 0 : ENOSPC);
}
+static int
+mdstart_null(struct md_s *sc, struct bio *bp)
+{
+
+ switch (bp->bio_cmd) {
+ case BIO_READ:
+ bzero(bp->bio_data, bp->bio_length);
+ cpu_flush_dcache(bp->bio_data, bp->bio_length);
+ break;
+ case BIO_WRITE:
+ break;
+ }
+ bp->bio_resid = 0;
+ return (0);
+}
+
static void
md_kthread(void *arg)
{
@@ -1030,6 +1046,7 @@ mdinit(struct md_s *sc)
pp->flags |= G_PF_ACCEPT_UNMAPPED;
break;
case MD_PRELOAD:
+ case MD_NULL:
break;
}
sc->gp = gp;
@@ -1248,6 +1265,7 @@ mdresize(struct md_s *sc, struct md_ioctl *mdio)
switch (sc->type) {
case MD_VNODE:
+ case MD_NULL:
break;
case MD_SWAP:
if (mdio->md_mediasize <= 0 ||
@@ -1342,6 +1360,19 @@ mdcreate_swap(struct md_s *sc, struct md_ioctl *mdio, struct thread *td)
return (error);
}
+static int
+mdcreate_null(struct md_s *sc, struct md_ioctl *mdio, struct thread *td)
+{
+
+ /*
+ * Range check. Disallow negative sizes or any size less then the
+ * size of a page. Then round to a page.
+ */
+ if (sc->mediasize <= 0 || (sc->mediasize % PAGE_SIZE) != 0)
+ return (EDOM);
+
+ return (0);
+}
static int
xmdctlioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td)
@@ -1374,6 +1405,7 @@ xmdctlioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread
case MD_PRELOAD:
case MD_VNODE:
case MD_SWAP:
+ case MD_NULL:
break;
default:
return (EINVAL);
@@ -1419,6 +1451,10 @@ xmdctlioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread
sc->start = mdstart_swap;
error = mdcreate_swap(sc, mdio, td);
break;
+ case MD_NULL:
+ sc->start = mdstart_null;
+ error = mdcreate_null(sc, mdio, td);
+ break;
}
if (error != 0) {
mddestroy(sc, td);
@@ -1589,6 +1625,9 @@ g_md_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp,
case MD_SWAP:
type = "swap";
break;
+ case MD_NULL:
+ type = "null";
+ break;
default:
type = "unknown";
break;
diff --git a/sys/dev/mmc/mmc.c b/sys/dev/mmc/mmc.c
index 712a2d3..a41d807 100644
--- a/sys/dev/mmc/mmc.c
+++ b/sys/dev/mmc/mmc.c
@@ -1379,6 +1379,21 @@ mmc_discover_cards(struct mmc_softc *sc)
ivar->hs_tran_speed = SD_MAX_HS;
}
}
+
+ /*
+ * We deselect then reselect the card here. Some cards
+ * become unselected and timeout with the above two
+ * commands, although the state tables / diagrams in the
+ * standard suggest they go back to the transfer state.
+ * Other cards don't become deselected, and if we
+ * atttempt to blindly re-select them, we get timeout
+ * errors from some controllers. So we deselect then
+ * reselect to handle all situations. The only thing we
+ * use from the sd_status is the erase sector size, but
+ * it is still nice to get that right.
+ */
+ mmc_select_card(sc, 0);
+ mmc_select_card(sc, ivar->rca);
mmc_app_sd_status(sc, ivar->rca, ivar->raw_sd_status);
mmc_app_decode_sd_status(ivar->raw_sd_status,
&ivar->sd_status);
@@ -1386,7 +1401,6 @@ mmc_discover_cards(struct mmc_softc *sc)
ivar->erase_sector =
16 << ivar->sd_status.au_size;
}
- mmc_select_card(sc, 0);
/* Find max supported bus width. */
if ((mmcbr_get_caps(sc->dev) & MMC_CAP_4_BIT_DATA) &&
(ivar->scr.bus_widths & SD_SCR_BUS_WIDTH_4))
@@ -1414,6 +1428,7 @@ mmc_discover_cards(struct mmc_softc *sc)
child = device_add_child(sc->dev, NULL, -1);
device_set_ivars(child, ivar);
}
+ mmc_select_card(sc, 0);
return;
}
mmc_decode_cid_mmc(ivar->raw_cid, &ivar->cid);
@@ -1446,10 +1461,10 @@ mmc_discover_cards(struct mmc_softc *sc)
break;
}
+ mmc_select_card(sc, ivar->rca);
+
/* Only MMC >= 4.x cards support EXT_CSD. */
if (ivar->csd.spec_vers >= 4) {
- /* Card must be selected to fetch EXT_CSD. */
- mmc_select_card(sc, ivar->rca);
mmc_send_ext_csd(sc, ivar->raw_ext_csd);
/* Handle extended capacity from EXT_CSD */
sec_count = ivar->raw_ext_csd[EXT_CSD_SEC_CNT] +
@@ -1472,7 +1487,6 @@ mmc_discover_cards(struct mmc_softc *sc)
ivar->hs_tran_speed = ivar->tran_speed;
/* Find max supported bus width. */
ivar->bus_width = mmc_test_bus_width(sc);
- mmc_select_card(sc, 0);
/* Handle HC erase sector size. */
if (ivar->raw_ext_csd[EXT_CSD_ERASE_GRP_SIZE] != 0) {
ivar->erase_sector = 1024 *
@@ -1506,6 +1520,7 @@ mmc_discover_cards(struct mmc_softc *sc)
child = device_add_child(sc->dev, NULL, -1);
device_set_ivars(child, ivar);
}
+ mmc_select_card(sc, 0);
}
}
diff --git a/sys/dev/pcf/pcf.c b/sys/dev/pcf/pcf.c
index 55e0346..f9252b5 100644
--- a/sys/dev/pcf/pcf.c
+++ b/sys/dev/pcf/pcf.c
@@ -170,7 +170,7 @@ pcf_start(device_t dev, u_char slave, int timeout)
printf("pcf: busy!\n");
#endif
PCF_UNLOCK(sc);
- return (IIC_EBUSBSY);
+ return (IIC_EBUSERR);
}
/* set slave address to PCF. Last bit (LSB) must be set correctly
diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c
index 7f20389..17a336f 100644
--- a/sys/fs/devfs/devfs_vnops.c
+++ b/sys/fs/devfs/devfs_vnops.c
@@ -64,6 +64,7 @@
#include <sys/vnode.h>
static struct vop_vector devfs_vnodeops;
+static struct vop_vector devfs_specops;
static struct fileops devfs_ops_f;
#include <fs/devfs/devfs.h>
@@ -1763,7 +1764,7 @@ static struct vop_vector devfs_vnodeops = {
.vop_vptocnp = devfs_vptocnp,
};
-struct vop_vector devfs_specops = {
+static struct vop_vector devfs_specops = {
.vop_default = &default_vnodeops,
.vop_access = devfs_access,
diff --git a/sys/geom/geom_dev.c b/sys/geom/geom_dev.c
index 621a037..1123323 100644
--- a/sys/geom/geom_dev.c
+++ b/sys/geom/geom_dev.c
@@ -356,6 +356,13 @@ g_dev_open(struct cdev *dev, int flags, int fmt, struct thread *td)
#else
e = 0;
#endif
+
+ /*
+ * This happens on attempt to open a device node with O_EXEC.
+ */
+ if (r + w + e == 0)
+ return (EINVAL);
+
if (w) {
/*
* When running in very secure mode, do not allow
@@ -399,6 +406,20 @@ g_dev_close(struct cdev *dev, int flags, int fmt, struct thread *td)
#else
e = 0;
#endif
+
+ /*
+ * The vgonel(9) - caused by eg. forced unmount of devfs - calls
+ * VOP_CLOSE(9) on devfs vnode without any FREAD or FWRITE flags,
+ * which would result in zero deltas, which in turn would cause
+ * panic in g_access(9).
+ *
+ * Note that we cannot zero the counters (ie. do "r = cp->acr"
+ * etc) instead, because the consumer might be opened in another
+ * devfs instance.
+ */
+ if (r + w + e == 0)
+ return (EINVAL);
+
sc = cp->private;
mtx_lock(&sc->sc_mtx);
sc->sc_open += r + w + e;
diff --git a/sys/geom/nop/g_nop.c b/sys/geom/nop/g_nop.c
index bd72d78..837f3f4 100644
--- a/sys/geom/nop/g_nop.c
+++ b/sys/geom/nop/g_nop.c
@@ -162,7 +162,7 @@ g_nop_access(struct g_provider *pp, int dr, int dw, int de)
static int
g_nop_create(struct gctl_req *req, struct g_class *mp, struct g_provider *pp,
int ioerror, u_int rfailprob, u_int wfailprob, off_t offset, off_t size,
- u_int secsize)
+ u_int secsize, u_int stripesize, u_int stripeoffset)
{
struct g_nop_softc *sc;
struct g_geom *gp;
@@ -208,6 +208,18 @@ g_nop_create(struct gctl_req *req, struct g_class *mp, struct g_provider *pp,
return (EINVAL);
}
size -= size % secsize;
+ if ((stripesize % pp->sectorsize) != 0) {
+ gctl_error(req, "Invalid stripesize for provider %s.", pp->name);
+ return (EINVAL);
+ }
+ if ((stripeoffset % pp->sectorsize) != 0) {
+ gctl_error(req, "Invalid stripeoffset for provider %s.", pp->name);
+ return (EINVAL);
+ }
+ if (stripesize != 0 && stripeoffset >= stripesize) {
+ gctl_error(req, "stripeoffset is too big.");
+ return (EINVAL);
+ }
snprintf(name, sizeof(name), "%s%s", pp->name, G_NOP_SUFFIX);
LIST_FOREACH(gp, &mp->geom, geom) {
if (strcmp(gp->name, name) == 0) {
@@ -219,6 +231,8 @@ g_nop_create(struct gctl_req *req, struct g_class *mp, struct g_provider *pp,
sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO);
sc->sc_offset = offset;
sc->sc_explicitsize = explicitsize;
+ sc->sc_stripesize = stripesize;
+ sc->sc_stripeoffset = stripeoffset;
sc->sc_error = ioerror;
sc->sc_rfailprob = rfailprob;
sc->sc_wfailprob = wfailprob;
@@ -238,6 +252,8 @@ g_nop_create(struct gctl_req *req, struct g_class *mp, struct g_provider *pp,
newpp->flags |= G_PF_DIRECT_SEND | G_PF_DIRECT_RECEIVE;
newpp->mediasize = size;
newpp->sectorsize = secsize;
+ newpp->stripesize = stripesize;
+ newpp->stripeoffset = stripeoffset;
cp = g_new_consumer(gp);
cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE;
@@ -304,7 +320,8 @@ static void
g_nop_ctl_create(struct gctl_req *req, struct g_class *mp)
{
struct g_provider *pp;
- intmax_t *error, *rfailprob, *wfailprob, *offset, *secsize, *size;
+ intmax_t *error, *rfailprob, *wfailprob, *offset, *secsize, *size,
+ *stripesize, *stripeoffset;
const char *name;
char param[16];
int i, *nargs;
@@ -370,6 +387,24 @@ g_nop_ctl_create(struct gctl_req *req, struct g_class *mp)
gctl_error(req, "Invalid '%s' argument", "secsize");
return;
}
+ stripesize = gctl_get_paraml(req, "stripesize", sizeof(*stripesize));
+ if (stripesize == NULL) {
+ gctl_error(req, "No '%s' argument", "stripesize");
+ return;
+ }
+ if (*stripesize < 0) {
+ gctl_error(req, "Invalid '%s' argument", "stripesize");
+ return;
+ }
+ stripeoffset = gctl_get_paraml(req, "stripeoffset", sizeof(*stripeoffset));
+ if (stripeoffset == NULL) {
+ gctl_error(req, "No '%s' argument", "stripeoffset");
+ return;
+ }
+ if (*stripeoffset < 0) {
+ gctl_error(req, "Invalid '%s' argument", "stripeoffset");
+ return;
+ }
for (i = 0; i < *nargs; i++) {
snprintf(param, sizeof(param), "arg%d", i);
@@ -390,7 +425,8 @@ g_nop_ctl_create(struct gctl_req *req, struct g_class *mp)
*error == -1 ? EIO : (int)*error,
*rfailprob == -1 ? 0 : (u_int)*rfailprob,
*wfailprob == -1 ? 0 : (u_int)*wfailprob,
- (off_t)*offset, (off_t)*size, (u_int)*secsize) != 0) {
+ (off_t)*offset, (off_t)*size, (u_int)*secsize,
+ (u_int)*stripesize, (u_int)*stripeoffset) != 0) {
return;
}
}
diff --git a/sys/geom/nop/g_nop.h b/sys/geom/nop/g_nop.h
index 3e37c05..b5e954a 100644
--- a/sys/geom/nop/g_nop.h
+++ b/sys/geom/nop/g_nop.h
@@ -59,6 +59,8 @@ struct g_nop_softc {
int sc_error;
off_t sc_offset;
off_t sc_explicitsize;
+ off_t sc_stripesize;
+ off_t sc_stripeoffset;
u_int sc_rfailprob;
u_int sc_wfailprob;
uintmax_t sc_reads;
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 8846ae4..f2a61ad 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -957,9 +957,7 @@ proc_reap(struct thread *td, struct proc *p, int *status, int options)
KASSERT(FIRST_THREAD_IN_PROC(p),
("proc_reap: no residual thread!"));
uma_zfree(proc_zone, p);
- sx_xlock(&allproc_lock);
- nprocs--;
- sx_xunlock(&allproc_lock);
+ atomic_add_int(&nprocs, -1);
}
static int
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index 37774ef..10b2339 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -386,12 +386,6 @@ do_fork(struct thread *td, int flags, struct proc *p2, struct thread *td2,
p2_held = 0;
p1 = td->td_proc;
- /*
- * Increment the nprocs resource before blocking can occur. There
- * are hard-limits as to the number of processes that can run.
- */
- nprocs++;
-
trypid = fork_findpid(flags);
sx_sunlock(&proctree_lock);
@@ -773,18 +767,16 @@ int
fork1(struct thread *td, int flags, int pages, struct proc **procp,
int *procdescp, int pdflags)
{
- struct proc *p1;
- struct proc *newproc;
- int ok;
+ struct proc *p1, *newproc;
struct thread *td2;
struct vmspace *vm2;
+#ifdef PROCDESC
+ struct file *fp_procdesc;
+#endif
vm_ooffset_t mem_charged;
- int error;
+ int error, nprocs_new, ok;
static int curfail;
static struct timeval lastfail;
-#ifdef PROCDESC
- struct file *fp_procdesc = NULL;
-#endif
/* Check for the undefined or unimplemented flags. */
if ((flags & ~(RFFLAGS | RFTSIGFLAGS(RFTSIGMASK))) != 0)
@@ -826,6 +818,37 @@ fork1(struct thread *td, int flags, int pages, struct proc **procp,
}
#ifdef PROCDESC
+ fp_procdesc = NULL;
+#endif
+ newproc = NULL;
+ vm2 = NULL;
+
+ /*
+ * Increment the nprocs resource before allocations occur.
+ * Although process entries are dynamically created, we still
+ * keep a global limit on the maximum number we will
+ * create. There are hard-limits as to the number of processes
+ * that can run, established by the KVA and memory usage for
+ * the process data.
+ *
+ * Don't allow a nonprivileged user to use the last ten
+ * processes; don't let root exceed the limit.
+ */
+ nprocs_new = atomic_fetchadd_int(&nprocs, 1) + 1;
+ if ((nprocs_new >= maxproc - 10 && priv_check_cred(td->td_ucred,
+ PRIV_MAXPROC, 0) != 0) || nprocs_new >= maxproc) {
+ sx_xlock(&allproc_lock);
+ if (ppsratecheck(&lastfail, &curfail, 1)) {
+ printf("maxproc limit exceeded by uid %u (pid %d); "
+ "see tuning(7) and login.conf(5)\n",
+ td->td_ucred->cr_ruid, p1->p_pid);
+ }
+ sx_xunlock(&allproc_lock);
+ error = EAGAIN;
+ goto fail1;
+ }
+
+#ifdef PROCDESC
/*
* If required, create a process descriptor in the parent first; we
* will abandon it if something goes wrong. We don't finit() until
@@ -834,12 +857,11 @@ fork1(struct thread *td, int flags, int pages, struct proc **procp,
if (flags & RFPROCDESC) {
error = falloc(td, &fp_procdesc, procdescp, 0);
if (error != 0)
- return (error);
+ goto fail1;
}
#endif
mem_charged = 0;
- vm2 = NULL;
if (pages == 0)
pages = KSTACK_PAGES;
/* Allocate new proc. */
@@ -906,20 +928,7 @@ fork1(struct thread *td, int flags, int pages, struct proc **procp,
/* We have to lock the process tree while we look for a pid. */
sx_slock(&proctree_lock);
-
- /*
- * Although process entries are dynamically created, we still keep
- * a global limit on the maximum number we will create. Don't allow
- * a nonprivileged user to use the last ten processes; don't let root
- * exceed the limit. The variable nprocs is the current number of
- * processes, maxproc is the limit.
- */
sx_xlock(&allproc_lock);
- if ((nprocs >= maxproc - 10 && priv_check_cred(td->td_ucred,
- PRIV_MAXPROC, 0) != 0) || nprocs >= maxproc) {
- error = EAGAIN;
- goto fail;
- }
/*
* Increment the count of procs running with this uid. Don't allow
@@ -954,11 +963,7 @@ fork1(struct thread *td, int flags, int pages, struct proc **procp,
}
error = EAGAIN;
-fail:
sx_sunlock(&proctree_lock);
- if (ppsratecheck(&lastfail, &curfail, 1))
- printf("maxproc limit exceeded by uid %u (pid %d); see tuning(7) and login.conf(5)\n",
- td->td_ucred->cr_ruid, p1->p_pid);
sx_xunlock(&allproc_lock);
#ifdef MAC
mac_proc_destroy(newproc);
@@ -974,6 +979,7 @@ fail1:
fdrop(fp_procdesc, td);
}
#endif
+ atomic_add_int(&nprocs, -1);
pause("fork", hz / 2);
return (error);
}
diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c
index 48f7550..05dff4e 100644
--- a/sys/kern/vfs_cache.c
+++ b/sys/kern/vfs_cache.c
@@ -324,11 +324,9 @@ static SYSCTL_NODE(_debug, OID_AUTO, hashstat, CTLFLAG_RW, NULL,
static int
sysctl_debug_hashstat_rawnchash(SYSCTL_HANDLER_ARGS)
{
- int error;
struct nchashhead *ncpp;
struct namecache *ncp;
- int n_nchash;
- int count;
+ int i, error, n_nchash, *cntbuf;
retry:
n_nchash = nchash + 1; /* nchash is max index, not count */
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 10b5b28..5058080 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -2661,10 +2661,6 @@ loop:
* If FORCECLOSE is set, forcibly close the vnode.
*/
if (vp->v_usecount == 0 || (flags & FORCECLOSE)) {
- VNASSERT(vp->v_usecount == 0 ||
- vp->v_op != &devfs_specops ||
- (vp->v_type != VCHR && vp->v_type != VBLK), vp,
- ("device VNODE %p is FORCECLOSED", vp));
vgonel(vp);
} else {
busy++;
@@ -2802,7 +2798,7 @@ unlock:
/*
* vgone, with the vp interlock held.
*/
-void
+static void
vgonel(struct vnode *vp)
{
struct thread *td;
diff --git a/sys/net/paravirt.h b/sys/net/paravirt.h
new file mode 100644
index 0000000..e2885bc
--- /dev/null
+++ b/sys/net/paravirt.h
@@ -0,0 +1,157 @@
+/*
+ * Copyright (C) 2013 Luigi Rizzo. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef NET_PARAVIRT_H
+#define NET_PARAVIRT_H
+
+ /*
+ * $FreeBSD$
+ *
+ Support for virtio-like communication between host (H) and guest (G) NICs.
+
+ THIS IS EXPERIMENTAL CODE AND SUBJECT TO CHANGE.
+
+ The guest allocates the shared Communication Status Block (csb) and
+ write its physical address at CSBAL and CSBAH (data is little endian).
+ csb->csb_on enables the mode. If disabled, the device acts a regular one.
+
+ Notifications for tx and rx are exchanged without vm exits
+ if possible. In particular (only mentioning csb mode below),
+ the following actions are performed. In the description below,
+ "double check" means verifying again the condition that caused
+ the previous action, and reverting the action if the condition has
+ changed. The condition typically depends on a variable set by the
+ other party, and the double check is done to avoid races. E.g.
+
+ // start with A=0
+ again:
+ // do something
+ if ( cond(C) ) { // C is written by the other side
+ A = 1;
+ // barrier
+ if ( !cond(C) ) {
+ A = 0;
+ goto again;
+ }
+ }
+
+ TX: start from idle:
+ H starts with host_need_txkick=1 when the I/O thread bh is idle. Upon new
+ transmissions, G always updates guest_tdt. If host_need_txkick == 1,
+ G also writes to the TDT, which acts as a kick to H (so pending
+ writes are always dispatched to H as soon as possible.)
+
+ TX: active state:
+ On the kick (TDT write) H sets host_need_txkick == 0 (if not
+ done already by G), and starts an I/O thread trying to consume
+ packets from TDH to guest_tdt, periodically refreshing host_tdh
+ and TDH. When host_tdh == guest_tdt, H sets host_need_txkick=1,
+ and then does the "double check" for race avoidance.
+
+ TX: G runs out of buffers
+ XXX there are two mechanisms, one boolean (using guest_need_txkick)
+ and one with a threshold (using guest_txkick_at). They are mutually
+ exclusive.
+ BOOLEAN: when G has no space, it sets guest_need_txkick=1 and does
+ the double check. If H finds guest_need_txkick== 1 on a write
+ to TDH, it also generates an interrupt.
+ THRESHOLD: G sets guest_txkick_at to the TDH value for which it
+ wants to receive an interrupt. When H detects that TDH moves
+ across guest_txkick_at, it generates an interrupt.
+ This second mechanism reduces the number of interrupts and
+ TDT writes on the transmit side when the host is too slow.
+
+ RX: start from idle
+ G starts with guest_need_rxkick = 1 when the receive ring is empty.
+ As packets arrive, H updates host_rdh (and RDH) and also generates an
+ interrupt when guest_need_rxkick == 1 (so incoming packets are
+ always reported to G as soon as possible, apart from interrupt
+ moderation delays). It also tracks guest_rdt for new buffers.
+
+ RX: active state
+ As the interrupt arrives, G sets guest_need_rxkick = 0 and starts
+ draining packets from the receive ring, while updating guest_rdt
+ When G runs out of packets it sets guest_need_rxkick=1 and does the
+ double check.
+
+ RX: H runs out of buffers
+ XXX there are two mechanisms, one boolean (using host_need_rxkick)
+ and one with a threshold (using host_xxkick_at). They are mutually
+ exclusive.
+ BOOLEAN: when H has no space, it sets host_need_rxkick=1 and does the
+ double check. If G finds host_need_rxkick==1 on updating guest_rdt,
+ it also writes to RDT causing a kick to H.
+ THRESHOLD: H sets host_rxkick_at to the RDT value for which it wants
+ to receive a kick. When G detects that guest_rdt moves across
+ host_rxkick_at, it writes to RDT thus generates a kick.
+ This second mechanism reduces the number of kicks and
+ RDT writes on the receive side when the guest is too slow and
+ would free only a few buffers at a time.
+
+ */
+struct paravirt_csb {
+ /* XXX revise the layout to minimize cache bounces.
+ * Usage is described as follows:
+ * [GH][RW][+-0] guest/host reads/writes frequently/rarely/almost never
+ */
+ /* these are (mostly) written by the guest */
+ uint32_t guest_tdt; /* GW+ HR+ pkt to transmit */
+ uint32_t guest_need_txkick; /* GW- HR+ G ran out of tx bufs, request kick */
+ uint32_t guest_need_rxkick; /* GW- HR+ G ran out of rx pkts, request kick */
+ uint32_t guest_csb_on; /* GW- HR+ enable paravirtual mode */
+ uint32_t guest_rdt; /* GW+ HR+ rx buffers available */
+ uint32_t guest_txkick_at; /* GW- HR+ tx ring pos. where G expects an intr */
+ uint32_t guest_use_msix; /* GW0 HR0 guest uses MSI-X interrupts. */
+ uint32_t pad[9];
+
+ /* these are (mostly) written by the host */
+ uint32_t host_tdh; /* GR0 HW- shadow register, mostly unused */
+ uint32_t host_need_txkick; /* GR+ HW- start the iothread */
+ uint32_t host_txcycles_lim; /* GW- HR- how much to spin before sleep.
+ * set by the guest */
+ uint32_t host_txcycles; /* GR0 HW- counter, but no need to be exported */
+ uint32_t host_rdh; /* GR0 HW- shadow register, mostly unused */
+ uint32_t host_need_rxkick; /* GR+ HW- flush rx queued packets */
+ uint32_t host_isr; /* GR* HW* shadow copy of ISR */
+ uint32_t host_rxkick_at; /* GR+ HW- rx ring pos where H expects a kick */
+ uint32_t vnet_ring_high; /* Vnet ring physical address high. */
+ uint32_t vnet_ring_low; /* Vnet ring physical address low. */
+};
+
+#define NET_PARAVIRT_CSB_SIZE 4096
+#define NET_PARAVIRT_NONE (~((uint32_t)0))
+
+#ifdef QEMU_PCI_H
+
+/*
+ * API functions only available within QEMU
+ */
+
+void paravirt_configure_csb(struct paravirt_csb** csb, uint32_t csbbal,
+ uint32_t csbbah, QEMUBH* tx_bh, AddressSpace *as);
+
+#endif /* QEMU_PCI_H */
+
+#endif /* NET_PARAVIRT_H */
diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h
index e3f4a92..7909cdc 100644
--- a/sys/net/pfvar.h
+++ b/sys/net/pfvar.h
@@ -1633,6 +1633,8 @@ extern void pf_print_state(struct pf_state *);
extern void pf_print_flags(u_int8_t);
extern u_int16_t pf_cksum_fixup(u_int16_t, u_int16_t, u_int16_t,
u_int8_t);
+extern u_int16_t pf_proto_cksum_fixup(struct mbuf *, u_int16_t,
+ u_int16_t, u_int16_t, u_int8_t);
VNET_DECLARE(struct ifnet *, sync_ifp);
#define V_sync_ifp VNET(sync_ifp);
@@ -1662,6 +1664,9 @@ u_int32_t pf_new_isn(struct pf_state *);
void *pf_pull_hdr(struct mbuf *, int, void *, int, u_short *, u_short *,
sa_family_t);
void pf_change_a(void *, u_int16_t *, u_int32_t, u_int8_t);
+void pf_change_proto_a(struct mbuf *, void *, u_int16_t *, u_int32_t,
+ u_int8_t);
+void pf_change_tcp_a(struct mbuf *, void *, u_int16_t *, u_int32_t);
void pf_send_deferred_syn(struct pf_state *);
int pf_match_addr(u_int8_t, struct pf_addr *, struct pf_addr *,
struct pf_addr *, sa_family_t);
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index f75de7f..631cd2e 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -2521,6 +2521,16 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so,
tp->snd_nxt = onxt;
goto drop;
} else if (V_tcp_do_rfc3042) {
+ /*
+ * Process first and second duplicate
+ * ACKs. Each indicates a segment
+ * leaving the network, creating room
+ * for more. Make sure we can send a
+ * packet on reception of each duplicate
+ * ACK by increasing snd_cwnd by one
+ * segment. Restore the original
+ * snd_cwnd after packet transmission.
+ */
cc_ack_received(tp, th, CC_DUPACK);
u_long oldcwnd = tp->snd_cwnd;
tcp_seq oldsndmax = tp->snd_max;
diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c
index 4a809c8..0d45a38 100644
--- a/sys/netpfil/pf/pf.c
+++ b/sys/netpfil/pf/pf.c
@@ -208,7 +208,7 @@ static void pf_init_threshold(struct pf_threshold *, u_int32_t,
static void pf_add_threshold(struct pf_threshold *);
static int pf_check_threshold(struct pf_threshold *);
-static void pf_change_ap(struct pf_addr *, u_int16_t *,
+static void pf_change_ap(struct mbuf *, struct pf_addr *, u_int16_t *,
u_int16_t *, u_int16_t *, struct pf_addr *,
u_int16_t, u_int8_t, sa_family_t);
static int pf_modulate_sack(struct mbuf *, int, struct pf_pdesc *,
@@ -2178,6 +2178,22 @@ pf_addr_wrap_neq(struct pf_addr_wrap *aw1, struct pf_addr_wrap *aw2)
}
}
+/**
+ * Checksum updates are a little complicated because the checksum in the TCP/UDP
+ * header isn't always a full checksum. In some cases (i.e. output) it's a
+ * pseudo-header checksum, which is a partial checksum over src/dst IP
+ * addresses, protocol number and length.
+ *
+ * That means we have the following cases:
+ * * Input or forwarding: we don't have TSO, the checksum fields are full
+ * checksums, we need to update the checksum whenever we change anything.
+ * * Output (i.e. the checksum is a pseudo-header checksum):
+ * x The field being updated is src/dst address or affects the length of
+ * the packet. We need to update the pseudo-header checksum (note that this
+ * checksum is not ones' complement).
+ * x Some other field is being modified (e.g. src/dst port numbers): We
+ * don't have to update anything.
+ **/
u_int16_t
pf_cksum_fixup(u_int16_t cksum, u_int16_t old, u_int16_t new, u_int8_t udp)
{
@@ -2193,9 +2209,20 @@ pf_cksum_fixup(u_int16_t cksum, u_int16_t old, u_int16_t new, u_int8_t udp)
return (l);
}
+u_int16_t
+pf_proto_cksum_fixup(struct mbuf *m, u_int16_t cksum, u_int16_t old,
+ u_int16_t new, u_int8_t udp)
+{
+ if (m->m_pkthdr.csum_flags & (CSUM_DELAY_DATA | CSUM_DELAY_DATA_IPV6))
+ return (cksum);
+
+ return (pf_cksum_fixup(cksum, old, new, udp));
+}
+
static void
-pf_change_ap(struct pf_addr *a, u_int16_t *p, u_int16_t *ic, u_int16_t *pc,
- struct pf_addr *an, u_int16_t pn, u_int8_t u, sa_family_t af)
+pf_change_ap(struct mbuf *m, struct pf_addr *a, u_int16_t *p, u_int16_t *ic,
+ u_int16_t *pc, struct pf_addr *an, u_int16_t pn, u_int8_t u,
+ sa_family_t af)
{
struct pf_addr ao;
u_int16_t po = *p;
@@ -2203,6 +2230,9 @@ pf_change_ap(struct pf_addr *a, u_int16_t *p, u_int16_t *ic, u_int16_t *pc,
PF_ACPY(&ao, a, af);
PF_ACPY(a, an, af);
+ if (m->m_pkthdr.csum_flags & (CSUM_DELAY_DATA | CSUM_DELAY_DATA_IPV6))
+ *pc = ~*pc;
+
*p = pn;
switch (af) {
@@ -2212,17 +2242,19 @@ pf_change_ap(struct pf_addr *a, u_int16_t *p, u_int16_t *ic, u_int16_t *pc,
ao.addr16[0], an->addr16[0], 0),
ao.addr16[1], an->addr16[1], 0);
*p = pn;
- *pc = pf_cksum_fixup(pf_cksum_fixup(pf_cksum_fixup(*pc,
+
+ *pc = pf_cksum_fixup(pf_cksum_fixup(*pc,
ao.addr16[0], an->addr16[0], u),
- ao.addr16[1], an->addr16[1], u),
- po, pn, u);
+ ao.addr16[1], an->addr16[1], u);
+
+ *pc = pf_proto_cksum_fixup(m, *pc, po, pn, u);
break;
#endif /* INET */
#ifdef INET6
case AF_INET6:
*pc = pf_cksum_fixup(pf_cksum_fixup(pf_cksum_fixup(
pf_cksum_fixup(pf_cksum_fixup(pf_cksum_fixup(
- pf_cksum_fixup(pf_cksum_fixup(pf_cksum_fixup(*pc,
+ pf_cksum_fixup(pf_cksum_fixup(*pc,
ao.addr16[0], an->addr16[0], u),
ao.addr16[1], an->addr16[1], u),
ao.addr16[2], an->addr16[2], u),
@@ -2230,13 +2262,20 @@ pf_change_ap(struct pf_addr *a, u_int16_t *p, u_int16_t *ic, u_int16_t *pc,
ao.addr16[4], an->addr16[4], u),
ao.addr16[5], an->addr16[5], u),
ao.addr16[6], an->addr16[6], u),
- ao.addr16[7], an->addr16[7], u),
- po, pn, u);
+ ao.addr16[7], an->addr16[7], u);
+
+ *pc = pf_proto_cksum_fixup(m, *pc, po, pn, u);
break;
#endif /* INET6 */
}
-}
+ if (m->m_pkthdr.csum_flags & (CSUM_DELAY_DATA |
+ CSUM_DELAY_DATA_IPV6)) {
+ *pc = ~*pc;
+ if (! *pc)
+ *pc = 0xffff;
+ }
+}
/* Changes a u_int32_t. Uses a void * so there are no align restrictions */
void
@@ -2250,6 +2289,19 @@ pf_change_a(void *a, u_int16_t *c, u_int32_t an, u_int8_t u)
ao % 65536, an % 65536, u);
}
+void
+pf_change_proto_a(struct mbuf *m, void *a, u_int16_t *c, u_int32_t an, u_int8_t udp)
+{
+ u_int32_t ao;
+
+ memcpy(&ao, a, sizeof(ao));
+ memcpy(a, &an, sizeof(u_int32_t));
+
+ *c = pf_proto_cksum_fixup(m,
+ pf_proto_cksum_fixup(m, *c, ao / 65536, an / 65536, udp),
+ ao % 65536, an % 65536, udp);
+}
+
#ifdef INET6
static void
pf_change_a6(struct pf_addr *a, u_int16_t *c, struct pf_addr *an, u_int8_t u)
@@ -2395,12 +2447,10 @@ pf_modulate_sack(struct mbuf *m, int off, struct pf_pdesc *pd,
for (i = 2; i + TCPOLEN_SACK <= olen;
i += TCPOLEN_SACK) {
memcpy(&sack, &opt[i], sizeof(sack));
- pf_change_a(&sack.start, &th->th_sum,
- htonl(ntohl(sack.start) -
- dst->seqdiff), 0);
- pf_change_a(&sack.end, &th->th_sum,
- htonl(ntohl(sack.end) -
- dst->seqdiff), 0);
+ pf_change_proto_a(m, &sack.start, &th->th_sum,
+ htonl(ntohl(sack.start) - dst->seqdiff), 0);
+ pf_change_proto_a(m, &sack.end, &th->th_sum,
+ htonl(ntohl(sack.end) - dst->seqdiff), 0);
memcpy(&opt[i], &sack, sizeof(sack));
}
copyback = 1;
@@ -3375,7 +3425,7 @@ pf_test_rule(struct pf_rule **rm, struct pf_state **sm, int direction,
if (PF_ANEQ(saddr, &nk->addr[pd->sidx], af) ||
nk->port[pd->sidx] != sport) {
- pf_change_ap(saddr, &th->th_sport, pd->ip_sum,
+ pf_change_ap(m, saddr, &th->th_sport, pd->ip_sum,
&th->th_sum, &nk->addr[pd->sidx],
nk->port[pd->sidx], 0, af);
pd->sport = &th->th_sport;
@@ -3384,7 +3434,7 @@ pf_test_rule(struct pf_rule **rm, struct pf_state **sm, int direction,
if (PF_ANEQ(daddr, &nk->addr[pd->didx], af) ||
nk->port[pd->didx] != dport) {
- pf_change_ap(daddr, &th->th_dport, pd->ip_sum,
+ pf_change_ap(m, daddr, &th->th_dport, pd->ip_sum,
&th->th_sum, &nk->addr[pd->didx],
nk->port[pd->didx], 0, af);
dport = th->th_dport;
@@ -3398,7 +3448,7 @@ pf_test_rule(struct pf_rule **rm, struct pf_state **sm, int direction,
if (PF_ANEQ(saddr, &nk->addr[pd->sidx], af) ||
nk->port[pd->sidx] != sport) {
- pf_change_ap(saddr, &pd->hdr.udp->uh_sport,
+ pf_change_ap(m, saddr, &pd->hdr.udp->uh_sport,
pd->ip_sum, &pd->hdr.udp->uh_sum,
&nk->addr[pd->sidx],
nk->port[pd->sidx], 1, af);
@@ -3408,7 +3458,7 @@ pf_test_rule(struct pf_rule **rm, struct pf_state **sm, int direction,
if (PF_ANEQ(daddr, &nk->addr[pd->didx], af) ||
nk->port[pd->didx] != dport) {
- pf_change_ap(daddr, &pd->hdr.udp->uh_dport,
+ pf_change_ap(m, daddr, &pd->hdr.udp->uh_dport,
pd->ip_sum, &pd->hdr.udp->uh_sum,
&nk->addr[pd->didx],
nk->port[pd->didx], 1, af);
@@ -3788,7 +3838,7 @@ pf_create_state(struct pf_rule *r, struct pf_rule *nr, struct pf_rule *a,
if ((s->src.seqdiff = pf_tcp_iss(pd) - s->src.seqlo) ==
0)
s->src.seqdiff = 1;
- pf_change_a(&th->th_seq, &th->th_sum,
+ pf_change_proto_a(m, &th->th_seq, &th->th_sum,
htonl(s->src.seqlo + s->src.seqdiff), 0);
*rewrite = 1;
} else
@@ -4132,9 +4182,9 @@ pf_tcp_track_full(struct pf_state_peer *src, struct pf_state_peer *dst,
while ((src->seqdiff = arc4random() - seq) == 0)
;
ack = ntohl(th->th_ack) - dst->seqdiff;
- pf_change_a(&th->th_seq, &th->th_sum, htonl(seq +
+ pf_change_proto_a(m, &th->th_seq, &th->th_sum, htonl(seq +
src->seqdiff), 0);
- pf_change_a(&th->th_ack, &th->th_sum, htonl(ack), 0);
+ pf_change_proto_a(m, &th->th_ack, &th->th_sum, htonl(ack), 0);
*copyback = 1;
} else {
ack = ntohl(th->th_ack);
@@ -4184,9 +4234,9 @@ pf_tcp_track_full(struct pf_state_peer *src, struct pf_state_peer *dst,
ack = ntohl(th->th_ack) - dst->seqdiff;
if (src->seqdiff) {
/* Modulate sequence numbers */
- pf_change_a(&th->th_seq, &th->th_sum, htonl(seq +
+ pf_change_proto_a(m, &th->th_seq, &th->th_sum, htonl(seq +
src->seqdiff), 0);
- pf_change_a(&th->th_ack, &th->th_sum, htonl(ack), 0);
+ pf_change_proto_a(m, &th->th_ack, &th->th_sum, htonl(ack), 0);
*copyback = 1;
}
end = seq + pd->p_len;
@@ -4640,14 +4690,14 @@ pf_test_state_tcp(struct pf_state **state, int direction, struct pfi_kif *kif,
if (PF_ANEQ(pd->src, &nk->addr[pd->sidx], pd->af) ||
nk->port[pd->sidx] != th->th_sport)
- pf_change_ap(pd->src, &th->th_sport, pd->ip_sum,
- &th->th_sum, &nk->addr[pd->sidx],
+ pf_change_ap(m, pd->src, &th->th_sport,
+ pd->ip_sum, &th->th_sum, &nk->addr[pd->sidx],
nk->port[pd->sidx], 0, pd->af);
if (PF_ANEQ(pd->dst, &nk->addr[pd->didx], pd->af) ||
nk->port[pd->didx] != th->th_dport)
- pf_change_ap(pd->dst, &th->th_dport, pd->ip_sum,
- &th->th_sum, &nk->addr[pd->didx],
+ pf_change_ap(m, pd->dst, &th->th_dport,
+ pd->ip_sum, &th->th_sum, &nk->addr[pd->didx],
nk->port[pd->didx], 0, pd->af);
copyback = 1;
}
@@ -4711,13 +4761,13 @@ pf_test_state_udp(struct pf_state **state, int direction, struct pfi_kif *kif,
if (PF_ANEQ(pd->src, &nk->addr[pd->sidx], pd->af) ||
nk->port[pd->sidx] != uh->uh_sport)
- pf_change_ap(pd->src, &uh->uh_sport, pd->ip_sum,
+ pf_change_ap(m, pd->src, &uh->uh_sport, pd->ip_sum,
&uh->uh_sum, &nk->addr[pd->sidx],
nk->port[pd->sidx], 1, pd->af);
if (PF_ANEQ(pd->dst, &nk->addr[pd->didx], pd->af) ||
nk->port[pd->didx] != uh->uh_dport)
- pf_change_ap(pd->dst, &uh->uh_dport, pd->ip_sum,
+ pf_change_ap(m, pd->dst, &uh->uh_dport, pd->ip_sum,
&uh->uh_sum, &nk->addr[pd->didx],
nk->port[pd->didx], 1, pd->af);
m_copyback(m, off, sizeof(*uh), (caddr_t)uh);
diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c
index 5990cf6..146a56f 100644
--- a/sys/netpfil/pf/pf_ioctl.c
+++ b/sys/netpfil/pf/pf_ioctl.c
@@ -3634,12 +3634,6 @@ pf_check_out(void *arg, struct mbuf **m, struct ifnet *ifp, int dir,
{
int chk;
- /* We need a proper CSUM befor we start (s. OpenBSD ip_output) */
- if ((*m)->m_pkthdr.csum_flags & CSUM_DELAY_DATA_IPV6) {
- in6_delayed_cksum(*m, (*m)->m_pkthdr.len - sizeof(struct ip6_hdr), sizeof(struct ip6_hdr));
- (*m)->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6;
- }
-
chk = pf_test(PF_OUT, ifp, m, inp);
if (chk && *m) {
m_freem(*m);
@@ -3678,13 +3672,6 @@ pf_check6_out(void *arg, struct mbuf **m, struct ifnet *ifp, int dir,
{
int chk;
- /* We need a proper CSUM before we start (s. OpenBSD ip_output) */
- if ((*m)->m_pkthdr.csum_flags & CSUM_DELAY_DATA_IPV6) {
- in6_delayed_cksum(*m,
- (*m)->m_pkthdr.len - sizeof(struct ip6_hdr),
- sizeof(struct ip6_hdr));
- (*m)->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6;
- }
CURVNET_SET(ifp->if_vnet);
chk = pf_test6(PF_OUT, ifp, m, inp);
CURVNET_RESTORE();
diff --git a/sys/netpfil/pf/pf_norm.c b/sys/netpfil/pf/pf_norm.c
index d56ad3c..4f9a499 100644
--- a/sys/netpfil/pf/pf_norm.c
+++ b/sys/netpfil/pf/pf_norm.c
@@ -1680,13 +1680,14 @@ pf_normalize_tcp(int dir, struct pfi_kif *kif, struct mbuf *m, int ipoff,
th->th_x2 = 0;
nv = *(u_int16_t *)(&th->th_ack + 1);
- th->th_sum = pf_cksum_fixup(th->th_sum, ov, nv, 0);
+ th->th_sum = pf_proto_cksum_fixup(m, th->th_sum, ov, nv, 0);
rewrite = 1;
}
/* Remove urgent pointer, if TH_URG is not set */
if (!(flags & TH_URG) && th->th_urp) {
- th->th_sum = pf_cksum_fixup(th->th_sum, th->th_urp, 0, 0);
+ th->th_sum = pf_proto_cksum_fixup(m, th->th_sum, th->th_urp,
+ 0, 0);
th->th_urp = 0;
rewrite = 1;
}
@@ -1887,7 +1888,7 @@ pf_normalize_tcp_stateful(struct mbuf *m, int off, struct pf_pdesc *pd,
(src->scrub->pfss_flags &
PFSS_TIMESTAMP)) {
tsval = ntohl(tsval);
- pf_change_a(&opt[2],
+ pf_change_proto_a(m, &opt[2],
&th->th_sum,
htonl(tsval +
src->scrub->pfss_ts_mod),
@@ -1903,7 +1904,7 @@ pf_normalize_tcp_stateful(struct mbuf *m, int off, struct pf_pdesc *pd,
PFSS_TIMESTAMP)) {
tsecr = ntohl(tsecr)
- dst->scrub->pfss_ts_mod;
- pf_change_a(&opt[6],
+ pf_change_proto_a(m, &opt[6],
&th->th_sum, htonl(tsecr),
0);
copyback = 1;
@@ -2230,8 +2231,8 @@ pf_normalize_tcpopt(struct pf_rule *r, struct mbuf *m, struct tcphdr *th,
case TCPOPT_MAXSEG:
mss = (u_int16_t *)(optp + 2);
if ((ntohs(*mss)) > r->max_mss) {
- th->th_sum = pf_cksum_fixup(th->th_sum,
- *mss, htons(r->max_mss), 0);
+ th->th_sum = pf_proto_cksum_fixup(m,
+ th->th_sum, *mss, htons(r->max_mss), 0);
*mss = htons(r->max_mss);
rewrite = 1;
}
diff --git a/sys/powerpc/mpc85xx/i2c.c b/sys/powerpc/mpc85xx/i2c.c
index f21c845..e02a08b 100644
--- a/sys/powerpc/mpc85xx/i2c.c
+++ b/sys/powerpc/mpc85xx/i2c.c
@@ -284,7 +284,7 @@ i2c_start(device_t dev, u_char slave, int timeout)
debugf("bus busy");
mtx_unlock(&sc->mutex);
i2c_stop(dev);
- return (IIC_EBUSBSY);
+ return (IIC_EBUSERR);
}
/* Set start condition */
diff --git a/sys/sys/elf_common.h b/sys/sys/elf_common.h
index b334fe9..1947d11 100644
--- a/sys/sys/elf_common.h
+++ b/sys/sys/elf_common.h
@@ -336,6 +336,12 @@ typedef struct {
/* Flags for section groups. */
#define GRP_COMDAT 0x1 /* COMDAT semantics. */
+/*
+ * Flags / mask for .gnu.versym sections.
+ */
+#define VERSYM_VERSION 0x7fff
+#define VERSYM_HIDDEN 0x8000
+
/* Values for p_type. */
#define PT_NULL 0 /* Unused entry. */
#define PT_LOAD 1 /* Loadable segment. */
diff --git a/sys/sys/mdioctl.h b/sys/sys/mdioctl.h
index 5efae79..acbfa4b 100644
--- a/sys/sys/mdioctl.h
+++ b/sys/sys/mdioctl.h
@@ -43,7 +43,7 @@
#ifndef _SYS_MDIOCTL_H_
#define _SYS_MDIOCTL_H_
-enum md_types {MD_MALLOC, MD_PRELOAD, MD_VNODE, MD_SWAP};
+enum md_types {MD_MALLOC, MD_PRELOAD, MD_VNODE, MD_SWAP, MD_NULL};
/*
* Ioctl definitions for memory disk pseudo-device.
diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h
index db0f60d..e738212 100644
--- a/sys/sys/vnode.h
+++ b/sys/sys/vnode.h
@@ -822,7 +822,6 @@ void vnode_destroy_vobject(struct vnode *vp);
extern struct vop_vector fifo_specops;
extern struct vop_vector dead_vnodeops;
extern struct vop_vector default_vnodeops;
-extern struct vop_vector devfs_specops;
#define VOP_PANIC ((void*)(uintptr_t)vop_panic)
#define VOP_NULL ((void*)(uintptr_t)vop_null)
diff --git a/usr.bin/rctl/rctl.8 b/usr.bin/rctl/rctl.8
index b63a67e..a8e3071 100644
--- a/usr.bin/rctl/rctl.8
+++ b/usr.bin/rctl/rctl.8
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd September 11, 2014
+.Dd September 14, 2015
.Dt RCTL 8
.Os
.Sh NAME
@@ -193,7 +193,7 @@ resource would be
.It Sy openfiles Ta "file descriptor table size"
.It Sy vmemoryuse Ta "address space limit, in bytes"
.It Sy pseudoterminals Ta "number of PTYs"
-.It Sy swapuse Ta "swap usage, in bytes"
+.It Sy swapuse Ta "swap space that may be reserved or used, in bytes"
.It Sy nthr Ta "number of threads"
.It Sy msgqqueued Ta "number of queued SysV messages"
.It Sy msgqsize Ta "SysV message queue size, in bytes"
diff --git a/usr.bin/svn/Makefile b/usr.bin/svn/Makefile
index 4442117..1d2ae21 100644
--- a/usr.bin/svn/Makefile
+++ b/usr.bin/svn/Makefile
@@ -1,5 +1,8 @@
# $FreeBSD$
-SUBDIR = lib svn svnadmin svndumpfilter svnlook svnserve svnsync svnversion svnmucc svnrdump
+SUBDIR = lib .WAIT \
+ svn svnadmin svndumpfilter svnlook svnserve svnsync svnversion \
+ svnmucc svnrdump
+SUBDIR_PARALLEL=
.include <bsd.subdir.mk>
diff --git a/usr.bin/truss/setup.c b/usr.bin/truss/setup.c
index d6e4300..a52bd16 100644
--- a/usr.bin/truss/setup.c
+++ b/usr.bin/truss/setup.c
@@ -221,11 +221,9 @@ detach:
info->pr_why = S_SCX;
info->curthread->in_syscall = 0;
break;
- } else {
- errx(1,
- "pl_flags %x contains neither PL_FLAG_SCE nor PL_FLAG_SCX",
- lwpinfo.pl_flags);
}
+ /* We didn't send the SIGTRAP, just forward it. */
+ /* FALLTHROUGH */
default:
info->pr_why = S_SIG;
info->pr_data = WSTOPSIG(waitval);
diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile
index b705669..81be708 100644
--- a/usr.sbin/Makefile
+++ b/usr.sbin/Makefile
@@ -73,6 +73,7 @@ SUBDIR= adduser \
rtprio \
service \
services_mkdb \
+ sesutil \
setfib \
setfmac \
setpmac \
diff --git a/usr.sbin/amd/Makefile b/usr.sbin/amd/Makefile
index 37e4200..67f7a8f 100644
--- a/usr.sbin/amd/Makefile
+++ b/usr.sbin/amd/Makefile
@@ -5,7 +5,9 @@
#
# $FreeBSD$
-SUBDIR= include libamu amd amq doc fixmount fsinfo hlfsd mk-amd-map pawd \
+SUBDIR= include libamu .WAIT \
+ amd amq doc fixmount fsinfo hlfsd mk-amd-map pawd \
scripts wire-test
+SUBDIR_PARALLEL=
.include <bsd.subdir.mk>
diff --git a/usr.sbin/bsdinstall/Makefile b/usr.sbin/bsdinstall/Makefile
index e72b5d3..4e3b7ef 100644
--- a/usr.sbin/bsdinstall/Makefile
+++ b/usr.sbin/bsdinstall/Makefile
@@ -1,6 +1,7 @@
# $FreeBSD$
SUBDIR= distextract distfetch partedit scripts
+SUBDIR_PARALLEL=
SCRIPTS= bsdinstall
MAN= bsdinstall.8
diff --git a/usr.sbin/fifolog/Makefile b/usr.sbin/fifolog/Makefile
index 59ac9fe..fbaaa89 100644
--- a/usr.sbin/fifolog/Makefile
+++ b/usr.sbin/fifolog/Makefile
@@ -1,5 +1,7 @@
# $FreeBSD$
-SUBDIR= lib fifolog_create fifolog_writer fifolog_reader
+SUBDIR= lib .WAIT \
+ fifolog_create fifolog_writer fifolog_reader
+SUBDIR_PARALLEL=
.include <bsd.subdir.mk>
diff --git a/usr.sbin/freebsd-update/freebsd-update.8 b/usr.sbin/freebsd-update/freebsd-update.8
index 02b9b00..a9caff6 100644
--- a/usr.sbin/freebsd-update/freebsd-update.8
+++ b/usr.sbin/freebsd-update/freebsd-update.8
@@ -113,6 +113,11 @@ Please do not run
.Nm Cm fetch
from crontab or similar using this flag, see:
.Nm Cm cron
+.It Fl -currently-running Ar release
+Don't detect the currently-running release; instead, assume that the
+system is running the specified
+.Ar release .
+This is most likely to be useful when upgrading jails.
.El
.Sh COMMANDS
The
diff --git a/usr.sbin/freebsd-update/freebsd-update.sh b/usr.sbin/freebsd-update/freebsd-update.sh
index 19d5198..9fcc012 100644
--- a/usr.sbin/freebsd-update/freebsd-update.sh
+++ b/usr.sbin/freebsd-update/freebsd-update.sh
@@ -52,6 +52,8 @@ Options:
(default: root)
--not-running-from-cron
-- Run without a tty, for use by automated tools
+ --currently-running release
+ -- Update as if currently running this release
Commands:
fetch -- Fetch updates from server
cron -- Sleep rand(3600) seconds, fetch updates, and send an
@@ -434,6 +436,9 @@ parse_cmdline () {
--not-running-from-cron)
NOTTYOK=1
;;
+ --currently-running)
+ shift; export UNAME_r="$1"
+ ;;
# Configuration file equivalents
-b)
diff --git a/usr.sbin/lpr/Makefile b/usr.sbin/lpr/Makefile
index 043ed8b..5873c07 100644
--- a/usr.sbin/lpr/Makefile
+++ b/usr.sbin/lpr/Makefile
@@ -1,7 +1,9 @@
# $FreeBSD$
-SUBDIR= common_source chkprintcap lp lpc lpd lpq lpr lprm lptest pac \
+SUBDIR= common_source .WAIT \
+ chkprintcap lp lpc lpd lpq lpr lprm lptest pac \
filters filters.ru
+SUBDIR_PARALLEL=
# Questions/ideas for lpr & friends could also be sent to:
# freebsd-print@bostonradio.org
diff --git a/usr.sbin/pc-sysinstall/Makefile b/usr.sbin/pc-sysinstall/Makefile
index aba8db7..d079e16 100644
--- a/usr.sbin/pc-sysinstall/Makefile
+++ b/usr.sbin/pc-sysinstall/Makefile
@@ -1,5 +1,6 @@
# $FreeBSD$
SUBDIR=backend backend-partmanager backend-query conf doc examples
SUBDIR+=pc-sysinstall
+SUBDIR_PARALLEL=
.include <bsd.subdir.mk>
diff --git a/usr.sbin/pw/pw.c b/usr.sbin/pw/pw.c
index 9adc9f0..6052e69 100644
--- a/usr.sbin/pw/pw.c
+++ b/usr.sbin/pw/pw.c
@@ -233,7 +233,7 @@ cmdhelp(int mode, int which)
{
"usage: pw useradd [name] [switches]\n"
"\t-V etcdir alternate /etc location\n"
- "\t-R rootir alternate root directory\n"
+ "\t-R rootdir alternate root directory\n"
"\t-C config configuration file\n"
"\t-q quiet operation\n"
" Adding users:\n"
@@ -256,7 +256,7 @@ cmdhelp(int mode, int which)
"\t-N no update\n"
" Setting defaults:\n"
"\t-V etcdir alternate /etc location\n"
- "\t-R rootir alternate root directory\n"
+ "\t-R rootdir alternate root directory\n"
"\t-D set user defaults\n"
"\t-b dir default home root dir\n"
"\t-e period default expiry period\n"
@@ -273,7 +273,7 @@ cmdhelp(int mode, int which)
"\t-y path set NIS passwd file path\n",
"usage: pw userdel [uid|name] [switches]\n"
"\t-V etcdir alternate /etc location\n"
- "\t-R rootir alternate root directory\n"
+ "\t-R rootdir alternate root directory\n"
"\t-n name login name\n"
"\t-u uid user id\n"
"\t-Y update NIS maps\n"
@@ -281,7 +281,7 @@ cmdhelp(int mode, int which)
"\t-r remove home & contents\n",
"usage: pw usermod [uid|name] [switches]\n"
"\t-V etcdir alternate /etc location\n"
- "\t-R rootir alternate root directory\n"
+ "\t-R rootdir alternate root directory\n"
"\t-C config configuration file\n"
"\t-q quiet operation\n"
"\t-F force add if no user\n"
@@ -306,7 +306,7 @@ cmdhelp(int mode, int which)
"\t-N no update\n",
"usage: pw usershow [uid|name] [switches]\n"
"\t-V etcdir alternate /etc location\n"
- "\t-R rootir alternate root directory\n"
+ "\t-R rootdir alternate root directory\n"
"\t-n name login name\n"
"\t-u uid user id\n"
"\t-F force print\n"
@@ -315,7 +315,7 @@ cmdhelp(int mode, int which)
"\t-7 print in v7 format\n",
"usage: pw usernext [switches]\n"
"\t-V etcdir alternate /etc location\n"
- "\t-R rootir alternate root directory\n"
+ "\t-R rootdir alternate root directory\n"
"\t-C config configuration file\n"
"\t-q quiet operation\n",
"usage pw: lock [switches]\n"
@@ -330,7 +330,7 @@ cmdhelp(int mode, int which)
{
"usage: pw groupadd [group|gid] [switches]\n"
"\t-V etcdir alternate /etc location\n"
- "\t-R rootir alternate root directory\n"
+ "\t-R rootdir alternate root directory\n"
"\t-C config configuration file\n"
"\t-q quiet operation\n"
"\t-n group group name\n"
@@ -341,13 +341,13 @@ cmdhelp(int mode, int which)
"\t-N no update\n",
"usage: pw groupdel [group|gid] [switches]\n"
"\t-V etcdir alternate /etc location\n"
- "\t-R rootir alternate root directory\n"
+ "\t-R rootdir alternate root directory\n"
"\t-n name group name\n"
"\t-g gid group id\n"
"\t-Y update NIS maps\n",
"usage: pw groupmod [group|gid] [switches]\n"
"\t-V etcdir alternate /etc location\n"
- "\t-R rootir alternate root directory\n"
+ "\t-R rootdir alternate root directory\n"
"\t-C config configuration file\n"
"\t-q quiet operation\n"
"\t-F force add if not exists\n"
@@ -361,7 +361,7 @@ cmdhelp(int mode, int which)
"\t-N no update\n",
"usage: pw groupshow [group|gid] [switches]\n"
"\t-V etcdir alternate /etc location\n"
- "\t-R rootir alternate root directory\n"
+ "\t-R rootdir alternate root directory\n"
"\t-n name group name\n"
"\t-g gid group id\n"
"\t-F force print\n"
@@ -369,7 +369,7 @@ cmdhelp(int mode, int which)
"\t-a print all accounting groups\n",
"usage: pw groupnext [switches]\n"
"\t-V etcdir alternate /etc location\n"
- "\t-R rootir alternate root directory\n"
+ "\t-R rootdir alternate root directory\n"
"\t-C config configuration file\n"
"\t-q quiet operation\n"
}
diff --git a/usr.sbin/unbound/Makefile b/usr.sbin/unbound/Makefile
index 3eb12fe..94cfdc3 100644
--- a/usr.sbin/unbound/Makefile
+++ b/usr.sbin/unbound/Makefile
@@ -2,5 +2,6 @@
SUBDIR= daemon anchor checkconf control
SUBDIR+= local-setup
+SUBDIR_PARALLEL=
.include <bsd.subdir.mk>
diff --git a/usr.sbin/wpa/Makefile b/usr.sbin/wpa/Makefile
index 5d746e9..ae07ec0 100644
--- a/usr.sbin/wpa/Makefile
+++ b/usr.sbin/wpa/Makefile
@@ -3,5 +3,6 @@
SUBDIR= wpa_supplicant wpa_cli wpa_passphrase
SUBDIR+= hostapd hostapd_cli
SUBDIR+= ndis_events
+SUBDIR_PARALLEL=
.include <bsd.subdir.mk>
OpenPOWER on IntegriCloud