aboutsummaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
Diffstat (limited to 'sbin')
-rw-r--r--sbin/Makefile27
-rw-r--r--sbin/adjkerntz/Makefile.depend19
-rw-r--r--sbin/atm/atmconfig/Makefile8
-rw-r--r--sbin/atm/atmconfig/Makefile.depend26
-rw-r--r--sbin/atm/atmconfig/atmconfig.84
-rw-r--r--sbin/badsect/Makefile3
-rw-r--r--sbin/badsect/Makefile.depend20
-rw-r--r--sbin/bsdlabel/Makefile3
-rw-r--r--sbin/bsdlabel/Makefile.depend22
-rw-r--r--sbin/bsdlabel/bsdlabel.82
-rw-r--r--sbin/camcontrol/Makefile3
-rw-r--r--sbin/camcontrol/Makefile.depend22
-rw-r--r--sbin/camcontrol/camcontrol.8101
-rw-r--r--sbin/camcontrol/camcontrol.c692
-rw-r--r--sbin/casperd/Makefile3
-rw-r--r--sbin/casperd/casperd.c2
-rw-r--r--sbin/casperd/zygote.c4
-rw-r--r--sbin/ccdconfig/Makefile3
-rw-r--r--sbin/ccdconfig/Makefile.depend22
-rw-r--r--sbin/clri/Makefile.depend19
-rw-r--r--sbin/comcontrol/Makefile.depend19
-rw-r--r--sbin/conscontrol/Makefile.depend19
-rw-r--r--sbin/ddb/Makefile3
-rw-r--r--sbin/ddb/Makefile.depend20
-rw-r--r--sbin/devd/Makefile3
-rw-r--r--sbin/devd/Makefile.depend28
-rw-r--r--sbin/devd/devd.conf.551
-rw-r--r--sbin/devfs/Makefile.depend19
-rw-r--r--sbin/dhclient/Makefile3
-rw-r--r--sbin/dhclient/Makefile.depend21
-rw-r--r--sbin/dhclient/dhclient.conf.52
-rw-r--r--sbin/dhclient/dhclient.leases.52
-rw-r--r--sbin/dmesg/Makefile3
-rw-r--r--sbin/dmesg/Makefile.depend20
-rw-r--r--sbin/dmesg/dmesg.c11
-rw-r--r--sbin/dump/Makefile.depend20
-rw-r--r--sbin/dumpfs/Makefile3
-rw-r--r--sbin/dumpfs/Makefile.depend20
-rw-r--r--sbin/dumpon/Makefile.depend19
-rw-r--r--sbin/etherswitchcfg/Makefile.depend19
-rw-r--r--sbin/fdisk/Makefile3
-rw-r--r--sbin/fdisk/Makefile.depend22
-rw-r--r--sbin/fdisk_pc98/Makefile3
-rw-r--r--sbin/fdisk_pc98/Makefile.depend20
-rw-r--r--sbin/ffsinfo/Makefile3
-rw-r--r--sbin/ffsinfo/Makefile.depend20
-rw-r--r--sbin/ffsinfo/ffsinfo.c46
-rw-r--r--sbin/fsck/Makefile.depend19
-rw-r--r--sbin/fsck/fsck.c54
-rw-r--r--sbin/fsck_ffs/Makefile3
-rw-r--r--sbin/fsck_ffs/Makefile.depend20
-rw-r--r--sbin/fsck_ffs/dir.c1
-rw-r--r--sbin/fsck_ffs/setup.c91
-rw-r--r--sbin/fsck_msdosfs/Makefile.depend19
-rw-r--r--sbin/fsdb/Makefile3
-rw-r--r--sbin/fsdb/Makefile.depend22
-rw-r--r--sbin/fsirand/Makefile.depend19
-rw-r--r--sbin/fsirand/fsirand.c11
-rw-r--r--sbin/gbde/Makefile3
-rw-r--r--sbin/gbde/Makefile.depend26
-rw-r--r--sbin/geom/Makefile3
-rw-r--r--sbin/geom/class/cache/Makefile.depend21
-rw-r--r--sbin/geom/class/concat/Makefile.depend21
-rw-r--r--sbin/geom/class/eli/Makefile3
-rw-r--r--sbin/geom/class/eli/Makefile.depend23
-rw-r--r--sbin/geom/class/journal/Makefile3
-rw-r--r--sbin/geom/class/journal/Makefile.depend23
-rw-r--r--sbin/geom/class/label/Makefile.depend21
-rw-r--r--sbin/geom/class/label/glabel.84
-rw-r--r--sbin/geom/class/mirror/Makefile3
-rw-r--r--sbin/geom/class/mirror/Makefile.depend22
-rw-r--r--sbin/geom/class/mountver/Makefile.depend21
-rw-r--r--sbin/geom/class/mountver/geom_mountver.c4
-rw-r--r--sbin/geom/class/mountver/gmountver.815
-rw-r--r--sbin/geom/class/multipath/Makefile.depend21
-rw-r--r--sbin/geom/class/nop/Makefile.depend21
-rw-r--r--sbin/geom/class/part/Makefile3
-rw-r--r--sbin/geom/class/part/Makefile.depend22
-rw-r--r--sbin/geom/class/part/geom_part.c15
-rw-r--r--sbin/geom/class/part/gpart.812
-rw-r--r--sbin/geom/class/raid/Makefile3
-rw-r--r--sbin/geom/class/raid/Makefile.depend22
-rw-r--r--sbin/geom/class/raid3/Makefile3
-rw-r--r--sbin/geom/class/raid3/Makefile.depend22
-rw-r--r--sbin/geom/class/sched/Makefile.depend21
-rw-r--r--sbin/geom/class/shsec/Makefile.depend21
-rw-r--r--sbin/geom/class/stripe/Makefile.depend21
-rw-r--r--sbin/geom/class/virstor/Makefile.depend21
-rw-r--r--sbin/geom/core/Makefile3
-rw-r--r--sbin/geom/core/Makefile.depend23
-rw-r--r--sbin/ggate/ggatec/Makefile3
-rw-r--r--sbin/ggate/ggatec/Makefile.depend25
-rw-r--r--sbin/ggate/ggatec/ggatec.831
-rw-r--r--sbin/ggate/ggated/Makefile3
-rw-r--r--sbin/ggate/ggated/Makefile.depend23
-rw-r--r--sbin/ggate/ggatel/Makefile3
-rw-r--r--sbin/ggate/ggatel/Makefile.depend24
-rw-r--r--sbin/ggate/ggatel/ggatel.826
-rw-r--r--sbin/growfs/Makefile11
-rw-r--r--sbin/growfs/Makefile.depend20
-rw-r--r--sbin/growfs/growfs.814
-rw-r--r--sbin/growfs/growfs.c4
-rw-r--r--sbin/gvinum/Makefile3
-rw-r--r--sbin/gvinum/Makefile.depend27
-rw-r--r--sbin/hastctl/Makefile6
-rw-r--r--sbin/hastctl/Makefile.depend28
-rw-r--r--sbin/hastd/Makefile6
-rw-r--r--sbin/hastd/Makefile.depend32
-rw-r--r--sbin/hastd/hast.conf.510
-rw-r--r--sbin/ifconfig/Makefile13
-rw-r--r--sbin/ifconfig/Makefile.depend24
-rw-r--r--sbin/ifconfig/af_inet.c5
-rw-r--r--sbin/ifconfig/af_inet6.c49
-rw-r--r--sbin/ifconfig/af_nd6.c4
-rw-r--r--sbin/ifconfig/carp.c1
-rw-r--r--sbin/ifconfig/ifconfig.853
-rw-r--r--sbin/ifconfig/ifconfig.c188
-rw-r--r--sbin/ifconfig/iffib.c36
-rw-r--r--sbin/ifconfig/ifgif.c4
-rw-r--r--sbin/ifconfig/ifgroup.c5
-rw-r--r--sbin/ifconfig/ifmedia.c32
-rw-r--r--sbin/ifconfig/ifvlan.c1
-rw-r--r--sbin/ifconfig/ifvxlan.c55
-rw-r--r--sbin/ifconfig/sfp.c189
-rw-r--r--sbin/ifconfig/tests/Makefile13
-rw-r--r--sbin/init/Makefile3
-rw-r--r--sbin/init/Makefile.depend20
-rw-r--r--sbin/ipf/Makefile.inc4
-rw-r--r--sbin/ipf/ipf/Makefile3
-rw-r--r--sbin/ipf/ipf/Makefile.depend33
-rw-r--r--sbin/ipf/ipfs/Makefile.depend22
-rw-r--r--sbin/ipf/ipfstat/Makefile3
-rw-r--r--sbin/ipf/ipfstat/Makefile.depend24
-rw-r--r--sbin/ipf/ipftest/Makefile.depend52
-rw-r--r--sbin/ipf/ipmon/Makefile.depend32
-rw-r--r--sbin/ipf/ipnat/Makefile.depend32
-rw-r--r--sbin/ipf/ippool/Makefile.depend32
-rw-r--r--sbin/ipf/ipresend/Makefile.depend23
-rw-r--r--sbin/ipf/ipsend/Makefile3
-rw-r--r--sbin/ipf/libipf/Makefile.depend16
-rw-r--r--sbin/ipfw/Makefile3
-rw-r--r--sbin/ipfw/Makefile.depend22
-rw-r--r--sbin/ipfw/ipfw.815
-rw-r--r--sbin/ipfw/ipfw2.c144
-rw-r--r--sbin/ipfw/ipfw2.h2
-rw-r--r--sbin/ipfw/nat.c11
-rw-r--r--sbin/ipfw/tables.c203
-rw-r--r--sbin/iscontrol/Makefile5
-rw-r--r--sbin/iscontrol/Makefile.depend23
-rw-r--r--sbin/iscontrol/iscontrol.86
-rw-r--r--sbin/iscontrol/iscsi.conf.5188
-rw-r--r--sbin/kldconfig/Makefile.depend19
-rw-r--r--sbin/kldload/Makefile.depend19
-rw-r--r--sbin/kldstat/Makefile.depend18
-rw-r--r--sbin/kldunload/Makefile.depend18
-rw-r--r--sbin/ldconfig/Makefile.depend19
-rw-r--r--sbin/mca/Makefile5
-rw-r--r--sbin/mca/Makefile.depend19
-rw-r--r--sbin/mca/mca.873
-rw-r--r--sbin/mca/mca.c547
-rw-r--r--sbin/md5/Makefile6
-rw-r--r--sbin/md5/Makefile.depend20
-rw-r--r--sbin/md5/md5.c34
-rw-r--r--sbin/mdconfig/Makefile3
-rw-r--r--sbin/mdconfig/Makefile.depend25
-rw-r--r--sbin/mdconfig/tests/Makefile9
-rw-r--r--sbin/mdconfig/tests/legacy_test.sh47
-rw-r--r--sbin/mdconfig/tests/mdconfig.test231
-rwxr-xr-xsbin/mdconfig/tests/mdconfig_test.sh281
-rw-r--r--sbin/mdconfig/tests/run.pl329
-rw-r--r--sbin/mdmfs/Makefile.depend19
-rw-r--r--sbin/mknod/Makefile.depend19
-rw-r--r--sbin/mksnap_ffs/Makefile.depend19
-rw-r--r--sbin/mount/Makefile3
-rw-r--r--sbin/mount/Makefile.depend20
-rw-r--r--sbin/mount/mount.87
-rw-r--r--sbin/mount/mount.c2
-rw-r--r--sbin/mount_cd9660/Makefile3
-rw-r--r--sbin/mount_cd9660/Makefile.depend21
-rw-r--r--sbin/mount_fusefs/Makefile.depend19
-rw-r--r--sbin/mount_fusefs/mount_fusefs.84
-rw-r--r--sbin/mount_fusefs/mount_fusefs.c7
-rw-r--r--sbin/mount_msdosfs/Makefile3
-rw-r--r--sbin/mount_msdosfs/Makefile.depend21
-rw-r--r--sbin/mount_nfs/Makefile3
-rw-r--r--sbin/mount_nfs/Makefile.depend22
-rw-r--r--sbin/mount_nfs/mount_nfs.88
-rw-r--r--sbin/mount_nullfs/Makefile.depend19
-rw-r--r--sbin/mount_udf/Makefile3
-rw-r--r--sbin/mount_udf/Makefile.depend20
-rw-r--r--sbin/mount_unionfs/Makefile.depend19
-rw-r--r--sbin/nandfs/Makefile3
-rw-r--r--sbin/natd/Makefile3
-rw-r--r--sbin/natd/Makefile.depend21
-rw-r--r--sbin/newfs/Makefile3
-rw-r--r--sbin/newfs/Makefile.depend21
-rw-r--r--sbin/newfs/newfs.84
-rw-r--r--sbin/newfs/newfs.c30
-rw-r--r--sbin/newfs_msdos/Makefile.depend19
-rw-r--r--sbin/newfs_msdos/newfs_msdos.84
-rw-r--r--sbin/newfs_msdos/newfs_msdos.c38
-rw-r--r--sbin/newfs_nandfs/Makefile3
-rw-r--r--sbin/nfsiod/Makefile.depend18
-rw-r--r--sbin/nos-tun/Makefile.depend20
-rw-r--r--sbin/nvmecontrol/Makefile.depend19
-rw-r--r--sbin/pfctl/Makefile3
-rw-r--r--sbin/pfctl/Makefile.depend24
-rw-r--r--sbin/pfctl/parse.y8
-rw-r--r--sbin/pfctl/pfctl.c2
-rw-r--r--sbin/pfctl/pfctl_altq.c8
-rw-r--r--sbin/pfctl/pfctl_qstats.c8
-rw-r--r--sbin/pflogd/Makefile3
-rw-r--r--sbin/pflogd/Makefile.depend20
-rw-r--r--sbin/ping/Makefile9
-rw-r--r--sbin/ping/Makefile.depend24
-rw-r--r--sbin/ping/ping.c7
-rw-r--r--sbin/ping6/Makefile3
-rw-r--r--sbin/ping6/Makefile.depend23
-rw-r--r--sbin/ping6/ping6.c17
-rw-r--r--sbin/quotacheck/Makefile3
-rw-r--r--sbin/quotacheck/Makefile.depend20
-rw-r--r--sbin/rcorder/Makefile12
-rw-r--r--sbin/rcorder/Makefile.depend22
-rw-r--r--sbin/rcorder/rcorder.c2
-rw-r--r--sbin/reboot/Makefile.depend19
-rw-r--r--sbin/reboot/nextboot.88
-rw-r--r--sbin/recoverdisk/Makefile.depend19
-rw-r--r--sbin/resolvconf/Makefile2
-rw-r--r--sbin/resolvconf/Makefile.depend12
-rw-r--r--sbin/restore/Makefile.depend20
-rw-r--r--sbin/restore/dirs.c16
-rw-r--r--sbin/restore/tape.c28
-rw-r--r--sbin/route/Makefile.depend22
-rw-r--r--sbin/route/route.c10
-rw-r--r--sbin/routed/Makefile3
-rw-r--r--sbin/routed/Makefile.depend22
-rw-r--r--sbin/routed/input.c4
-rw-r--r--sbin/routed/routed.82
-rw-r--r--sbin/routed/rtquery/Makefile3
-rw-r--r--sbin/routed/rtquery/Makefile.depend22
-rw-r--r--sbin/rtsol/Makefile.depend20
-rw-r--r--sbin/savecore/Makefile3
-rw-r--r--sbin/savecore/Makefile.depend20
-rw-r--r--sbin/savecore/savecore.c72
-rw-r--r--sbin/sconfig/Makefile.depend19
-rw-r--r--sbin/setkey/Makefile6
-rw-r--r--sbin/setkey/Makefile.depend29
-rw-r--r--sbin/shutdown/Makefile.depend19
-rw-r--r--sbin/shutdown/shutdown.811
-rw-r--r--sbin/shutdown/shutdown.c24
-rw-r--r--sbin/spppcontrol/Makefile.depend19
-rw-r--r--sbin/sunlabel/Makefile3
-rw-r--r--sbin/sunlabel/Makefile.depend20
-rw-r--r--sbin/swapon/Makefile3
-rw-r--r--sbin/swapon/Makefile.depend20
-rw-r--r--sbin/sysctl/Makefile.depend19
-rw-r--r--sbin/sysctl/sysctl.815
-rw-r--r--sbin/sysctl/sysctl.c30
-rw-r--r--sbin/tunefs/Makefile3
-rw-r--r--sbin/tunefs/Makefile.depend20
-rw-r--r--sbin/umount/Makefile.depend21
-rw-r--r--sbin/umount/umount.83
262 files changed, 4962 insertions, 2110 deletions
diff --git a/sbin/Makefile b/sbin/Makefile
index c828b21145f8..3725270c4c3f 100644
--- a/sbin/Makefile
+++ b/sbin/Makefile
@@ -8,6 +8,7 @@
SUBDIR=adjkerntz \
badsect \
camcontrol \
+ ccdconfig \
clri \
comcontrol \
conscontrol \
@@ -30,8 +31,11 @@ SUBDIR=adjkerntz \
ggate \
growfs \
gvinum \
+ hastctl \
+ hastd \
ifconfig \
init \
+ iscontrol \
kldconfig \
kldload \
kldstat \
@@ -78,24 +82,10 @@ SUBDIR+= atm
SUBDIR+= casperd
.endif
-.if ${MK_CCD} != "no"
-SUBDIR+= ccdconfig
-.endif
-
.if ${MK_CXX} != "no"
SUBDIR+= devd
.endif
-.if ${MK_HAST} != "no"
-SUBDIR+= hastctl
-SUBDIR+= hastd
-.endif
-
-.if ${MK_INET6} != "no"
-SUBDIR+= ping6
-SUBDIR+= rtsol
-.endif
-
.if ${MK_IPFILTER} != "no"
SUBDIR+= ipf
.endif
@@ -105,10 +95,6 @@ SUBDIR+= ipfw
SUBDIR+= natd
.endif
-.if ${MK_ISCSI} != "no"
-SUBDIR+= iscontrol
-.endif
-
.if ${MK_NAND} != "no"
SUBDIR+= nandfs
SUBDIR+= newfs_nandfs
@@ -119,6 +105,11 @@ SUBDIR+= pfctl
SUBDIR+= pflogd
.endif
+.if ${MK_INET6} != "no"
+SUBDIR+= ping6
+SUBDIR+= rtsol
+.endif
+
.if ${MK_QUOTAS} != "no"
SUBDIR+= quotacheck
.endif
diff --git a/sbin/adjkerntz/Makefile.depend b/sbin/adjkerntz/Makefile.depend
new file mode 100644
index 000000000000..96aa2a21a959
--- /dev/null
+++ b/sbin/adjkerntz/Makefile.depend
@@ -0,0 +1,19 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/atm/atmconfig/Makefile b/sbin/atm/atmconfig/Makefile
index 1e48f0454d32..ccf74d7528b3 100644
--- a/sbin/atm/atmconfig/Makefile
+++ b/sbin/atm/atmconfig/Makefile
@@ -12,14 +12,16 @@ SRCS= main.c diag.c natm.c
MAN= atmconfig.8
# CFLAGS+= -DPATH_HELP='".:/usr/share/doc/atm:/usr/local/share/doc/atm"'
-CFLAGS+= -I${.OBJDIR}
+CFLAGS+= -I.
.if !defined(RESCUE) && ${MK_BSNMP} != "no"
CFLAGS+= -DWITH_BSNMP
SRCS+= oid.h atmconfig_device.c
-LIBADD+= bsnmp
+DPADD+= ${LIBBSNMP}
+LDADD+= -lbsnmp
. if ${MK_DYNAMICROOT} == "no" && ${MK_OPENSSL} != "no"
-LIBADD+= crypto
+DPADD+= ${LIBCRYPTO}
+LDADD+= -lcrypto
. endif
.endif
diff --git a/sbin/atm/atmconfig/Makefile.depend b/sbin/atm/atmconfig/Makefile.depend
new file mode 100644
index 000000000000..42e50670ff63
--- /dev/null
+++ b/sbin/atm/atmconfig/Makefile.depend
@@ -0,0 +1,26 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ bin/cat.host \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libbsnmp/libbsnmp \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libnetgraph \
+ secure/lib/libcrypto \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+atmconfig_device.o: oid.h
+atmconfig_device.po: oid.h
+.endif
diff --git a/sbin/atm/atmconfig/atmconfig.8 b/sbin/atm/atmconfig/atmconfig.8
index dc765ca3027a..c8a740cea59b 100644
--- a/sbin/atm/atmconfig/atmconfig.8
+++ b/sbin/atm/atmconfig/atmconfig.8
@@ -90,7 +90,7 @@ To get a list of options and arguments for a command use:
.Pp
To get a list of common options use:
.D1 Nm Ic help Cm options
-.Ss The Ic diag Command
+.Ss The Ic diag Ss Command
The
.Ic diag
command allows the inspection of the ATM interfaces on the local host
@@ -201,7 +201,7 @@ Print traffic parameters: PCR, SCR, MBS, MCR.
.It Nm Ic diag Cm stats Ar device
Print driver specific statistics.
.El
-.Ss The Ic natm Command
+.Ss The Ic natm Ss Command
The
.Ic natm
command is used to change
diff --git a/sbin/badsect/Makefile b/sbin/badsect/Makefile
index c11f8cba506a..b6cb545e09f5 100644
--- a/sbin/badsect/Makefile
+++ b/sbin/badsect/Makefile
@@ -2,7 +2,8 @@
# $FreeBSD$
PROG= badsect
-LIBADD= ufs
+DPADD= ${LIBUFS}
+LDADD= -lufs
MAN= badsect.8
WARNS?= 2
diff --git a/sbin/badsect/Makefile.depend b/sbin/badsect/Makefile.depend
new file mode 100644
index 000000000000..66da85cb1de1
--- /dev/null
+++ b/sbin/badsect/Makefile.depend
@@ -0,0 +1,20 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libufs \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/bsdlabel/Makefile b/sbin/bsdlabel/Makefile
index 42f0f1c3861a..e51e928afb24 100644
--- a/sbin/bsdlabel/Makefile
+++ b/sbin/bsdlabel/Makefile
@@ -12,6 +12,7 @@ LINKS= ${BINDIR}/bsdlabel ${BINDIR}/disklabel
MLINKS= bsdlabel.8 disklabel.8
.endif
-LIBADD= geom
+DPADD= ${LIBGEOM} ${LIBBSDXML} ${LIBSBUF}
+LDADD= -lgeom -lbsdxml -lsbuf
.include <bsd.prog.mk>
diff --git a/sbin/bsdlabel/Makefile.depend b/sbin/bsdlabel/Makefile.depend
new file mode 100644
index 000000000000..df6361797d5d
--- /dev/null
+++ b/sbin/bsdlabel/Makefile.depend
@@ -0,0 +1,22 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libexpat \
+ lib/libgeom \
+ lib/libsbuf \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/bsdlabel/bsdlabel.8 b/sbin/bsdlabel/bsdlabel.8
index 54e2af2e5340..e0f3752c295b 100644
--- a/sbin/bsdlabel/bsdlabel.8
+++ b/sbin/bsdlabel/bsdlabel.8
@@ -109,7 +109,7 @@ argument forces
.Nm
to use a layout suitable for a different architecture.
Current valid values are
-.Cm i386 , amd64 ,
+.Cm i386 , amd64 ,
and
.Cm pc98 .
If this option is omitted,
diff --git a/sbin/camcontrol/Makefile b/sbin/camcontrol/Makefile
index f23ef521a8b7..4f11f195db5b 100644
--- a/sbin/camcontrol/Makefile
+++ b/sbin/camcontrol/Makefile
@@ -11,7 +11,8 @@ CFLAGS+= -DMINIMALISTIC
.if ${MACHINE_CPUARCH} == "arm"
WARNS?= 3
.endif
-LIBADD= cam sbuf util
+DPADD= ${LIBCAM} ${LIBSBUF} ${LIBUTIL}
+LDADD= -lcam -lsbuf -lutil
MAN= camcontrol.8
.include <bsd.prog.mk>
diff --git a/sbin/camcontrol/Makefile.depend b/sbin/camcontrol/Makefile.depend
new file mode 100644
index 000000000000..981ec38d17a8
--- /dev/null
+++ b/sbin/camcontrol/Makefile.depend
@@ -0,0 +1,22 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcam \
+ lib/libcompiler_rt \
+ lib/libsbuf \
+ lib/libutil \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/camcontrol/camcontrol.8 b/sbin/camcontrol/camcontrol.8
index 15e1862aebe8..0fc7c1ad75e2 100644
--- a/sbin/camcontrol/camcontrol.8
+++ b/sbin/camcontrol/camcontrol.8
@@ -27,7 +27,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd March 19, 2015
+.Dd August 31, 2014
.Dt CAMCONTROL 8
.Os
.Sh NAME
@@ -110,10 +110,6 @@
.Aq Fl f Ar format
.Op Fl P
.Op Fl G
-.Op Fl q
-.Op Fl s
-.Op Fl S Ar offset
-.Op Fl X
.Nm
.Ic modepage
.Op device id
@@ -239,16 +235,6 @@
.Op device id
.Op generic args
.Nm
-.Ic apm
-.Op device id
-.Op generic args
-.Op Fl l Ar level
-.Nm
-.Ic aam
-.Op device id
-.Op generic args
-.Op Fl l Ar level
-.Nm
.Ic fwdownload
.Op device id
.Op generic args
@@ -527,16 +513,18 @@ connecting to that device.
Note that this can have a destructive impact
on the system.
.It Ic defects
-Send the
-.Tn SCSI
-READ DEFECT DATA (10) command (0x37) or the
-.Tn SCSI
-READ DEFECT DATA (12) command (0xB7) to the given device, and
+Send the SCSI READ DEFECT DATA (10) command (0x37) to the given device, and
print out any combination of: the total number of defects, the primary
defect list (PLIST), and the grown defect list (GLIST).
.Bl -tag -width 11n
.It Fl f Ar format
-Specify the requested format of the defect list.
+The three format options are:
+.Em block ,
+to print out the list as logical blocks,
+.Em bfi ,
+to print out the list in bytes from index format, and
+.Em phys ,
+to print out the list in physical sector format.
The format argument is
required.
Most drives support the physical sector format.
@@ -553,51 +541,12 @@ If the drive uses a non-standard sense code to report that it does not
support the requested format,
.Nm
will probably see the error as a failure to complete the request.
-.Pp
-The format options are:
-.Bl -tag -width 9n
-.It block
-Print out the list as logical blocks.
-This is limited to 32-bit block sizes, and isn't supported by many modern
-drives.
-.It longblock
-Print out the list as logical blocks.
-This option uses a 64-bit block size.
-.It bfi
-Print out the list in bytes from index format.
-.It extbfi
-Print out the list in extended bytes from index format.
-The extended format allows for ranges of blocks to be printed.
-.It phys
-Print out the list in physical sector format.
-Most drives support this format.
-.It extphys
-Print out the list in extended physical sector format.
-The extended format allows for ranges of blocks to be printed.
-.El
.It Fl G
Print out the grown defect list.
This is a list of bad blocks that have
been remapped since the disk left the factory.
.It Fl P
Print out the primary defect list.
-This is the list of defects that were present in the factory.
-.It Fl q
-When printing status information with
-.Fl s ,
-only print the number of defects.
-.It Fl s
-Just print the number of defects, not the list of defects.
-.It Fl S Ar offset
-Specify the starting offset into the defect list.
-This implies using the
-.Tn SCSI
-READ DEFECT DATA (12) command, as the 10 byte version of the command
-doesn't support the address descriptor index field.
-Not all drives support the 12 byte command, and some drives that support
-the 12 byte command don't support the address descriptor index field.
-.It Fl X
-Print out defects in hexadecimal (base 16) form instead of base 10 form.
.El
.Pp
If neither
@@ -1300,19 +1249,6 @@ Value 0 disables timer.
Put ATA device into SLEEP state.
Note that the only way get device out of
this state may be reset.
-.It Ic apm
-It optional parameter
-.Pq Fl l
-specified, enables and sets advanced power management level, where
-1 -- minimum power, 127 -- maximum performance with standby,
-128 -- minimum power without standby, 254 -- maximum performance.
-If not specified -- APM is disabled.
-.It Ic aam
-It optional parameter
-.Pq Fl l
-specified, enables and sets automatic acoustic management level, where
-1 -- minimum noise, 254 -- maximum performance.
-If not specified -- AAM is disabled.
.It Ic security
Update or report security settings, using an ATA identify command (0xec).
By default,
@@ -1428,8 +1364,8 @@ Defaults to
Confirm yes to dangerous options such as
.Fl e
without prompting for confirmation.
-.El
.Pp
+.El
If the password specified for any action commands does not match the configured
password for the specified user the command will fail.
.Pp
@@ -1498,8 +1434,8 @@ additional unlock calls until after a power-on reset.
Confirm yes to dangerous options such as
.Fl e
without prompting for confirmation
-.El
.Pp
+.El
The password for all HPA commands is limited to 32 characters, longer passwords
will fail.
.It Ic fwdownload
@@ -1677,7 +1613,7 @@ For example:
.It FC
A Fibre Channel Transport ID consists of
.Dq fcp,
-followed by a 64-bit Fibre Channel World Wide Name.
+followed by a 64-bit Fibre Channel World Wide Name.
For example:
.Pp
.Dl fcp,0x1234567812345678
@@ -1799,11 +1735,11 @@ May also be specified as
.Dq exclusive_access .
.It wr_ex_ro
Write Exclusive Registrants Only mode.
-May also be specified as
+May also be specified as
.Dq write_exclusive_reg_only .
.It ex_ac_ro
Exclusive Access Registrants Only mode.
-May also be specified as
+May also be specified as
.Dq exclusive_access_reg_only .
.It wr_ex_ar
Write Exclusive All Registrants mode.
@@ -1811,7 +1747,7 @@ May also be specified as
.Dq write_exclusive_all_regs .
.It ex_ac_ar
Exclusive Access All Registrants mode.
-May also be specified as
+May also be specified as
.Dq exclusive_access_all_regs .
.El
.It Fl U
@@ -1988,13 +1924,14 @@ power-on or hardware reset!
.Pp
.Em DO NOT
use this on a device which has an active filesystem!
+.Pp
.Bd -literal -offset indent
camcontrol persist da0 -v -i read_keys
.Ed
.Pp
This will read any persistent reservation keys registered with da0, and
display any errors encountered when sending the PERSISTENT RESERVE IN
-.Tn SCSI
+.Tn SCSI
command.
.Bd -literal -offset indent
camcontrol persist da0 -v -o register -a -K 0x12345678
@@ -2039,9 +1976,9 @@ camcontrol persist da0 -v -o register_move -k 0x87654321 \e
.Ed
.Pp
This will move the registration from the current initiator, whose
-Registration Key is 0x87654321, to the Fibre Channel initiator with the
+Registration Key is 0x87654321, to the Fibre Channel initiator with the
Fiber Channel World Wide Node Name 0x1234567812345678.
-A new registration key, 0x12345678, will be registered for the initiator
+A new registration key, 0x12345678, will be registered for the initiator
with the Fibre Channel World Wide Node Name 0x1234567812345678, and the
current initiator will be unregistered from the target.
The reservation will be moved to relative target port 2 on the target
diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c
index c0a13446c9c5..cdb379dc6d24 100644
--- a/sbin/camcontrol/camcontrol.c
+++ b/sbin/camcontrol/camcontrol.c
@@ -96,9 +96,7 @@ typedef enum {
CAM_CMD_SECURITY = 0x0000001d,
CAM_CMD_HPA = 0x0000001e,
CAM_CMD_SANITIZE = 0x0000001f,
- CAM_CMD_PERSIST = 0x00000020,
- CAM_CMD_APM = 0x00000021,
- CAM_CMD_AAM = 0x00000022
+ CAM_CMD_PERSIST = 0x00000020
} cam_cmdmask;
typedef enum {
@@ -169,7 +167,7 @@ struct ata_set_max_pwd
};
static const char scsicmd_opts[] = "a:c:dfi:o:r";
-static const char readdefect_opts[] = "f:GPqsS:X";
+static const char readdefect_opts[] = "f:GP";
static const char negotiate_opts[] = "acD:M:O:qR:T:UW:";
static const char smprg_opts[] = "l";
static const char smppc_opts[] = "a:A:d:lm:M:o:p:s:S:T:";
@@ -218,8 +216,6 @@ static struct camcontrol_opts option_table[] = {
{"idle", CAM_CMD_IDLE, CAM_ARG_NONE, "t:"},
{"standby", CAM_CMD_STANDBY, CAM_ARG_NONE, "t:"},
{"sleep", CAM_CMD_SLEEP, CAM_ARG_NONE, ""},
- {"apm", CAM_CMD_APM, CAM_ARG_NONE, "l:"},
- {"aam", CAM_CMD_AAM, CAM_ARG_NONE, "l:"},
{"fwdownload", CAM_CMD_DOWNLOAD_FW, CAM_ARG_NONE, "f:ys"},
{"security", CAM_CMD_SECURITY, CAM_ARG_NONE, "d:e:fh:k:l:qs:T:U:y"},
{"hpa", CAM_CMD_HPA, CAM_ARG_NONE, "Pflp:qs:U:y"},
@@ -1410,7 +1406,7 @@ atacapprint(struct ata_params *parm)
parm->enabled.command2 & ATA_SUPPORT_APM ? "yes" : "no");
if (parm->support.command2 & ATA_SUPPORT_APM) {
printf(" %d/0x%02X\n",
- parm->apm_value & 0xff, parm->apm_value & 0xff);
+ parm->apm_value, parm->apm_value);
} else
printf("\n");
printf("automatic acoustic management %s %s",
@@ -3373,64 +3369,39 @@ scanlun_or_reset_dev(path_id_t bus, target_id_t target, lun_id_t lun, int scan)
}
#ifndef MINIMALISTIC
-
-static struct scsi_nv defect_list_type_map[] = {
- { "block", SRDD10_BLOCK_FORMAT },
- { "extbfi", SRDD10_EXT_BFI_FORMAT },
- { "extphys", SRDD10_EXT_PHYS_FORMAT },
- { "longblock", SRDD10_LONG_BLOCK_FORMAT },
- { "bfi", SRDD10_BYTES_FROM_INDEX_FORMAT },
- { "phys", SRDD10_PHYSICAL_SECTOR_FORMAT }
-};
-
static int
readdefects(struct cam_device *device, int argc, char **argv,
char *combinedopt, int retry_count, int timeout)
{
union ccb *ccb = NULL;
- struct scsi_read_defect_data_hdr_10 *hdr10 = NULL;
- struct scsi_read_defect_data_hdr_12 *hdr12 = NULL;
- size_t hdr_size = 0, entry_size = 0;
- int use_12byte = 0;
- int hex_format = 0;
+ struct scsi_read_defect_data_10 *rdd_cdb;
u_int8_t *defect_list = NULL;
- u_int8_t list_format = 0;
- int list_type_set = 0;
- u_int32_t dlist_length = 0;
- u_int32_t returned_length = 0, valid_len = 0;
- u_int32_t num_returned = 0, num_valid = 0;
- u_int32_t max_possible_size = 0, hdr_max = 0;
- u_int32_t starting_offset = 0;
- u_int8_t returned_format, returned_type;
+ u_int32_t max_dlist_length = SRDD10_MAX_LENGTH, dlist_length = 0;
+ u_int32_t returned_length = 0;
+ u_int32_t num_returned = 0;
+ u_int8_t returned_format;
unsigned int i;
- int summary = 0, quiet = 0;
int c, error = 0;
- int lists_specified = 0;
- int get_length = 1, first_pass = 1;
- int mads = 0;
+ int lists_specified;
+ int get_length = 1;
while ((c = getopt(argc, argv, combinedopt)) != -1) {
switch(c){
case 'f':
{
- scsi_nv_status status;
- int entry_num = 0;
-
- status = scsi_get_nv(defect_list_type_map,
- sizeof(defect_list_type_map) /
- sizeof(defect_list_type_map[0]), optarg,
- &entry_num, SCSI_NV_FLAG_IG_CASE);
-
- if (status == SCSI_NV_FOUND) {
- list_format = defect_list_type_map[
- entry_num].value;
- list_type_set = 1;
- } else {
- warnx("%s: %s %s option %s", __func__,
- (status == SCSI_NV_AMBIGUOUS) ?
- "ambiguous" : "invalid", "defect list type",
- optarg);
+ char *tstr;
+ tstr = optarg;
+ while (isspace(*tstr) && (*tstr != '\0'))
+ tstr++;
+ if (strcmp(tstr, "block") == 0)
+ arglist |= CAM_ARG_FORMAT_BLOCK;
+ else if (strcmp(tstr, "bfi") == 0)
+ arglist |= CAM_ARG_FORMAT_BFI;
+ else if (strcmp(tstr, "phys") == 0)
+ arglist |= CAM_ARG_FORMAT_PHYS;
+ else {
error = 1;
+ warnx("invalid defect format %s", tstr);
goto defect_bailout;
}
break;
@@ -3441,56 +3412,26 @@ readdefects(struct cam_device *device, int argc, char **argv,
case 'P':
arglist |= CAM_ARG_PLIST;
break;
- case 'q':
- quiet = 1;
- break;
- case 's':
- summary = 1;
- break;
- case 'S': {
- char *endptr;
-
- starting_offset = strtoul(optarg, &endptr, 0);
- if (*endptr != '\0') {
- error = 1;
- warnx("invalid starting offset %s", optarg);
- goto defect_bailout;
- }
- break;
- }
- case 'X':
- hex_format = 1;
- break;
default:
break;
}
}
- if (list_type_set == 0) {
- error = 1;
- warnx("no defect list format specified");
- goto defect_bailout;
- }
-
- if (arglist & CAM_ARG_PLIST) {
- list_format |= SRDD10_PLIST;
- lists_specified++;
- }
-
- if (arglist & CAM_ARG_GLIST) {
- list_format |= SRDD10_GLIST;
- lists_specified++;
- }
+ ccb = cam_getccb(device);
/*
- * This implies a summary, and was the previous behavior.
+ * Eventually we should probably support the 12 byte READ DEFECT
+ * DATA command. It supports a longer parameter list, which may be
+ * necessary on newer drives with lots of defects. According to
+ * the SBC-3 spec, drives are supposed to return an illegal request
+ * if they have more defect data than will fit in 64K.
*/
- if (lists_specified == 0)
- summary = 1;
-
- ccb = cam_getccb(device);
-
-retry_12byte:
+ defect_list = malloc(max_dlist_length);
+ if (defect_list == NULL) {
+ warnx("can't malloc memory for defect list");
+ error = 1;
+ goto defect_bailout;
+ }
/*
* We start off asking for just the header to determine how much
@@ -3498,25 +3439,13 @@ retry_12byte:
* if you ask for more data than the drive has. Once we know the
* length, we retry the command with the returned length.
*/
- if (use_12byte == 0)
- dlist_length = sizeof(*hdr10);
- else
- dlist_length = sizeof(*hdr12);
+ dlist_length = sizeof(struct scsi_read_defect_data_hdr_10);
+
+ rdd_cdb =(struct scsi_read_defect_data_10 *)&ccb->csio.cdb_io.cdb_bytes;
retry:
- if (defect_list != NULL) {
- free(defect_list);
- defect_list = NULL;
- }
- defect_list = malloc(dlist_length);
- if (defect_list == NULL) {
- warnx("can't malloc memory for defect list");
- error = 1;
- goto defect_bailout;
- }
-next_batch:
- bzero(defect_list, dlist_length);
+ lists_specified = 0;
/*
* cam_getccb() zeros the CCB header only. So we need to zero the
@@ -3525,17 +3454,41 @@ next_batch:
bzero(&(&ccb->ccb_h)[1],
sizeof(struct ccb_scsiio) - sizeof(struct ccb_hdr));
- scsi_read_defects(&ccb->csio,
- /*retries*/ retry_count,
- /*cbfcnp*/ NULL,
- /*tag_action*/ MSG_SIMPLE_Q_TAG,
- /*list_format*/ list_format,
- /*addr_desc_index*/ starting_offset,
- /*data_ptr*/ defect_list,
- /*dxfer_len*/ dlist_length,
- /*minimum_cmd_size*/ use_12byte ? 12 : 0,
- /*sense_len*/ SSD_FULL_SIZE,
- /*timeout*/ timeout ? timeout : 5000);
+ cam_fill_csio(&ccb->csio,
+ /*retries*/ retry_count,
+ /*cbfcnp*/ NULL,
+ /*flags*/ CAM_DIR_IN | ((arglist & CAM_ARG_ERR_RECOVER) ?
+ CAM_PASS_ERR_RECOVER : 0),
+ /*tag_action*/ MSG_SIMPLE_Q_TAG,
+ /*data_ptr*/ defect_list,
+ /*dxfer_len*/ dlist_length,
+ /*sense_len*/ SSD_FULL_SIZE,
+ /*cdb_len*/ sizeof(struct scsi_read_defect_data_10),
+ /*timeout*/ timeout ? timeout : 5000);
+
+ rdd_cdb->opcode = READ_DEFECT_DATA_10;
+ if (arglist & CAM_ARG_FORMAT_BLOCK)
+ rdd_cdb->format = SRDD10_BLOCK_FORMAT;
+ else if (arglist & CAM_ARG_FORMAT_BFI)
+ rdd_cdb->format = SRDD10_BYTES_FROM_INDEX_FORMAT;
+ else if (arglist & CAM_ARG_FORMAT_PHYS)
+ rdd_cdb->format = SRDD10_PHYSICAL_SECTOR_FORMAT;
+ else {
+ error = 1;
+ warnx("no defect list format specified");
+ goto defect_bailout;
+ }
+ if (arglist & CAM_ARG_PLIST) {
+ rdd_cdb->format |= SRDD10_PLIST;
+ lists_specified++;
+ }
+
+ if (arglist & CAM_ARG_GLIST) {
+ rdd_cdb->format |= SRDD10_GLIST;
+ lists_specified++;
+ }
+
+ scsi_ulto2b(dlist_length, rdd_cdb->alloc_length);
/* Disable freezing the device queue */
ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
@@ -3552,61 +3505,8 @@ next_batch:
goto defect_bailout;
}
- valid_len = ccb->csio.dxfer_len - ccb->csio.resid;
-
- if (use_12byte == 0) {
- hdr10 = (struct scsi_read_defect_data_hdr_10 *)defect_list;
- hdr_size = sizeof(*hdr10);
- hdr_max = SRDDH10_MAX_LENGTH;
-
- if (valid_len >= hdr_size) {
- returned_length = scsi_2btoul(hdr10->length);
- returned_format = hdr10->format;
- } else {
- returned_length = 0;
- returned_format = 0;
- }
- } else {
- hdr12 = (struct scsi_read_defect_data_hdr_12 *)defect_list;
- hdr_size = sizeof(*hdr12);
- hdr_max = SRDDH12_MAX_LENGTH;
-
- if (valid_len >= hdr_size) {
- returned_length = scsi_4btoul(hdr12->length);
- returned_format = hdr12->format;
- } else {
- returned_length = 0;
- returned_format = 0;
- }
- }
-
- returned_type = returned_format & SRDDH10_DLIST_FORMAT_MASK;
- switch (returned_type) {
- case SRDD10_BLOCK_FORMAT:
- entry_size = sizeof(struct scsi_defect_desc_block);
- break;
- case SRDD10_LONG_BLOCK_FORMAT:
- entry_size = sizeof(struct scsi_defect_desc_long_block);
- break;
- case SRDD10_EXT_PHYS_FORMAT:
- case SRDD10_PHYSICAL_SECTOR_FORMAT:
- entry_size = sizeof(struct scsi_defect_desc_phys_sector);
- break;
- case SRDD10_EXT_BFI_FORMAT:
- case SRDD10_BYTES_FROM_INDEX_FORMAT:
- entry_size = sizeof(struct scsi_defect_desc_bytes_from_index);
- break;
- default:
- warnx("Unknown defect format 0x%x\n", returned_type);
- error = 1;
- goto defect_bailout;
- break;
- }
-
- max_possible_size = (hdr_max / entry_size) * entry_size;
- num_returned = returned_length / entry_size;
- num_valid = min(returned_length, valid_len - hdr_size);
- num_valid /= entry_size;
+ returned_length = scsi_2btoul(((struct
+ scsi_read_defect_data_hdr_10 *)defect_list)->length);
if (get_length != 0) {
get_length = 0;
@@ -3630,66 +3530,12 @@ next_batch:
if ((sense_key == SSD_KEY_RECOVERED_ERROR)
&& (asc == 0x1c) && (ascq == 0x00)
&& (returned_length > 0)) {
- if ((use_12byte == 0)
- && (returned_length >= max_possible_size)) {
- get_length = 1;
- use_12byte = 1;
- goto retry_12byte;
- }
- dlist_length = returned_length + hdr_size;
- } else if ((sense_key == SSD_KEY_RECOVERED_ERROR)
- && (asc == 0x1f) && (ascq == 0x00)
- && (returned_length > 0)) {
- /* Partial defect list transfer */
- /*
- * Hitachi drives return this error
- * along with a partial defect list if they
- * have more defects than the 10 byte
- * command can support. Retry with the 12
- * byte command.
- */
- if (use_12byte == 0) {
- get_length = 1;
- use_12byte = 1;
- goto retry_12byte;
- }
- dlist_length = returned_length + hdr_size;
- } else if ((sense_key == SSD_KEY_ILLEGAL_REQUEST)
- && (asc == 0x24) && (ascq == 0x00)) {
- /* Invalid field in CDB */
- /*
- * SBC-3 says that if the drive has more
- * defects than can be reported with the
- * 10 byte command, it should return this
- * error and no data. Retry with the 12
- * byte command.
- */
- if (use_12byte == 0) {
- get_length = 1;
- use_12byte = 1;
- goto retry_12byte;
- }
- dlist_length = returned_length + hdr_size;
- } else {
- /*
- * If we got a SCSI error and no valid length,
- * just use the 10 byte maximum. The 12
- * byte maximum is too large.
- */
- if (returned_length == 0)
- dlist_length = SRDD10_MAX_LENGTH;
- else {
- if ((use_12byte == 0)
- && (returned_length >=
- max_possible_size)) {
- get_length = 1;
- use_12byte = 1;
- goto retry_12byte;
- }
- dlist_length = returned_length +
- hdr_size;
- }
- }
+ dlist_length = returned_length +
+ sizeof(struct scsi_read_defect_data_hdr_10);
+ dlist_length = min(dlist_length,
+ SRDD10_MAX_LENGTH);
+ } else
+ dlist_length = max_dlist_length;
} else if ((ccb->ccb_h.status & CAM_STATUS_MASK) !=
CAM_REQ_CMP){
error = 1;
@@ -3699,40 +3545,16 @@ next_batch:
CAM_EPF_ALL, stderr);
goto defect_bailout;
} else {
- if ((use_12byte == 0)
- && (returned_length >= max_possible_size)) {
- get_length = 1;
- use_12byte = 1;
- goto retry_12byte;
- }
- dlist_length = returned_length + hdr_size;
+ dlist_length = returned_length +
+ sizeof(struct scsi_read_defect_data_hdr_10);
+ dlist_length = min(dlist_length, SRDD10_MAX_LENGTH);
}
- if (summary != 0) {
- fprintf(stdout, "%u", num_returned);
- if (quiet == 0) {
- fprintf(stdout, " defect%s",
- (num_returned != 1) ? "s" : "");
- }
- fprintf(stdout, "\n");
-
- goto defect_bailout;
- }
-
- /*
- * We always limit the list length to the 10-byte maximum
- * length (0xffff). The reason is that some controllers
- * can't handle larger I/Os, and we can transfer the entire
- * 10 byte list in one shot. For drives that support the 12
- * byte read defects command, we'll step through the list
- * by specifying a starting offset. For drives that don't
- * support the 12 byte command's starting offset, we'll
- * just display the first 64K.
- */
- dlist_length = min(dlist_length, SRDD10_MAX_LENGTH);
goto retry;
}
+ returned_format = ((struct scsi_read_defect_data_hdr_10 *)
+ defect_list)->format;
if (((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_SCSI_STATUS_ERROR)
&& (ccb->csio.scsi_status == SCSI_STATUS_CHECK_COND)
@@ -3749,32 +3571,32 @@ next_batch:
* According to the SCSI spec, if the disk doesn't support
* the requested format, it will generally return a sense
* key of RECOVERED ERROR, and an additional sense code
- * of "DEFECT LIST NOT FOUND". HGST drives also return
- * Primary/Grown defect list not found errors. So just
- * check for an ASC of 0x1c.
+ * of "DEFECT LIST NOT FOUND". So, we check for that, and
+ * also check to make sure that the returned length is
+ * greater than 0, and then print out whatever format the
+ * disk gave us.
*/
if ((sense_key == SSD_KEY_RECOVERED_ERROR)
- && (asc == 0x1c)) {
- const char *format_str;
-
- format_str = scsi_nv_to_str(defect_list_type_map,
- sizeof(defect_list_type_map) /
- sizeof(defect_list_type_map[0]),
- list_format & SRDD10_DLIST_FORMAT_MASK);
- warnx("requested defect format %s not available",
- format_str ? format_str : "unknown");
-
- format_str = scsi_nv_to_str(defect_list_type_map,
- sizeof(defect_list_type_map) /
- sizeof(defect_list_type_map[0]), returned_type);
- if (format_str != NULL) {
- warnx("Device returned %s format",
- format_str);
- } else {
+ && (asc == 0x1c) && (ascq == 0x00)
+ && (returned_length > 0)) {
+ warnx("requested defect format not available");
+ switch(returned_format & SRDDH10_DLIST_FORMAT_MASK) {
+ case SRDD10_BLOCK_FORMAT:
+ warnx("Device returned block format");
+ break;
+ case SRDD10_BYTES_FROM_INDEX_FORMAT:
+ warnx("Device returned bytes from index"
+ " format");
+ break;
+ case SRDD10_PHYSICAL_SECTOR_FORMAT:
+ warnx("Device returned physical sector format");
+ break;
+ default:
error = 1;
warnx("Device returned unknown defect"
- " data format %#x", returned_type);
+ " data format %#x", returned_format);
goto defect_bailout;
+ break; /* NOTREACHED */
}
} else {
error = 1;
@@ -3793,151 +3615,99 @@ next_batch:
goto defect_bailout;
}
- if (first_pass != 0) {
- fprintf(stderr, "Got %d defect", num_returned);
-
- if ((lists_specified == 0) || (num_returned == 0)) {
- fprintf(stderr, "s.\n");
- goto defect_bailout;
- } else if (num_returned == 1)
- fprintf(stderr, ":\n");
- else
- fprintf(stderr, "s:\n");
-
- first_pass = 0;
- }
-
/*
* XXX KDM I should probably clean up the printout format for the
* disk defects.
*/
- switch (returned_type) {
- case SRDD10_PHYSICAL_SECTOR_FORMAT:
- case SRDD10_EXT_PHYS_FORMAT:
- {
- struct scsi_defect_desc_phys_sector *dlist;
-
- dlist = (struct scsi_defect_desc_phys_sector *)
- (defect_list + hdr_size);
-
- for (i = 0; i < num_valid; i++) {
- uint32_t sector;
-
- sector = scsi_4btoul(dlist[i].sector);
- if (returned_type == SRDD10_EXT_PHYS_FORMAT) {
- mads = (sector & SDD_EXT_PHYS_MADS) ?
- 0 : 1;
- sector &= ~SDD_EXT_PHYS_FLAG_MASK;
- }
- if (hex_format == 0)
- fprintf(stdout, "%d:%d:%d%s",
- scsi_3btoul(dlist[i].cylinder),
- dlist[i].head,
- scsi_4btoul(dlist[i].sector),
- mads ? " - " : "\n");
- else
- fprintf(stdout, "0x%x:0x%x:0x%x%s",
- scsi_3btoul(dlist[i].cylinder),
- dlist[i].head,
- scsi_4btoul(dlist[i].sector),
- mads ? " - " : "\n");
- mads = 0;
- }
- if (num_valid < num_returned) {
- starting_offset += num_valid;
- goto next_batch;
- }
- break;
- }
- case SRDD10_BYTES_FROM_INDEX_FORMAT:
- case SRDD10_EXT_BFI_FORMAT:
- {
- struct scsi_defect_desc_bytes_from_index *dlist;
+ switch (returned_format & SRDDH10_DLIST_FORMAT_MASK){
+ case SRDDH10_PHYSICAL_SECTOR_FORMAT:
+ {
+ struct scsi_defect_desc_phys_sector *dlist;
- dlist = (struct scsi_defect_desc_bytes_from_index *)
- (defect_list + hdr_size);
+ dlist = (struct scsi_defect_desc_phys_sector *)
+ (defect_list +
+ sizeof(struct scsi_read_defect_data_hdr_10));
- for (i = 0; i < num_valid; i++) {
- uint32_t bfi;
+ num_returned = returned_length /
+ sizeof(struct scsi_defect_desc_phys_sector);
- bfi = scsi_4btoul(dlist[i].bytes_from_index);
- if (returned_type == SRDD10_EXT_BFI_FORMAT) {
- mads = (bfi & SDD_EXT_BFI_MADS) ? 1 : 0;
- bfi &= ~SDD_EXT_BFI_FLAG_MASK;
- }
- if (hex_format == 0)
- fprintf(stdout, "%d:%d:%d%s",
- scsi_3btoul(dlist[i].cylinder),
- dlist[i].head,
- scsi_4btoul(dlist[i].bytes_from_index),
- mads ? " - " : "\n");
+ fprintf(stderr, "Got %d defect", num_returned);
+
+ if ((lists_specified == 0) || (num_returned == 0)) {
+ fprintf(stderr, "s.\n");
+ break;
+ } else if (num_returned == 1)
+ fprintf(stderr, ":\n");
else
- fprintf(stdout, "0x%x:0x%x:0x%x%s",
+ fprintf(stderr, "s:\n");
+
+ for (i = 0; i < num_returned; i++) {
+ fprintf(stdout, "%d:%d:%d\n",
scsi_3btoul(dlist[i].cylinder),
dlist[i].head,
- scsi_4btoul(dlist[i].bytes_from_index),
- mads ? " - " : "\n");
-
- mads = 0;
- }
- if (num_valid < num_returned) {
- starting_offset += num_valid;
- goto next_batch;
+ scsi_4btoul(dlist[i].sector));
+ }
+ break;
}
- break;
- }
- case SRDDH10_BLOCK_FORMAT:
- {
- struct scsi_defect_desc_block *dlist;
+ case SRDDH10_BYTES_FROM_INDEX_FORMAT:
+ {
+ struct scsi_defect_desc_bytes_from_index *dlist;
- dlist = (struct scsi_defect_desc_block *)
- (defect_list + hdr_size);
+ dlist = (struct scsi_defect_desc_bytes_from_index *)
+ (defect_list +
+ sizeof(struct scsi_read_defect_data_hdr_10));
- for (i = 0; i < num_valid; i++) {
- if (hex_format == 0)
- fprintf(stdout, "%u\n",
- scsi_4btoul(dlist[i].address));
+ num_returned = returned_length /
+ sizeof(struct scsi_defect_desc_bytes_from_index);
+
+ fprintf(stderr, "Got %d defect", num_returned);
+
+ if ((lists_specified == 0) || (num_returned == 0)) {
+ fprintf(stderr, "s.\n");
+ break;
+ } else if (num_returned == 1)
+ fprintf(stderr, ":\n");
else
- fprintf(stdout, "0x%x\n",
- scsi_4btoul(dlist[i].address));
- }
+ fprintf(stderr, "s:\n");
- if (num_valid < num_returned) {
- starting_offset += num_valid;
- goto next_batch;
+ for (i = 0; i < num_returned; i++) {
+ fprintf(stdout, "%d:%d:%d\n",
+ scsi_3btoul(dlist[i].cylinder),
+ dlist[i].head,
+ scsi_4btoul(dlist[i].bytes_from_index));
+ }
+ break;
}
+ case SRDDH10_BLOCK_FORMAT:
+ {
+ struct scsi_defect_desc_block *dlist;
- break;
- }
- case SRDD10_LONG_BLOCK_FORMAT:
- {
- struct scsi_defect_desc_long_block *dlist;
+ dlist = (struct scsi_defect_desc_block *)(defect_list +
+ sizeof(struct scsi_read_defect_data_hdr_10));
+
+ num_returned = returned_length /
+ sizeof(struct scsi_defect_desc_block);
- dlist = (struct scsi_defect_desc_long_block *)
- (defect_list + hdr_size);
+ fprintf(stderr, "Got %d defect", num_returned);
- for (i = 0; i < num_valid; i++) {
- if (hex_format == 0)
- fprintf(stdout, "%ju\n",
- (uintmax_t)scsi_8btou64(
- dlist[i].address));
+ if ((lists_specified == 0) || (num_returned == 0)) {
+ fprintf(stderr, "s.\n");
+ break;
+ } else if (num_returned == 1)
+ fprintf(stderr, ":\n");
else
- fprintf(stdout, "0x%jx\n",
- (uintmax_t)scsi_8btou64(
- dlist[i].address));
- }
+ fprintf(stderr, "s:\n");
- if (num_valid < num_returned) {
- starting_offset += num_valid;
- goto next_batch;
+ for (i = 0; i < num_returned; i++)
+ fprintf(stdout, "%u\n",
+ scsi_4btoul(dlist[i].address));
+ break;
}
- break;
- }
- default:
- fprintf(stderr, "Unknown defect format 0x%x\n",
- returned_type);
- error = 1;
- break;
+ default:
+ fprintf(stderr, "Unknown defect format %d\n",
+ returned_format & SRDDH10_DLIST_FORMAT_MASK);
+ error = 1;
+ break;
}
defect_bailout:
@@ -7408,7 +7178,7 @@ getdevid(struct cam_devitem *item)
retry:
ccb->ccb_h.func_code = XPT_DEV_ADVINFO;
ccb->ccb_h.flags = CAM_DIR_IN;
- ccb->cdai.flags = CDAI_FLAG_NONE;
+ ccb->cdai.flags = 0;
ccb->cdai.buftype = CDAI_TYPE_SCSI_DEVID;
ccb->cdai.bufsiz = item->device_id_len;
if (item->device_id_len != 0)
@@ -7968,83 +7738,39 @@ atapm(struct cam_device *device, int argc, char **argv,
else
sc = 253;
- retval = ata_do_28bit_cmd(device,
- ccb,
- /*retries*/retry_count,
- /*flags*/CAM_DIR_NONE,
- /*protocol*/AP_PROTO_NON_DATA,
- /*tag_action*/MSG_SIMPLE_Q_TAG,
- /*command*/cmd,
- /*features*/0,
- /*lba*/0,
- /*sector_count*/sc,
- /*data_ptr*/NULL,
- /*dxfer_len*/0,
- /*timeout*/timeout ? timeout : 30 * 1000,
- /*quiet*/1);
+ cam_fill_ataio(&ccb->ataio,
+ retry_count,
+ NULL,
+ /*flags*/CAM_DIR_NONE,
+ MSG_SIMPLE_Q_TAG,
+ /*data_ptr*/NULL,
+ /*dxfer_len*/0,
+ timeout ? timeout : 30 * 1000);
+ ata_28bit_cmd(&ccb->ataio, cmd, 0, 0, sc);
- cam_freeccb(ccb);
- return (retval);
-}
+ /* Disable freezing the device queue */
+ ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
-static int
-ataaxm(struct cam_device *device, int argc, char **argv,
- char *combinedopt, int retry_count, int timeout)
-{
- union ccb *ccb;
- int retval = 0;
- int l = -1;
- int c;
- u_char cmd, sc;
+ if (arglist & CAM_ARG_ERR_RECOVER)
+ ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER;
- ccb = cam_getccb(device);
+ if (cam_send_ccb(device, ccb) < 0) {
+ warn("error sending command");
- if (ccb == NULL) {
- warnx("%s: error allocating ccb", __func__);
- return (1);
- }
+ if (arglist & CAM_ARG_VERBOSE)
+ cam_error_print(device, ccb, CAM_ESF_ALL,
+ CAM_EPF_ALL, stderr);
- while ((c = getopt(argc, argv, combinedopt)) != -1) {
- switch (c) {
- case 'l':
- l = atoi(optarg);
- break;
- default:
- break;
- }
- }
- sc = 0;
- if (strcmp(argv[1], "apm") == 0) {
- if (l == -1)
- cmd = 0x85;
- else {
- cmd = 0x05;
- sc = l;
- }
- } else /* aam */ {
- if (l == -1)
- cmd = 0xC2;
- else {
- cmd = 0x42;
- sc = l;
- }
+ retval = 1;
+ goto bailout;
}
- retval = ata_do_28bit_cmd(device,
- ccb,
- /*retries*/retry_count,
- /*flags*/CAM_DIR_NONE,
- /*protocol*/AP_PROTO_NON_DATA,
- /*tag_action*/MSG_SIMPLE_Q_TAG,
- /*command*/ATA_SETFEATURES,
- /*features*/cmd,
- /*lba*/0,
- /*sector_count*/sc,
- /*data_ptr*/NULL,
- /*dxfer_len*/0,
- /*timeout*/timeout ? timeout : 30 * 1000,
- /*quiet*/1);
-
+ if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
+ cam_error_print(device, ccb, CAM_ESF_ALL, CAM_EPF_ALL, stderr);
+ retval = 1;
+ goto bailout;
+ }
+bailout:
cam_freeccb(ccb);
return (retval);
}
@@ -8075,7 +7801,6 @@ usage(int printlong)
" camcontrol reset <all | bus[:target:lun]>\n"
#ifndef MINIMALISTIC
" camcontrol defects [dev_id][generic args] <-f format> [-P][-G]\n"
-" [-q][-s][-S offset][-X]\n"
" camcontrol modepage [dev_id][generic args] <-m page | -l>\n"
" [-P pagectl][-e | -b][-d]\n"
" camcontrol cmd [dev_id][generic args]\n"
@@ -8106,8 +7831,6 @@ usage(int printlong)
" camcontrol idle [dev_id][generic args][-t time]\n"
" camcontrol standby [dev_id][generic args][-t time]\n"
" camcontrol sleep [dev_id][generic args]\n"
-" camcontrol apm [dev_id][generic args][-l level]\n"
-" camcontrol aam [dev_id][generic args][-l level]\n"
" camcontrol fwdownload [dev_id][generic args] <-f fw_image> [-y][-s]\n"
" camcontrol security [dev_id][generic args]\n"
" <-d pwd | -e pwd | -f | -h pwd | -k pwd>\n"
@@ -8628,11 +8351,6 @@ main(int argc, char **argv)
error = atapm(cam_dev, argc, argv,
combinedopt, retry_count, timeout);
break;
- case CAM_CMD_APM:
- case CAM_CMD_AAM:
- error = ataaxm(cam_dev, argc, argv,
- combinedopt, retry_count, timeout);
- break;
case CAM_CMD_SECURITY:
error = atasecurity(cam_dev, retry_count, timeout,
argc, argv, combinedopt);
diff --git a/sbin/casperd/Makefile b/sbin/casperd/Makefile
index 93f145ceeb38..f5a8e05860a8 100644
--- a/sbin/casperd/Makefile
+++ b/sbin/casperd/Makefile
@@ -4,7 +4,8 @@ PROG= casperd
SRCS= casperd.c zygote.c
-LIBADD= casper nv pjdlog util
+DPADD= ${LIBCASPER} ${LIBCAPSICUM} ${LIBNV} ${LIBPJDLOG} ${LIBUTIL}
+LDADD= -lcasper -lcapsicum -lnv -lpjdlog -lutil
MAN= casperd.8
diff --git a/sbin/casperd/casperd.c b/sbin/casperd/casperd.c
index f83881107de7..4b9037b40e38 100644
--- a/sbin/casperd/casperd.c
+++ b/sbin/casperd/casperd.c
@@ -357,7 +357,7 @@ service_external_execute(int chanfd)
int stderrfd, execfd, procfd;
nvlist_t *nvl;
- nvl = nvlist_recv(chanfd, 0);
+ nvl = nvlist_recv(chanfd);
if (nvl == NULL)
pjdlog_exit(1, "Unable to receive nvlist");
service = nvlist_take_string(nvl, "service");
diff --git a/sbin/casperd/zygote.c b/sbin/casperd/zygote.c
index c460bd322b92..be3d9e5eee4c 100644
--- a/sbin/casperd/zygote.c
+++ b/sbin/casperd/zygote.c
@@ -91,7 +91,7 @@ zygote_clone(zygote_func_t *func, int flags, int *chanfdp, int *procfdp)
nvl = nvlist_create(0);
nvlist_add_number(nvl, "func", (uint64_t)(uintptr_t)func);
nvlist_add_number(nvl, "flags", (uint64_t)flags);
- nvl = nvlist_xfer(zygote_sock, nvl, 0);
+ nvl = nvlist_xfer(zygote_sock, nvl);
if (nvl == NULL)
return (-1);
if (nvlist_exists_number(nvl, "error")) {
@@ -134,7 +134,7 @@ zygote_main(int sock)
closefrom(sock + 1);
for (;;) {
- nvlin = nvlist_recv(sock, 0);
+ nvlin = nvlist_recv(sock);
if (nvlin == NULL) {
if (errno == ENOTCONN) {
/* Casperd exited. */
diff --git a/sbin/ccdconfig/Makefile b/sbin/ccdconfig/Makefile
index 3b64dafb5c83..0feca5426dec 100644
--- a/sbin/ccdconfig/Makefile
+++ b/sbin/ccdconfig/Makefile
@@ -3,6 +3,7 @@
PROG= ccdconfig
MAN= ccdconfig.8
-LIBADD= geom
+DPADD= ${LIBGEOM}
+LDADD= -lgeom
.include <bsd.prog.mk>
diff --git a/sbin/ccdconfig/Makefile.depend b/sbin/ccdconfig/Makefile.depend
new file mode 100644
index 000000000000..df6361797d5d
--- /dev/null
+++ b/sbin/ccdconfig/Makefile.depend
@@ -0,0 +1,22 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libexpat \
+ lib/libgeom \
+ lib/libsbuf \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/clri/Makefile.depend b/sbin/clri/Makefile.depend
new file mode 100644
index 000000000000..96aa2a21a959
--- /dev/null
+++ b/sbin/clri/Makefile.depend
@@ -0,0 +1,19 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/comcontrol/Makefile.depend b/sbin/comcontrol/Makefile.depend
new file mode 100644
index 000000000000..96aa2a21a959
--- /dev/null
+++ b/sbin/comcontrol/Makefile.depend
@@ -0,0 +1,19 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/conscontrol/Makefile.depend b/sbin/conscontrol/Makefile.depend
new file mode 100644
index 000000000000..96aa2a21a959
--- /dev/null
+++ b/sbin/conscontrol/Makefile.depend
@@ -0,0 +1,19 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/ddb/Makefile b/sbin/ddb/Makefile
index 72abbed337ae..c556be12f016 100644
--- a/sbin/ddb/Makefile
+++ b/sbin/ddb/Makefile
@@ -5,6 +5,7 @@ SRCS= ddb.c ddb_capture.c ddb_script.c
MAN= ddb.8
WARNS?= 3
-LIBADD= kvm
+DPADD= ${LIBKVM}
+LDADD= -lkvm
.include <bsd.prog.mk>
diff --git a/sbin/ddb/Makefile.depend b/sbin/ddb/Makefile.depend
new file mode 100644
index 000000000000..384b6754a9ab
--- /dev/null
+++ b/sbin/ddb/Makefile.depend
@@ -0,0 +1,20 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libkvm \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/devd/Makefile b/sbin/devd/Makefile
index fc0021656beb..518e5e2c21d5 100644
--- a/sbin/devd/Makefile
+++ b/sbin/devd/Makefile
@@ -10,7 +10,8 @@ WARNS?= 3
NO_SHARED?=YES
-LIBADD= l util
+DPADD= ${LIBL} ${LIBUTIL}
+LDADD= -ll -lutil
YFLAGS+=-v
CFLAGS+=-I. -I${.CURDIR}
diff --git a/sbin/devd/Makefile.depend b/sbin/devd/Makefile.depend
new file mode 100644
index 000000000000..adc7292db895
--- /dev/null
+++ b/sbin/devd/Makefile.depend
@@ -0,0 +1,28 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libc++ \
+ lib/libcompiler_rt \
+ lib/libutil \
+ lib/msun \
+ usr.bin/lex/lib \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+parse.o: parse.c
+parse.po: parse.c
+token.o: token.c
+token.o: y.tab.h
+token.po: token.c
+token.po: y.tab.h
+.endif
diff --git a/sbin/devd/devd.conf.5 b/sbin/devd/devd.conf.5
index 3956a7389737..311228ec28e7 100644
--- a/sbin/devd/devd.conf.5
+++ b/sbin/devd/devd.conf.5
@@ -41,7 +41,7 @@
.\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
.\" SOFTWARE.
.\"
-.Dd May 13, 2015
+.Dd February 22, 2013
.Dt DEVD.CONF 5
.Os
.Sh NAME
@@ -270,8 +270,6 @@ Interface Class (USB)
Interface Protocol (USB)
.It Li intsubclass
Interface Sub-class (USB)
-.It Li jail
-Jail name for the process triggering the rule (RCTL)
.It Li manufacturer
Manufacturer ID (pccard).
.It Li mode
@@ -282,18 +280,12 @@ Match the value of the
variable.
.It Li parent
Parent device
-.It Li pid
-PID of the process triggering the rule (RCTL)
.It Li port
Hub port number (USB)
.It Li product
Product ID (pccard/USB).
.It Li release
Hardware revision (USB)
-.It Li ruid
-Real UID of the process triggering the rule (RCTL)
-.It Li rule
-Rule (RCTL)
.It Li sernum
Serial Number (USB).
.It Li slot
@@ -378,47 +370,6 @@ node is destroyed.
.El
.El
.Pp
-.It Li GEOM
-Events related to the
-.Xr geom 4
-framework.
-The difference compared to
-.Li DEVFS
-is that
-.Li GEOM
-only includes disk-like devices.
-.Bl -tag -width ".Sy Subsystem" -compact
-.It Sy Subsystem
-.It Li DEV
-.Bl -tag -width ".Li MEDIACHANGE" -compact
-.It Sy Type
-.It Li CREATE
-A
-.Xr geom 4
-device node is created.
-.It Li DESTROY
-A
-.Xr geom 4
-device node is destroyed.
-.It Li MEDIACHANGE
-Physical media has changed.
-.El
-.El
-.Pp
-.It Li RCTL
-Events related to the
-.Xr rctl 8
-framework.
-.Bl -tag -width ".Sy Subsystem" -compact
-.It Sy Subsystem
-.It Li rule
-.Bl -tag -width ".Li matched" -compact
-.It Sy Type
-.It Li matched
-A rule with action specified as "devctl" was triggered.
-.El
-.El
-.Pp
.It Li USB
Events related to the USB subsystem.
.Bl -tag -width ".Sy Subsystem" -compact
diff --git a/sbin/devfs/Makefile.depend b/sbin/devfs/Makefile.depend
new file mode 100644
index 000000000000..96aa2a21a959
--- /dev/null
+++ b/sbin/devfs/Makefile.depend
@@ -0,0 +1,19 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/dhclient/Makefile b/sbin/dhclient/Makefile
index 868df6d6ba65..09f19db0747e 100644
--- a/sbin/dhclient/Makefile
+++ b/sbin/dhclient/Makefile
@@ -41,7 +41,8 @@ PROG= dhclient
SCRIPTS=dhclient-script
MAN= dhclient.8 dhclient.conf.5 dhclient.leases.5 dhcp-options.5 \
dhclient-script.8
-LIBADD= util
+DPADD= ${LIBUTIL}
+LDADD= -lutil
WARNS?= 2
diff --git a/sbin/dhclient/Makefile.depend b/sbin/dhclient/Makefile.depend
new file mode 100644
index 000000000000..d9ecce6a52af
--- /dev/null
+++ b/sbin/dhclient/Makefile.depend
@@ -0,0 +1,21 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libutil \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/dhclient/dhclient.conf.5 b/sbin/dhclient/dhclient.conf.5
index fb9d9f17048c..3b6ae044343c 100644
--- a/sbin/dhclient/dhclient.conf.5
+++ b/sbin/dhclient/dhclient.conf.5
@@ -524,8 +524,8 @@ In many cases, it is sufficient to just create an empty
file - the defaults are usually fine.
.Sh SEE ALSO
.Xr dhclient.leases 5 ,
-.Xr dhcp-options 5 ,
.Xr dhcpd.conf 5 ,
+.Xr dhcp-options 5 ,
.Xr dhclient 8 ,
.Xr dhcpd 8
.Rs
diff --git a/sbin/dhclient/dhclient.leases.5 b/sbin/dhclient/dhclient.leases.5
index ebef81966ef1..f48b106287cf 100644
--- a/sbin/dhclient/dhclient.leases.5
+++ b/sbin/dhclient/dhclient.leases.5
@@ -75,8 +75,8 @@ Current lease file.
.El
.Sh SEE ALSO
.Xr dhclient.conf 5 ,
-.Xr dhcp-options 5 ,
.Xr dhcpd.conf 5 ,
+.Xr dhcp-options 5 ,
.Xr dhclient 8 ,
.Xr dhcpd 8
.Rs
diff --git a/sbin/dmesg/Makefile b/sbin/dmesg/Makefile
index 64a0155917be..266551be5765 100644
--- a/sbin/dmesg/Makefile
+++ b/sbin/dmesg/Makefile
@@ -4,6 +4,7 @@
PROG= dmesg
MAN= dmesg.8
-LIBADD= kvm
+LDADD= -lkvm
+DPADD= ${LIBKVM}
.include <bsd.prog.mk>
diff --git a/sbin/dmesg/Makefile.depend b/sbin/dmesg/Makefile.depend
new file mode 100644
index 000000000000..384b6754a9ab
--- /dev/null
+++ b/sbin/dmesg/Makefile.depend
@@ -0,0 +1,20 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libkvm \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/dmesg/dmesg.c b/sbin/dmesg/dmesg.c
index 827ed8e28c2b..f0fcb8125877 100644
--- a/sbin/dmesg/dmesg.c
+++ b/sbin/dmesg/dmesg.c
@@ -111,22 +111,15 @@ main(int argc, char *argv[])
if (memf == NULL) {
/*
- * Running kernel. Use sysctl. This gives an unwrapped buffer
- * as a side effect. Remove nulterm (if present) so the value
- * returned by sysctl is formatted as the rest of the code
- * expects (the same as the value read from a core file below).
+ * Running kernel. Use sysctl. This gives an unwrapped
+ * buffer as a side effect.
*/
if (sysctlbyname("kern.msgbuf", NULL, &buflen, NULL, 0) == -1)
err(1, "sysctl kern.msgbuf");
- /* Allocate extra room for growth between the sysctl calls. */
- buflen += buflen/8;
- /* Allocate more than sysctl sees, for room to append \n\0. */
if ((bp = malloc(buflen + 2)) == NULL)
errx(1, "malloc failed");
if (sysctlbyname("kern.msgbuf", bp, &buflen, NULL, 0) == -1)
err(1, "sysctl kern.msgbuf");
- if (buflen > 0 && bp[buflen - 1] == '\0')
- buflen--;
if (clear)
if (sysctlbyname("kern.msgbuf_clear", NULL, NULL, &clear, sizeof(int)))
err(1, "sysctl kern.msgbuf_clear");
diff --git a/sbin/dump/Makefile.depend b/sbin/dump/Makefile.depend
new file mode 100644
index 000000000000..4a9f7867ec6d
--- /dev/null
+++ b/sbin/dump/Makefile.depend
@@ -0,0 +1,20 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/protocols \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/dumpfs/Makefile b/sbin/dumpfs/Makefile
index 87eb89b1782e..fe464e03f7be 100644
--- a/sbin/dumpfs/Makefile
+++ b/sbin/dumpfs/Makefile
@@ -3,7 +3,8 @@
PROG= dumpfs
WARNS?= 2
-LIBADD= ufs
+DPADD= ${LIBUFS}
+LDADD= -lufs
MAN= dumpfs.8
.include <bsd.prog.mk>
diff --git a/sbin/dumpfs/Makefile.depend b/sbin/dumpfs/Makefile.depend
new file mode 100644
index 000000000000..66da85cb1de1
--- /dev/null
+++ b/sbin/dumpfs/Makefile.depend
@@ -0,0 +1,20 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libufs \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/dumpon/Makefile.depend b/sbin/dumpon/Makefile.depend
new file mode 100644
index 000000000000..96aa2a21a959
--- /dev/null
+++ b/sbin/dumpon/Makefile.depend
@@ -0,0 +1,19 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/etherswitchcfg/Makefile.depend b/sbin/etherswitchcfg/Makefile.depend
new file mode 100644
index 000000000000..96aa2a21a959
--- /dev/null
+++ b/sbin/etherswitchcfg/Makefile.depend
@@ -0,0 +1,19 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/fdisk/Makefile b/sbin/fdisk/Makefile
index a49c69954d0f..795377917e1c 100644
--- a/sbin/fdisk/Makefile
+++ b/sbin/fdisk/Makefile
@@ -7,7 +7,8 @@ MAN= fdisk.8
.PATH: ${.CURDIR}/../../sys/geom
-LIBADD= geom
+DPADD+= ${LIBGEOM} ${LIBBSDXML} ${LIBSBUF}
+LDADD+= -lgeom -lbsdxml -lsbuf
.include <bsd.prog.mk>
diff --git a/sbin/fdisk/Makefile.depend b/sbin/fdisk/Makefile.depend
new file mode 100644
index 000000000000..df6361797d5d
--- /dev/null
+++ b/sbin/fdisk/Makefile.depend
@@ -0,0 +1,22 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libexpat \
+ lib/libgeom \
+ lib/libsbuf \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/fdisk_pc98/Makefile b/sbin/fdisk_pc98/Makefile
index 9915267e6d7c..6961d31d58a8 100644
--- a/sbin/fdisk_pc98/Makefile
+++ b/sbin/fdisk_pc98/Makefile
@@ -7,6 +7,7 @@ MAN= fdisk.8
.PATH: ${.CURDIR}/../../sys/geom
-LIBADD= geom
+DPADD+= ${LIBGEOM} ${LIBBSDXML} ${LIBSBUF}
+LDADD+= -lgeom -lbsdxml -lsbuf
.include <bsd.prog.mk>
diff --git a/sbin/fdisk_pc98/Makefile.depend b/sbin/fdisk_pc98/Makefile.depend
new file mode 100644
index 000000000000..25f093b1c085
--- /dev/null
+++ b/sbin/fdisk_pc98/Makefile.depend
@@ -0,0 +1,20 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DEP_MACHINE := ${.PARSEFILE:E}
+
+DIRDEPS = \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libgeom \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/ffsinfo/Makefile b/sbin/ffsinfo/Makefile
index 7fd033d3475a..cb4e8f945979 100644
--- a/sbin/ffsinfo/Makefile
+++ b/sbin/ffsinfo/Makefile
@@ -13,6 +13,7 @@ MAN= ffsinfo.8
WARNS?= 1
CFLAGS+=-DFS_DEBUG -I${GROWFS}
-LIBADD= ufs
+DPADD= ${LIBUFS}
+LDADD= -lufs
.include <bsd.prog.mk>
diff --git a/sbin/ffsinfo/Makefile.depend b/sbin/ffsinfo/Makefile.depend
new file mode 100644
index 000000000000..66da85cb1de1
--- /dev/null
+++ b/sbin/ffsinfo/Makefile.depend
@@ -0,0 +1,20 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libufs \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/ffsinfo/ffsinfo.c b/sbin/ffsinfo/ffsinfo.c
index c1e7c87c1b47..881fc1e1e1d3 100644
--- a/sbin/ffsinfo/ffsinfo.c
+++ b/sbin/ffsinfo/ffsinfo.c
@@ -67,7 +67,6 @@ static const char rcsid[] =
#include <fcntl.h>
#include <libufs.h>
#include <paths.h>
-#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -362,7 +361,7 @@ dump_whole_ufs1_inode(ino_t inode, int level)
/*
* Dump the main inode structure.
*/
- snprintf(comment, sizeof(comment), "Inode 0x%08jx", (uintmax_t)inode);
+ snprintf(comment, sizeof(comment), "Inode 0x%08x", inode);
if (level & 0x100) {
DBG_DUMP_INO(&sblock,
comment,
@@ -386,8 +385,8 @@ dump_whole_ufs1_inode(ino_t inode, int level)
(size_t)sblock.fs_bsize) == -1) {
err(1, "bread: %s", disk.d_error);
}
- snprintf(comment, sizeof(comment), "Inode 0x%08jx: indirect 0",
- (uintmax_t)inode);
+ snprintf(comment, sizeof(comment), "Inode 0x%08x: indirect 0",
+ inode);
DBG_DUMP_IBLK(&sblock,
comment,
i1blk,
@@ -402,8 +401,8 @@ dump_whole_ufs1_inode(ino_t inode, int level)
(size_t)sblock.fs_bsize) == -1) {
err(1, "bread: %s", disk.d_error);
}
- snprintf(comment, sizeof(comment), "Inode 0x%08jx: indirect 1",
- (uintmax_t)inode);
+ snprintf(comment, sizeof(comment), "Inode 0x%08x: indirect 1",
+ inode);
DBG_DUMP_IBLK(&sblock,
comment,
i2blk,
@@ -417,8 +416,7 @@ dump_whole_ufs1_inode(ino_t inode, int level)
err(1, "bread: %s", disk.d_error);
}
snprintf(comment, sizeof(comment),
- "Inode 0x%08jx: indirect 1->%d", (uintmax_t)inode,
- ind2ctr);
+ "Inode 0x%08x: indirect 1->%d", inode, ind2ctr);
DBG_DUMP_IBLK(&sblock,
comment,
i1blk,
@@ -434,8 +432,8 @@ dump_whole_ufs1_inode(ino_t inode, int level)
(size_t)sblock.fs_bsize) == -1) {
err(1, "bread: %s", disk.d_error);
}
- snprintf(comment, sizeof(comment), "Inode 0x%08jx: indirect 2",
- (uintmax_t)inode);
+ snprintf(comment, sizeof(comment), "Inode 0x%08x: indirect 2",
+ inode);
#define SQUARE(a) ((a)*(a))
DBG_DUMP_IBLK(&sblock,
comment,
@@ -452,8 +450,7 @@ dump_whole_ufs1_inode(ino_t inode, int level)
err(1, "bread: %s", disk.d_error);
}
snprintf(comment, sizeof(comment),
- "Inode 0x%08jx: indirect 2->%d", (uintmax_t)inode,
- ind3ctr);
+ "Inode 0x%08x: indirect 2->%d", inode, ind3ctr);
DBG_DUMP_IBLK(&sblock,
comment,
i2blk,
@@ -469,8 +466,8 @@ dump_whole_ufs1_inode(ino_t inode, int level)
err(1, "bread: %s", disk.d_error);
}
snprintf(comment, sizeof(comment),
- "Inode 0x%08jx: indirect 2->%d->%d",
- (uintmax_t)inode, ind3ctr, ind3ctr);
+ "Inode 0x%08x: indirect 2->%d->%d", inode,
+ ind3ctr, ind3ctr);
DBG_DUMP_IBLK(&sblock,
comment,
i1blk,
@@ -516,7 +513,7 @@ dump_whole_ufs2_inode(ino_t inode, int level)
/*
* Dump the main inode structure.
*/
- snprintf(comment, sizeof(comment), "Inode 0x%08jx", (uintmax_t)inode);
+ snprintf(comment, sizeof(comment), "Inode 0x%08x", inode);
if (level & 0x100) {
DBG_DUMP_INO(&sblock, comment, ino);
}
@@ -538,8 +535,7 @@ dump_whole_ufs2_inode(ino_t inode, int level)
(size_t)sblock.fs_bsize) == -1) {
err(1, "bread: %s", disk.d_error);
}
- snprintf(comment, sizeof(comment), "Inode 0x%08jx: indirect 0",
- (uintmax_t)inode);
+ snprintf(comment, sizeof(comment), "Inode 0x%08x: indirect 0", inode);
DBG_DUMP_IBLK(&sblock, comment, i1blk, (size_t)rb);
rb -= howmany(sblock.fs_bsize, sizeof(ufs2_daddr_t));
}
@@ -551,8 +547,7 @@ dump_whole_ufs2_inode(ino_t inode, int level)
(size_t)sblock.fs_bsize) == -1) {
err(1, "bread: %s", disk.d_error);
}
- snprintf(comment, sizeof(comment), "Inode 0x%08jx: indirect 1",
- (uintmax_t)inode);
+ snprintf(comment, sizeof(comment), "Inode 0x%08x: indirect 1", inode);
DBG_DUMP_IBLK(&sblock,
comment,
i2blk,
@@ -566,8 +561,7 @@ dump_whole_ufs2_inode(ino_t inode, int level)
err(1, "bread: %s", disk.d_error);
}
snprintf(comment, sizeof(comment),
- "Inode 0x%08jx: indirect 1->%d",
- (uintmax_t)inode, ind2ctr);
+ "Inode 0x%08x: indirect 1->%d", inode, ind2ctr);
DBG_DUMP_IBLK(&sblock, comment, i1blk, (size_t)rb);
rb -= howmany(sblock.fs_bsize, sizeof(ufs2_daddr_t));
}
@@ -580,8 +574,7 @@ dump_whole_ufs2_inode(ino_t inode, int level)
(size_t)sblock.fs_bsize) == -1) {
err(1, "bread: %s", disk.d_error);
}
- snprintf(comment, sizeof(comment), "Inode 0x%08jx: indirect 2",
- (uintmax_t)inode);
+ snprintf(comment, sizeof(comment), "Inode 0x%08x: indirect 2", inode);
#define SQUARE(a) ((a)*(a))
DBG_DUMP_IBLK(&sblock,
comment,
@@ -598,8 +591,7 @@ dump_whole_ufs2_inode(ino_t inode, int level)
err(1, "bread: %s", disk.d_error);
}
snprintf(comment, sizeof(comment),
- "Inode 0x%08jx: indirect 2->%d",
- (uintmax_t)inode, ind3ctr);
+ "Inode 0x%08x: indirect 2->%d", inode, ind3ctr);
DBG_DUMP_IBLK(&sblock,
comment,
i2blk,
@@ -613,8 +605,8 @@ dump_whole_ufs2_inode(ino_t inode, int level)
err(1, "bread: %s", disk.d_error);
}
snprintf(comment, sizeof(comment),
- "Inode 0x%08jx: indirect 2->%d->%d",
- (uintmax_t)inode, ind3ctr, ind3ctr);
+ "Inode 0x%08x: indirect 2->%d->%d", inode,
+ ind3ctr, ind3ctr);
DBG_DUMP_IBLK(&sblock, comment, i1blk, (size_t)rb);
rb -= howmany(sblock.fs_bsize, sizeof(ufs2_daddr_t));
}
diff --git a/sbin/fsck/Makefile.depend b/sbin/fsck/Makefile.depend
new file mode 100644
index 000000000000..96aa2a21a959
--- /dev/null
+++ b/sbin/fsck/Makefile.depend
@@ -0,0 +1,19 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/fsck/fsck.c b/sbin/fsck/fsck.c
index 63ff15326655..6bc702e90280 100644
--- a/sbin/fsck/fsck.c
+++ b/sbin/fsck/fsck.c
@@ -41,7 +41,8 @@ __FBSDID("$FreeBSD$");
#include <sys/mount.h>
#include <sys/queue.h>
#include <sys/wait.h>
-#include <sys/disk.h>
+#define FSTYPENAMES
+#include <sys/disklabel.h>
#include <sys/ioctl.h>
#include <ctype.h>
@@ -80,21 +81,10 @@ static void addentry(struct fstypelist *, const char *, const char *);
static void maketypelist(char *);
static void catopt(char **, const char *);
static void mangle(char *, int *, const char ** volatile *, int *);
-static const char *getfstype(const char *);
+static const char *getfslab(const char *);
static void usage(void) __dead2;
static int isok(struct fstab *);
-static struct {
- const char *ptype;
- const char *name;
-} ptype_map[] = {
- { "ufs", "ffs" },
- { "ffs", "ffs" },
- { "fat", "msdosfs" },
- { "efi", "msdosfs" },
- { NULL, NULL },
-};
-
int
main(int argc, char *argv[])
{
@@ -213,7 +203,7 @@ main(int argc, char *argv[])
if ((fs = getfsfile(spec)) == NULL &&
(fs = getfsspec(spec)) == NULL) {
if (vfstype == NULL)
- vfstype = getfstype(spec);
+ vfstype = getfslab(spec);
if (vfstype == NULL)
errx(1, "Could not determine filesystem type");
type = vfstype;
@@ -545,27 +535,41 @@ mangle(char *opts, int *argcp, const char ** volatile *argvp, int *maxargcp)
*maxargcp = maxargc;
}
+
static const char *
-getfstype(const char *str)
+getfslab(const char *str)
{
- struct diocgattr_arg attr;
- int fd, i;
+ struct disklabel dl;
+ int fd;
+ char p;
+ const char *vfstype;
+ u_char t;
+ /* deduce the file system type from the disk label */
if ((fd = open(str, O_RDONLY)) == -1)
err(1, "cannot open `%s'", str);
- strncpy(attr.name, "PART::type", sizeof(attr.name));
- memset(&attr.value, 0, sizeof(attr.value));
- attr.len = sizeof(attr.value);
- if (ioctl(fd, DIOCGATTR, &attr) == -1) {
+ if (ioctl(fd, DIOCGDINFO, &dl) == -1) {
(void) close(fd);
return(NULL);
}
+
(void) close(fd);
- for (i = 0; ptype_map[i].ptype != NULL; i++)
- if (strstr(attr.value.str, ptype_map[i].ptype) != NULL)
- return (ptype_map[i].name);
- return (NULL);
+
+ p = str[strlen(str) - 1];
+
+ if ((p - 'a') >= dl.d_npartitions)
+ errx(1, "partition `%s' is not defined on disk", str);
+
+ if ((t = dl.d_partitions[p - 'a'].p_fstype) >= FSMAXTYPES)
+ errx(1, "partition `%s' is not of a legal vfstype",
+ str);
+
+ if ((vfstype = fstypenames[t]) == NULL)
+ errx(1, "vfstype `%s' on partition `%s' is not supported",
+ fstypenames[t], str);
+
+ return vfstype;
}
diff --git a/sbin/fsck_ffs/Makefile b/sbin/fsck_ffs/Makefile
index 02754697dfa5..028a4867c85d 100644
--- a/sbin/fsck_ffs/Makefile
+++ b/sbin/fsck_ffs/Makefile
@@ -9,7 +9,8 @@ MLINKS= fsck_ffs.8 fsck_ufs.8 fsck_ffs.8 fsck_4.2bsd.8
SRCS= dir.c ea.c fsutil.c inode.c main.c pass1.c pass1b.c pass2.c pass3.c \
pass4.c pass5.c setup.c suj.c utilities.c gjournal.c getmntopts.c \
globs.c
-LIBADD= ufs
+DPADD= ${LIBUFS}
+LDADD= -lufs
WARNS?= 2
CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../mount
diff --git a/sbin/fsck_ffs/Makefile.depend b/sbin/fsck_ffs/Makefile.depend
new file mode 100644
index 000000000000..66da85cb1de1
--- /dev/null
+++ b/sbin/fsck_ffs/Makefile.depend
@@ -0,0 +1,20 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libufs \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/fsck_ffs/dir.c b/sbin/fsck_ffs/dir.c
index 9203000f4fce..7640f704b76a 100644
--- a/sbin/fsck_ffs/dir.c
+++ b/sbin/fsck_ffs/dir.c
@@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/time.h>
-#include <sys/types.h>
#include <sys/sysctl.h>
#include <ufs/ufs/dinode.h>
diff --git a/sbin/fsck_ffs/setup.c b/sbin/fsck_ffs/setup.c
index 494e50309558..85e954844319 100644
--- a/sbin/fsck_ffs/setup.c
+++ b/sbin/fsck_ffs/setup.c
@@ -59,6 +59,8 @@ struct bufarea asblk;
#define POWEROF2(num) (((num) & ((num) - 1)) == 0)
static void badsb(int listerr, const char *s);
+static int calcsb(char *dev, int devfd, struct fs *fs);
+static struct disklabel *getdisklabel(char *s, int fd);
/*
* Read in a superblock finding an alternate if necessary.
@@ -176,7 +178,7 @@ setup(char *dev)
*/
if (readsb(1) == 0) {
skipclean = 0;
- if (bflag || preen)
+ if (bflag || preen || calcsb(dev, fsreadfd, &proto) == 0)
return(0);
if (reply("LOOK FOR ALTERNATE SUPERBLOCKS") == 0)
return (0);
@@ -435,6 +437,7 @@ badsb(int listerr, const char *s)
void
sblock_init(void)
{
+ struct disklabel *lp;
fswritefd = -1;
fsmodified = 0;
@@ -445,5 +448,89 @@ sblock_init(void)
asblk.b_un.b_buf = Malloc(SBLOCKSIZE);
if (sblk.b_un.b_buf == NULL || asblk.b_un.b_buf == NULL)
errx(EEXIT, "cannot allocate space for superblock");
- dev_bsize = secsize = DEV_BSIZE;
+ if ((lp = getdisklabel(NULL, fsreadfd)))
+ real_dev_bsize = dev_bsize = secsize = lp->d_secsize;
+ else
+ dev_bsize = secsize = DEV_BSIZE;
+}
+
+/*
+ * Calculate a prototype superblock based on information in the disk label.
+ * When done the cgsblock macro can be calculated and the fs_ncg field
+ * can be used. Do NOT attempt to use other macros without verifying that
+ * their needed information is available!
+ */
+static int
+calcsb(char *dev, int devfd, struct fs *fs)
+{
+ struct disklabel *lp;
+ struct partition *pp;
+ char *cp;
+ int i, nspf;
+
+ cp = strchr(dev, '\0') - 1;
+ if (cp == (char *)-1 || ((*cp < 'a' || *cp > 'h') && !isdigit(*cp))) {
+ pfatal("%s: CANNOT FIGURE OUT FILE SYSTEM PARTITION\n", dev);
+ return (0);
+ }
+ lp = getdisklabel(dev, devfd);
+ if (isdigit(*cp))
+ pp = &lp->d_partitions[0];
+ else
+ pp = &lp->d_partitions[*cp - 'a'];
+ if (pp->p_fstype != FS_BSDFFS) {
+ pfatal("%s: NOT LABELED AS A BSD FILE SYSTEM (%s)\n",
+ dev, pp->p_fstype < FSMAXTYPES ?
+ fstypenames[pp->p_fstype] : "unknown");
+ return (0);
+ }
+ if (pp->p_fsize == 0 || pp->p_frag == 0 ||
+ pp->p_cpg == 0 || pp->p_size == 0) {
+ pfatal("%s: %s: type %s fsize %d, frag %d, cpg %d, size %d\n",
+ dev, "INCOMPLETE LABEL", fstypenames[pp->p_fstype],
+ pp->p_fsize, pp->p_frag, pp->p_cpg, pp->p_size);
+ return (0);
+ }
+ memset(fs, 0, sizeof(struct fs));
+ fs->fs_fsize = pp->p_fsize;
+ fs->fs_frag = pp->p_frag;
+ fs->fs_size = pp->p_size;
+ fs->fs_sblkno = roundup(
+ howmany(lp->d_bbsize + lp->d_sbsize, fs->fs_fsize),
+ fs->fs_frag);
+ nspf = fs->fs_fsize / lp->d_secsize;
+ for (fs->fs_fsbtodb = 0, i = nspf; i > 1; i >>= 1)
+ fs->fs_fsbtodb++;
+ dev_bsize = lp->d_secsize;
+ if (fs->fs_magic == FS_UFS2_MAGIC) {
+ fs->fs_fpg = pp->p_cpg;
+ fs->fs_ncg = howmany(fs->fs_size, fs->fs_fpg);
+ } else /* if (fs->fs_magic == FS_UFS1_MAGIC) */ {
+ fs->fs_old_cpg = pp->p_cpg;
+ fs->fs_old_cgmask = 0xffffffff;
+ for (i = lp->d_ntracks; i > 1; i >>= 1)
+ fs->fs_old_cgmask <<= 1;
+ if (!POWEROF2(lp->d_ntracks))
+ fs->fs_old_cgmask <<= 1;
+ fs->fs_old_cgoffset = roundup(howmany(lp->d_nsectors, nspf),
+ fs->fs_frag);
+ fs->fs_fpg = (fs->fs_old_cpg * lp->d_secpercyl) / nspf;
+ fs->fs_ncg = howmany(fs->fs_size / lp->d_secpercyl,
+ fs->fs_old_cpg);
+ }
+ return (1);
+}
+
+static struct disklabel *
+getdisklabel(char *s, int fd)
+{
+ static struct disklabel lab;
+
+ if (ioctl(fd, DIOCGDINFO, (char *)&lab) < 0) {
+ if (s == NULL)
+ return ((struct disklabel *)NULL);
+ pwarn("ioctl (GCINFO): %s\n", strerror(errno));
+ errx(EEXIT, "%s: can't read disk label", s);
+ }
+ return (&lab);
}
diff --git a/sbin/fsck_msdosfs/Makefile.depend b/sbin/fsck_msdosfs/Makefile.depend
new file mode 100644
index 000000000000..96aa2a21a959
--- /dev/null
+++ b/sbin/fsck_msdosfs/Makefile.depend
@@ -0,0 +1,19 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/fsdb/Makefile b/sbin/fsdb/Makefile
index e0a9cc3cb382..21ac09f9c66d 100644
--- a/sbin/fsdb/Makefile
+++ b/sbin/fsdb/Makefile
@@ -9,7 +9,8 @@ SRCS= fsdb.c fsdbutil.c \
pass5.c setup.c utilities.c ffs_subr.c ffs_tables.c globs.c
CFLAGS+= -I${.CURDIR}/../fsck_ffs
WARNS?= 2
-LIBADD= edit
+LDADD= -ledit -ltermcapw
+DPADD= ${LIBEDIT} ${LIBTERMCAPW}
.PATH: ${.CURDIR}/../fsck_ffs ${.CURDIR}/../../sys/ufs/ffs
.include <bsd.prog.mk>
diff --git a/sbin/fsdb/Makefile.depend b/sbin/fsdb/Makefile.depend
new file mode 100644
index 000000000000..6653b3c047eb
--- /dev/null
+++ b/sbin/fsdb/Makefile.depend
@@ -0,0 +1,22 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libedit \
+ lib/libufs \
+ lib/ncurses/ncursesw \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/fsirand/Makefile.depend b/sbin/fsirand/Makefile.depend
new file mode 100644
index 000000000000..96aa2a21a959
--- /dev/null
+++ b/sbin/fsirand/Makefile.depend
@@ -0,0 +1,19 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/fsirand/fsirand.c b/sbin/fsirand/fsirand.c
index 0fea239c893f..c373c5bb56f5 100644
--- a/sbin/fsirand/fsirand.c
+++ b/sbin/fsirand/fsirand.c
@@ -36,6 +36,7 @@ static const char rcsid[] =
#endif /* not lint */
#include <sys/param.h>
+#include <sys/disklabel.h>
#include <sys/resource.h>
#include <ufs/ufs/dinode.h>
@@ -119,12 +120,22 @@ fsirand(char *device)
char sbuf[SBLOCKSIZE], sbuftmp[SBLOCKSIZE];
int i, devfd, n, cg;
u_int32_t bsize = DEV_BSIZE;
+ struct disklabel label;
if ((devfd = open(device, printonly ? O_RDONLY : O_RDWR)) < 0) {
warn("can't open %s", device);
return (1);
}
+ /* Get block size (usually 512) from disklabel if possible */
+ if (!ignorelabel) {
+ if (ioctl(devfd, DIOCGDINFO, &label) < 0)
+ warn("can't read disklabel, using sector size of %d",
+ bsize);
+ else
+ bsize = label.d_secsize;
+ }
+
dp1 = NULL;
dp2 = NULL;
diff --git a/sbin/gbde/Makefile b/sbin/gbde/Makefile
index c33136b05e14..019ee18f8af3 100644
--- a/sbin/gbde/Makefile
+++ b/sbin/gbde/Makefile
@@ -20,7 +20,8 @@ CFLAGS+= -I${.CURDIR}/../../sys
CLEANFILES+= template.c
MAN= gbde.8
-LIBADD= md util geom
+DPADD= ${LIBMD} ${LIBUTIL} ${LIBGEOM}
+LDADD= -lmd -lutil -lgeom
template.c: template.txt
file2c 'const char template[] = {' ',0};' \
diff --git a/sbin/gbde/Makefile.depend b/sbin/gbde/Makefile.depend
new file mode 100644
index 000000000000..f30afe7cb903
--- /dev/null
+++ b/sbin/gbde/Makefile.depend
@@ -0,0 +1,26 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libexpat \
+ lib/libgeom \
+ lib/libmd \
+ lib/libsbuf \
+ lib/libutil \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+template.o: template.c
+template.po: template.c
+.endif
diff --git a/sbin/geom/Makefile b/sbin/geom/Makefile
index 19a56360ccce..ced58425c657 100644
--- a/sbin/geom/Makefile
+++ b/sbin/geom/Makefile
@@ -14,7 +14,8 @@ MAN=
WARNS?= 2
CFLAGS+=-I${.CURDIR} -I${.CURDIR}/core -DSTATIC_GEOM_CLASSES
-LIBADD= geom util
+DPADD= ${LIBGEOM} ${LIBSBUF} ${LIBBSDXML} ${LIBUTIL}
+LDADD= -lgeom -lsbuf -lbsdxml -lutil
.include <bsd.prog.mk>
diff --git a/sbin/geom/class/cache/Makefile.depend b/sbin/geom/class/cache/Makefile.depend
new file mode 100644
index 000000000000..b1d6d2cfbef4
--- /dev/null
+++ b/sbin/geom/class/cache/Makefile.depend
@@ -0,0 +1,21 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libgeom \
+ sbin/geom/core \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/geom/class/concat/Makefile.depend b/sbin/geom/class/concat/Makefile.depend
new file mode 100644
index 000000000000..b1d6d2cfbef4
--- /dev/null
+++ b/sbin/geom/class/concat/Makefile.depend
@@ -0,0 +1,21 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libgeom \
+ sbin/geom/core \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/geom/class/eli/Makefile b/sbin/geom/class/eli/Makefile
index f8e453dc616c..119566876d71 100644
--- a/sbin/geom/class/eli/Makefile
+++ b/sbin/geom/class/eli/Makefile
@@ -8,7 +8,8 @@ SRCS+= g_eli_key.c
SRCS+= pkcs5v2.c
SRCS+= sha2.c
-LIBADD= md crypto
+DPADD= ${LIBMD} ${LIBCRYPTO}
+LDADD= -lmd -lcrypto
WARNS?= 3
diff --git a/sbin/geom/class/eli/Makefile.depend b/sbin/geom/class/eli/Makefile.depend
new file mode 100644
index 000000000000..2c7c316eefa7
--- /dev/null
+++ b/sbin/geom/class/eli/Makefile.depend
@@ -0,0 +1,23 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libgeom \
+ lib/libmd \
+ sbin/geom/core \
+ secure/lib/libcrypto \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/geom/class/journal/Makefile b/sbin/geom/class/journal/Makefile
index 0e1a38ea6dc4..2db8d3002734 100644
--- a/sbin/geom/class/journal/Makefile
+++ b/sbin/geom/class/journal/Makefile
@@ -5,7 +5,8 @@
GEOM_CLASS= journal
SRCS+= geom_journal_ufs.c
-LIBADD= ufs md
+DPADD= ${LIBMD} ${LIBUFS}
+LDADD= -lmd -lufs
CFLAGS+=-I${.CURDIR}/../../../../sys
diff --git a/sbin/geom/class/journal/Makefile.depend b/sbin/geom/class/journal/Makefile.depend
new file mode 100644
index 000000000000..058f0d7f87e5
--- /dev/null
+++ b/sbin/geom/class/journal/Makefile.depend
@@ -0,0 +1,23 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libgeom \
+ lib/libmd \
+ lib/libufs \
+ sbin/geom/core \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/geom/class/label/Makefile.depend b/sbin/geom/class/label/Makefile.depend
new file mode 100644
index 000000000000..b1d6d2cfbef4
--- /dev/null
+++ b/sbin/geom/class/label/Makefile.depend
@@ -0,0 +1,21 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libgeom \
+ sbin/geom/core \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/geom/class/label/glabel.8 b/sbin/geom/class/label/glabel.8
index a2f665e18ff7..c950e26b35a7 100644
--- a/sbin/geom/class/label/glabel.8
+++ b/sbin/geom/class/label/glabel.8
@@ -227,11 +227,11 @@ maximum amount of debug information is printed.
.It Va kern.geom.label.*.enable : No 1
Most
.Nm LABEL
-providers implement a
+providers implement a
.Xr sysctl 8
flag and a tunable variable named in the above format. This flag
controls if the label provider will be active, tasting devices
-and creating label nodes in the
+and creating label nodes in the
.Xr devfs 5
tree. It is sometimes desirable to disable certain label types if
they conflict with other classes in complex GEOM topologies.
diff --git a/sbin/geom/class/mirror/Makefile b/sbin/geom/class/mirror/Makefile
index ce7ee6466326..e38d617b6da5 100644
--- a/sbin/geom/class/mirror/Makefile
+++ b/sbin/geom/class/mirror/Makefile
@@ -4,6 +4,7 @@
GEOM_CLASS= mirror
-LIBADD= md
+DPADD= ${LIBMD}
+LDADD= -lmd
.include <bsd.lib.mk>
diff --git a/sbin/geom/class/mirror/Makefile.depend b/sbin/geom/class/mirror/Makefile.depend
new file mode 100644
index 000000000000..4fa82023ea16
--- /dev/null
+++ b/sbin/geom/class/mirror/Makefile.depend
@@ -0,0 +1,22 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libgeom \
+ lib/libmd \
+ sbin/geom/core \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/geom/class/mountver/Makefile.depend b/sbin/geom/class/mountver/Makefile.depend
new file mode 100644
index 000000000000..b1d6d2cfbef4
--- /dev/null
+++ b/sbin/geom/class/mountver/Makefile.depend
@@ -0,0 +1,21 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libgeom \
+ sbin/geom/core \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/geom/class/mountver/geom_mountver.c b/sbin/geom/class/mountver/geom_mountver.c
index bff69c545cda..a1ed95d6c879 100644
--- a/sbin/geom/class/mountver/geom_mountver.c
+++ b/sbin/geom/class/mountver/geom_mountver.c
@@ -43,14 +43,14 @@ struct g_command class_commands[] = {
{
G_OPT_SENTINEL
},
- "[-v] prov ..."
+ "[-v] dev ..."
},
{ "destroy", G_FLAG_VERBOSE, NULL,
{
{ 'f', "force", NULL, G_TYPE_BOOL },
G_OPT_SENTINEL
},
- "[-fv] name"
+ "[-fv] prov ..."
},
G_CMD_SENTINEL
};
diff --git a/sbin/geom/class/mountver/gmountver.8 b/sbin/geom/class/mountver/gmountver.8
index 4c27a652b0b0..c9a9c0ac8313 100644
--- a/sbin/geom/class/mountver/gmountver.8
+++ b/sbin/geom/class/mountver/gmountver.8
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd May 18, 2015
+.Dd January 14, 2010
.Dt GMOUNTVER 8
.Os
.Sh NAME
@@ -35,11 +35,11 @@
.Nm
.Cm create
.Op Fl v
-.Ar prov ...
+.Ar dev ...
.Nm
.Cm destroy
.Op Fl fv
-.Ar name
+.Ar prov ...
.Nm
.Cm list
.Nm
@@ -66,11 +66,8 @@ The first argument to
indicates an action to be performed:
.Bl -tag -width ".Cm destroy"
.It Cm create
-Enable mount verification for the given provider.
-If the operation succeeds, a new GEOM provider will be created using the
-given provider's name with a
-.Ql .mountver
-suffix.
+Cache the given devices with specified
+.Ar name .
The kernel module
.Pa geom_mountver.ko
will be loaded if it is not loaded already.
@@ -113,7 +110,7 @@ GEOM class.
This can be set to a number between 0 and 3 inclusive.
If set to 0 minimal debug information is printed, and if set to 3 the
maximum amount of debug information is printed.
-.It Va kern.geom.mountver.check_ident : No 1
+.It Va kern.geom.mountver.check.check_ident : No 1
This can be set to 0 or 1.
If set to 0,
.Nm
diff --git a/sbin/geom/class/multipath/Makefile.depend b/sbin/geom/class/multipath/Makefile.depend
new file mode 100644
index 000000000000..b1d6d2cfbef4
--- /dev/null
+++ b/sbin/geom/class/multipath/Makefile.depend
@@ -0,0 +1,21 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libgeom \
+ sbin/geom/core \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/geom/class/nop/Makefile.depend b/sbin/geom/class/nop/Makefile.depend
new file mode 100644
index 000000000000..b1d6d2cfbef4
--- /dev/null
+++ b/sbin/geom/class/nop/Makefile.depend
@@ -0,0 +1,21 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libgeom \
+ sbin/geom/core \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/geom/class/part/Makefile b/sbin/geom/class/part/Makefile
index 4b67de4ef415..341cd42b8c97 100644
--- a/sbin/geom/class/part/Makefile
+++ b/sbin/geom/class/part/Makefile
@@ -4,6 +4,7 @@
GEOM_CLASS= part
-LIBADD= util
+DPADD= ${LIBUTIL}
+LDADD= -lutil
.include <bsd.lib.mk>
diff --git a/sbin/geom/class/part/Makefile.depend b/sbin/geom/class/part/Makefile.depend
new file mode 100644
index 000000000000..ef3b57ef9b99
--- /dev/null
+++ b/sbin/geom/class/part/Makefile.depend
@@ -0,0 +1,22 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libgeom \
+ lib/libutil \
+ sbin/geom/core \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/geom/class/part/geom_part.c b/sbin/geom/class/part/geom_part.c
index 133e8f8281e9..ee4b2a939f82 100644
--- a/sbin/geom/class/part/geom_part.c
+++ b/sbin/geom/class/part/geom_part.c
@@ -207,20 +207,15 @@ find_class(struct gmesh *mesh, const char *name)
static struct ggeom *
find_geom(struct gclass *classp, const char *name)
{
- struct ggeom *gp, *wgp;
+ struct ggeom *gp;
if (strncmp(name, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0)
name += sizeof(_PATH_DEV) - 1;
- wgp = NULL;
LIST_FOREACH(gp, &classp->lg_geom, lg_geom) {
- if (strcmp(gp->lg_name, name) != 0)
- continue;
- if (find_geomcfg(gp, "wither") == NULL)
+ if (strcmp(gp->lg_name, name) == 0)
return (gp);
- else
- wgp = gp;
}
- return (wgp);
+ return (NULL);
}
static const char *
@@ -566,7 +561,7 @@ gpart_autofill(struct gctl_req *req)
s = find_provcfg(pp, "end");
first = (off_t)strtoimax(s, NULL, 0) + 1;
- if (first + offset > a_first)
+ if (first > a_first)
a_first = ALIGNUP(first + offset, alignment);
}
if (a_first <= last) {
@@ -614,8 +609,6 @@ gpart_show_geom(struct ggeom *gp, const char *element, int show_providers)
off_t length, secsz;
int idx, wblocks, wname, wmax;
- if (find_geomcfg(gp, "wither"))
- return;
scheme = find_geomcfg(gp, "scheme");
if (scheme == NULL)
errx(EXIT_FAILURE, "Scheme not found for geom %s", gp->lg_name);
diff --git a/sbin/geom/class/part/gpart.8 b/sbin/geom/class/part/gpart.8
index 8e8f858432b8..e8c4dab2f43b 100644
--- a/sbin/geom/class/part/gpart.8
+++ b/sbin/geom/class/part/gpart.8
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd May 5, 2015
+.Dd August 12, 2014
.Dt GPART 8
.Os
.Sh NAME
@@ -659,17 +659,9 @@ Another symbolic names that can be used with
.Cm gpart
utility are:
.Bl -tag -width ".Cm dragonfly-disklabel64"
-.It Cm apple-core-storage
-An Apple Mac OS X partition used by logical volume manager known as
-Core Storage.
-The scheme-specific type is
-.Qq Li "!53746f72-6167-11aa-aa11-00306543ecac"
-for GPT.
.It Cm apple-hfs
An Apple Mac OS X partition that contains a HFS or HFS+ filesystem.
The scheme-specific types are
-.Qq Li "!175"
-for MBR,
.Qq Li "!Apple_HFS"
for APM and
.Qq Li "!48465300-0000-11aa-aa11-00306543ecac"
@@ -698,8 +690,6 @@ for GPT.
.It Cm apple-ufs
An Apple Mac OS X partition that contains a UFS filesystem.
The scheme-specific types are
-.Qq Li "!168"
-for MBR,
.Qq Li "!Apple_UNIX_SVR2"
for APM and
.Qq Li "!55465300-0000-11aa-aa11-00306543ecac"
diff --git a/sbin/geom/class/raid/Makefile b/sbin/geom/class/raid/Makefile
index 07d71403d48f..743f690f0fd9 100644
--- a/sbin/geom/class/raid/Makefile
+++ b/sbin/geom/class/raid/Makefile
@@ -4,6 +4,7 @@
GEOM_CLASS= raid
-LIBADD= md
+DPADD= ${LIBMD}
+LDADD= -lmd
.include <bsd.lib.mk>
diff --git a/sbin/geom/class/raid/Makefile.depend b/sbin/geom/class/raid/Makefile.depend
new file mode 100644
index 000000000000..4fa82023ea16
--- /dev/null
+++ b/sbin/geom/class/raid/Makefile.depend
@@ -0,0 +1,22 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libgeom \
+ lib/libmd \
+ sbin/geom/core \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/geom/class/raid3/Makefile b/sbin/geom/class/raid3/Makefile
index 74e12455a432..d2405d4b4f5d 100644
--- a/sbin/geom/class/raid3/Makefile
+++ b/sbin/geom/class/raid3/Makefile
@@ -4,6 +4,7 @@
GEOM_CLASS= raid3
-LIBADD= md
+DPADD= ${LIBMD}
+LDADD= -lmd
.include <bsd.lib.mk>
diff --git a/sbin/geom/class/raid3/Makefile.depend b/sbin/geom/class/raid3/Makefile.depend
new file mode 100644
index 000000000000..4fa82023ea16
--- /dev/null
+++ b/sbin/geom/class/raid3/Makefile.depend
@@ -0,0 +1,22 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libgeom \
+ lib/libmd \
+ sbin/geom/core \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/geom/class/sched/Makefile.depend b/sbin/geom/class/sched/Makefile.depend
new file mode 100644
index 000000000000..b1d6d2cfbef4
--- /dev/null
+++ b/sbin/geom/class/sched/Makefile.depend
@@ -0,0 +1,21 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libgeom \
+ sbin/geom/core \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/geom/class/shsec/Makefile.depend b/sbin/geom/class/shsec/Makefile.depend
new file mode 100644
index 000000000000..b1d6d2cfbef4
--- /dev/null
+++ b/sbin/geom/class/shsec/Makefile.depend
@@ -0,0 +1,21 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libgeom \
+ sbin/geom/core \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/geom/class/stripe/Makefile.depend b/sbin/geom/class/stripe/Makefile.depend
new file mode 100644
index 000000000000..b1d6d2cfbef4
--- /dev/null
+++ b/sbin/geom/class/stripe/Makefile.depend
@@ -0,0 +1,21 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libgeom \
+ sbin/geom/core \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/geom/class/virstor/Makefile.depend b/sbin/geom/class/virstor/Makefile.depend
new file mode 100644
index 000000000000..b1d6d2cfbef4
--- /dev/null
+++ b/sbin/geom/class/virstor/Makefile.depend
@@ -0,0 +1,21 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libgeom \
+ sbin/geom/core \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/geom/core/Makefile b/sbin/geom/core/Makefile
index 0636d037a358..64edc793a95e 100644
--- a/sbin/geom/core/Makefile
+++ b/sbin/geom/core/Makefile
@@ -11,6 +11,7 @@ NO_SHARED=NO
CFLAGS+= -DGEOM_CLASS_DIR=\"${GEOM_CLASS_DIR}\"
CFLAGS+= -I${.CURDIR}/../../../sys -I${.CURDIR} -I${.CURDIR}/..
-LIBADD= geom util
+DPADD= ${LIBGEOM} ${LIBSBUF} ${LIBBSDXML} ${LIBUTIL}
+LDADD= -lgeom -lsbuf -lbsdxml -lutil
.include <bsd.prog.mk>
diff --git a/sbin/geom/core/Makefile.depend b/sbin/geom/core/Makefile.depend
new file mode 100644
index 000000000000..e20388c0bb72
--- /dev/null
+++ b/sbin/geom/core/Makefile.depend
@@ -0,0 +1,23 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libexpat \
+ lib/libgeom \
+ lib/libsbuf \
+ lib/libutil \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/ggate/ggatec/Makefile b/sbin/ggate/ggatec/Makefile
index e228feaf471a..4d8917f3164c 100644
--- a/sbin/ggate/ggatec/Makefile
+++ b/sbin/ggate/ggatec/Makefile
@@ -10,6 +10,7 @@ CFLAGS+= -DMAX_SEND_SIZE=32768
CFLAGS+= -DLIBGEOM
CFLAGS+= -I${.CURDIR}/../shared
-LIBADD= geom util pthread
+DPADD= ${LIBGEOM} ${LIBSBUF} ${LIBBSDXML} ${LIBUTIL} ${LIBPTHREAD}
+LDADD= -lgeom -lsbuf -lbsdxml -lutil -lpthread
.include <bsd.prog.mk>
diff --git a/sbin/ggate/ggatec/Makefile.depend b/sbin/ggate/ggatec/Makefile.depend
new file mode 100644
index 000000000000..c2834f3d54b9
--- /dev/null
+++ b/sbin/ggate/ggatec/Makefile.depend
@@ -0,0 +1,25 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libexpat \
+ lib/libgeom \
+ lib/libsbuf \
+ lib/libthr \
+ lib/libutil \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/ggate/ggatec/ggatec.8 b/sbin/ggate/ggatec/ggatec.8
index 8545bafb1e85..72ae4c5a9c3e 100644
--- a/sbin/ggate/ggatec/ggatec.8
+++ b/sbin/ggate/ggatec/ggatec.8
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 2, 2015
+.Dd April 26, 2004
.Dt GGATEC 8
.Os
.Sh NAME
@@ -67,29 +67,29 @@
.Sh DESCRIPTION
The
.Nm
-utility is a network client for the GEOM Gate class.
-It is responsible for the creation of
+utility is a network client for GEOM Gate class.
+It is responsible for creation of
.Nm ggate
-devices and forwarding I/O requests between the
+devices and forwarding I/O requests between
.Nm geom_gate.ko
-kernel module and the
+kernel module and
.Xr ggated 8
network daemon.
Available commands:
.Bl -tag -width ".Cm destroy"
.It Cm create
-Connect to a
+Connect to given
.Xr ggated 8
-daemon on the specified host and create a
+daemon and create a
.Nm ggate
-provider for the specified remote file or device.
+provider related to the given remote file or device.
.It Cm rescue
-Create a new connection after the
+If
.Nm
-process has died or been killed.
-The new connection to the
+process died/has been killed, you can save situation with this
+command, which creates new connection to the
.Xr ggated 8
-daemon handles pending and future requests.
+daemon and will handle pending and future requests.
.It Cm destroy
Destroy the given
.Nm ggate
@@ -139,11 +139,12 @@ provider.
If not specified, it is taken from device, or set to 512 bytes for files.
.It Fl t Ar timeout
Number of seconds to wait before an I/O request will be canceled.
-Default is 0, which means no timeout.
+0 means no timeout.
+Default is 0.
.It Fl u Ar unit
Unit number to use.
.It Fl v
-Do not fork, run in foreground and print debug information on standard
+Do not fork, run in foreground and print debug informations on standard
output.
.It Ar host
Remote host to connect to.
@@ -158,7 +159,7 @@ should be called with the
.Fl v
option.
.Sh EXAMPLES
-Use a CD-ROM device on a remote host.
+Make use of CD-ROM device from remote host.
.Bd -literal -offset indent
server# cat /etc/gg.exports
client RO /dev/acd0
diff --git a/sbin/ggate/ggated/Makefile b/sbin/ggate/ggated/Makefile
index af5c9bdf796a..4e7708ebffa3 100644
--- a/sbin/ggate/ggated/Makefile
+++ b/sbin/ggate/ggated/Makefile
@@ -6,7 +6,8 @@ PROG= ggated
MAN= ggated.8
SRCS= ggated.c ggate.c
-LIBADD= pthread
+DPADD= ${LIBPTHREAD}
+LDADD= -lpthread
CFLAGS+= -I${.CURDIR}/../shared
diff --git a/sbin/ggate/ggated/Makefile.depend b/sbin/ggate/ggated/Makefile.depend
new file mode 100644
index 000000000000..375f95b6da8c
--- /dev/null
+++ b/sbin/ggate/ggated/Makefile.depend
@@ -0,0 +1,23 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libgeom \
+ lib/libthr \
+ lib/libutil \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/ggate/ggatel/Makefile b/sbin/ggate/ggatel/Makefile
index be88bd496c36..604a75480313 100644
--- a/sbin/ggate/ggatel/Makefile
+++ b/sbin/ggate/ggatel/Makefile
@@ -9,6 +9,7 @@ SRCS= ggatel.c ggate.c
CFLAGS+= -DLIBGEOM
CFLAGS+= -I${.CURDIR}/../shared
-LIBADD= geom util
+DPADD= ${LIBGEOM} ${LIBSBUF} ${LIBBSDXML} ${LIBUTIL}
+LDADD= -lgeom -lsbuf -lbsdxml -lutil
.include <bsd.prog.mk>
diff --git a/sbin/ggate/ggatel/Makefile.depend b/sbin/ggate/ggatel/Makefile.depend
new file mode 100644
index 000000000000..4aa987016f02
--- /dev/null
+++ b/sbin/ggate/ggatel/Makefile.depend
@@ -0,0 +1,24 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libexpat \
+ lib/libgeom \
+ lib/libsbuf \
+ lib/libutil \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/ggate/ggatel/ggatel.8 b/sbin/ggate/ggatel/ggatel.8
index 37e11cd8b2d6..1463426f2384 100644
--- a/sbin/ggate/ggatel/ggatel.8
+++ b/sbin/ggate/ggatel/ggatel.8
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 9, 2015
+.Dd April 2, 2011
.Dt GGATEL 8
.Os
.Sh NAME
@@ -40,6 +40,12 @@
.Op Fl u Ar unit
.Ar path
.Nm
+.Cm attach
+.Op Fl v
+.Op Fl o Cm ro | wo | rw
+.Fl u Ar unit
+.Ar path
+.Nm
.Cm destroy
.Op Fl f
.Fl u Ar unit
@@ -47,12 +53,6 @@
.Cm list
.Op Fl v
.Op Fl u Ar unit
-.Nm
-.Cm rescue
-.Op Fl v
-.Op Fl o Cm ro | wo | rw
-.Fl u Ar unit
-.Ar path
.Sh DESCRIPTION
The
.Nm
@@ -70,6 +70,10 @@ Available commands:
Create a
.Nm ggate
provider related to the given regular file or device.
+.It Cm attach
+Attach a worker process to an existing
+.Nm ggate
+provider.
.It Cm destroy
Destroy the given
.Nm ggate
@@ -78,12 +82,6 @@ provider.
List
.Nm ggate
providers.
-.It Cm rescue
-Take over a previously created provider and handle pending and future
-requests. This is useful if the initial
-.Nm
-process died. To prevent data loss, the given path must lead to the
-regular file or device that was used to create the provider.
.El
.Pp
Available options:
@@ -113,7 +111,7 @@ Default is 30.
.It Fl u Ar unit
Unit number to use.
.It Fl v
-Do not fork, run in foreground and print debug information on standard
+Do not fork, run in foreground and print debug informations on standard
output.
.It Ar path
Path to a regular file or device.
diff --git a/sbin/growfs/Makefile b/sbin/growfs/Makefile
index e7017a71f938..025771fa0370 100644
--- a/sbin/growfs/Makefile
+++ b/sbin/growfs/Makefile
@@ -4,6 +4,8 @@
# $FreeBSD$
#
+#GFSDBG=
+
.include <src.opts.mk>
.PATH: ${.CURDIR}/../mount
@@ -14,15 +16,14 @@ MAN= growfs.8
CFLAGS+=-I${.CURDIR}/../mount
.if defined(GFSDBG)
-SRCS+= debug.c
-CFLAGS+= -DFS_DEBUG
-NO_WCAST_ALIGN= yes
+SRCS+= debug.c
.endif
-LIBADD= util
+DPADD= ${LIBUTIL}
+LDADD= -lutil
.if ${MK_TESTS} != "no"
SUBDIR+= tests
.endif
-.include <bsd.prog.mk>
+.include <bsd.prog.mk>
diff --git a/sbin/growfs/Makefile.depend b/sbin/growfs/Makefile.depend
new file mode 100644
index 000000000000..78b235bef5b2
--- /dev/null
+++ b/sbin/growfs/Makefile.depend
@@ -0,0 +1,20 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libutil \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/growfs/growfs.8 b/sbin/growfs/growfs.8
index 42dc530a1970..0dab89f35943 100644
--- a/sbin/growfs/growfs.8
+++ b/sbin/growfs/growfs.8
@@ -37,7 +37,7 @@
.\" $TSHeader: src/sbin/growfs/growfs.8,v 1.3 2000/12/12 19:31:00 tomsoft Exp $
.\" $FreeBSD$
.\"
-.Dd November 20, 2014
+.Dd November 26, 2013
.Dt GROWFS 8
.Os
.Sh NAME
@@ -96,14 +96,12 @@ This value defaults to the size of the raw partition specified in
will enlarge the file system to the size of the entire partition).
.El
.Sh EXAMPLES
-Expand root file system to fill up available space:
-.Dl growfs /
+.Dl growfs -s 2G /dev/ada0p1
.Pp
-Resize
+will enlarge
.Pa /dev/ada0p1
-partition to 2GB and expand the file system:
-.Dl gpart resize -i 1 -s 2G ada0
-.Dl growfs -s 2G /dev/ada0p1
+up to 2GB if there is enough space in
+.Pa /dev/ada0p1 .
.Sh SEE ALSO
.Xr dumpfs 8 ,
.Xr ffsinfo 8 ,
@@ -117,7 +115,7 @@ The
.Nm
utility first appeared in
.Fx 4.4 .
-The ability to resize mounted file systems was added in
+The ability to resize mounted filesystems was added in
.Fx 10.0 .
.Sh AUTHORS
.An Christoph Herrmann Aq Mt chm@FreeBSD.org
diff --git a/sbin/growfs/growfs.c b/sbin/growfs/growfs.c
index 7b85b25329b8..96897e2f8db9 100644
--- a/sbin/growfs/growfs.c
+++ b/sbin/growfs/growfs.c
@@ -161,7 +161,7 @@ growfs(int fsi, int fso, unsigned int Nflag)
#ifdef FS_DEBUG
{
struct csum *dbg_csp;
- u_int32_t dbg_csc;
+ int dbg_csc;
char dbg_line[80];
dbg_csp = fscs;
@@ -242,7 +242,7 @@ growfs(int fsi, int fso, unsigned int Nflag)
#ifdef FS_DEBUG
{
struct csum *dbg_csp;
- u_int32_t dbg_csc;
+ int dbg_csc;
char dbg_line[80];
dbg_csp = fscs;
diff --git a/sbin/gvinum/Makefile b/sbin/gvinum/Makefile
index 0e56920d9cee..1b5f948ce893 100644
--- a/sbin/gvinum/Makefile
+++ b/sbin/gvinum/Makefile
@@ -7,7 +7,8 @@ MAN= gvinum.8
WARNS?= 2
CFLAGS+= -I${.CURDIR}/../../sys -I${DESTDIR}/${INCLUDEDIR}/edit
-LIBADD= edit geom
+DPADD= ${LIBEDIT} ${LIBTERMCAPW} ${LIBDEVSTAT} ${LIBKVM} ${LIBGEOM}
+LDADD= -ledit -ltermcapw -ldevstat -lkvm -lgeom
.PATH: ${.CURDIR}/../../sys/geom/vinum
diff --git a/sbin/gvinum/Makefile.depend b/sbin/gvinum/Makefile.depend
new file mode 100644
index 000000000000..95ff20cc34ce
--- /dev/null
+++ b/sbin/gvinum/Makefile.depend
@@ -0,0 +1,27 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libdevstat \
+ lib/libedit \
+ lib/libedit/edit/readline \
+ lib/libexpat \
+ lib/libgeom \
+ lib/libkvm \
+ lib/libsbuf \
+ lib/ncurses/ncursesw \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/hastctl/Makefile b/sbin/hastctl/Makefile
index 41d443d32783..89b972e56705 100644
--- a/sbin/hastctl/Makefile
+++ b/sbin/hastctl/Makefile
@@ -32,9 +32,11 @@ CFLAGS+=-DINET6
CFLAGS+=-DYY_NO_UNPUT
CFLAGS+=-DYY_NO_INPUT
-LIBADD= util
+DPADD= ${LIBUTIL}
+LDADD= -lutil
.if ${MK_OPENSSL} != "no"
-LIBADD+= crypto
+DPADD+= ${LIBCRYPTO}
+LDADD+= -lcrypto
CFLAGS+=-DHAVE_CRYPTO
.endif
diff --git a/sbin/hastctl/Makefile.depend b/sbin/hastctl/Makefile.depend
new file mode 100644
index 000000000000..55bb66cd4f36
--- /dev/null
+++ b/sbin/hastctl/Makefile.depend
@@ -0,0 +1,28 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libutil \
+ secure/lib/libcrypto \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+parse.o: parse.c
+parse.po: parse.c
+token.o: token.c
+token.o: y.tab.h
+token.po: token.c
+token.po: y.tab.h
+.endif
diff --git a/sbin/hastd/Makefile b/sbin/hastd/Makefile
index e3fed8d0b522..3604b5bab41d 100644
--- a/sbin/hastd/Makefile
+++ b/sbin/hastd/Makefile
@@ -30,9 +30,11 @@ CFLAGS+=-DINET
CFLAGS+=-DINET6
.endif
-LIBADD= geom pthread util
+DPADD= ${LIBGEOM} ${LIBBSDXML} ${LIBSBUF} ${LIBPTHREAD} ${LIBUTIL}
+LDADD= -lgeom -lbsdxml -lsbuf -lpthread -lutil
.if ${MK_OPENSSL} != "no"
-LIBADD+= crypto
+DPADD+= ${LIBCRYPTO}
+LDADD+= -lcrypto
CFLAGS+=-DHAVE_CRYPTO
.endif
diff --git a/sbin/hastd/Makefile.depend b/sbin/hastd/Makefile.depend
new file mode 100644
index 000000000000..8fc25faadb51
--- /dev/null
+++ b/sbin/hastd/Makefile.depend
@@ -0,0 +1,32 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libexpat \
+ lib/libgeom \
+ lib/libsbuf \
+ lib/libthr \
+ lib/libutil \
+ secure/lib/libcrypto \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+parse.o: parse.c
+parse.po: parse.c
+token.o: token.c
+token.o: y.tab.h
+token.po: token.c
+token.po: y.tab.h
+.endif
diff --git a/sbin/hastd/hast.conf.5 b/sbin/hastd/hast.conf.5
index 9267e368f8d3..c7e2e33ec097 100644
--- a/sbin/hastd/hast.conf.5
+++ b/sbin/hastd/hast.conf.5
@@ -270,33 +270,39 @@ program is executed with:
.It Ic "<path> role <resource> <oldrole> <newrole>"
.Pp
Executed on both primary and secondary nodes when resource role is changed.
+.Pp
.It Ic "<path> connect <resource>"
.Pp
Executed on both primary and secondary nodes when connection for the given
resource between the nodes is established.
+.Pp
.It Ic "<path> disconnect <resource>"
.Pp
Executed on both primary and secondary nodes when connection for the given
resource between the nodes is lost.
+.Pp
.It Ic "<path> syncstart <resource>"
.Pp
Executed on primary node when synchronization process of secondary node is
started.
+.Pp
.It Ic "<path> syncdone <resource>"
.Pp
Executed on primary node when synchronization process of secondary node is
completed successfully.
+.Pp
.It Ic "<path> syncintr <resource>"
.Pp
Executed on primary node when synchronization process of secondary node is
interrupted, most likely due to secondary node outage or connection failure
between the nodes.
+.Pp
.It Ic "<path> split-brain <resource>"
.Pp
Executed on both primary and secondary nodes when split-brain condition is
detected.
-.El
.Pp
+.El
The
.Aq path
argument should contain full path to executable program.
@@ -324,6 +330,7 @@ It can be one of:
.Ar init ,
.Ar secondary ,
.Ar primary .
+.Pp
.It Ic metaflush on | off
.Pp
When set to
@@ -342,6 +349,7 @@ will disable
automatically.
The default value is
.Va on .
+.Pp
.It Ic name Aq name
.Pp
GEOM provider name that will appear as
diff --git a/sbin/ifconfig/Makefile b/sbin/ifconfig/Makefile
index ac7faf9fa460..8aba6b466255 100644
--- a/sbin/ifconfig/Makefile
+++ b/sbin/ifconfig/Makefile
@@ -35,10 +35,12 @@ SRCS+= ifgre.c # GRE keys etc
SRCS+= ifgif.c # GIF reversed header workaround
SRCS+= sfp.c # SFP/SFP+ information
-LIBADD+= m
+DPADD+= ${LIBM}
+LDADD+= -lm
SRCS+= ifieee80211.c regdomain.c # SIOC[GS]IEEE80211 support
-LIBADD+= bsdxml sbuf
+DPADD+= ${LIBBSDXML} ${LIBSBUF}
+LDADD+= -lbsdxml -lsbuf
SRCS+= carp.c # SIOC[GS]VH support
SRCS+= ifgroup.c # ...
@@ -57,7 +59,8 @@ CFLAGS+= -DINET
.endif
.if ${MK_JAIL} != "no" && !defined(RELEASE_CRUNCH) && !defined(RESCUE)
CFLAGS+= -DJAIL
-LIBADD+= jail
+DPADD+= ${LIBJAIL}
+LDADD+= -ljail
.endif
MAN= ifconfig.8
@@ -65,8 +68,4 @@ MAN= ifconfig.8
CFLAGS+= -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wnested-externs
WARNS?= 2
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
-
.include <bsd.prog.mk>
diff --git a/sbin/ifconfig/Makefile.depend b/sbin/ifconfig/Makefile.depend
new file mode 100644
index 000000000000..318c7c863a7e
--- /dev/null
+++ b/sbin/ifconfig/Makefile.depend
@@ -0,0 +1,24 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libexpat \
+ lib/libjail \
+ lib/libsbuf \
+ lib/msun \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/ifconfig/af_inet.c b/sbin/ifconfig/af_inet.c
index eff1ce5958b9..c73337374be4 100644
--- a/sbin/ifconfig/af_inet.c
+++ b/sbin/ifconfig/af_inet.c
@@ -32,7 +32,7 @@ static const char rcsid[] =
"$FreeBSD$";
#endif /* not lint */
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <net/if.h>
@@ -46,6 +46,7 @@ static const char rcsid[] =
#include <ifaddrs.h>
#include <netinet/in.h>
+#include <net/if_var.h> /* for struct ifaddr */
#include <netinet/in_var.h>
#include <arpa/inet.h>
#include <netdb.h>
@@ -100,6 +101,7 @@ static struct sockaddr_in *sintab[] = {
static void
in_getaddr(const char *s, int which)
{
+#define MIN(a,b) ((a)<(b)?(a):(b))
struct sockaddr_in *sin = sintab[which];
struct hostent *hp;
struct netent *np;
@@ -140,6 +142,7 @@ in_getaddr(const char *s, int which)
sin->sin_addr = inet_makeaddr(np->n_net, INADDR_ANY);
else
errx(1, "%s: bad value", s);
+#undef MIN
}
static void
diff --git a/sbin/ifconfig/af_inet6.c b/sbin/ifconfig/af_inet6.c
index 6dd86222cae5..0f8688a8b3e1 100644
--- a/sbin/ifconfig/af_inet6.c
+++ b/sbin/ifconfig/af_inet6.c
@@ -48,6 +48,7 @@ static const char rcsid[] =
#include <arpa/inet.h>
#include <netinet/in.h>
+#include <net/if_var.h> /* for struct ifaddr */
#include <netinet/in_var.h>
#include <arpa/inet.h>
#include <netdb.h>
@@ -57,8 +58,8 @@ static const char rcsid[] =
#include "ifconfig.h"
static struct in6_ifreq in6_ridreq;
-static struct in6_aliasreq in6_addreq =
- { .ifra_flags = 0,
+static struct in6_aliasreq in6_addreq =
+ { .ifra_flags = 0,
.ifra_lifetime = { 0, 0, ND6_INFINITE_LIFETIME, ND6_INFINITE_LIFETIME } };
static int ip6lifetime;
@@ -264,16 +265,14 @@ in6_status(int s __unused, const struct ifaddrs *ifa)
printf("pltime ");
if (lifetime.ia6t_preferred) {
printf("%s ", lifetime.ia6t_preferred < now.tv_sec
- ? "0" :
- sec2str(lifetime.ia6t_preferred - now.tv_sec));
+ ? "0" : sec2str(lifetime.ia6t_preferred - now.tv_sec));
} else
printf("infty ");
printf("vltime ");
if (lifetime.ia6t_expire) {
printf("%s ", lifetime.ia6t_expire < now.tv_sec
- ? "0" :
- sec2str(lifetime.ia6t_expire - now.tv_sec));
+ ? "0" : sec2str(lifetime.ia6t_expire - now.tv_sec));
} else
printf("infty ");
}
@@ -348,25 +347,25 @@ in6_getaddr(const char *s, int which)
static int
prefix(void *val, int size)
{
- u_char *name = (u_char *)val;
- int byte, bit, plen = 0;
+ u_char *name = (u_char *)val;
+ int byte, bit, plen = 0;
- for (byte = 0; byte < size; byte++, plen += 8)
- if (name[byte] != 0xff)
- break;
+ for (byte = 0; byte < size; byte++, plen += 8)
+ if (name[byte] != 0xff)
+ break;
if (byte == size)
return (plen);
for (bit = 7; bit != 0; bit--, plen++)
- if (!(name[byte] & (1 << bit)))
- break;
- for (; bit != 0; bit--)
- if (name[byte] & (1 << bit))
- return(0);
- byte++;
- for (; byte < size; byte++)
- if (name[byte])
- return(0);
- return (plen);
+ if (!(name[byte] & (1 << bit)))
+ break;
+ for (; bit != 0; bit--)
+ if (name[byte] & (1 << bit))
+ return(0);
+ byte++;
+ for (; byte < size; byte++)
+ if (name[byte])
+ return(0);
+ return (plen);
}
static char *
@@ -484,8 +483,6 @@ static struct cmd inet6_cmds[] = {
DEF_CMD("-auto_linklocal",-ND6_IFF_AUTO_LINKLOCAL,setnd6flags),
DEF_CMD("no_prefer_iface",ND6_IFF_NO_PREFER_IFACE,setnd6flags),
DEF_CMD("-no_prefer_iface",-ND6_IFF_NO_PREFER_IFACE,setnd6flags),
- DEF_CMD("no_dad", ND6_IFF_NO_DAD, setnd6flags),
- DEF_CMD("-no_dad", -ND6_IFF_NO_DAD, setnd6flags),
DEF_CMD_ARG("pltime", setip6pltime),
DEF_CMD_ARG("vltime", setip6vltime),
DEF_CMD("eui64", 0, setip6eui64),
@@ -512,11 +509,7 @@ in6_Lopt_cb(const char *optarg __unused)
{
ip6lifetime++; /* print IPv6 address lifetime */
}
-static struct option in6_Lopt = {
- .opt = "L",
- .opt_usage = "[-L]",
- .cb = in6_Lopt_cb
-};
+static struct option in6_Lopt = { .opt = "L", .opt_usage = "[-L]", .cb = in6_Lopt_cb };
static __constructor void
inet6_ctor(void)
diff --git a/sbin/ifconfig/af_nd6.c b/sbin/ifconfig/af_nd6.c
index 9a1be79710a2..b3db0a8204ed 100644
--- a/sbin/ifconfig/af_nd6.c
+++ b/sbin/ifconfig/af_nd6.c
@@ -46,6 +46,7 @@ static const char rcsid[] =
#include <arpa/inet.h>
#include <netinet/in.h>
+#include <net/if_var.h>
#include <netinet/in_var.h>
#include <arpa/inet.h>
#include <netdb.h>
@@ -57,8 +58,7 @@ static const char rcsid[] =
#define MAX_SYSCTL_TRY 5
#define ND6BITS "\020\001PERFORMNUD\002ACCEPT_RTADV\003PREFER_SOURCE" \
"\004IFDISABLED\005DONT_SET_IFROUTE\006AUTO_LINKLOCAL" \
- "\007NO_RADR\010NO_PREFER_IFACE\011IGNORELOOP\012NO_DAD" \
- "\020DEFAULTIF"
+ "\007NO_RADR\010NO_PREFER_IFACE\020DEFAULTIF"
static int isnd6defif(int);
void setnd6flags(const char *, int, int, const struct afswtch *);
diff --git a/sbin/ifconfig/carp.c b/sbin/ifconfig/carp.c
index adff153a42ae..2c58fcb1e931 100644
--- a/sbin/ifconfig/carp.c
+++ b/sbin/ifconfig/carp.c
@@ -36,6 +36,7 @@
#include <unistd.h>
#include <net/if.h>
+#include <net/if_var.h>
#include <netinet/in.h>
#include <netinet/in_var.h>
#include <netinet/ip_carp.h>
diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8
index 56b5c1483f54..064a62d27b8d 100644
--- a/sbin/ifconfig/ifconfig.8
+++ b/sbin/ifconfig/ifconfig.8
@@ -28,7 +28,7 @@
.\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94
.\" $FreeBSD$
.\"
-.Dd May 15, 2015
+.Dd October 20, 2014
.Dt IFCONFIG 8
.Os
.Sh NAME
@@ -316,14 +316,6 @@ using the
kernel configuration option, or the
.Va net.fibs
tunable.
-.It Cm tunnelfib Ar fib_number
-Specify tunnel FIB.
-A FIB
-.Ar fib_number
-is assigned to all packets encapsulated by tunnel interface, e.g.,
-.Xr gif 4
-and
-.Xr gre 4 .
.It Cm maclabel Ar label
If Mandatory Access Control support is enabled in the kernel,
set the MAC label to
@@ -695,11 +687,6 @@ policy table, configurable with
.It Cm -no_prefer_iface
Clear a flag
.Cm no_prefer_iface .
-.It Cm no_dad
-Set a flag to disable Duplicate Address Detection.
-.It Cm -no_dad
-Clear a flag
-.Cm no_dad .
.El
.Pp
The following parameters are specific for IPv6 addresses.
@@ -2428,14 +2415,6 @@ This is for backward compatibility with
.It Cm -accept_rev_ethip_ver
Clear a flag
.Cm accept_rev_ethip_ver .
-.It Cm ignore_source
-Set a flag to accept encapsulated packets destined to this host
-independently from source address.
-This may be useful for hosts, that receive encapsulated packets
-from the load balancers.
-.It Cm -ignore_source
-Clear a flag
-.Cm ignore_source .
.It Cm send_rev_ethip_ver
Set a flag to send EtherIP packets with reversed version
field intentionally.
@@ -2565,33 +2544,33 @@ The following parameters are used to configure
.Xr vxlan 4
interfaces.
.Bl -tag -width indent
-.It Cm vxlanid Ar identifier
+.It Cm vni Ar identifier
This value is a 24-bit VXLAN Network Identifier (VNI) that identifies the
virtual network segment membership of the interface.
-.It Cm vxlanlocal Ar address
+.It Cm local Ar address
The source address used in the encapsulating IPv4/IPv6 header.
The address should already be assigned to an existing interface.
When the interface is configured in unicast mode, the listening socket
is bound to this address.
-.It Cm vxlanremote Ar address
+.It Cm remote Ar address
The interface can be configured in a unicast, or point-to-point, mode
to create a tunnel between two hosts.
This is the IP address of the remote end of the tunnel.
-.It Cm vxlangroup Ar address
+.It Cm group Ar address
The interface can be configured in a multicast mode
to create a virtual network of hosts.
This is the IP multicast group address the interface will join.
-.It Cm vxlanlocalport Ar port
+.It Cm localport Ar port
The port number the interface will listen on.
The default port number is 4789.
-.It Cm vxlanremoteport Ar port
+.It Cm remoteport Ar port
The destination port number used in the encapsulating IPv4/IPv6 header.
The remote host should be listening on this port.
The default port number is 4789.
Note some other implementations, such as Linux,
do not default to the IANA assigned port,
but instead listen on port 8472.
-.It Cm vxlanportrange Ar low high
+.It Cm portrange Ar low high
The range of source ports used in the encapsulating IPv4/IPv6 header.
The port selected within the range is based on a hash of the inner frame.
A range is useful to provide entropy within the outer IP header
@@ -2602,32 +2581,32 @@ variables
.Va net.inet.ip.portrange.first
and
.Va net.inet.ip.portrange.last
-.It Cm vxlantimeout Ar timeout
+.It Cm timeout Ar timeout
The maximum time, in seconds, before an entry in the forwarding table
is pruned.
The default is 1200 seconds (20 minutes).
-.It Cm vxlanmaxaddr Ar max
+.It Cm maxaddr Ar max
The maximum number of entries in the forwarding table.
The default is 2000.
.It Cm vxlandev Ar dev
When the interface is configured in multicast mode, the
.Cm dev
interface is used to transmit IP multicast packets.
-.It Cm vxlanttl Ar ttl
+.It Cm ttl Ar ttl
The TTL used in the encapsulating IPv4/IPv6 header.
The default is 64.
-.It Cm vxlanlearn
+.It Cm learn
The source IP address and inner source Ethernet MAC address of
received packets are used to dynamically populate the forwarding table.
When in multicast mode, an entry in the forwarding table allows the
interface to send the frame directly to the remote host instead of
broadcasting the frame to the multicast group.
This is the default.
-.It Fl vxlanlearn
+.It Fl learn
The forwarding table is not populated by recevied packets.
-.It Cm vxlanflush
+.It Cm flush
Delete all dynamically-learned addresses from the forwarding table.
-.It Cm vxlanflushall
+.It Cm flushall
Delete all addresses, including static addresses, from the forwarding table.
.El
.Pp
@@ -2840,9 +2819,9 @@ tried to alter an interface's configuration.
.Xr devd.conf 5 ,
.\" .Xr eon 5 ,
.Xr devd 8 ,
-.Xr jail 8 ,
.Xr rc 8 ,
.Xr routed 8 ,
+.Xr jail 8 ,
.Xr sysctl 8
.Sh HISTORY
The
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index 4a7999232be0..61fd15589f14 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -47,10 +47,10 @@ static const char rcsid[] =
#include <sys/time.h>
#include <sys/module.h>
#include <sys/linker.h>
-#include <sys/queue.h>
#include <net/ethernet.h>
#include <net/if.h>
+#include <net/if_var.h>
#include <net/if_dl.h>
#include <net/if_types.h>
#include <net/route.h>
@@ -110,15 +110,6 @@ static void af_other_status(int);
static struct option *opts = NULL;
-struct ifa_order_elt {
- int if_order;
- int af_orders[255];
- struct ifaddrs *ifa;
- TAILQ_ENTRY(ifa_order_elt) link;
-};
-
-TAILQ_HEAD(ifa_queue, ifa_order_elt);
-
void
opt_register(struct option *p)
{
@@ -150,165 +141,16 @@ usage(void)
exit(1);
}
-#define ORDERS_SIZE(x) sizeof(x) / sizeof(x[0])
-
-static int
-calcorders(struct ifaddrs *ifa, struct ifa_queue *q)
-{
- struct ifaddrs *prev;
- struct ifa_order_elt *cur;
- unsigned int ord, af, ifa_ord;
-
- prev = NULL;
- cur = NULL;
- ord = 0;
- ifa_ord = 0;
-
- while (ifa != NULL) {
- if (prev == NULL ||
- strcmp(ifa->ifa_name, prev->ifa_name) != 0) {
- cur = calloc(1, sizeof(*cur));
-
- if (cur == NULL)
- return (-1);
-
- TAILQ_INSERT_TAIL(q, cur, link);
- cur->if_order = ifa_ord ++;
- cur->ifa = ifa;
- ord = 0;
- }
-
- if (ifa->ifa_addr) {
- af = ifa->ifa_addr->sa_family;
-
- if (af < ORDERS_SIZE(cur->af_orders) &&
- cur->af_orders[af] == 0)
- cur->af_orders[af] = ++ord;
- }
- prev = ifa;
- ifa = ifa->ifa_next;
- }
-
- return (0);
-}
-
-static int
-cmpifaddrs(struct ifaddrs *a, struct ifaddrs *b, struct ifa_queue *q)
-{
- struct ifa_order_elt *cur, *e1, *e2;
- unsigned int af1, af2;
- int ret;
-
- e1 = e2 = NULL;
-
- ret = strcmp(a->ifa_name, b->ifa_name);
- if (ret != 0) {
- TAILQ_FOREACH(cur, q, link) {
- if (e1 && e2)
- break;
-
- if (strcmp(cur->ifa->ifa_name, a->ifa_name) == 0)
- e1 = cur;
- else if (strcmp(cur->ifa->ifa_name, b->ifa_name) == 0)
- e2 = cur;
- }
-
- if (!e1 || !e2)
- return (0);
- else
- return (e1->if_order - e2->if_order);
-
- } else if (a->ifa_addr != NULL && b->ifa_addr != NULL) {
- TAILQ_FOREACH(cur, q, link) {
- if (strcmp(cur->ifa->ifa_name, a->ifa_name) == 0) {
- e1 = cur;
- break;
- }
- }
-
- if (!e1)
- return (0);
-
- af1 = a->ifa_addr->sa_family;
- af2 = b->ifa_addr->sa_family;
-
- if (af1 < ORDERS_SIZE(e1->af_orders) &&
- af2 < ORDERS_SIZE(e1->af_orders))
- return (e1->af_orders[af1] - e1->af_orders[af2]);
- }
-
- return (0);
-}
-
-#undef ORDERS_SIZE
-
-static struct ifaddrs *
-sortifaddrs(struct ifaddrs *list,
- int (*compare)(struct ifaddrs *, struct ifaddrs *, struct ifa_queue *),
- struct ifa_queue *q)
-{
- struct ifaddrs *right, *temp, *last, *result, *next, *tail;
-
- right = list;
- temp = list;
- last = list;
- result = NULL;
- next = NULL;
- tail = NULL;
-
- if (!list || !list->ifa_next)
- return (list);
-
- while (temp && temp->ifa_next) {
- last = right;
- right = right->ifa_next;
- temp = temp->ifa_next->ifa_next;
- }
-
- last->ifa_next = NULL;
-
- list = sortifaddrs(list, compare, q);
- right = sortifaddrs(right, compare, q);
-
- while (list || right) {
-
- if (!right) {
- next = list;
- list = list->ifa_next;
- } else if (!list) {
- next = right;
- right = right->ifa_next;
- } else if (compare(list, right, q) <= 0) {
- next = list;
- list = list->ifa_next;
- } else {
- next = right;
- right = right->ifa_next;
- }
-
- if (!result)
- result = next;
- else
- tail->ifa_next = next;
-
- tail = next;
- }
-
- return (result);
-}
-
int
main(int argc, char *argv[])
{
int c, all, namesonly, downonly, uponly;
const struct afswtch *afp = NULL;
int ifindex;
- struct ifaddrs *ifap, *sifap, *ifa;
+ struct ifaddrs *ifap, *ifa;
struct ifreq paifr;
const struct sockaddr_dl *sdl;
char options[1024], *cp, *namecp = NULL;
- struct ifa_queue q = TAILQ_HEAD_INITIALIZER(q);
- struct ifa_order_elt *cur, *tmp;
const char *ifname;
struct option *p;
size_t iflen;
@@ -443,19 +285,9 @@ main(int argc, char *argv[])
if (getifaddrs(&ifap) != 0)
err(EXIT_FAILURE, "getifaddrs");
-
cp = NULL;
-
- if (calcorders(ifap, &q) != 0)
- err(EXIT_FAILURE, "calcorders");
-
- sifap = sortifaddrs(ifap, cmpifaddrs, &q);
-
- TAILQ_FOREACH_SAFE(cur, &q, link, tmp)
- free(cur);
-
ifindex = 0;
- for (ifa = sifap; ifa; ifa = ifa->ifa_next) {
+ for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
memset(&paifr, 0, sizeof(paifr));
strncpy(paifr.ifr_name, ifa->ifa_name, sizeof(paifr.ifr_name));
if (sizeof(paifr.ifr_addr) >= ifa->ifa_addr->sa_len) {
@@ -501,8 +333,7 @@ main(int argc, char *argv[])
sdl->sdl_alen != ETHER_ADDR_LEN)
continue;
} else {
- if (ifa->ifa_addr->sa_family
- != afp->af_af)
+ if (ifa->ifa_addr->sa_family != afp->af_af)
continue;
}
}
@@ -838,7 +669,7 @@ settunnel(const char *src, const char *dst, int s, const struct afswtch *afp)
errx(1, "error in parsing address string: %s",
gai_strerror(ecode));
- if ((ecode = getaddrinfo(dst, NULL, NULL, &dstres)) != 0)
+ if ((ecode = getaddrinfo(dst, NULL, NULL, &dstres)) != 0)
errx(1, "error in parsing address string: %s",
gai_strerror(ecode));
@@ -1279,8 +1110,9 @@ ifmaybeload(const char *name)
}
/* turn interface and unit into module name */
- strlcpy(ifkind, "if_", sizeof(ifkind));
- strlcat(ifkind, ifname, sizeof(ifkind));
+ strcpy(ifkind, "if_");
+ strlcpy(ifkind + MOD_PREFIX_LEN, ifname,
+ sizeof(ifkind) - MOD_PREFIX_LEN);
/* scan files in kernel */
mstat.version = sizeof(struct module_stat);
@@ -1297,8 +1129,8 @@ ifmaybeload(const char *name)
cp = mstat.name;
}
/* already loaded? */
- if (strcmp(ifname, cp) == 0 ||
- strcmp(ifkind, cp) == 0)
+ if (strncmp(ifname, cp, strlen(ifname) + 1) == 0 ||
+ strncmp(ifkind, cp, strlen(ifkind) + 1) == 0)
return;
}
}
diff --git a/sbin/ifconfig/iffib.c b/sbin/ifconfig/iffib.c
index 07ded3cbb24f..f3498b42e486 100644
--- a/sbin/ifconfig/iffib.c
+++ b/sbin/ifconfig/iffib.c
@@ -50,38 +50,19 @@ fib_status(int s)
memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
- if (ioctl(s, SIOCGIFFIB, (caddr_t)&ifr) == 0 &&
- ifr.ifr_fib != RT_DEFAULT_FIB)
- printf("\tfib: %u\n", ifr.ifr_fib);
- memset(&ifr, 0, sizeof(ifr));
- strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
- if (ioctl(s, SIOCGTUNFIB, (caddr_t)&ifr) == 0 &&
- ifr.ifr_fib != RT_DEFAULT_FIB)
- printf("\ttunnelfib: %u\n", ifr.ifr_fib);
-}
-
-static void
-setiffib(const char *val, int dummy __unused, int s,
- const struct afswtch *afp)
-{
- unsigned long fib;
- char *ep;
+ if (ioctl(s, SIOCGIFFIB, (caddr_t)&ifr) < 0)
+ return;
- fib = strtoul(val, &ep, 0);
- if (*ep != '\0' || fib > UINT_MAX) {
- warn("fib %s not valid", val);
+ /* Ignore if it is the default. */
+ if (ifr.ifr_fib == 0)
return;
- }
- strncpy(ifr.ifr_name, name, sizeof (ifr.ifr_name));
- ifr.ifr_fib = fib;
- if (ioctl(s, SIOCSIFFIB, (caddr_t)&ifr) < 0)
- warn("ioctl (SIOCSIFFIB)");
+ printf("\tfib: %u\n", ifr.ifr_fib);
}
static void
-settunfib(const char *val, int dummy __unused, int s,
+setiffib(const char *val, int dummy __unused, int s,
const struct afswtch *afp)
{
unsigned long fib;
@@ -95,13 +76,12 @@ settunfib(const char *val, int dummy __unused, int s,
strncpy(ifr.ifr_name, name, sizeof (ifr.ifr_name));
ifr.ifr_fib = fib;
- if (ioctl(s, SIOCSTUNFIB, (caddr_t)&ifr) < 0)
- warn("ioctl (SIOCSTUNFIB)");
+ if (ioctl(s, SIOCSIFFIB, (caddr_t)&ifr) < 0)
+ warn("ioctl (SIOCSIFFIB)");
}
static struct cmd fib_cmds[] = {
DEF_CMD_ARG("fib", setiffib),
- DEF_CMD_ARG("tunnelfib", settunfib),
};
static struct afswtch af_fib = {
diff --git a/sbin/ifconfig/ifgif.c b/sbin/ifconfig/ifgif.c
index 91c433c9aecc..f91508b53c71 100644
--- a/sbin/ifconfig/ifgif.c
+++ b/sbin/ifconfig/ifgif.c
@@ -51,7 +51,7 @@ static const char rcsid[] =
#include "ifconfig.h"
-#define GIFBITS "\020\1ACCEPT_REV_ETHIP_VER\2IGNORE_SOURCE\5SEND_REV_ETHIP_VER"
+#define GIFBITS "\020\1ACCEPT_REV_ETHIP_VER\5SEND_REV_ETHIP_VER"
static void gif_status(int);
@@ -95,8 +95,6 @@ setgifopts(const char *val,
static struct cmd gif_cmds[] = {
DEF_CMD("accept_rev_ethip_ver", GIF_ACCEPT_REVETHIP, setgifopts),
DEF_CMD("-accept_rev_ethip_ver",-GIF_ACCEPT_REVETHIP, setgifopts),
- DEF_CMD("ignore_source", GIF_IGNORE_SOURCE, setgifopts),
- DEF_CMD("-ignore_source", -GIF_IGNORE_SOURCE, setgifopts),
DEF_CMD("send_rev_ethip_ver", GIF_SEND_REVETHIP, setgifopts),
DEF_CMD("-send_rev_ethip_ver", -GIF_SEND_REVETHIP, setgifopts),
};
diff --git a/sbin/ifconfig/ifgroup.c b/sbin/ifconfig/ifgroup.c
index e3f271d4429f..f8b18b4a9835 100644
--- a/sbin/ifconfig/ifgroup.c
+++ b/sbin/ifconfig/ifgroup.c
@@ -86,6 +86,9 @@ getifgroups(int s)
struct ifgroupreq ifgr;
struct ifg_req *ifg;
+ if (!verbose)
+ return;
+
memset(&ifgr, 0, sizeof(ifgr));
strlcpy(ifgr.ifgr_name, name, IFNAMSIZ);
@@ -118,8 +121,6 @@ getifgroups(int s)
}
if (cnt)
printf("\n");
-
- free(ifgr.ifgr_groups);
}
static void
diff --git a/sbin/ifconfig/ifmedia.c b/sbin/ifconfig/ifmedia.c
index eee33918f778..0b0daa3086a1 100644
--- a/sbin/ifconfig/ifmedia.c
+++ b/sbin/ifconfig/ifmedia.c
@@ -109,17 +109,11 @@ media_status(int s)
{
struct ifmediareq ifmr;
int *media_list, i;
- int xmedia = 1;
(void) memset(&ifmr, 0, sizeof(ifmr));
(void) strncpy(ifmr.ifm_name, name, sizeof(ifmr.ifm_name));
- /*
- * Check if interface supports extended media types.
- */
- if (ioctl(s, SIOCGIFXMEDIA, (caddr_t)&ifmr) < 0)
- xmedia = 0;
- if (xmedia == 0 && ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) {
+ if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) {
/*
* Interface doesn't support SIOC{G,S}IFMEDIA.
*/
@@ -136,13 +130,8 @@ media_status(int s)
err(1, "malloc");
ifmr.ifm_ulist = media_list;
- if (xmedia) {
- if (ioctl(s, SIOCGIFXMEDIA, (caddr_t)&ifmr) < 0)
- err(1, "SIOCGIFXMEDIA");
- } else {
- if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0)
- err(1, "SIOCGIFMEDIA");
- }
+ if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0)
+ err(1, "SIOCGIFMEDIA");
printf("\tmedia: ");
print_media_word(ifmr.ifm_current, 1);
@@ -205,7 +194,6 @@ ifmedia_getstate(int s)
{
static struct ifmediareq *ifmr = NULL;
int *mwords;
- int xmedia = 1;
if (ifmr == NULL) {
ifmr = (struct ifmediareq *)malloc(sizeof(struct ifmediareq));
@@ -225,10 +213,7 @@ ifmedia_getstate(int s)
* the current media type and the top-level type.
*/
- if (ioctl(s, SIOCGIFXMEDIA, (caddr_t)ifmr) < 0) {
- xmedia = 0;
- }
- if (xmedia == 0 && ioctl(s, SIOCGIFMEDIA, (caddr_t)ifmr) < 0) {
+ if (ioctl(s, SIOCGIFMEDIA, (caddr_t)ifmr) < 0) {
err(1, "SIOCGIFMEDIA");
}
@@ -240,13 +225,8 @@ ifmedia_getstate(int s)
err(1, "malloc");
ifmr->ifm_ulist = mwords;
- if (xmedia) {
- if (ioctl(s, SIOCGIFXMEDIA, (caddr_t)ifmr) < 0)
- err(1, "SIOCGIFXMEDIA");
- } else {
- if (ioctl(s, SIOCGIFMEDIA, (caddr_t)ifmr) < 0)
- err(1, "SIOCGIFMEDIA");
- }
+ if (ioctl(s, SIOCGIFMEDIA, (caddr_t)ifmr) < 0)
+ err(1, "SIOCGIFMEDIA");
}
return ifmr;
diff --git a/sbin/ifconfig/ifvlan.c b/sbin/ifconfig/ifvlan.c
index 1a3fbaa5de47..cefcbbceffb4 100644
--- a/sbin/ifconfig/ifvlan.c
+++ b/sbin/ifconfig/ifvlan.c
@@ -40,6 +40,7 @@
#include <net/ethernet.h>
#include <net/if.h>
+#include <net/if_var.h>
#include <net/if_vlan_var.h>
#include <net/route.h>
diff --git a/sbin/ifconfig/ifvxlan.c b/sbin/ifconfig/ifvxlan.c
index 48f5331bf686..72346675faae 100644
--- a/sbin/ifconfig/ifvxlan.c
+++ b/sbin/ifconfig/ifvxlan.c
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
#include <net/ethernet.h>
#include <net/if.h>
+#include <net/if_var.h>
#include <net/if_vxlan.h>
#include <net/route.h>
#include <netinet/in.h>
@@ -594,36 +595,36 @@ setvxlan_flush(const char *val, int d, int s, const struct afswtch *afp)
static struct cmd vxlan_cmds[] = {
- DEF_CLONE_CMD_ARG("vxlanid", setvxlan_vni),
- DEF_CLONE_CMD_ARG("vxlanlocal", setvxlan_local),
- DEF_CLONE_CMD_ARG("vxlanremote", setvxlan_remote),
- DEF_CLONE_CMD_ARG("vxlangroup", setvxlan_group),
- DEF_CLONE_CMD_ARG("vxlanlocalport", setvxlan_local_port),
- DEF_CLONE_CMD_ARG("vxlanremoteport", setvxlan_remote_port),
- DEF_CLONE_CMD_ARG2("vxlanportrange", setvxlan_port_range),
- DEF_CLONE_CMD_ARG("vxlantimeout", setvxlan_timeout),
- DEF_CLONE_CMD_ARG("vxlanmaxaddr", setvxlan_maxaddr),
+ DEF_CLONE_CMD_ARG("vni", setvxlan_vni),
+ DEF_CLONE_CMD_ARG("local", setvxlan_local),
+ DEF_CLONE_CMD_ARG("remote", setvxlan_remote),
+ DEF_CLONE_CMD_ARG("group", setvxlan_group),
+ DEF_CLONE_CMD_ARG("localport", setvxlan_local_port),
+ DEF_CLONE_CMD_ARG("remoteport", setvxlan_remote_port),
+ DEF_CLONE_CMD_ARG2("portrange", setvxlan_port_range),
+ DEF_CLONE_CMD_ARG("timeout", setvxlan_timeout),
+ DEF_CLONE_CMD_ARG("maxaddr", setvxlan_maxaddr),
DEF_CLONE_CMD_ARG("vxlandev", setvxlan_dev),
- DEF_CLONE_CMD_ARG("vxlanttl", setvxlan_ttl),
- DEF_CLONE_CMD("vxlanlearn", 1, setvxlan_learn),
- DEF_CLONE_CMD("-vxlanlearn", 0, setvxlan_learn),
-
- DEF_CMD_ARG("vxlanvni", setvxlan_vni),
- DEF_CMD_ARG("vxlanlocal", setvxlan_local),
- DEF_CMD_ARG("vxlanremote", setvxlan_remote),
- DEF_CMD_ARG("vxlangroup", setvxlan_group),
- DEF_CMD_ARG("vxlanlocalport", setvxlan_local_port),
- DEF_CMD_ARG("vxlanremoteport", setvxlan_remote_port),
- DEF_CMD_ARG2("vxlanportrange", setvxlan_port_range),
- DEF_CMD_ARG("vxlantimeout", setvxlan_timeout),
- DEF_CMD_ARG("vxlanmaxaddr", setvxlan_maxaddr),
+ DEF_CLONE_CMD_ARG("ttl", setvxlan_ttl),
+ DEF_CLONE_CMD("learn", 1, setvxlan_learn),
+ DEF_CLONE_CMD("-learn", 0, setvxlan_learn),
+
+ DEF_CMD_ARG("vni", setvxlan_vni),
+ DEF_CMD_ARG("local", setvxlan_local),
+ DEF_CMD_ARG("remote", setvxlan_remote),
+ DEF_CMD_ARG("group", setvxlan_group),
+ DEF_CMD_ARG("localport", setvxlan_local_port),
+ DEF_CMD_ARG("remoteport", setvxlan_remote_port),
+ DEF_CMD_ARG2("portrange", setvxlan_port_range),
+ DEF_CMD_ARG("timeout", setvxlan_timeout),
+ DEF_CMD_ARG("maxaddr", setvxlan_maxaddr),
DEF_CMD_ARG("vxlandev", setvxlan_dev),
- DEF_CMD_ARG("vxlanttl", setvxlan_ttl),
- DEF_CMD("vxlanlearn", 1, setvxlan_learn),
- DEF_CMD("-vxlanlearn", 0, setvxlan_learn),
+ DEF_CMD_ARG("ttl", setvxlan_ttl),
+ DEF_CMD("learn", 1, setvxlan_learn),
+ DEF_CMD("-learn", 0, setvxlan_learn),
- DEF_CMD("vxlanflush", 0, setvxlan_flush),
- DEF_CMD("vxlanflushall", 1, setvxlan_flush),
+ DEF_CMD("flush", 0, setvxlan_flush),
+ DEF_CMD("flushall", 1, setvxlan_flush),
};
static struct afswtch af_vxlan = {
diff --git a/sbin/ifconfig/sfp.c b/sbin/ifconfig/sfp.c
index 7c090e142c83..d4da8c331ff4 100644
--- a/sbin/ifconfig/sfp.c
+++ b/sbin/ifconfig/sfp.c
@@ -48,16 +48,25 @@ static const char rcsid[] =
#include "ifconfig.h"
+struct i2c_info;
+typedef int (read_i2c)(struct i2c_info *ii, uint8_t addr, uint8_t off,
+ uint8_t len, caddr_t buf);
+
struct i2c_info {
- int fd; /* fd to issue SIOCGI2C */
- int error; /* Store first error */
- int qsfp; /* True if transceiver is QSFP */
- int do_diag; /* True if we need to request DDM */
- struct ifreq *ifr; /* Pointer to pre-filled ifreq */
+ int s;
+ int error;
+ int bshift;
+ int qsfp;
+ int do_diag;
+ struct ifreq *ifr;
+ read_i2c *f;
+ char *textbuf;
+ size_t bufsize;
+ int cfd;
+ int port_id;
+ int chip_id;
};
-static int read_i2c(struct i2c_info *ii, uint8_t addr, uint8_t off,
- uint8_t len, uint8_t *buf);
static void dump_i2c_data(struct i2c_info *ii, uint8_t addr, uint8_t off,
uint8_t len);
@@ -182,18 +191,6 @@ static struct _nv eth_1040g[] = {
{ 0, NULL }
};
-/* SFF-8636 Rev. 2.5 table 6.3: Revision compliance */
-static struct _nv rev_compl[] = {
- { 0x1, "SFF-8436 rev <=4.8" },
- { 0x2, "SFF-8436 rev <=4.8" },
- { 0x3, "SFF-8636 rev <=1.3" },
- { 0x4, "SFF-8636 rev <=1.4" },
- { 0x5, "SFF-8636 rev <=1.5" },
- { 0x6, "SFF-8636 rev <=2.0" },
- { 0x7, "SFF-8636 rev <=2.5" },
- { 0x0, "Unspecified" }
-};
-
const char *
find_value(struct _nv *x, int value)
{
@@ -258,24 +255,11 @@ convert_sff_connector(char *buf, size_t size, uint8_t value)
}
static void
-convert_sff_rev_compliance(char *buf, size_t size, uint8_t value)
-{
- const char *x;
-
- if (value > 0x07)
- x = "Unallocated";
- else
- x = find_value(rev_compl, value);
-
- snprintf(buf, size, "%s", x);
-}
-
-static void
get_sfp_identifier(struct i2c_info *ii, char *buf, size_t size)
{
uint8_t data;
- read_i2c(ii, SFF_8472_BASE, SFF_8472_ID, 1, &data);
+ ii->f(ii, SFF_8472_BASE, SFF_8472_ID, 1, (caddr_t)&data);
convert_sff_identifier(buf, size, data);
}
@@ -284,7 +268,7 @@ get_sfp_connector(struct i2c_info *ii, char *buf, size_t size)
{
uint8_t data;
- read_i2c(ii, SFF_8472_BASE, SFF_8472_CONNECTOR, 1, &data);
+ ii->f(ii, SFF_8472_BASE, SFF_8472_CONNECTOR, 1, (caddr_t)&data);
convert_sff_connector(buf, size, data);
}
@@ -293,7 +277,7 @@ get_qsfp_identifier(struct i2c_info *ii, char *buf, size_t size)
{
uint8_t data;
- read_i2c(ii, SFF_8436_BASE, SFF_8436_ID, 1, &data);
+ ii->f(ii, SFF_8436_BASE, SFF_8436_ID, 1, (caddr_t)&data);
convert_sff_identifier(buf, size, data);
}
@@ -302,7 +286,7 @@ get_qsfp_connector(struct i2c_info *ii, char *buf, size_t size)
{
uint8_t data;
- read_i2c(ii, SFF_8436_BASE, SFF_8436_CONNECTOR, 1, &data);
+ ii->f(ii, SFF_8436_BASE, SFF_8436_CONNECTOR, 1, (caddr_t)&data);
convert_sff_connector(buf, size, data);
}
@@ -319,7 +303,7 @@ printf_sfp_transceiver_descr(struct i2c_info *ii, char *buf, size_t size)
tech_speed = NULL;
/* Read bytes 3-10 at once */
- read_i2c(ii, SFF_8472_BASE, SFF_8472_TRANS_START, 8, &xbuf[3]);
+ ii->f(ii, SFF_8472_BASE, SFF_8472_TRANS_START, 8, &xbuf[3]);
/* Check 10G ethernet first */
tech_class = find_zero_bit(eth_10g, xbuf[3], 1);
@@ -347,14 +331,14 @@ get_sfp_transceiver_class(struct i2c_info *ii, char *buf, size_t size)
uint8_t code;
unsigned char qbuf[8];
- read_i2c(ii, SFF_8472_BASE, SFF_8472_TRANS_START, 8, (uint8_t *)qbuf);
+ ii->f(ii, SFF_8472_BASE, SFF_8472_TRANS_START, 8, (caddr_t)qbuf);
/* Check 10G Ethernet/IB first */
- read_i2c(ii, SFF_8472_BASE, SFF_8472_TRANS_START, 1, &code);
+ ii->f(ii, SFF_8472_BASE, SFF_8472_TRANS_START, 1, (caddr_t)&code);
tech_class = find_zero_bit(eth_10g, code, 1);
if (tech_class == NULL) {
/* No match. Try Ethernet 1G */
- read_i2c(ii, SFF_8472_BASE, SFF_8472_TRANS_START + 3,
+ ii->f(ii, SFF_8472_BASE, SFF_8472_TRANS_START + 3,
1, (caddr_t)&code);
tech_class = find_zero_bit(eth_compat, code, 1);
}
@@ -372,7 +356,7 @@ get_qsfp_transceiver_class(struct i2c_info *ii, char *buf, size_t size)
uint8_t code;
/* Check 10/40G Ethernet class only */
- read_i2c(ii, SFF_8436_BASE, SFF_8436_CODE_E1040G, 1, &code);
+ ii->f(ii, SFF_8436_BASE, SFF_8436_CODE_E1040G, 1, (caddr_t)&code);
tech_class = find_zero_bit(eth_1040g, code, 1);
if (tech_class == NULL)
tech_class = "Unknown";
@@ -409,7 +393,7 @@ get_sfp_vendor_name(struct i2c_info *ii, char *buf, size_t size)
char xbuf[17];
memset(xbuf, 0, sizeof(xbuf));
- read_i2c(ii, SFF_8472_BASE, SFF_8472_VENDOR_START, 16, (uint8_t *)xbuf);
+ ii->f(ii, SFF_8472_BASE, SFF_8472_VENDOR_START, 16, xbuf);
convert_sff_name(buf, size, xbuf);
}
@@ -419,7 +403,7 @@ get_sfp_vendor_pn(struct i2c_info *ii, char *buf, size_t size)
char xbuf[17];
memset(xbuf, 0, sizeof(xbuf));
- read_i2c(ii, SFF_8472_BASE, SFF_8472_PN_START, 16, (uint8_t *)xbuf);
+ ii->f(ii, SFF_8472_BASE, SFF_8472_PN_START, 16, xbuf);
convert_sff_name(buf, size, xbuf);
}
@@ -429,7 +413,7 @@ get_sfp_vendor_sn(struct i2c_info *ii, char *buf, size_t size)
char xbuf[17];
memset(xbuf, 0, sizeof(xbuf));
- read_i2c(ii, SFF_8472_BASE, SFF_8472_SN_START, 16, (uint8_t *)xbuf);
+ ii->f(ii, SFF_8472_BASE, SFF_8472_SN_START, 16, xbuf);
convert_sff_name(buf, size, xbuf);
}
@@ -440,7 +424,7 @@ get_sfp_vendor_date(struct i2c_info *ii, char *buf, size_t size)
memset(xbuf, 0, sizeof(xbuf));
/* Date code, see Table 3.8 for description */
- read_i2c(ii, SFF_8472_BASE, SFF_8472_DATE_START, 6, (uint8_t *)xbuf);
+ ii->f(ii, SFF_8472_BASE, SFF_8472_DATE_START, 6, xbuf);
convert_sff_date(buf, size, xbuf);
}
@@ -450,7 +434,7 @@ get_qsfp_vendor_name(struct i2c_info *ii, char *buf, size_t size)
char xbuf[17];
memset(xbuf, 0, sizeof(xbuf));
- read_i2c(ii, SFF_8436_BASE, SFF_8436_VENDOR_START, 16, (uint8_t *)xbuf);
+ ii->f(ii, SFF_8436_BASE, SFF_8436_VENDOR_START, 16, xbuf);
convert_sff_name(buf, size, xbuf);
}
@@ -460,7 +444,7 @@ get_qsfp_vendor_pn(struct i2c_info *ii, char *buf, size_t size)
char xbuf[17];
memset(xbuf, 0, sizeof(xbuf));
- read_i2c(ii, SFF_8436_BASE, SFF_8436_PN_START, 16, (uint8_t *)xbuf);
+ ii->f(ii, SFF_8436_BASE, SFF_8436_PN_START, 16, xbuf);
convert_sff_name(buf, size, xbuf);
}
@@ -470,7 +454,7 @@ get_qsfp_vendor_sn(struct i2c_info *ii, char *buf, size_t size)
char xbuf[17];
memset(xbuf, 0, sizeof(xbuf));
- read_i2c(ii, SFF_8436_BASE, SFF_8436_SN_START, 16, (uint8_t *)xbuf);
+ ii->f(ii, SFF_8436_BASE, SFF_8436_SN_START, 16, xbuf);
convert_sff_name(buf, size, xbuf);
}
@@ -480,7 +464,7 @@ get_qsfp_vendor_date(struct i2c_info *ii, char *buf, size_t size)
char xbuf[6];
memset(xbuf, 0, sizeof(xbuf));
- read_i2c(ii, SFF_8436_BASE, SFF_8436_DATE_START, 6, (uint8_t *)xbuf);
+ ii->f(ii, SFF_8436_BASE, SFF_8436_DATE_START, 6, xbuf);
convert_sff_date(buf, size, xbuf);
}
@@ -517,12 +501,12 @@ print_sfp_vendor(struct i2c_info *ii, char *buf, size_t size)
*
*/
static void
-convert_sff_temp(char *buf, size_t size, uint8_t *xbuf)
+convert_sff_temp(char *buf, size_t size, char *xbuf)
{
double d;
- d = (double)xbuf[0];
- d += (double)xbuf[1] / 256;
+ d = (double)(int8_t)xbuf[0];
+ d += (double)(uint8_t)xbuf[1] / 256;
snprintf(buf, size, "%.2f C", d);
}
@@ -532,11 +516,11 @@ convert_sff_temp(char *buf, size_t size, uint8_t *xbuf)
* 16-bit usigned value, treated as range 0..+6.55 Volts
*/
static void
-convert_sff_voltage(char *buf, size_t size, uint8_t *xbuf)
+convert_sff_voltage(char *buf, size_t size, char *xbuf)
{
double d;
- d = (double)((xbuf[0] << 8) | xbuf[1]);
+ d = (double)(((uint8_t)xbuf[0] << 8) | (uint8_t)xbuf[1]);
snprintf(buf, size, "%.2f Volts", d / 10000);
}
@@ -545,12 +529,12 @@ convert_sff_voltage(char *buf, size_t size, uint8_t *xbuf)
* human representation.
*/
static void
-convert_sff_power(struct i2c_info *ii, char *buf, size_t size, uint8_t *xbuf)
+convert_sff_power(struct i2c_info *ii, char *buf, size_t size, char *xbuf)
{
uint16_t mW;
double dbm;
- mW = (xbuf[0] << 8) + xbuf[1];
+ mW = ((uint8_t)xbuf[0] << 8) + (uint8_t)xbuf[1];
/* Convert mw to dbm */
dbm = 10.0 * log10(1.0 * mW / 10000);
@@ -569,116 +553,87 @@ convert_sff_power(struct i2c_info *ii, char *buf, size_t size, uint8_t *xbuf)
static void
get_sfp_temp(struct i2c_info *ii, char *buf, size_t size)
{
- uint8_t xbuf[2];
+ char xbuf[2];
memset(xbuf, 0, sizeof(xbuf));
- read_i2c(ii, SFF_8472_DIAG, SFF_8472_TEMP, 2, xbuf);
+ ii->f(ii, SFF_8472_DIAG, SFF_8472_TEMP, 2, xbuf);
convert_sff_temp(buf, size, xbuf);
}
static void
get_sfp_voltage(struct i2c_info *ii, char *buf, size_t size)
{
- uint8_t xbuf[2];
+ char xbuf[2];
memset(xbuf, 0, sizeof(xbuf));
- read_i2c(ii, SFF_8472_DIAG, SFF_8472_VCC, 2, xbuf);
+ ii->f(ii, SFF_8472_DIAG, SFF_8472_VCC, 2, xbuf);
convert_sff_voltage(buf, size, xbuf);
}
static void
get_qsfp_temp(struct i2c_info *ii, char *buf, size_t size)
{
- uint8_t xbuf[2];
+ char xbuf[2];
memset(xbuf, 0, sizeof(xbuf));
- read_i2c(ii, SFF_8436_BASE, SFF_8436_TEMP, 2, xbuf);
+ ii->f(ii, SFF_8436_BASE, SFF_8436_TEMP, 2, xbuf);
convert_sff_temp(buf, size, xbuf);
}
static void
get_qsfp_voltage(struct i2c_info *ii, char *buf, size_t size)
{
- uint8_t xbuf[2];
+ char xbuf[2];
memset(xbuf, 0, sizeof(xbuf));
- read_i2c(ii, SFF_8436_BASE, SFF_8436_VCC, 2, xbuf);
+ ii->f(ii, SFF_8436_BASE, SFF_8436_VCC, 2, xbuf);
convert_sff_voltage(buf, size, xbuf);
}
static void
get_sfp_rx_power(struct i2c_info *ii, char *buf, size_t size)
{
- uint8_t xbuf[2];
+ char xbuf[2];
memset(xbuf, 0, sizeof(xbuf));
- read_i2c(ii, SFF_8472_DIAG, SFF_8472_RX_POWER, 2, xbuf);
+ ii->f(ii, SFF_8472_DIAG, SFF_8472_RX_POWER, 2, xbuf);
convert_sff_power(ii, buf, size, xbuf);
}
static void
get_sfp_tx_power(struct i2c_info *ii, char *buf, size_t size)
{
- uint8_t xbuf[2];
+ char xbuf[2];
memset(xbuf, 0, sizeof(xbuf));
- read_i2c(ii, SFF_8472_DIAG, SFF_8472_TX_POWER, 2, xbuf);
+ ii->f(ii, SFF_8472_DIAG, SFF_8472_TX_POWER, 2, xbuf);
convert_sff_power(ii, buf, size, xbuf);
}
static void
get_qsfp_rx_power(struct i2c_info *ii, char *buf, size_t size, int chan)
{
- uint8_t xbuf[2];
+ char xbuf[2];
memset(xbuf, 0, sizeof(xbuf));
- read_i2c(ii, SFF_8436_BASE, SFF_8436_RX_CH1_MSB + (chan-1)*2, 2, xbuf);
+ ii->f(ii, SFF_8436_BASE, SFF_8436_RX_CH1_MSB + (chan - 1) * 2, 2, xbuf);
convert_sff_power(ii, buf, size, xbuf);
}
static void
get_qsfp_tx_power(struct i2c_info *ii, char *buf, size_t size, int chan)
{
- uint8_t xbuf[2];
+ char xbuf[2];
memset(xbuf, 0, sizeof(xbuf));
- read_i2c(ii, SFF_8436_BASE, SFF_8436_TX_CH1_MSB + (chan-1)*2, 2, xbuf);
+ ii->f(ii, SFF_8436_BASE, SFF_8436_TX_CH1_MSB + (chan -1) * 2, 2, xbuf);
convert_sff_power(ii, buf, size, xbuf);
}
-static void
-get_qsfp_rev_compliance(struct i2c_info *ii, char *buf, size_t size)
-{
- uint8_t xbuf;
-
- xbuf = 0;
- read_i2c(ii, SFF_8436_BASE, SFF_8436_STATUS, 1, &xbuf);
- convert_sff_rev_compliance(buf, size, xbuf);
-}
-
-static uint32_t
-get_qsfp_br(struct i2c_info *ii)
-{
- uint8_t xbuf;
- uint32_t rate;
-
- xbuf = 0;
- read_i2c(ii, SFF_8436_BASE, SFF_8436_BITRATE, 1, &xbuf);
- rate = xbuf * 100;
- if (xbuf == 0xFF) {
- read_i2c(ii, SFF_8436_BASE, SFF_8636_BITRATE, 1, &xbuf);
- rate = xbuf * 250;
- }
-
- return (rate);
-}
-
-/*
- * Reads i2c data from opened kernel socket.
- */
+/* Generic handler */
static int
-read_i2c(struct i2c_info *ii, uint8_t addr, uint8_t off, uint8_t len,
- uint8_t *buf)
+read_i2c_generic(struct i2c_info *ii, uint8_t addr, uint8_t off, uint8_t len,
+ caddr_t buf)
{
struct ifi2creq req;
int i, l;
@@ -698,7 +653,7 @@ read_i2c(struct i2c_info *ii, uint8_t addr, uint8_t off, uint8_t len,
while (len > 0) {
l = (len > sizeof(req.data)) ? sizeof(req.data) : len;
req.len = l;
- if (ioctl(ii->fd, SIOCGI2C, ii->ifr) != 0) {
+ if (ioctl(ii->s, SIOCGI2C, ii->ifr) != 0) {
ii->error = errno;
return (errno);
}
@@ -721,7 +676,7 @@ dump_i2c_data(struct i2c_info *ii, uint8_t addr, uint8_t off, uint8_t len)
while (len > 0) {
memset(buf, 0, sizeof(buf));
read = (len > sizeof(buf)) ? sizeof(buf) : len;
- read_i2c(ii, addr, off, read, buf);
+ ii->f(ii, addr, off, read, buf);
if (ii->error != 0) {
fprintf(stderr, "Error reading i2c info\n");
return;
@@ -741,11 +696,10 @@ print_qsfp_status(struct i2c_info *ii, int verbose)
{
char buf[80], buf2[40], buf3[40];
uint8_t diag_type;
- uint32_t bitrate;
int i;
/* Read diagnostic monitoring type */
- read_i2c(ii, SFF_8436_BASE, SFF_8436_DIAG_TYPE, 1, (caddr_t)&diag_type);
+ ii->f(ii, SFF_8436_BASE, SFF_8436_DIAG_TYPE, 1, (caddr_t)&diag_type);
if (ii->error != 0)
return;
@@ -768,16 +722,6 @@ print_qsfp_status(struct i2c_info *ii, int verbose)
if (ii->error == 0)
printf("\t%s\n", buf);
- if (verbose > 1) {
- get_qsfp_rev_compliance(ii, buf, sizeof(buf));
- if (ii->error == 0)
- printf("\tcompliance level: %s\n", buf);
-
- bitrate = get_qsfp_br(ii);
- if (ii->error == 0 && bitrate > 0)
- printf("\tnominal bitrate: %u Mbps\n", bitrate);
- }
-
/* Request current measurements if they are provided: */
if (ii->do_diag != 0) {
get_qsfp_temp(ii, buf, sizeof(buf));
@@ -805,7 +749,7 @@ print_sfp_status(struct i2c_info *ii, int verbose)
uint8_t diag_type, flags;
/* Read diagnostic monitoring type */
- read_i2c(ii, SFF_8472_BASE, SFF_8472_DIAG_TYPE, 1, (caddr_t)&diag_type);
+ ii->f(ii, SFF_8472_BASE, SFF_8472_DIAG_TYPE, 1, (caddr_t)&diag_type);
if (ii->error != 0)
return;
@@ -853,10 +797,11 @@ sfp_status(int s, struct ifreq *ifr, int verbose)
struct i2c_info ii;
uint8_t id_byte;
- /* Prepare necessary into pass to i2c reader */
memset(&ii, 0, sizeof(ii));
- ii.fd = s;
+ /* Prepare necessary into to pass to NIC handler */
+ ii.s = s;
ii.ifr = ifr;
+ ii.f = read_i2c_generic;
/*
* Try to read byte 0 from i2c:
@@ -866,7 +811,7 @@ sfp_status(int s, struct ifreq *ifr, int verbose)
* this might happen in case of empty transceiver slot.
*/
id_byte = 0;
- read_i2c(&ii, SFF_8472_BASE, SFF_8472_ID, 1, (caddr_t)&id_byte);
+ ii.f(&ii, SFF_8472_BASE, SFF_8472_ID, 1, (caddr_t)&id_byte);
if (ii.error != 0 || id_byte == 0)
return;
diff --git a/sbin/ifconfig/tests/Makefile b/sbin/ifconfig/tests/Makefile
deleted file mode 100644
index 044e9792d352..000000000000
--- a/sbin/ifconfig/tests/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-# $FreeBSD$
-
-OBJTOP= ${.OBJDIR}/../../..
-SRCTOP= ${.CURDIR}/../../..
-TESTSRC= ${SRCTOP}/contrib/netbsd-tests/sbin/ifconfig
-
-TESTSDIR= ${TESTSBASE}/sbin/ifconfig
-
-NETBSD_ATF_TESTS_SH= nonexistent_test
-
-.include <netbsd-tests.test.mk>
-
-.include <bsd.test.mk>
diff --git a/sbin/init/Makefile b/sbin/init/Makefile
index 6e9c0fc99c67..7497a4b54fd7 100644
--- a/sbin/init/Makefile
+++ b/sbin/init/Makefile
@@ -6,7 +6,8 @@ MAN= init.8
PRECIOUSPROG=
INSTALLFLAGS=-b -B.bak
CFLAGS+=-DDEBUGSHELL -DSECURE -DLOGIN_CAP -DCOMPAT_SYSV_INIT
-LIBADD= util crypt
+DPADD= ${LIBUTIL} ${LIBCRYPT}
+LDADD= -lutil -lcrypt
NO_SHARED?= YES
diff --git a/sbin/init/Makefile.depend b/sbin/init/Makefile.depend
new file mode 100644
index 000000000000..1b2a0bde85e0
--- /dev/null
+++ b/sbin/init/Makefile.depend
@@ -0,0 +1,20 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libcrypt \
+ lib/libutil \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/ipf/Makefile.inc b/sbin/ipf/Makefile.inc
index 79bdb8e378db..2d7d7b1c71bf 100644
--- a/sbin/ipf/Makefile.inc
+++ b/sbin/ipf/Makefile.inc
@@ -18,7 +18,9 @@ CFLAGS+= -DUSE_INET6
CFLAGS+= -DNOINET6
.endif
-LIBADD+= ipf
+LIBIPF= ${.OBJDIR}/../libipf/libipf.a
+DPADD+= ${LIBIPF} ${LIBKVM}
+LDADD+= ${LIBIPF} -lkvm
CLEANFILES+= y.tab.c y.tab.h
diff --git a/sbin/ipf/ipf/Makefile b/sbin/ipf/ipf/Makefile
index 3ffd2b272489..c3938c63af61 100644
--- a/sbin/ipf/ipf/Makefile
+++ b/sbin/ipf/ipf/Makefile
@@ -35,7 +35,8 @@ ipf_l.h: lexer.h
LIBIPF_SRCS!= cd ${.CURDIR}/../libipf && ${MAKE} -V SRCS
SRCS+= ${LIBIPF_SRCS}
.else
-LIBADD+= pcap
+DPADD+= ${LIBPCAP}
+LDADD+= -lpcap
.endif
.include <bsd.prog.mk>
diff --git a/sbin/ipf/ipf/Makefile.depend b/sbin/ipf/ipf/Makefile.depend
new file mode 100644
index 000000000000..f781eb1d1370
--- /dev/null
+++ b/sbin/ipf/ipf/Makefile.depend
@@ -0,0 +1,33 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libkvm \
+ lib/libpcap \
+ sbin/ipf/libipf \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+ipf_l.o: ipf_l.c
+ipf_l.o: ipf_l.h
+ipf_l.o: ipf_y.h
+ipf_l.po: ipf_l.c
+ipf_l.po: ipf_l.h
+ipf_l.po: ipf_y.h
+ipf_y.o: ipf_l.h
+ipf_y.o: ipf_y.c
+ipf_y.po: ipf_l.h
+ipf_y.po: ipf_y.c
+.endif
diff --git a/sbin/ipf/ipfs/Makefile.depend b/sbin/ipf/ipfs/Makefile.depend
new file mode 100644
index 000000000000..c09695388eae
--- /dev/null
+++ b/sbin/ipf/ipfs/Makefile.depend
@@ -0,0 +1,22 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libkvm \
+ sbin/ipf/libipf \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/ipf/ipfstat/Makefile b/sbin/ipf/ipfstat/Makefile
index 14823cf5110c..a33c5df38d8f 100644
--- a/sbin/ipf/ipfstat/Makefile
+++ b/sbin/ipf/ipfstat/Makefile
@@ -5,6 +5,7 @@ NOGCCERROR= # defined
PROG= ipfstat
SRCS= ipfstat.c
MAN= ipfstat.8
-LIBADD+= ncursesw
+DPADD+= ${LIBCURSES}
+LDADD+= -lcurses
.include <bsd.prog.mk>
diff --git a/sbin/ipf/ipfstat/Makefile.depend b/sbin/ipf/ipfstat/Makefile.depend
new file mode 100644
index 000000000000..e2073f8e3ad0
--- /dev/null
+++ b/sbin/ipf/ipfstat/Makefile.depend
@@ -0,0 +1,24 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libkvm \
+ lib/ncurses/ncurses \
+ lib/ncurses/ncursesw \
+ sbin/ipf/libipf \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/ipf/ipftest/Makefile.depend b/sbin/ipf/ipftest/Makefile.depend
new file mode 100644
index 000000000000..0ba17cd30337
--- /dev/null
+++ b/sbin/ipf/ipftest/Makefile.depend
@@ -0,0 +1,52 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libkvm \
+ sbin/ipf/libipf \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+ipf_l.o: ipf_l.c
+ipf_l.o: ipf_l.h
+ipf_l.o: ipf_y.h
+ipf_l.po: ipf_l.c
+ipf_l.po: ipf_l.h
+ipf_l.po: ipf_y.h
+ipf_y.o: ipf_l.h
+ipf_y.o: ipf_y.c
+ipf_y.po: ipf_l.h
+ipf_y.po: ipf_y.c
+ipnat_l.o: ipnat_l.c
+ipnat_l.o: ipnat_l.h
+ipnat_l.o: ipnat_y.h
+ipnat_l.po: ipnat_l.c
+ipnat_l.po: ipnat_l.h
+ipnat_l.po: ipnat_y.h
+ipnat_y.o: ipnat_l.h
+ipnat_y.o: ipnat_y.c
+ipnat_y.po: ipnat_l.h
+ipnat_y.po: ipnat_y.c
+ippool_l.o: ippool_l.c
+ippool_l.o: ippool_l.h
+ippool_l.o: ippool_y.h
+ippool_l.po: ippool_l.c
+ippool_l.po: ippool_l.h
+ippool_l.po: ippool_y.h
+ippool_y.o: ippool_l.h
+ippool_y.o: ippool_y.c
+ippool_y.po: ippool_l.h
+ippool_y.po: ippool_y.c
+.endif
diff --git a/sbin/ipf/ipmon/Makefile.depend b/sbin/ipf/ipmon/Makefile.depend
new file mode 100644
index 000000000000..7f71b7a2971f
--- /dev/null
+++ b/sbin/ipf/ipmon/Makefile.depend
@@ -0,0 +1,32 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libkvm \
+ sbin/ipf/libipf \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+ipmon_l.o: ipmon_l.c
+ipmon_l.o: ipmon_l.h
+ipmon_l.o: ipmon_y.h
+ipmon_l.po: ipmon_l.c
+ipmon_l.po: ipmon_l.h
+ipmon_l.po: ipmon_y.h
+ipmon_y.o: ipmon_l.h
+ipmon_y.o: ipmon_y.c
+ipmon_y.po: ipmon_l.h
+ipmon_y.po: ipmon_y.c
+.endif
diff --git a/sbin/ipf/ipnat/Makefile.depend b/sbin/ipf/ipnat/Makefile.depend
new file mode 100644
index 000000000000..6ba8eba5c3c4
--- /dev/null
+++ b/sbin/ipf/ipnat/Makefile.depend
@@ -0,0 +1,32 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libkvm \
+ sbin/ipf/libipf \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+ipnat_l.o: ipnat_l.c
+ipnat_l.o: ipnat_l.h
+ipnat_l.o: ipnat_y.h
+ipnat_l.po: ipnat_l.c
+ipnat_l.po: ipnat_l.h
+ipnat_l.po: ipnat_y.h
+ipnat_y.o: ipnat_l.h
+ipnat_y.o: ipnat_y.c
+ipnat_y.po: ipnat_l.h
+ipnat_y.po: ipnat_y.c
+.endif
diff --git a/sbin/ipf/ippool/Makefile.depend b/sbin/ipf/ippool/Makefile.depend
new file mode 100644
index 000000000000..05af37b93c5e
--- /dev/null
+++ b/sbin/ipf/ippool/Makefile.depend
@@ -0,0 +1,32 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libkvm \
+ sbin/ipf/libipf \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+ippool_l.o: ippool_l.c
+ippool_l.o: ippool_l.h
+ippool_l.o: ippool_y.h
+ippool_l.po: ippool_l.c
+ippool_l.po: ippool_l.h
+ippool_l.po: ippool_y.h
+ippool_y.o: ippool_l.h
+ippool_y.o: ippool_y.c
+ippool_y.po: ippool_l.h
+ippool_y.po: ippool_y.c
+.endif
diff --git a/sbin/ipf/ipresend/Makefile.depend b/sbin/ipf/ipresend/Makefile.depend
new file mode 100644
index 000000000000..7499c73c3480
--- /dev/null
+++ b/sbin/ipf/ipresend/Makefile.depend
@@ -0,0 +1,23 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libkvm \
+ lib/msun \
+ sbin/ipf/libipf \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/ipf/ipsend/Makefile b/sbin/ipf/ipsend/Makefile
index 176cb106baff..4ae4c3441bbb 100644
--- a/sbin/ipf/ipsend/Makefile
+++ b/sbin/ipf/ipsend/Makefile
@@ -8,7 +8,8 @@ PROG= ipsend
SRCS= ipsend.c ip.c ipsopt.c iplang_y.c iplang_l.l sbpf.c \
sock.c 44arp.c
MAN= ipsend.1 ipsend.5
-LIBADD+= l
+DPADD+= ${LIBL}
+LDADD+= -ll
CFLAGS+= -I${NETBSDSRCDIR}/dist/ipf/ipsend
CFLAGS+= -I${NETBSDSRCDIR}/dist/ipf/iplang
diff --git a/sbin/ipf/libipf/Makefile.depend b/sbin/ipf/libipf/Makefile.depend
new file mode 100644
index 000000000000..06fce29bf119
--- /dev/null
+++ b/sbin/ipf/libipf/Makefile.depend
@@ -0,0 +1,16 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/libkvm \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/ipfw/Makefile b/sbin/ipfw/Makefile
index efd99fcdf316..9eb4511fb3c9 100644
--- a/sbin/ipfw/Makefile
+++ b/sbin/ipfw/Makefile
@@ -11,7 +11,8 @@ SRCS+= altq.c
CFLAGS+=-DPF
.endif
-LIBADD= util
+DPADD= ${LIBUTIL}
+LDADD= -lutil
MAN= ipfw.8
.include <bsd.prog.mk>
diff --git a/sbin/ipfw/Makefile.depend b/sbin/ipfw/Makefile.depend
new file mode 100644
index 000000000000..a4fcbf0bce75
--- /dev/null
+++ b/sbin/ipfw/Makefile.depend
@@ -0,0 +1,22 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libalias/libalias \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libutil \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/ipfw/ipfw.8 b/sbin/ipfw/ipfw.8
index 63f04cf96904..0c6edb2be3c2 100644
--- a/sbin/ipfw/ipfw.8
+++ b/sbin/ipfw/ipfw.8
@@ -1,7 +1,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd March 13, 2015
+.Dd Aug 13, 2014
.Dt IPFW 8
.Os
.Sh NAME
@@ -76,7 +76,7 @@ in-kernel NAT.
.Nm
.Oo Cm set Ar N Oc Cm table
.Brq Ar name | all
-.Cm info
+.Cm info
.Nm
.Oo Cm set Ar N Oc Cm table
.Brq Ar name | all
@@ -1642,6 +1642,7 @@ be specified as:
.Pp
Note that the ampersand character has a special meaning in many shells
and should generally be escaped.
+.Pp
.El
Note that the order of MAC addresses (destination first,
source second) is
@@ -1872,7 +1873,7 @@ addresses or other search keys (e.g., ports, jail IDs, interface names).
In the rest of this section we will use the term ``key''.
Table name needs to match the following spec:
.Ar table-name .
-Tables with the same name can be created in different
+Tables with the same name can be created in different
.Ar sets .
However, rule links to the tables in
.Ar set 0
@@ -1972,7 +1973,7 @@ command.
Addition of all items are performed atomically.
By default, error in addition of one entry does not influence
addition of other entries. However, non-zero error code is returned
-in that case.
+in that case.
Special
.Cm atomic
keyword may be specified before
@@ -1984,13 +1985,13 @@ One or more entries can be removed from a table at once using
command.
By default, error in removal of one entry does not influence
removing of other entries. However, non-zero error code is returned
-in that case.
+in that case.
.Pp
It may be possible to check what entry will be found on particular
.Ar table-key
using
.Cm lookup
-.Ar table-key
+.Ae table-key
command.
This functionality is optional and may be unsupported in some algorithms.
.Pp
@@ -2078,8 +2079,6 @@ hook number to move packet to.
maximum number of connections.
.It Cm ipv4
IPv4 nexthop to fwd packets to.
-.It Cm ipv6
-IPv6 nexthop to fwd packets to.
.El
.Pp
The
diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c
index 687d707195e6..2c9846628977 100644
--- a/sbin/ipfw/ipfw2.c
+++ b/sbin/ipfw/ipfw2.c
@@ -61,7 +61,6 @@ struct format_opts {
int bcwidth;
int pcwidth;
int show_counters;
- int show_time; /* show timestamp */
uint32_t set_mask; /* enabled sets mask */
uint32_t flags; /* request flags */
uint32_t first; /* first rule to request */
@@ -375,13 +374,6 @@ static int ipfw_show_config(struct cmdline_opts *co, struct format_opts *fo,
ipfw_cfg_lheader *cfg, size_t sz, int ac, char **av);
static void ipfw_list_tifaces(void);
-struct tidx;
-static uint16_t pack_object(struct tidx *tstate, char *name, int otype);
-static uint16_t pack_table(struct tidx *tstate, char *name);
-
-static char *table_search_ctlv(ipfw_obj_ctlv *ctlv, uint16_t idx);
-static void object_sort_ctlv(ipfw_obj_ctlv *ctlv);
-
/*
* Simple string buffer API.
* Used to simplify buffer passing between function and for
@@ -1532,14 +1524,11 @@ show_static_rule(struct cmdline_opts *co, struct format_opts *fo,
case O_FORWARD_IP6:
{
- char buf[INET6_ADDRSTRLEN + IF_NAMESIZE + 2];
+ char buf[4 + INET6_ADDRSTRLEN + 1];
ipfw_insn_sa6 *s = (ipfw_insn_sa6 *)cmd;
- bprintf(bp, "fwd ");
- if (getnameinfo((const struct sockaddr *)&s->sa,
- sizeof(struct sockaddr_in6), buf, sizeof(buf),
- NULL, 0, NI_NUMERICHOST) == 0)
- bprintf(bp, "%s", buf);
+ bprintf(bp, "fwd %s", inet_ntop(AF_INET6,
+ &s->sa.sin6_addr, buf, sizeof(buf)));
if (s->sa.sin6_port)
bprintf(bp, ",%d", s->sa.sin6_port);
}
@@ -2413,7 +2402,7 @@ list_static_range(struct cmdline_opts *co, struct format_opts *fo,
for (n = seen = 0; n < rcnt; n++,
rtlv = (ipfw_obj_tlv *)((caddr_t)rtlv + rtlv->length)) {
- if ((fo->show_counters | fo->show_time) != 0) {
+ if (fo->show_counters != 0) {
cntr = (struct ip_fw_bcounter *)(rtlv + 1);
r = (struct ip_fw_rule *)((caddr_t)cntr + cntr->size);
} else {
@@ -2515,11 +2504,10 @@ ipfw_list(int ac, char *av[], int show_counters)
/* get configuraion from kernel */
cfg = NULL;
sfo.show_counters = show_counters;
- sfo.show_time = co.do_time;
sfo.flags = IPFW_CFG_GET_STATIC;
if (co.do_dynamic != 0)
sfo.flags |= IPFW_CFG_GET_STATES;
- if ((sfo.show_counters | sfo.show_time) != 0)
+ if (sfo.show_counters != 0)
sfo.flags |= IPFW_CFG_GET_COUNTERS;
if (ipfw_get_config(&co, &sfo, &cfg, &sz) != 0)
err(EX_OSERR, "retrieving config failed");
@@ -2565,7 +2553,6 @@ ipfw_show_config(struct cmdline_opts *co, struct format_opts *fo,
if (cfg->flags & IPFW_CFG_GET_STATIC) {
/* We've requested static rules */
if (ctlv->head.type == IPFW_TLV_TBLNAME_LIST) {
- object_sort_ctlv(ctlv);
fo->tstate = ctlv;
readsz += ctlv->head.length;
ctlv = (ipfw_obj_ctlv *)((caddr_t)ctlv +
@@ -2732,18 +2719,19 @@ struct tidx {
};
static uint16_t
-pack_object(struct tidx *tstate, char *name, int otype)
+pack_table(struct tidx *tstate, char *name)
{
int i;
ipfw_obj_ntlv *ntlv;
+ if (table_check_name(name) != 0)
+ return (0);
+
for (i = 0; i < tstate->count; i++) {
if (strcmp(tstate->idx[i].name, name) != 0)
continue;
if (tstate->idx[i].set != tstate->set)
continue;
- if (tstate->idx[i].head.type != otype)
- continue;
return (tstate->idx[i].idx);
}
@@ -2759,7 +2747,7 @@ pack_object(struct tidx *tstate, char *name, int otype)
ntlv = &tstate->idx[i];
memset(ntlv, 0, sizeof(ipfw_obj_ntlv));
strlcpy(ntlv->name, name, sizeof(ntlv->name));
- ntlv->head.type = otype;
+ ntlv->head.type = IPFW_TLV_TBL_NAME;
ntlv->head.length = sizeof(ipfw_obj_ntlv);
ntlv->set = tstate->set;
ntlv->idx = ++tstate->counter;
@@ -2768,16 +2756,6 @@ pack_object(struct tidx *tstate, char *name, int otype)
return (ntlv->idx);
}
-static uint16_t
-pack_table(struct tidx *tstate, char *name)
-{
-
- if (table_check_name(name) != 0)
- return (0);
-
- return (pack_object(tstate, name, IPFW_TLV_TBL_NAME));
-}
-
static void
fill_table(ipfw_insn *cmd, char *av, uint8_t opcode, struct tidx *tstate)
{
@@ -3628,6 +3606,7 @@ compile_rule(char *av[], uint32_t *rbuf, int *rbufsize, struct tidx *tstate)
break;
} else
goto chkarg;
+
case TOK_QUEUE:
action->opcode = O_QUEUE;
goto chkarg;
@@ -3760,8 +3739,8 @@ chkarg:
p->sa.sin6_family = AF_INET6;
p->sa.sin6_port = port_number;
p->sa.sin6_flowinfo = 0;
- p->sa.sin6_scope_id =
- ((struct sockaddr_in6 *)&result)->sin6_scope_id;
+ p->sa.sin6_scope_id = 0;
+ /* No table support for v6 yet. */
bcopy(&((struct sockaddr_in6*)&result)->sin6_addr,
&p->sa.sin6_addr, sizeof(p->sa.sin6_addr));
} else {
@@ -4672,101 +4651,6 @@ done:
*rbufsize = (char *)dst - (char *)rule;
}
-static int
-compare_ntlv(const void *_a, const void *_b)
-{
- ipfw_obj_ntlv *a, *b;
-
- a = (ipfw_obj_ntlv *)_a;
- b = (ipfw_obj_ntlv *)_b;
-
- if (a->set < b->set)
- return (-1);
- else if (a->set > b->set)
- return (1);
-
- if (a->idx < b->idx)
- return (-1);
- else if (a->idx > b->idx)
- return (1);
-
- if (a->head.type < b->head.type)
- return (-1);
- else if (a->head.type > b->head.type)
- return (1);
-
- return (0);
-}
-
-/*
- * Provide kernel with sorted list of referenced objects
- */
-static void
-object_sort_ctlv(ipfw_obj_ctlv *ctlv)
-{
-
- qsort(ctlv + 1, ctlv->count, ctlv->objsize, compare_ntlv);
-}
-
-struct object_kt {
- uint16_t uidx;
- uint16_t type;
-};
-static int
-compare_object_kntlv(const void *k, const void *v)
-{
- ipfw_obj_ntlv *ntlv;
- struct object_kt key;
-
- key = *((struct object_kt *)k);
- ntlv = (ipfw_obj_ntlv *)v;
-
- if (key.uidx < ntlv->idx)
- return (-1);
- else if (key.uidx > ntlv->idx)
- return (1);
-
- if (key.type < ntlv->head.type)
- return (-1);
- else if (key.type > ntlv->head.type)
- return (1);
-
- return (0);
-}
-
-/*
- * Finds object name in @ctlv by @idx and @type.
- * Uses the following facts:
- * 1) All TLVs are the same size
- * 2) Kernel implementation provides already sorted list.
- *
- * Returns table name or NULL.
- */
-static char *
-object_search_ctlv(ipfw_obj_ctlv *ctlv, uint16_t idx, uint16_t type)
-{
- ipfw_obj_ntlv *ntlv;
- struct object_kt key;
-
- key.uidx = idx;
- key.type = type;
-
- ntlv = bsearch(&key, (ctlv + 1), ctlv->count, ctlv->objsize,
- compare_object_kntlv);
-
- if (ntlv != 0)
- return (ntlv->name);
-
- return (NULL);
-}
-
-static char *
-table_search_ctlv(ipfw_obj_ctlv *ctlv, uint16_t idx)
-{
-
- return (object_search_ctlv(ctlv, idx, IPFW_TLV_TBL_NAME));
-}
-
/*
* Adds one or more rules to ipfw chain.
* Data layout:
@@ -4835,7 +4719,7 @@ ipfw_add(char *av[])
ctlv->count = ts.count;
ctlv->objsize = sizeof(ipfw_obj_ntlv);
memcpy(ctlv + 1, ts.idx, tlen);
- object_sort_ctlv(ctlv);
+ table_sort_ctlv(ctlv);
tstate = ctlv;
/* Rule next */
ctlv = (ipfw_obj_ctlv *)((caddr_t)ctlv + ctlv->head.length);
diff --git a/sbin/ipfw/ipfw2.h b/sbin/ipfw/ipfw2.h
index 5a083216d53b..80970ef0deee 100644
--- a/sbin/ipfw/ipfw2.h
+++ b/sbin/ipfw/ipfw2.h
@@ -344,6 +344,8 @@ int fill_ext6hdr(struct _ipfw_insn *cmd, char *av);
/* tables.c */
struct _ipfw_obj_ctlv;
+char *table_search_ctlv(struct _ipfw_obj_ctlv *ctlv, uint16_t idx);
+void table_sort_ctlv(struct _ipfw_obj_ctlv *ctlv);
int table_check_name(char *tablename);
void ipfw_list_ta(int ac, char *av[]);
void ipfw_list_values(int ac, char *av[]);
diff --git a/sbin/ipfw/nat.c b/sbin/ipfw/nat.c
index 184b17215fb8..3bd0259ad5ad 100644
--- a/sbin/ipfw/nat.c
+++ b/sbin/ipfw/nat.c
@@ -163,9 +163,9 @@ set_addr_dynamic(const char *ifn, struct nat44_cfg_nat *n)
}
}
if (sin == NULL)
- n->ip.s_addr = htonl(INADDR_ANY);
- else
- n->ip = sin->sin_addr;
+ errx(1, "%s: cannot get interface address", ifn);
+
+ n->ip = sin->sin_addr;
strncpy(n->if_name, ifn, IF_NAMESIZE);
free(buf);
@@ -1008,10 +1008,11 @@ nat_foreach(nat_cb_t *f, void *arg, int sort)
olh->size = sz;
if (do_get3(IP_FW_NAT44_LIST_NAT, &olh->opheader, &sz) != 0) {
- sz = olh->size;
free(olh);
- if (errno == ENOMEM)
+ if (errno == ENOMEM) {
+ sz = olh->size;
continue;
+ }
return (errno);
}
diff --git a/sbin/ipfw/tables.c b/sbin/ipfw/tables.c
index b3473fc15575..4829fecdc417 100644
--- a/sbin/ipfw/tables.c
+++ b/sbin/ipfw/tables.c
@@ -35,7 +35,6 @@
#include <netinet/in.h>
#include <netinet/ip_fw.h>
#include <arpa/inet.h>
-#include <netdb.h>
#include "ipfw2.h"
@@ -715,7 +714,6 @@ table_print_valheader(char *buf, size_t bufsize, uint32_t vmask)
return;
}
- memset(buf, 0, bufsize);
print_flags_buffer(buf, bufsize, tablevaltypes, vmask);
}
@@ -1310,63 +1308,6 @@ tentry_fill_key_type(char *arg, ipfw_obj_tentry *tentry, uint8_t type,
tentry->masklen = masklen;
}
-/*
- * Tries to guess table key type.
- * This procedure is used in legacy table auto-create
- * code AND in `ipfw -n` ruleset checking.
- *
- * Imported from old table_fill_xentry() parse code.
- */
-static int
-guess_key_type(char *key, uint8_t *ptype)
-{
- char *p;
- struct in6_addr addr;
- uint32_t kv;
-
- if (ishexnumber(*key) != 0 || *key == ':') {
- /* Remove / if exists */
- if ((p = strchr(key, '/')) != NULL)
- *p = '\0';
-
- if ((inet_pton(AF_INET, key, &addr) == 1) ||
- (inet_pton(AF_INET6, key, &addr) == 1)) {
- *ptype = IPFW_TABLE_CIDR;
- if (p != NULL)
- *p = '/';
- return (0);
- } else {
- /* Port or any other key */
- /* Skip non-base 10 entries like 'fa1' */
- kv = strtol(key, &p, 10);
- if (*p == '\0') {
- *ptype = IPFW_TABLE_NUMBER;
- return (0);
- } else if ((p != key) && (*p == '.')) {
- /*
- * Warn on IPv4 address strings
- * which are "valid" for inet_aton() but not
- * in inet_pton().
- *
- * Typical examples: '10.5' or '10.0.0.05'
- */
- return (1);
- }
- }
- }
-
- if (strchr(key, '.') == NULL) {
- *ptype = IPFW_TABLE_INTERFACE;
- return (0);
- }
-
- if (lookup_host(key, (struct in_addr *)&addr) != 0)
- return (1);
-
- *ptype = IPFW_TABLE_CIDR;
- return (0);
-}
-
static void
tentry_fill_key(ipfw_obj_header *oh, ipfw_obj_tentry *tent, char *key,
int add, uint8_t *ptype, uint32_t *pvmask, ipfw_xtable_info *xi)
@@ -1374,6 +1315,7 @@ tentry_fill_key(ipfw_obj_header *oh, ipfw_obj_tentry *tent, char *key,
uint8_t type, tflags;
uint32_t vmask;
int error;
+ char *del;
type = 0;
tflags = 0;
@@ -1385,24 +1327,10 @@ tentry_fill_key(ipfw_obj_header *oh, ipfw_obj_tentry *tent, char *key,
error = 0;
if (error == 0) {
- if (co.test_only == 0) {
- /* Table found */
- type = xi->type;
- tflags = xi->tflags;
- vmask = xi->vmask;
- } else {
- /*
- * we're running `ipfw -n`
- * Compability layer: try to guess key type
- * before failing.
- */
- if (guess_key_type(key, &type) != 0) {
- /* Inknown key */
- errx(EX_USAGE, "Cannot guess "
- "key '%s' type", key);
- }
- vmask = IPFW_VTYPE_LEGACY;
- }
+ /* Table found. */
+ type = xi->type;
+ tflags = xi->tflags;
+ vmask = xi->vmask;
} else {
if (error != ESRCH)
errx(EX_OSERR, "Error requesting table %s info",
@@ -1411,16 +1339,24 @@ tentry_fill_key(ipfw_obj_header *oh, ipfw_obj_tentry *tent, char *key,
errx(EX_DATAERR, "Table %s does not exist",
oh->ntlv.name);
/*
- * Table does not exist
- * Compability layer: try to guess key type before failing.
+ * Table does not exist.
+ * Compability layer: try to interpret data as ADDR
+ * before failing.
*/
- if (guess_key_type(key, &type) != 0) {
+ if ((del = strchr(key, '/')) != NULL)
+ *del = '\0';
+ if (inet_pton(AF_INET, key, &tent->k.addr6) == 1 ||
+ inet_pton(AF_INET6, key, &tent->k.addr6) == 1) {
+ /* OK Prepare and send */
+ type = IPFW_TABLE_ADDR;
+ vmask = IPFW_VTYPE_LEGACY;
+ } else {
/* Inknown key */
errx(EX_USAGE, "Table %s does not exist, cannot guess "
"key '%s' type", oh->ntlv.name, key);
}
-
- vmask = IPFW_VTYPE_LEGACY;
+ if (del != NULL)
+ *del = '/';
}
tentry_fill_key_type(key, tent, type, tflags);
@@ -1448,7 +1384,6 @@ static void
tentry_fill_value(ipfw_obj_header *oh, ipfw_obj_tentry *tent, char *arg,
uint8_t type, uint32_t vmask)
{
- struct addrinfo hints, *res;
uint32_t a4, flag, val, vm;
ipfw_table_value *v;
uint32_t i;
@@ -1559,19 +1494,9 @@ tentry_fill_value(ipfw_obj_header *oh, ipfw_obj_tentry *tent, char *arg,
}
break;
case IPFW_VTYPE_NH6:
- if (strchr(n, ':') != NULL) {
- memset(&hints, 0, sizeof(hints));
- hints.ai_family = AF_INET6;
- hints.ai_flags = AI_NUMERICHOST;
- if (getaddrinfo(n, NULL, &hints, &res) == 0) {
- v->nh6 = ((struct sockaddr_in6 *)
- res->ai_addr)->sin6_addr;
- v->zoneid = ((struct sockaddr_in6 *)
- res->ai_addr)->sin6_scope_id;
- freeaddrinfo(res);
- break;
- }
- }
+ if (strchr(n, ':') != NULL &&
+ inet_pton(AF_INET6, n, &v->nh6) == 1)
+ break;
etype = "ipv6";
break;
}
@@ -1718,11 +1643,10 @@ static void
table_show_value(char *buf, size_t bufsize, ipfw_table_value *v,
uint32_t vmask, int print_ip)
{
- char abuf[INET6_ADDRSTRLEN + IF_NAMESIZE + 2];
- struct sockaddr_in6 sa6;
uint32_t flag, i, l;
size_t sz;
struct in_addr a4;
+ char abuf[INET6_ADDRSTRLEN];
sz = bufsize;
@@ -1778,15 +1702,8 @@ table_show_value(char *buf, size_t bufsize, ipfw_table_value *v,
l = snprintf(buf, sz, "%d,", v->dscp);
break;
case IPFW_VTYPE_NH6:
- sa6.sin6_family = AF_INET6;
- sa6.sin6_len = sizeof(sa6);
- sa6.sin6_addr = v->nh6;
- sa6.sin6_port = 0;
- sa6.sin6_scope_id = v->zoneid;
- if (getnameinfo((const struct sockaddr *)&sa6,
- sa6.sin6_len, abuf, sizeof(abuf), NULL, 0,
- NI_NUMERICHOST) == 0)
- l = snprintf(buf, sz, "%s,", abuf);
+ inet_ntop(AF_INET6, &v->nh6, abuf, sizeof(abuf));
+ l = snprintf(buf, sz, "%s,", abuf);
break;
}
@@ -1945,12 +1862,11 @@ struct _table_value {
uint32_t nat; /* O_NAT */
uint32_t nh4;
uint8_t dscp;
- uint8_t spare0;
- uint16_t spare1;
+ uint8_t spare0[3];
/* -- 32 bytes -- */
struct in6_addr nh6;
uint32_t limit; /* O_LIMIT */
- uint32_t zoneid;
+ uint32_t spare1;
uint64_t refcnt; /* Number of references */
};
@@ -2000,6 +1916,73 @@ ipfw_list_values(int ac, char *av[])
}
int
+compare_ntlv(const void *_a, const void *_b)
+{
+ ipfw_obj_ntlv *a, *b;
+
+ a = (ipfw_obj_ntlv *)_a;
+ b = (ipfw_obj_ntlv *)_b;
+
+ if (a->set < b->set)
+ return (-1);
+ else if (a->set > b->set)
+ return (1);
+
+ if (a->idx < b->idx)
+ return (-1);
+ else if (a->idx > b->idx)
+ return (1);
+
+ return (0);
+}
+
+int
+compare_kntlv(const void *k, const void *v)
+{
+ ipfw_obj_ntlv *ntlv;
+ uint16_t key;
+
+ key = *((uint16_t *)k);
+ ntlv = (ipfw_obj_ntlv *)v;
+
+ if (key < ntlv->idx)
+ return (-1);
+ else if (key > ntlv->idx)
+ return (1);
+
+ return (0);
+}
+
+/*
+ * Finds table name in @ctlv by @idx.
+ * Uses the following facts:
+ * 1) All TLVs are the same size
+ * 2) Kernel implementation provides already sorted list.
+ *
+ * Returns table name or NULL.
+ */
+char *
+table_search_ctlv(ipfw_obj_ctlv *ctlv, uint16_t idx)
+{
+ ipfw_obj_ntlv *ntlv;
+
+ ntlv = bsearch(&idx, (ctlv + 1), ctlv->count, ctlv->objsize,
+ compare_kntlv);
+
+ if (ntlv != 0)
+ return (ntlv->name);
+
+ return (NULL);
+}
+
+void
+table_sort_ctlv(ipfw_obj_ctlv *ctlv)
+{
+
+ qsort(ctlv + 1, ctlv->count, ctlv->objsize, compare_ntlv);
+}
+
+int
table_check_name(char *tablename)
{
int c, i, l;
diff --git a/sbin/iscontrol/Makefile b/sbin/iscontrol/Makefile
index 9c4d9f4fff58..9bdc29bc5b70 100644
--- a/sbin/iscontrol/Makefile
+++ b/sbin/iscontrol/Makefile
@@ -2,12 +2,13 @@
SRCS= iscontrol.c pdu.c fsm.c config.c login.c auth_subr.c misc.c
PROG= iscontrol
-LIBADD= cam md
+DPADD= ${LIBCAM} ${LIBMD}
+LDADD= -lcam -lmd
S= ${.CURDIR}/../../sys
WARNS?= 3
CFLAGS+= -I$S
-MAN= iscontrol.8
+MAN= iscsi.conf.5 iscontrol.8
.include <bsd.prog.mk>
diff --git a/sbin/iscontrol/Makefile.depend b/sbin/iscontrol/Makefile.depend
new file mode 100644
index 000000000000..bf26a6c27532
--- /dev/null
+++ b/sbin/iscontrol/Makefile.depend
@@ -0,0 +1,23 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcam \
+ lib/libcompiler_rt \
+ lib/libmd \
+ lib/libsbuf \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/iscontrol/iscontrol.8 b/sbin/iscontrol/iscontrol.8
index 36e0c471289f..eee877653a12 100644
--- a/sbin/iscontrol/iscontrol.8
+++ b/sbin/iscontrol/iscontrol.8
@@ -43,7 +43,7 @@
.Sh DESCRIPTION
.Bf -symbolic
This command, along with its kernel counterpart
-.Xr iscsi_initiator 4 ,
+.Xr iscsi_initiator 4 ,
is obsolete.
Users are advised to use
.Xr iscsictl 8
@@ -121,8 +121,8 @@ whatever options are specified, and start an iscsi-session.
.Xr iscsi_initiator 4 ,
.Xr sa 4 ,
.Xr iscsi.conf 5 ,
-.Xr camcontrol 8 ,
-.Xr iscsictl 8
+.Xr iscsictl 8 ,
+.Xr camcontrol 8
.Sh STANDARDS
RFC 3720
.\"Sh HISTORY
diff --git a/sbin/iscontrol/iscsi.conf.5 b/sbin/iscontrol/iscsi.conf.5
new file mode 100644
index 000000000000..2e7a68dc6476
--- /dev/null
+++ b/sbin/iscontrol/iscsi.conf.5
@@ -0,0 +1,188 @@
+.\" Copyright (c) 2007-2010 Daniel Braniss <danny@cs.huji.ac.il>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 17, 2013
+.Dt ISCSI.CONF 5
+.Os
+.Sh NAME
+.Nm iscsi.conf
+.Nd iSCSI initiator configuration file
+.Sh DESCRIPTION
+The file
+.Nm ,
+is used by the
+.Xr iscsictl 8
+and
+.Xr iscontrol 8
+utilities.
+It contains declarations and parameter/key-options.
+The syntax is very simple,
+.D1 Li variable = value;
+and they can be grouped via a
+.Em block
+declaration:
+.Bf Li
+.Bd -literal
+ # this is a comment
+ target_1 { # nickname
+ variable = value;
+ ...
+ } # this must be on a line by itself.
+.Ed
+.Ef
+.Pp
+The following are specified in the iSCSI RFC 3720,
+for a full description see sections 11/12 of the RFC.
+.Bl -tag -width MaxConnections
+.It Cm AuthMethod
+currently only supported authentication method is CHAP, with
+digest either MD5 or SHA.
+Default is none.
+.It Cm HeaderDigest
+a
+.Em digest
+is calculated on the header of all iSCSI PDUs, and
+checked.
+Only CRC32C is implemented.
+Default is none.
+.It Cm DataDigest
+same as for HeaderDigest, but on the data part of the iSCSI PDU.
+(not yet tested)
+.It Cm TargetName
+is the name by which the target is known, not to be confused with
+target address, either obtained via the target administrator, or
+from a
+.Em discovery session .
+.It Cm InitiatorName
+if not specified, defaults to
+.Sy iqn.2005-01.il.ac.huji.cs:
+.Aq hostname .
+.It Cm TargetAddress
+is of the form
+.Sy domainname[:port][,portal-group-tag]
+to quote the RFC:
+.Bd -ragged -compact
+The domainname can be specified as either a DNS host name, a
+dotted-decimal IPv4 address, or a bracketed IPv6 address as specified
+in [RFC2732].
+.Ed
+Note: portal-group-tag is unused at the moment.
+.Em not implemented yet.
+.It Cm MaxRecvDataSegmentLength
+the maximum data segment length in
+bytes it can receive in an iSCSI PDU, default is 8192.
+.It Cm MaxOutstandingR2T
+is used to calculate/negotiate the
+.Em tag opening ,
+can be overridden by the
+.Sy tag
+option.
+.It Cm SessionType
+either Discovery or Normal, default is Normal, see the
+.Fl d
+flag of
+.Cm iscontrol .
+.El
+.sp
+The following are not specified in the
+.Sy RFC 3720
+.Bl -tag -width sockbufsize
+.It Cm port
+The iSCSI port used by the iSCSI protocol, defaults to 3260.
+.It Cm tags
+Sets the
+.Em tag opening
+to the value specified.
+.It Cm maxluns
+overrides the compiled value of
+.Sy luns ,
+see
+.Xr iscsi_initiator 4 .
+This value can only be reduced.
+.It Cm sockbufsize
+sets the receiver and transmitter socket buffer size to
+.Em size ,
+in kilobytes.
+The default is 128.
+.El
+.sp
+If
+.Em AuthMethod
+is set to
+.Cm CHAP ,
+then the following must also be set:
+.Bl -tag -width chapSecret
+.It Cm chapSecret
+this
+.Em shared-secret .
+Can be either an ASCII string (e.g. hello world), a hex string (e.g
+0xababcd0987654321...), or base64 string (eg 0b...)
+.It Cm chapIName
+the chap-name, defaults to
+.Em hostname .
+.It Cm chapDigest
+can be MD5 or SHA1.
+.It Cm tgtChapName/tgtChapSecret
+name and secret used for mutual CHAP; by default, mutual CHAP
+is not used.
+.El
+.Sh FILES
+.Bl -tag -width indent
+.It Pa /etc/iscsi.conf
+.El
+.Sh EXAMPLES
+.Bd -literal
+#
+# Globals
+#
+port = 3260
+#
+myiscsi { # nickname
+ targetaddress = iscsi1
+ targetname = iqn.1900.com.com:sn.123456
+}
+chaptest {
+ targetaddress= 10.0.0.1;
+ targetname = iqn.1900.com.com:sn.123456
+ initiatorname= iqn.2005-01.il.ac.huji.cs:nobody
+ authmethod = CHAP; chapDigest = SHA1;
+ chapsecret = 0x3713c3336d9a224c2791c873d3d2b174
+ tags = 256
+}
+.Ed
+.Sh SEE ALSO
+.Xr iscsi_initiator 4 ,
+.Xr iscsictl 8 ,
+.Xr iscontrol 8
+.Sh STANDARDS
+ISCSI RFC 3720
+.\"Sh HISTORY
+.\"Sh AUTHORS
+.Sh BUGS
+Some options have not been implemented, either they were found
+to be unnecessary, or not understood, this can change in the future.
+.br
+The tags opening value is difficult to calculate, use wisely.
diff --git a/sbin/kldconfig/Makefile.depend b/sbin/kldconfig/Makefile.depend
new file mode 100644
index 000000000000..96aa2a21a959
--- /dev/null
+++ b/sbin/kldconfig/Makefile.depend
@@ -0,0 +1,19 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/kldload/Makefile.depend b/sbin/kldload/Makefile.depend
new file mode 100644
index 000000000000..96aa2a21a959
--- /dev/null
+++ b/sbin/kldload/Makefile.depend
@@ -0,0 +1,19 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/kldstat/Makefile.depend b/sbin/kldstat/Makefile.depend
new file mode 100644
index 000000000000..2d9ec507cd13
--- /dev/null
+++ b/sbin/kldstat/Makefile.depend
@@ -0,0 +1,18 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/kldunload/Makefile.depend b/sbin/kldunload/Makefile.depend
new file mode 100644
index 000000000000..2d9ec507cd13
--- /dev/null
+++ b/sbin/kldunload/Makefile.depend
@@ -0,0 +1,18 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/ldconfig/Makefile.depend b/sbin/ldconfig/Makefile.depend
new file mode 100644
index 000000000000..96aa2a21a959
--- /dev/null
+++ b/sbin/ldconfig/Makefile.depend
@@ -0,0 +1,19 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/mca/Makefile b/sbin/mca/Makefile
new file mode 100644
index 000000000000..261672578a73
--- /dev/null
+++ b/sbin/mca/Makefile
@@ -0,0 +1,5 @@
+# $FreeBSD$
+PROG= mca
+MAN= mca.8
+
+.include <bsd.prog.mk>
diff --git a/sbin/mca/Makefile.depend b/sbin/mca/Makefile.depend
new file mode 100644
index 000000000000..a83954553d0e
--- /dev/null
+++ b/sbin/mca/Makefile.depend
@@ -0,0 +1,19 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DEP_MACHINE := ${.PARSEFILE:E}
+
+DIRDEPS = \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/mca/mca.8 b/sbin/mca/mca.8
new file mode 100644
index 000000000000..e654d3676173
--- /dev/null
+++ b/sbin/mca/mca.8
@@ -0,0 +1,73 @@
+.\" Copyright (c) 2006 Marcel Moolenaar
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\"
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 11, 2006
+.Dt MCA 8
+.Os
+.Sh NAME
+.Nm mca
+.Nd "Machine Check Architecture control utility"
+.Sh SYNOPSIS
+.Nm
+.Op Fl d
+.Op Fl f Ar filename
+.Sh DESCRIPTION
+The
+.Nm
+utility provides minimal functionality to dump or display MCA records
+that were saved by the kernel during boot.
+The default behaviour of the
+.Nm
+utility is to display all new MCA records on stdout.
+When the
+.Fl d
+option is given, the records are dumped in binary form.
+The default file to which records are dumped is
+.Pa /var/log/mca.log .
+This can be changed by specifying the
+.Fl f
+option.
+New records are appended to the dump file.
+.Pp
+Previously dumped records can be displayed by giving the name of
+the dump file with the
+.Fl f
+option.
+.Sh FILES
+.Bl -tag -width ".Pa /var/log/mca.log" -compact
+.It Pa /var/log/mca.log
+default dump file
+.El
+.Sh HISTORY
+The
+.Nm
+utility appeared in
+.Fx 5.0
+for ia64.
+.Sh BUGS
+The development of the
+.Nm
+utility is still a work in progress.
diff --git a/sbin/mca/mca.c b/sbin/mca/mca.c
new file mode 100644
index 000000000000..ed7bcff5fcc9
--- /dev/null
+++ b/sbin/mca/mca.c
@@ -0,0 +1,547 @@
+/*
+ * Copyright (c) 2002 Marcel Moolenaar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <sys/sysctl.h>
+#include <sys/uuid.h>
+
+/*
+ * Hack to make this compile on non-ia64 machines.
+ */
+#ifdef __ia64__
+#include <machine/mca.h>
+#else
+#include "../../sys/ia64/include/mca.h"
+#endif
+
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <uuid.h>
+
+#define BCD(x) ((x >> 4) * 10 + (x & 15))
+
+#define HW_MCA_MAX_CPUID 255
+
+static const char hw_mca_count[] = "hw.mca.count";
+static const char hw_mca_first[] = "hw.mca.first";
+static const char hw_mca_last[] = "hw.mca.last";
+static const char hw_mca_recid[] = "hw.mca.%d.%u";
+
+static char default_dumpfile[] = "/var/log/mca.log";
+
+int fl_dump;
+char *file;
+
+static const char *
+severity(int error)
+{
+
+ switch (error) {
+ case MCA_RH_ERROR_RECOVERABLE:
+ return ("recoverable");
+ case MCA_RH_ERROR_FATAL:
+ return ("fatal");
+ case MCA_RH_ERROR_CORRECTED:
+ return ("corrected");
+ }
+
+ return ("unknown");
+}
+
+static const char *
+uuid(uuid_t *id)
+{
+ static char buffer[64];
+ char *s;
+
+ uuid_to_string(id, &s, NULL);
+ strcpy(buffer, s);
+ free(s);
+ return (buffer);
+}
+
+static int
+show_value(int indent, const char *var, const char *fmt, ...)
+{
+ va_list ap;
+ int len;
+
+ len = indent;
+ while (indent--)
+ putchar(' ');
+ len += printf("<%s>", var);
+ va_start(ap, fmt);
+ len += vprintf(fmt, ap);
+ len += printf("</%s>\n", var);
+ return (len);
+}
+
+static size_t
+show_header(struct mca_record_header *rh)
+{
+
+ printf(" <header>\n");
+ show_value(4, "seqnr", "%lld", (long long)rh->rh_seqnr);
+ show_value(4, "revision", "%d.%d", BCD(rh->rh_major),
+ BCD(rh->rh_minor));
+ show_value(4, "severity", "%s", severity(rh->rh_error));
+ show_value(4, "length", "%lld", (long long)rh->rh_length);
+ show_value(4, "date", "%d%02d/%02d/%02d",
+ BCD(rh->rh_time[MCA_RH_TIME_CENT]),
+ BCD(rh->rh_time[MCA_RH_TIME_YEAR]),
+ BCD(rh->rh_time[MCA_RH_TIME_MON]),
+ BCD(rh->rh_time[MCA_RH_TIME_MDAY]));
+ show_value(4, "time", "%02d:%02d:%02d",
+ BCD(rh->rh_time[MCA_RH_TIME_HOUR]),
+ BCD(rh->rh_time[MCA_RH_TIME_MIN]),
+ BCD(rh->rh_time[MCA_RH_TIME_SEC]));
+ if (rh->rh_flags & MCA_RH_FLAGS_PLATFORM_ID)
+ show_value(4, "platform", "%s", uuid(&rh->rh_platform));
+ printf(" </header>\n");
+ return (rh->rh_length);
+}
+
+static void
+show_cpu_mod(const char *what, int idx, struct mca_cpu_mod *cpu_mod)
+{
+ printf(" <%s-%d>\n", what, idx);
+ if (cpu_mod->cpu_mod_flags & MCA_CPU_MOD_FLAGS_INFO)
+ show_value(8, "info", "0x%016llx",
+ (long long)cpu_mod->cpu_mod_info);
+ if (cpu_mod->cpu_mod_flags & MCA_CPU_MOD_FLAGS_REQID)
+ show_value(8, "requester", "0x%016llx",
+ (long long)cpu_mod->cpu_mod_reqid);
+ if (cpu_mod->cpu_mod_flags & MCA_CPU_MOD_FLAGS_RSPID)
+ show_value(8, "responder", "0x%016llx",
+ (long long)cpu_mod->cpu_mod_rspid);
+ if (cpu_mod->cpu_mod_flags & MCA_CPU_MOD_FLAGS_TGTID)
+ show_value(8, "target", "0x%016llx",
+ (long long)cpu_mod->cpu_mod_tgtid);
+ if (cpu_mod->cpu_mod_flags & MCA_CPU_MOD_FLAGS_IP)
+ show_value(8, "ip", "0x%016llx",
+ (long long)cpu_mod->cpu_mod_ip);
+ printf(" </%s-%d>\n", what, idx);
+}
+
+static void
+show_cpu(struct mca_cpu_record *cpu)
+{
+ char var[16];
+ struct mca_cpu_mod *mod;
+ struct mca_cpu_cpuid *cpuid;
+#ifdef notyet
+ struct mca_cpu_psi *psi;
+#endif
+ int i, n;
+
+ printf(" <cpu>\n");
+
+ if (cpu->cpu_flags & MCA_CPU_FLAGS_ERRMAP)
+ show_value(6, "errmap", "0x%016llx",
+ (long long)cpu->cpu_errmap);
+ if (cpu->cpu_flags & MCA_CPU_FLAGS_STATE)
+ show_value(6, "state", "0x%016llx",
+ (long long)cpu->cpu_state);
+ if (cpu->cpu_flags & MCA_CPU_FLAGS_CR_LID)
+ show_value(6, "cr_lid", "0x%016llx",
+ (long long)cpu->cpu_cr_lid);
+
+ mod = (struct mca_cpu_mod*)(cpu + 1);
+ n = MCA_CPU_FLAGS_CACHE(cpu->cpu_flags);
+ for (i = 0; i < n; i++)
+ show_cpu_mod("cache", i, mod++);
+ n = MCA_CPU_FLAGS_TLB(cpu->cpu_flags);
+ for (i = 0; i < n; i++)
+ show_cpu_mod("tlb", i, mod++);
+ n = MCA_CPU_FLAGS_BUS(cpu->cpu_flags);
+ for (i = 0; i < n; i++)
+ show_cpu_mod("bus", i, mod++);
+ n = MCA_CPU_FLAGS_REG(cpu->cpu_flags);
+ for (i = 0; i < n; i++)
+ show_cpu_mod("reg", i, mod++);
+ n = MCA_CPU_FLAGS_MS(cpu->cpu_flags);
+ for (i = 0; i < n; i++)
+ show_cpu_mod("ms", i, mod++);
+
+ cpuid = (struct mca_cpu_cpuid*)mod;
+ for (i = 0; i < 6; i++) {
+ sprintf(var, "cpuid-%d", i);
+ show_value(6, var, "0x%016llx", (long long)cpuid->cpuid[i]);
+ }
+
+#ifdef notyet
+ psi = (struct mca_cpu_psi*)(cpuid + 1);
+#endif
+ /* TODO: Dump PSI */
+
+ printf(" </cpu>\n");
+}
+
+static void
+show_memory(struct mca_mem_record *mem)
+{
+ printf(" <memory>\n");
+
+ if (mem->mem_flags & MCA_MEM_FLAGS_STATUS)
+ show_value(6, "status", "0x%016llx",
+ (long long)mem->mem_status);
+ if (mem->mem_flags & MCA_MEM_FLAGS_ADDR)
+ show_value(6, "address", "0x%016llx",
+ (long long)mem->mem_addr);
+ if (mem->mem_flags & MCA_MEM_FLAGS_ADDRMASK)
+ show_value(6, "mask", "0x%016llx",
+ (long long)mem->mem_addrmask);
+ if (mem->mem_flags & MCA_MEM_FLAGS_NODE)
+ show_value(6, "node", "0x%04x", mem->mem_node);
+ if (mem->mem_flags & MCA_MEM_FLAGS_CARD)
+ show_value(6, "card", "0x%04x", mem->mem_card);
+ if (mem->mem_flags & MCA_MEM_FLAGS_MODULE)
+ show_value(6, "module", "0x%04x", mem->mem_module);
+ if (mem->mem_flags & MCA_MEM_FLAGS_BANK)
+ show_value(6, "bank", "0x%04x", mem->mem_bank);
+ if (mem->mem_flags & MCA_MEM_FLAGS_DEVICE)
+ show_value(6, "device", "0x%04x", mem->mem_device);
+ if (mem->mem_flags & MCA_MEM_FLAGS_ROW)
+ show_value(6, "row", "0x%04x", mem->mem_row);
+ if (mem->mem_flags & MCA_MEM_FLAGS_COLUMN)
+ show_value(6, "column", "0x%04x", mem->mem_column);
+ if (mem->mem_flags & MCA_MEM_FLAGS_BITPOS)
+ show_value(6, "bit", "0x%04x", mem->mem_bitpos);
+ if (mem->mem_flags & MCA_MEM_FLAGS_REQID)
+ show_value(6, "requester", "0x%016llx",
+ (long long)mem->mem_reqid);
+ if (mem->mem_flags & MCA_MEM_FLAGS_RSPID)
+ show_value(6, "responder", "0x%016llx",
+ (long long)mem->mem_rspid);
+ if (mem->mem_flags & MCA_MEM_FLAGS_TGTID)
+ show_value(6, "target", "0x%016llx",
+ (long long)mem->mem_tgtid);
+ if (mem->mem_flags & MCA_MEM_FLAGS_BUSDATA)
+ show_value(6, "status", "0x%016llx",
+ (long long)mem->mem_busdata);
+ if (mem->mem_flags & MCA_MEM_FLAGS_OEM_ID)
+ show_value(6, "oem", "%s", uuid(&mem->mem_oem_id));
+ /* TODO: Dump OEM data */
+
+ printf(" </memory>\n");
+}
+
+static void
+show_sel(void)
+{
+ printf(" # SEL\n");
+}
+
+static void
+show_pci_bus(struct mca_pcibus_record *pcibus)
+{
+ printf(" <pci-bus>\n");
+
+ if (pcibus->pcibus_flags & MCA_PCIBUS_FLAGS_STATUS)
+ show_value(6, "status", "0x%016llx",
+ (long long)pcibus->pcibus_status);
+ if (pcibus->pcibus_flags & MCA_PCIBUS_FLAGS_ERROR)
+ show_value(6, "error", "0x%04x", pcibus->pcibus_error);
+ if (pcibus->pcibus_flags & MCA_PCIBUS_FLAGS_BUS)
+ show_value(6, "bus", "0x%04x", pcibus->pcibus_bus);
+ if (pcibus->pcibus_flags & MCA_PCIBUS_FLAGS_ADDR)
+ show_value(6, "address", "0x%016llx",
+ (long long)pcibus->pcibus_addr);
+ if (pcibus->pcibus_flags & MCA_PCIBUS_FLAGS_DATA)
+ show_value(6, "data", "0x%016llx",
+ (long long)pcibus->pcibus_data);
+ if (pcibus->pcibus_flags & MCA_PCIBUS_FLAGS_CMD)
+ show_value(6, "cmd", "0x%016llx",
+ (long long)pcibus->pcibus_cmd);
+ if (pcibus->pcibus_flags & MCA_PCIBUS_FLAGS_REQID)
+ show_value(6, "requester", "0x%016llx",
+ (long long)pcibus->pcibus_reqid);
+ if (pcibus->pcibus_flags & MCA_PCIBUS_FLAGS_RSPID)
+ show_value(6, "responder", "0x%016llx",
+ (long long)pcibus->pcibus_rspid);
+ if (pcibus->pcibus_flags & MCA_PCIBUS_FLAGS_TGTID)
+ show_value(6, "target", "0x%016llx",
+ (long long)pcibus->pcibus_tgtid);
+ if (pcibus->pcibus_flags & MCA_PCIBUS_FLAGS_OEM_ID)
+ show_value(6, "oem", "%s", uuid(&pcibus->pcibus_oem_id));
+ /* TODO: Dump OEM data */
+
+ printf(" </pci-bus>\n");
+}
+
+static void
+show_smbios(void)
+{
+ printf(" # SMBIOS\n");
+}
+
+static void
+show_pci_dev(struct mca_pcidev_record *pcidev)
+{
+ printf(" <pci-dev>\n");
+
+ if (pcidev->pcidev_flags & MCA_PCIDEV_FLAGS_STATUS)
+ show_value(6, "status", "0x%016llx",
+ (long long)pcidev->pcidev_status);
+ if (pcidev->pcidev_flags & MCA_PCIDEV_FLAGS_INFO) {
+ show_value(6, "vendor", "0x%04x",
+ pcidev->pcidev_info.info_vendor);
+ show_value(6, "device", "0x%04x",
+ pcidev->pcidev_info.info_device);
+ show_value(6, "class", "0x%06x",
+ MCA_PCIDEV_INFO_CLASS(pcidev->pcidev_info.info_ccfn));
+ show_value(6, "function", "0x%02x",
+ MCA_PCIDEV_INFO_FUNCTION(pcidev->pcidev_info.info_ccfn));
+ show_value(6, "slot", "0x%02x", pcidev->pcidev_info.info_slot);
+ show_value(6, "bus", "0x%04x", pcidev->pcidev_info.info_bus);
+ show_value(6, "segment", "0x%04x",
+ pcidev->pcidev_info.info_segment);
+ }
+ /* TODO: dump registers */
+ /* TODO: Dump OEM data */
+
+ printf(" </pci-dev>\n");
+}
+
+static void
+show_generic(void)
+{
+ printf(" # GENERIC\n");
+}
+
+static size_t
+show_section(struct mca_section_header *sh)
+{
+ static uuid_t uuid_cpu = MCA_UUID_CPU;
+ static uuid_t uuid_memory = MCA_UUID_MEMORY;
+ static uuid_t uuid_sel = MCA_UUID_SEL;
+ static uuid_t uuid_pci_bus = MCA_UUID_PCI_BUS;
+ static uuid_t uuid_smbios = MCA_UUID_SMBIOS;
+ static uuid_t uuid_pci_dev = MCA_UUID_PCI_DEV;
+ static uuid_t uuid_generic = MCA_UUID_GENERIC;
+
+ printf(" <section>\n");
+ show_value(4, "uuid", "%s", uuid(&sh->sh_uuid));
+ show_value(4, "revision", "%d.%d", BCD(sh->sh_major),
+ BCD(sh->sh_minor));
+
+ if (uuid_equal(&sh->sh_uuid, &uuid_cpu, NULL))
+ show_cpu((void*)(sh + 1));
+ else if (uuid_equal(&sh->sh_uuid, &uuid_memory, NULL))
+ show_memory((void*)(sh + 1));
+ else if (uuid_equal(&sh->sh_uuid, &uuid_sel, NULL))
+ show_sel();
+ else if (uuid_equal(&sh->sh_uuid, &uuid_pci_bus, NULL))
+ show_pci_bus((void*)(sh + 1));
+ else if (uuid_equal(&sh->sh_uuid, &uuid_smbios, NULL))
+ show_smbios();
+ else if (uuid_equal(&sh->sh_uuid, &uuid_pci_dev, NULL))
+ show_pci_dev((void*)(sh + 1));
+ else if (uuid_equal(&sh->sh_uuid, &uuid_generic, NULL))
+ show_generic();
+
+ printf(" </section>\n");
+ return (sh->sh_length);
+}
+
+static void
+show(char *data, const char *mib)
+{
+ size_t reclen, seclen;
+
+ if (mib != NULL)
+ printf("<!-- MIB: %s -->\n", mib);
+
+ printf("<record>\n");
+ reclen = show_header((void*)data) - sizeof(struct mca_record_header);
+ data += sizeof(struct mca_record_header);
+ while (reclen > sizeof(struct mca_section_header)) {
+ seclen = show_section((void*)data);
+ reclen -= seclen;
+ data += seclen;
+ }
+ printf("</record>\n");
+}
+
+static void
+showall(char *buf, size_t buflen)
+{
+ struct mca_record_header *rh;
+ size_t reclen;
+
+ do {
+ if (buflen < sizeof(struct mca_record_header))
+ return;
+
+ rh = (void*)buf;
+ reclen = rh->rh_length;
+ if (buflen < reclen)
+ return;
+
+ show(buf, NULL);
+
+ buf += reclen;
+ buflen -= reclen;
+ }
+ while (1);
+}
+
+static void
+dump(char *data)
+{
+ struct mca_record_header *rh;
+ const char *fn;
+ int fd;
+
+ rh = (void*)data;
+ fn = (file) ? file : default_dumpfile;
+ fd = open(fn, O_WRONLY|O_CREAT|O_APPEND, 0660);
+ if (fd == -1)
+ err(2, "open(%s)", fn);
+ if (write(fd, (void*)rh, rh->rh_length) == -1)
+ err(2, "write(%s)", fn);
+ close(fd);
+}
+
+static void
+usage(void)
+{
+
+ fprintf(stderr, "usage: mca [-df]\n");
+ exit (1);
+}
+
+int
+main(int argc, char **argv)
+{
+ char mib[32];
+ char *buf;
+ size_t len;
+ int ch, error, fd;
+ int count, first, last, cpuid;
+
+ while ((ch = getopt(argc, argv, "df:")) != -1) {
+ switch(ch) {
+ case 'd': /* dump */
+ fl_dump = 1;
+ break;
+ case 'f':
+ if (file)
+ free(file); /* XXX complain! */
+ file = strdup(optarg);
+ break;
+ default:
+ usage();
+ }
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ if (file == NULL || fl_dump) {
+ len = sizeof(count);
+ if (sysctlbyname(hw_mca_count, &count, &len, NULL, 0) == -1)
+ err(1, hw_mca_count);
+
+ if (count == 0)
+ errx(0, "no error records found");
+
+ len = sizeof(first);
+ if (sysctlbyname(hw_mca_first, &first, &len, NULL, 0) == -1)
+ err(1, hw_mca_first);
+
+ len = sizeof(last);
+ if (sysctlbyname(hw_mca_last, &last, &len, NULL, 0) == -1)
+ err(1, hw_mca_last);
+
+ cpuid = 0;
+ error = 0;
+ while (count && first <= last) {
+ do {
+ sprintf(mib, hw_mca_recid, first, cpuid);
+ len = 0;
+ ch = sysctlbyname(mib, NULL, &len, NULL, 0);
+ error = (ch == -1) ? errno : 0;
+ if (error != ENOENT)
+ break;
+ cpuid++;
+ } while (cpuid <= HW_MCA_MAX_CPUID);
+ if (error == ENOENT && cpuid > HW_MCA_MAX_CPUID) {
+ first++;
+ cpuid = 0;
+ continue;
+ }
+ if (error)
+ errc(1, error, "%s(1)", mib);
+
+ buf = malloc(len);
+ if (buf == NULL)
+ err(1, "buffer");
+
+ if (sysctlbyname(mib, buf, &len, NULL, 0) == -1)
+ err(1, "%s(2)", mib);
+
+ if (fl_dump)
+ dump(buf);
+ else
+ show(buf, mib);
+
+ free(buf);
+ count--;
+ if (cpuid == HW_MCA_MAX_CPUID) {
+ first++;
+ cpuid = 0;
+ } else
+ cpuid++;
+ }
+ } else {
+ fd = open(file, O_RDONLY);
+ if (fd == -1)
+ err(1, "open(%s)", file);
+
+ len = lseek(fd, 0LL, SEEK_END);
+ buf = mmap(NULL, len, PROT_READ, 0U, fd, 0LL);
+ if (buf == MAP_FAILED)
+ err(1, "mmap(%s)", file);
+
+ showall(buf, len);
+
+ munmap(buf, len);
+ close(fd);
+ }
+
+ return (0);
+}
diff --git a/sbin/md5/Makefile b/sbin/md5/Makefile
index b6afe4e6a63c..eabf129f6b43 100644
--- a/sbin/md5/Makefile
+++ b/sbin/md5/Makefile
@@ -13,6 +13,10 @@ MLINKS= md5.1 rmd160.1 \
md5.1 sha256.1 \
md5.1 sha512.1
-LIBADD= md
+NO_WMISSING_VARIABLE_DECLARATIONS=
+WFORMAT?= 1
+
+DPADD= ${LIBMD}
+LDADD= -lmd
.include <bsd.prog.mk>
diff --git a/sbin/md5/Makefile.depend b/sbin/md5/Makefile.depend
new file mode 100644
index 000000000000..50e2e74bea35
--- /dev/null
+++ b/sbin/md5/Makefile.depend
@@ -0,0 +1,20 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libmd \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/md5/md5.c b/sbin/md5/md5.c
index f4c56ac86c0d..823d09b2c08a 100644
--- a/sbin/md5/md5.c
+++ b/sbin/md5/md5.c
@@ -42,11 +42,11 @@ __FBSDID("$FreeBSD$");
#define TEST_BLOCK_COUNT 100000
#define MDTESTCOUNT 8
-static int qflag;
-static int rflag;
-static int sflag;
-static char* checkAgainst;
-static int checksFailed;
+int qflag;
+int rflag;
+int sflag;
+unsigned char* checkAgainst;
+int checksFailed;
typedef void (DIGEST_Init)(void *);
typedef void (DIGEST_Update)(void *, const unsigned char *, size_t);
@@ -70,11 +70,11 @@ typedef struct Algorithm_t {
} Algorithm_t;
static void MD5_Update(MD5_CTX *, const unsigned char *, size_t);
-static void MDString(const Algorithm_t *, const char *);
-static void MDTimeTrial(const Algorithm_t *);
-static void MDTestSuite(const Algorithm_t *);
-static void MDFilter(const Algorithm_t *, int);
-static void usage(const Algorithm_t *);
+static void MDString(Algorithm_t *, const char *);
+static void MDTimeTrial(Algorithm_t *);
+static void MDTestSuite(Algorithm_t *);
+static void MDFilter(Algorithm_t *, int);
+static void usage(Algorithm_t *);
typedef union {
MD5_CTX md5;
@@ -91,7 +91,7 @@ typedef union {
/* algorithm function table */
-static const struct Algorithm_t Algorithm[] = {
+struct Algorithm_t Algorithm[] = {
{ "md5", "MD5", &MD5TestOutput, (DIGEST_Init*)&MD5Init,
(DIGEST_Update*)&MD5_Update, (DIGEST_End*)&MD5End,
&MD5Data, &MD5File },
@@ -216,7 +216,7 @@ main(int argc, char *argv[])
* Digests a string and prints the result.
*/
static void
-MDString(const Algorithm_t *alg, const char *string)
+MDString(Algorithm_t *alg, const char *string)
{
size_t len = strlen(string);
char buf[HEX_DIGEST_LENGTH];
@@ -240,7 +240,7 @@ MDString(const Algorithm_t *alg, const char *string)
* Measures the time to digest TEST_BLOCK_COUNT TEST_BLOCK_LEN-byte blocks.
*/
static void
-MDTimeTrial(const Algorithm_t *alg)
+MDTimeTrial(Algorithm_t *alg)
{
DIGEST_CTX context;
struct rusage before, after;
@@ -282,7 +282,7 @@ MDTimeTrial(const Algorithm_t *alg)
* Digests a reference suite of strings and prints the results.
*/
-static const char *MDTestInput[MDTESTCOUNT] = {
+const char *MDTestInput[MDTESTCOUNT] = {
"",
"a",
"abc",
@@ -350,7 +350,7 @@ const char *RIPEMD160_TestOutput[MDTESTCOUNT] = {
};
static void
-MDTestSuite(const Algorithm_t *alg)
+MDTestSuite(Algorithm_t *alg)
{
int i;
char buffer[HEX_DIGEST_LENGTH];
@@ -370,7 +370,7 @@ MDTestSuite(const Algorithm_t *alg)
* Digests the standard input and prints the result.
*/
static void
-MDFilter(const Algorithm_t *alg, int tee)
+MDFilter(Algorithm_t *alg, int tee)
{
DIGEST_CTX context;
unsigned int len;
@@ -387,7 +387,7 @@ MDFilter(const Algorithm_t *alg, int tee)
}
static void
-usage(const Algorithm_t *alg)
+usage(Algorithm_t *alg)
{
fprintf(stderr, "usage: %s [-pqrtx] [-c string] [-s string] [files ...]\n", alg->progname);
diff --git a/sbin/mdconfig/Makefile b/sbin/mdconfig/Makefile
index 6be9129144e7..69a688cdc389 100644
--- a/sbin/mdconfig/Makefile
+++ b/sbin/mdconfig/Makefile
@@ -5,7 +5,8 @@
PROG= mdconfig
MAN= mdconfig.8
-LIBADD= util geom
+DPADD= ${LIBUTIL} ${LIBGEOM} ${LIBBSDXML} ${LIBSBUF}
+LDADD= -lutil -lgeom -lbsdxml -lsbuf
.if ${MK_TESTS} != "no"
SUBDIR+= tests
diff --git a/sbin/mdconfig/Makefile.depend b/sbin/mdconfig/Makefile.depend
new file mode 100644
index 000000000000..d6b21c79a951
--- /dev/null
+++ b/sbin/mdconfig/Makefile.depend
@@ -0,0 +1,25 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libdevstat \
+ lib/libexpat \
+ lib/libgeom \
+ lib/libkvm \
+ lib/libsbuf \
+ lib/libutil \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/mdconfig/tests/Makefile b/sbin/mdconfig/tests/Makefile
index 08a9e47e90dc..17284bb6ee22 100644
--- a/sbin/mdconfig/tests/Makefile
+++ b/sbin/mdconfig/tests/Makefile
@@ -2,9 +2,12 @@
TESTSDIR= ${TESTSBASE}/sbin/mdconfig
-ATF_TESTS_SH= mdconfig_test
+TAP_TESTS_SH= legacy_test
+TAP_TESTS_SH_SED_legacy_test= 's,__PERL__,${TAP_PERL_INTERPRETER},g'
+TEST_METADATA.legacy_test+= required_programs="${TAP_PERL_INTERPRETER}"
-
-TEST_METADATA.mdconfig_test+= required_user="root"
+FILESDIR= ${TESTSDIR}
+FILES= mdconfig.test
+FILES+= run.pl
.include <bsd.test.mk>
diff --git a/sbin/mdconfig/tests/legacy_test.sh b/sbin/mdconfig/tests/legacy_test.sh
new file mode 100644
index 000000000000..728224dbd975
--- /dev/null
+++ b/sbin/mdconfig/tests/legacy_test.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+#
+# Copyright (c) 2012 Edward Tomasz Napierała <trasz@FreeBSD.org>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+
+# This is a wrapper script to run mdconfig.test.
+
+echo "1..1"
+
+if [ `whoami` != "root" ]; then
+ echo "ok 1 # skip You need to be root to run this test."
+ exit 0
+fi
+
+TESTDIR=$(dirname $(realpath $0))
+
+__PERL__ -w -U $TESTDIR/run.pl $TESTDIR/mdconfig.test > /dev/null
+
+if [ $? -eq 0 ]; then
+ echo "ok 1"
+else
+ echo "not ok 1"
+fi
diff --git a/sbin/mdconfig/tests/mdconfig.test b/sbin/mdconfig/tests/mdconfig.test
new file mode 100644
index 000000000000..65d3670b57c3
--- /dev/null
+++ b/sbin/mdconfig/tests/mdconfig.test
@@ -0,0 +1,231 @@
+# Copyright (c) 2012 Edward Tomasz Napierała <trasz@FreeBSD.org>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+
+# This is a test for mdconfig(8) functionality. Run it as root:
+#
+# /usr/src/tools/regression/mdconfig/run /usr/src/tools/regression/mdconfig/mdconfig.test
+#
+# WARNING: Creates files in unsafe way.
+
+$ whoami
+> root
+$ umask 022
+$ truncate -s 1gb xxx
+
+$ mdconfig -l
+
+$ mdconfig -af xxx
+> md0
+
+# This awk thing is to strip the file path.
+$ mdconfig -lv | awk '{ print $1, $2, $3 }'
+> md0 vnode 1024M
+
+$ diskinfo -v /dev/md0 | expand
+> /dev/md0
+> 512 # sectorsize
+> 1073741824 # mediasize in bytes (1.0G)
+> 2097152 # mediasize in sectors
+> 0 # stripesize
+> 0 # stripeoffset
+>
+
+$ mdconfig -du 0
+
+# Check different valid syntax variations: implicit -a.
+
+$ mdconfig xxx
+> md0
+
+$ mdconfig -lv | awk '{ print $1, $2, $3 }'
+> md0 vnode 1024M
+
+$ diskinfo -v /dev/md0 | expand
+> /dev/md0
+> 512 # sectorsize
+> 1073741824 # mediasize in bytes (1.0G)
+> 2097152 # mediasize in sectors
+> 0 # stripesize
+> 0 # stripeoffset
+>
+
+$ mdconfig -du 0
+
+# Explicit -t vnode.
+
+$ mdconfig -a -t vnode -f xxx
+> md0
+
+$ mdconfig -lv | awk '{ print $1, $2, $3 }'
+> md0 vnode 1024M
+
+$ diskinfo -v /dev/md0 | expand
+> /dev/md0
+> 512 # sectorsize
+> 1073741824 # mediasize in bytes (1.0G)
+> 2097152 # mediasize in sectors
+> 0 # stripesize
+> 0 # stripeoffset
+>
+
+$ mdconfig -du 0
+
+# Size for vnodes - smaller than the actual file.
+
+$ mdconfig -a -t vnode -f xxx -s 128m
+> md0
+
+$ mdconfig -lv | awk '{ print $1, $2, $3 }'
+> md0 vnode 128M
+
+$ diskinfo -v /dev/md0 | expand
+> /dev/md0
+> 512 # sectorsize
+> 134217728 # mediasize in bytes (128M)
+> 262144 # mediasize in sectors
+> 0 # stripesize
+> 0 # stripeoffset
+>
+
+$ mdconfig -du 0
+
+# Size for vnodes - larger than the actual file.
+
+$ mdconfig -a -t vnode -f xxx -s 128g
+> md0
+
+$ mdconfig -lv | awk '{ print $1, $2, $3 }'
+> md0 vnode 128G
+
+$ diskinfo -v /dev/md0 | expand
+> /dev/md0
+> 512 # sectorsize
+> 137438953472 # mediasize in bytes (128G)
+> 268435456 # mediasize in sectors
+> 0 # stripesize
+> 0 # stripeoffset
+>
+
+$ mdconfig -du 0
+
+# Sector size for vnodes.
+
+$ mdconfig -a -t vnode -f xxx -S 2048
+> md0
+
+$ mdconfig -lv | awk '{ print $1, $2, $3 }'
+> md0 vnode 1024M
+
+$ diskinfo -v /dev/md0 | expand
+> /dev/md0
+> 2048 # sectorsize
+> 1073741824 # mediasize in bytes (1.0G)
+> 524288 # mediasize in sectors
+> 0 # stripesize
+> 0 # stripeoffset
+>
+
+$ mdconfig -du 0
+
+# Malloc type.
+
+$ mdconfig -a -t malloc -s 1g
+> md0
+
+$ mdconfig -lv | awk '{ print $1, $2, $3 }'
+> md0 malloc 1024M
+
+$ diskinfo -v /dev/md0 | expand
+> /dev/md0
+> 512 # sectorsize
+> 1073741824 # mediasize in bytes (1.0G)
+> 2097152 # mediasize in sectors
+> 0 # stripesize
+> 0 # stripeoffset
+>
+
+$ mdconfig -du 0
+
+# Swap type.
+
+$ mdconfig -a -t swap -s 1g
+> md0
+
+$ mdconfig -lv | awk '{ print $1, $2, $3 }'
+> md0 swap 1024M
+
+$ diskinfo -v /dev/md0 | expand
+> /dev/md0
+> 512 # sectorsize
+> 1073741824 # mediasize in bytes (1.0G)
+> 2097152 # mediasize in sectors
+> 0 # stripesize
+> 0 # stripeoffset
+>
+
+$ mdconfig -du 0
+
+# Attaching with a specific unit number.
+
+$ mdconfig -as 1g -u 42
+
+$ mdconfig -lv | awk '{ print $1, $2, $3 }'
+> md42 swap 1024M
+
+$ diskinfo -v /dev/md42 | expand
+> /dev/md42
+> 512 # sectorsize
+> 1073741824 # mediasize in bytes (1.0G)
+> 2097152 # mediasize in sectors
+> 0 # stripesize
+> 0 # stripeoffset
+>
+
+$ mdconfig -du 42
+
+# Querying.
+
+$ mdconfig -as 1g
+> md0
+$ mdconfig -as 2g -u 42
+
+$ mdconfig -lv | awk '{ print $1, $2, $3 }'
+> md0 swap 1024M
+> md42 swap 2048M
+
+$ mdconfig -lvu 0 | awk '{ print $1, $2, $3 }'
+> md0 swap 1024M
+
+$ mdconfig -lvu 42 | awk '{ print $1, $2, $3 }'
+> md42 swap 2048M
+
+$ mdconfig -lvu 24 | awk '{ print $1, $2, $3 }'
+
+$ mdconfig -du 42
+$ mdconfig -du 0
+
+$ rm xxx
diff --git a/sbin/mdconfig/tests/mdconfig_test.sh b/sbin/mdconfig/tests/mdconfig_test.sh
deleted file mode 100755
index d12e565db4aa..000000000000
--- a/sbin/mdconfig/tests/mdconfig_test.sh
+++ /dev/null
@@ -1,281 +0,0 @@
-# Copyright (c) 2012 Edward Tomasz Napierała <trasz@FreeBSD.org>
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD$
-#
-
-check_diskinfo()
-{
- local md=$1
- local mediasize_in_bytes=$2
- local mediasize_in_sectors=$3
- local sectorsize=${4:-512}
- local stripesize=${5:-0}
- local stripeoffset=${6:-0}
-
- atf_check -s exit:0 \
- -o match:"/dev/$md *$sectorsize *$mediasize_in_bytes *$mediasize_in_sectors *$stripesize *$stripeoffset" \
- -x "diskinfo /dev/$md | expand"
-}
-
-cleanup_common()
-{
- if [ -f mdconfig.out ]; then
- mdconfig -d -u $(sed -e 's/md//' mdconfig.out)
- fi
-}
-
-atf_test_case attach_vnode_non_explicit_type cleanup
-attach_vnode_non_explicit_type_head()
-{
- atf_set "descr" "Tests out -a / -f without -t"
-}
-attach_vnode_non_explicit_type_body()
-{
- local md
- local size_in_mb=1024
-
- atf_check -s exit:0 -x "truncate -s ${size_in_mb}m xxx"
- atf_check -s exit:0 -o save:mdconfig.out -x 'mdconfig -af xxx'
- md=$(cat mdconfig.out)
- atf_check -s exit:0 -o match:'^md[0-9]+$' -x "echo $md"
- check_diskinfo "$md" "1073741824" "2097152"
- # This awk strips the file path.
- atf_check -s exit:0 -o match:"^$md vnode ${size_in_mb}M$" \
- -x "mdconfig -lv | awk '\$1 == \"$md\" { print \$1, \$2, \$3 }'"
-}
-attach_vnode_non_explicit_type_cleanup()
-{
- cleanup_common
-}
-
-atf_test_case attach_vnode_implicit_a_f cleanup
-attach_vnode_implicit_a_f_head()
-{
- atf_set "descr" "Tests out implied -a / -f without -t"
-}
-attach_vnode_implicit_a_f_body()
-{
- local md
- local size_in_mb=1024
-
- atf_check -s exit:0 -x "truncate -s ${size_in_mb}m xxx"
- atf_check -s exit:0 -o save:mdconfig.out -x 'mdconfig xxx'
- md=$(cat mdconfig.out)
- atf_check -s exit:0 -o match:'^md[0-9]+$' -x "echo $md"
- check_diskinfo "$md" "1073741824" "2097152"
- # This awk strips the file path.
- atf_check -s exit:0 -o match:"^$md vnode ${size_in_mb}M$" \
- -x "mdconfig -lv | awk '\$1 == \"$md\" { print \$1, \$2, \$3 }'"
-}
-attach_vnode_implicit_a_f_cleanup()
-{
- cleanup_common
-}
-
-atf_test_case attach_vnode_explicit_type cleanup
-attach_vnode_explicit_type_head()
-{
- atf_set "descr" "Tests out implied -a / -f with -t vnode"
-}
-attach_vnode_explicit_type_body()
-{
- local md
- local size_in_mb=1024
-
- atf_check -s exit:0 -x "truncate -s ${size_in_mb}m xxx"
- atf_check -s exit:0 -o save:mdconfig.out -x 'mdconfig -af xxx -t vnode'
- md=$(cat mdconfig.out)
- atf_check -s exit:0 -o match:'^md[0-9]+$' -x "echo $md"
- check_diskinfo "$md" "1073741824" "2097152"
- # This awk strips the file path.
- atf_check -s exit:0 -o match:"^$md vnode ${size_in_mb}M$" \
- -x "mdconfig -lv | awk '\$1 == \"$md\" { print \$1, \$2, \$3 }'"
-}
-attach_vnode_explicit_type_cleanup()
-{
- [ -f mdconfig.out ] && mdconfig -d -u $(sed -e 's/md//' mdconfig.out)
- rm -f mdconfig.out xxx
-}
-
-atf_test_case attach_vnode_smaller_than_file cleanup
-attach_vnode_smaller_than_file_head()
-{
- atf_set "descr" "Tests mdconfig -s with size less than the file size"
-}
-attach_vnode_smaller_than_file_body()
-{
- local md
- local size_in_mb=128
-
- atf_check -s exit:0 -x "truncate -s 1024m xxx"
- atf_check -s exit:0 -o save:mdconfig.out \
- -x "mdconfig -af xxx -s ${size_in_mb}m"
- md=$(cat mdconfig.out)
- atf_check -s exit:0 -o match:'^md[0-9]+$' -x "echo $md"
- check_diskinfo "$md" "134217728" "262144"
- # This awk strips the file path.
- atf_check -s exit:0 -o match:"^$md vnode ${size_in_mb}M$" \
- -x "mdconfig -lv | awk '\$1 == \"$md\" { print \$1, \$2, \$3 }'"
-}
-attach_vnode_smaller_than_file_cleanup()
-{
- cleanup_common
-}
-
-atf_test_case attach_vnode_larger_than_file cleanup
-attach_vnode_larger_than_file_head()
-{
- atf_set "descr" "Tests mdconfig -s with size greater than the file size"
-}
-attach_vnode_larger_than_file_body()
-{
- local md
- local size_in_gb=128
-
- atf_check -s exit:0 -x "truncate -s 1024m xxx"
- atf_check -s exit:0 -o save:mdconfig.out \
- -x "mdconfig -af xxx -s ${size_in_gb}g"
- md=$(cat mdconfig.out)
- atf_check -s exit:0 -o match:'^md[0-9]+$' -x "echo $md"
- check_diskinfo "$md" "137438953472" "268435456"
- # This awk strips the file path.
- atf_check -s exit:0 -o match:"^$md vnode ${size_in_gb}G$" \
- -x "mdconfig -lv | awk '\$1 == \"$md\" { print \$1, \$2, \$3 }'"
-}
-attach_vnode_larger_than_file_cleanup()
-{
- cleanup_common
-}
-
-atf_test_case attach_vnode_sector_size cleanup
-attach_vnode_sector_size_head()
-{
- atf_set "descr" "Tests mdconfig -s with size greater than the file size"
-}
-attach_vnode_sector_size_body()
-{
- local md
- local size_in_mb=1024
-
- atf_check -s exit:0 -x "truncate -s ${size_in_mb}m xxx"
- atf_check -s exit:0 -o save:mdconfig.out \
- -x "mdconfig -af xxx -S 2048"
- md=$(cat mdconfig.out)
- atf_check -s exit:0 -o match:'^md[0-9]+$' -x "echo $md"
- check_diskinfo "$md" "1073741824" "524288" "2048"
- # This awk strips the file path.
- atf_check -s exit:0 -o match:"^$md vnode ${size_in_mb}M$" \
- -x "mdconfig -lv | awk '\$1 == \"$md\" { print \$1, \$2, \$3 }'"
-}
-attach_vnode_sector_size_cleanup()
-{
- cleanup_common
-}
-
-atf_test_case attach_malloc cleanup
-attach_malloc_head()
-{
- atf_set "descr" "Tests mdconfig with -t malloc"
-}
-attach_malloc_body()
-{
- local md
- local size_in_mb=1024
-
- atf_check -s exit:0 -o save:mdconfig.out \
- -x 'mdconfig -a -t malloc -s 1g'
- md=$(cat mdconfig.out)
- atf_check -s exit:0 -o match:'^md[0-9]+$' -x "echo $md"
- check_diskinfo "$md" "1073741824" "2097152"
- # This awk strips the file path.
- atf_check -s exit:0 -o match:"^$md malloc ${size_in_mb}M$" \
- -x "mdconfig -lv | awk '\$1 == \"$md\" { print \$1, \$2, \$3 }'"
-}
-attach_malloc_cleanup()
-{
- cleanup_common
-}
-
-atf_test_case attach_swap cleanup
-attach_swap_head()
-{
- atf_set "descr" "Tests mdconfig with -t swap"
-}
-attach_swap_body()
-{
- local md
- local size_in_mb=1024
-
- atf_check -s exit:0 -o save:mdconfig.out \
- -x 'mdconfig -a -t swap -s 1g'
- md=$(cat mdconfig.out)
- atf_check -s exit:0 -o match:'^md[0-9]+$' -x "echo $md"
- check_diskinfo "$md" "1073741824" "2097152"
- # This awk strips the file path.
- atf_check -s exit:0 -o match:"^$md swap ${size_in_mb}M$" \
- -x "mdconfig -lv | awk '\$1 == \"$md\" { print \$1, \$2, \$3 }'"
-}
-attach_swap_cleanup()
-{
- cleanup_common
-}
-
-atf_test_case attach_with_specific_unit_number cleanup
-attach_with_specific_unit_number_head()
-{
- atf_set "descr" "Tests mdconfig with a unit specified by -u"
-}
-attach_with_specific_unit_number_body()
-{
- local md_unit=99
- local size_in_mb=10
-
- local md="md${md_unit}"
-
- echo "$md" > mdconfig.out
-
- atf_check -s exit:0 -o empty \
- -x "mdconfig -a -t malloc -s ${size_in_mb}m -u $md_unit"
- check_diskinfo "$md" "10485760" "20480"
- # This awk strips the file path.
- atf_check -s exit:0 -o match:"^$md malloc "$size_in_mb"M$" \
- -x "mdconfig -lv | awk '\$1 == \"$md\" { print \$1, \$2, \$3 }'"
-}
-attach_with_specific_unit_number_cleanup()
-{
- cleanup_common
-}
-
-atf_init_test_cases()
-{
- atf_add_test_case attach_vnode_non_explicit_type
- atf_add_test_case attach_vnode_explicit_type
- atf_add_test_case attach_vnode_smaller_than_file
- atf_add_test_case attach_vnode_larger_than_file
- atf_add_test_case attach_vnode_sector_size
- atf_add_test_case attach_malloc
- atf_add_test_case attach_swap
- atf_add_test_case attach_with_specific_unit_number
-}
diff --git a/sbin/mdconfig/tests/run.pl b/sbin/mdconfig/tests/run.pl
new file mode 100644
index 000000000000..383f47e62397
--- /dev/null
+++ b/sbin/mdconfig/tests/run.pl
@@ -0,0 +1,329 @@
+#!/usr/bin/perl -w -U
+
+# Copyright (c) 2007, 2008 Andreas Gruenbacher.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions, and the following disclaimer,
+# without modification, immediately at the beginning of the file.
+# 2. The name of the author may not be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# Alternatively, this software may be distributed under the terms of the
+# GNU Public License ("GPL").
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+
+#
+# Possible improvements:
+#
+# - distinguish stdout and stderr output
+# - add environment variable like assignments
+# - run up to a specific line
+# - resume at a specific line
+#
+
+use strict;
+use FileHandle;
+use Getopt::Std;
+use POSIX qw(isatty setuid getcwd);
+use vars qw($opt_l $opt_v);
+
+no warnings qw(taint);
+
+$opt_l = ~0; # a really huge number
+getopts('l:v');
+
+my ($OK, $FAILED) = ("ok", "failed");
+if (isatty(fileno(STDOUT))) {
+ $OK = "\033[32m" . $OK . "\033[m";
+ $FAILED = "\033[31m\033[1m" . $FAILED . "\033[m";
+}
+
+sub exec_test($$);
+sub process_test($$$$);
+
+my ($prog, $in, $out) = ([], [], []);
+my $prog_line = 0;
+my ($tests, $failed) = (0,0);
+my $lineno;
+my $width = ($ENV{COLUMNS} || 80) >> 1;
+
+for (;;) {
+ my $line = <>; $lineno++;
+ if (defined $line) {
+ # Substitute %VAR and %{VAR} with environment variables.
+ $line =~ s[%(\w+)][$ENV{$1}]eg;
+ $line =~ s[%{(\w+)}][$ENV{$1}]eg;
+ }
+ if (defined $line) {
+ if ($line =~ s/^\s*< ?//) {
+ push @$in, $line;
+ } elsif ($line =~ s/^\s*> ?//) {
+ push @$out, $line;
+ } else {
+ process_test($prog, $prog_line, $in, $out);
+ last if $prog_line >= $opt_l;
+
+ $prog = [];
+ $prog_line = 0;
+ }
+ if ($line =~ s/^\s*\$ ?//) {
+ $prog = [ map { s/\\(.)/$1/g; $_ } split /(?<!\\)\s+/, $line ];
+ $prog_line = $lineno;
+ $in = [];
+ $out = [];
+ }
+ } else {
+ process_test($prog, $prog_line, $in, $out);
+ last;
+ }
+}
+
+my $status = sprintf("%d commands (%d passed, %d failed)",
+ $tests, $tests-$failed, $failed);
+if (isatty(fileno(STDOUT))) {
+ if ($failed) {
+ $status = "\033[31m\033[1m" . $status . "\033[m";
+ } else {
+ $status = "\033[32m" . $status . "\033[m";
+ }
+}
+print $status, "\n";
+exit $failed ? 1 : 0;
+
+
+sub process_test($$$$) {
+ my ($prog, $prog_line, $in, $out) = @_;
+
+ return unless @$prog;
+
+ my $p = [ @$prog ];
+ print "[$prog_line] \$ ", join(' ',
+ map { s/\s/\\$&/g; $_ } @$p), " -- ";
+ my $result = exec_test($prog, $in);
+ my @good = ();
+ my $nmax = (@$out > @$result) ? @$out : @$result;
+ for (my $n=0; $n < $nmax; $n++) {
+ my $use_re;
+ if (defined $out->[$n] && $out->[$n] =~ /^~ /) {
+ $use_re = 1;
+ $out->[$n] =~ s/^~ //g;
+ }
+
+ if (!defined($out->[$n]) || !defined($result->[$n]) ||
+ (!$use_re && $result->[$n] ne $out->[$n]) ||
+ ( $use_re && $result->[$n] !~ /^$out->[$n]/)) {
+ push @good, ($use_re ? '!~' : '!=');
+ }
+ else {
+ push @good, ($use_re ? '=~' : '==');
+ }
+ }
+ my $good = !(grep /!/, @good);
+ $tests++;
+ $failed++ unless $good;
+ print $good ? $OK : $FAILED, "\n";
+ if (!$good || $opt_v) {
+ for (my $n=0; $n < $nmax; $n++) {
+ my $l = defined($out->[$n]) ? $out->[$n] : "~";
+ chomp $l;
+ my $r = defined($result->[$n]) ? $result->[$n] : "~";
+ chomp $r;
+ print sprintf("%-" . ($width-3) . "s %s %s\n",
+ $r, $good[$n], $l);
+ }
+ }
+}
+
+
+sub su($) {
+ my ($user) = @_;
+
+ $user ||= "root";
+
+ my ($login, $pass, $uid, $gid) = getpwnam($user)
+ or return [ "su: user $user does not exist\n" ];
+ my @groups = ();
+ my $fh = new FileHandle("/etc/group")
+ or return [ "opening /etc/group: $!\n" ];
+ while (<$fh>) {
+ chomp;
+ my ($group, $passwd, $gid, $users) = split /:/;
+ foreach my $u (split /,/, $users) {
+ push @groups, $gid
+ if ($user eq $u);
+ }
+ }
+ $fh->close;
+
+ my $groups = join(" ", ($gid, $gid, @groups));
+ #print STDERR "[[$groups]]\n";
+ $! = 0; # reset errno
+ $> = 0;
+ $( = $gid;
+ $) = $groups;
+ if ($!) {
+ return [ "su: $!\n" ];
+ }
+ if ($uid != 0) {
+ $> = $uid;
+ #$< = $uid;
+ if ($!) {
+ return [ "su: $prog->[1]: $!\n" ];
+ }
+ }
+ #print STDERR "[($>,$<)($(,$))]";
+ return [];
+}
+
+
+sub sg($) {
+ my ($group) = @_;
+
+ my $gid = getgrnam($group)
+ or return [ "sg: group $group does not exist\n" ];
+ my %groups = map { $_ eq $gid ? () : ($_ => 1) } (split /\s/, $));
+
+ #print STDERR "<<", join("/", keys %groups), ">>\n";
+ my $groups = join(" ", ($gid, $gid, keys %groups));
+ #print STDERR "[[$groups]]\n";
+ $! = 0; # reset errno
+ if ($> != 0) {
+ my $uid = $>;
+ $> = 0;
+ $( = $gid;
+ $) = $groups;
+ $> = $uid;
+ } else {
+ $( = $gid;
+ $) = $groups;
+ }
+ if ($!) {
+ return [ "sg: $!\n" ];
+ }
+ print STDERR "[($>,$<)($(,$))]";
+ return [];
+}
+
+
+sub exec_test($$) {
+ my ($prog, $in) = @_;
+ local (*IN, *IN_DUP, *IN2, *OUT_DUP, *OUT, *OUT2);
+ my $needs_shell = (join('', @$prog) =~ /[][|<>"'`\$\*\?]/);
+
+ if ($prog->[0] eq "umask") {
+ umask oct $prog->[1];
+ return [];
+ } elsif ($prog->[0] eq "cd") {
+ if (!chdir $prog->[1]) {
+ return [ "chdir: $prog->[1]: $!\n" ];
+ }
+ $ENV{PWD} = getcwd;
+ return [];
+ } elsif ($prog->[0] eq "su") {
+ return su($prog->[1]);
+ } elsif ($prog->[0] eq "sg") {
+ return sg($prog->[1]);
+ } elsif ($prog->[0] eq "export") {
+ my ($name, $value) = split /=/, $prog->[1];
+ # FIXME: need to evaluate $value, so that things like this will work:
+ # export dir=$PWD/dir
+ $ENV{$name} = $value;
+ return [];
+ } elsif ($prog->[0] eq "unset") {
+ delete $ENV{$prog->[1]};
+ return [];
+ }
+
+ pipe *IN2, *OUT
+ or die "Can't create pipe for reading: $!";
+ open *IN_DUP, "<&STDIN"
+ or *IN_DUP = undef;
+ open *STDIN, "<&IN2"
+ or die "Can't duplicate pipe for reading: $!";
+ close *IN2;
+
+ open *OUT_DUP, ">&STDOUT"
+ or die "Can't duplicate STDOUT: $!";
+ pipe *IN, *OUT2
+ or die "Can't create pipe for writing: $!";
+ open *STDOUT, ">&OUT2"
+ or die "Can't duplicate pipe for writing: $!";
+ close *OUT2;
+
+ *STDOUT->autoflush();
+ *OUT->autoflush();
+
+ $SIG{CHLD} = 'IGNORE';
+
+ if (fork()) {
+ # Server
+ if (*IN_DUP) {
+ open *STDIN, "<&IN_DUP"
+ or die "Can't duplicate STDIN: $!";
+ close *IN_DUP
+ or die "Can't close STDIN duplicate: $!";
+ }
+ open *STDOUT, ">&OUT_DUP"
+ or die "Can't duplicate STDOUT: $!";
+ close *OUT_DUP
+ or die "Can't close STDOUT duplicate: $!";
+
+ foreach my $line (@$in) {
+ #print "> $line";
+ print OUT $line;
+ }
+ close *OUT
+ or die "Can't close pipe for writing: $!";
+
+ my $result = [];
+ while (<IN>) {
+ #print "< $_";
+ if ($needs_shell) {
+ s#^/bin/sh: line \d+: ##;
+ }
+ push @$result, $_;
+ }
+ return $result;
+ } else {
+ # Client
+ $< = $>;
+ close IN
+ or die "Can't close read end for input pipe: $!";
+ close OUT
+ or die "Can't close write end for output pipe: $!";
+ close OUT_DUP
+ or die "Can't close STDOUT duplicate: $!";
+ local *ERR_DUP;
+ open ERR_DUP, ">&STDERR"
+ or die "Can't duplicate STDERR: $!";
+ open STDERR, ">&STDOUT"
+ or die "Can't join STDOUT and STDERR: $!";
+
+ if ($needs_shell) {
+ exec ('/bin/sh', '-c', join(" ", @$prog));
+ } else {
+ exec @$prog;
+ }
+ print STDERR $prog->[0], ": $!\n";
+ exit;
+ }
+}
+
diff --git a/sbin/mdmfs/Makefile.depend b/sbin/mdmfs/Makefile.depend
new file mode 100644
index 000000000000..96aa2a21a959
--- /dev/null
+++ b/sbin/mdmfs/Makefile.depend
@@ -0,0 +1,19 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/mknod/Makefile.depend b/sbin/mknod/Makefile.depend
new file mode 100644
index 000000000000..96aa2a21a959
--- /dev/null
+++ b/sbin/mknod/Makefile.depend
@@ -0,0 +1,19 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/mksnap_ffs/Makefile.depend b/sbin/mksnap_ffs/Makefile.depend
new file mode 100644
index 000000000000..96aa2a21a959
--- /dev/null
+++ b/sbin/mksnap_ffs/Makefile.depend
@@ -0,0 +1,19 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/mount/Makefile b/sbin/mount/Makefile
index f95085a6cae7..c4d98f0fc56a 100644
--- a/sbin/mount/Makefile
+++ b/sbin/mount/Makefile
@@ -6,6 +6,7 @@ SRCS= mount.c mount_fs.c getmntopts.c vfslist.c
MAN= mount.8 mount.conf.8
# We do NOT install the getmntopts.3 man page.
-LIBADD= util
+DPADD= ${LIBUTIL}
+LDADD= -lutil
.include <bsd.prog.mk>
diff --git a/sbin/mount/Makefile.depend b/sbin/mount/Makefile.depend
new file mode 100644
index 000000000000..78b235bef5b2
--- /dev/null
+++ b/sbin/mount/Makefile.depend
@@ -0,0 +1,20 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libutil \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/mount/mount.8 b/sbin/mount/mount.8
index 2b1ac527ba93..bfa70b6b9643 100644
--- a/sbin/mount/mount.8
+++ b/sbin/mount/mount.8
@@ -28,7 +28,7 @@
.\" @(#)mount.8 8.8 (Berkeley) 6/16/94
.\" $FreeBSD$
.\"
-.Dd December 3, 2014
+.Dd August 20, 2014
.Dt MOUNT 8
.Os
.Sh NAME
@@ -457,6 +457,7 @@ However, for the following file system types:
.Cm msdosfs ,
.Cm nfs ,
.Cm nullfs ,
+.Cm oldnfs ,
.Cm smbfs ,
.Cm udf ,
and
@@ -547,9 +548,6 @@ support for a particular file system might be provided either on a static
.Xr ext2fs 5 ,
.Xr fstab 5 ,
.Xr procfs 5 ,
-.Xr tmpfs 5 ,
-.Xr automount 8 ,
-.Xr fstyp 8 ,
.Xr kldload 8 ,
.Xr mount_cd9660 8 ,
.Xr mount_msdosfs 8 ,
@@ -558,6 +556,7 @@ support for a particular file system might be provided either on a static
.Xr mount_smbfs 8 ,
.Xr mount_udf 8 ,
.Xr mount_unionfs 8 ,
+.Xr tmpfs 5 ,
.Xr umount 8 ,
.Xr zfs 8 ,
.Xr zpool 8
diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c
index 6427fc8b7ff3..5ea45df11d1f 100644
--- a/sbin/mount/mount.c
+++ b/sbin/mount/mount.c
@@ -144,7 +144,7 @@ use_mountprog(const char *vfstype)
unsigned int i;
const char *fs[] = {
"cd9660", "mfs", "msdosfs", "nfs",
- "nullfs", "smbfs", "udf", "unionfs",
+ "nullfs", "oldnfs", "smbfs", "udf", "unionfs",
NULL
};
diff --git a/sbin/mount_cd9660/Makefile b/sbin/mount_cd9660/Makefile
index c70892c3309e..b889174ffa05 100644
--- a/sbin/mount_cd9660/Makefile
+++ b/sbin/mount_cd9660/Makefile
@@ -4,7 +4,8 @@
PROG= mount_cd9660
SRCS= mount_cd9660.c getmntopts.c
MAN= mount_cd9660.8
-LIBADD= kiconv
+DPADD= ${LIBKICONV}
+LDADD= -lkiconv
MOUNT= ${.CURDIR}/../mount
CFLAGS+= -I${MOUNT}
diff --git a/sbin/mount_cd9660/Makefile.depend b/sbin/mount_cd9660/Makefile.depend
new file mode 100644
index 000000000000..69a5342e7030
--- /dev/null
+++ b/sbin/mount_cd9660/Makefile.depend
@@ -0,0 +1,21 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libkiconv \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/mount_fusefs/Makefile.depend b/sbin/mount_fusefs/Makefile.depend
new file mode 100644
index 000000000000..96aa2a21a959
--- /dev/null
+++ b/sbin/mount_fusefs/Makefile.depend
@@ -0,0 +1,19 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/mount_fusefs/mount_fusefs.8 b/sbin/mount_fusefs/mount_fusefs.8
index 3faf61822e5c..3e11cf19bd8f 100644
--- a/sbin/mount_fusefs/mount_fusefs.8
+++ b/sbin/mount_fusefs/mount_fusefs.8
@@ -326,8 +326,8 @@ does not call any external utility and also provides a hacky
.Sh SEE ALSO
.Xr fstat 1 ,
.Xr mount 8 ,
-.Xr sudo 8 ,
-.Xr umount 8
+.Xr umount 8 ,
+.Xr sudo 8
.Sh HISTORY
.Nm
appears as the part of the FreeBSD implementation of the Fuse userspace filesystem
diff --git a/sbin/mount_fusefs/mount_fusefs.c b/sbin/mount_fusefs/mount_fusefs.c
index 7d4b9a1ebd6b..797aba7228a4 100644
--- a/sbin/mount_fusefs/mount_fusefs.c
+++ b/sbin/mount_fusefs/mount_fusefs.c
@@ -73,13 +73,6 @@ static struct mntopt mopts[] = {
{ "subtype=", 0, ALTF_SUBTYPE, 1 },
#define ALTF_SYNC_UNMOUNT 0x80
{ "sync_unmount", 0, ALTF_SYNC_UNMOUNT, 1 },
- /*
- * MOPT_AUTOMOUNTED, included by MOPT_STDOPTS, does not fit into
- * the 'flags' argument to nmount(2). We have to abuse altflags
- * to pass it, as string, via iovec.
- */
- #define ALTF_AUTOMOUNTED 0x100
- { "automounted", 0, ALTF_AUTOMOUNTED, 1 },
/* Linux specific options, we silently ignore them */
{ "fsname=", 0, 0x00, 1 },
{ "fd=", 0, 0x00, 1 },
diff --git a/sbin/mount_msdosfs/Makefile b/sbin/mount_msdosfs/Makefile
index ede86b4d8674..c3e416af21fc 100644
--- a/sbin/mount_msdosfs/Makefile
+++ b/sbin/mount_msdosfs/Makefile
@@ -5,7 +5,8 @@
PROG= mount_msdosfs
SRCS= mount_msdosfs.c getmntopts.c
MAN= mount_msdosfs.8
-LIBADD= kiconv
+DPADD= ${LIBKICONV}
+LDADD= -lkiconv
MOUNT= ${.CURDIR}/../mount
CFLAGS+= -I${MOUNT}
diff --git a/sbin/mount_msdosfs/Makefile.depend b/sbin/mount_msdosfs/Makefile.depend
new file mode 100644
index 000000000000..6f58bd155962
--- /dev/null
+++ b/sbin/mount_msdosfs/Makefile.depend
@@ -0,0 +1,21 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libkiconv \
+ lib/libutil \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/mount_nfs/Makefile b/sbin/mount_nfs/Makefile
index 75f781798ab7..eceed2b5aaa0 100644
--- a/sbin/mount_nfs/Makefile
+++ b/sbin/mount_nfs/Makefile
@@ -5,11 +5,14 @@
PROG= mount_nfs
SRCS= mount_nfs.c getmntopts.c mounttab.c
MAN= mount_nfs.8
+MLINKS= mount_nfs.8 mount_oldnfs.8
MOUNT= ${.CURDIR}/../mount
UMNTALL= ${.CURDIR}/../../usr.sbin/rpc.umntall
CFLAGS+= -DNFS -I${MOUNT} -I${UMNTALL}
+LINKS= ${BINDIR}/mount_nfs ${BINDIR}/mount_oldnfs
+
.PATH: ${MOUNT} ${UMNTALL}
.include <bsd.prog.mk>
diff --git a/sbin/mount_nfs/Makefile.depend b/sbin/mount_nfs/Makefile.depend
new file mode 100644
index 000000000000..2a44c25ffe8e
--- /dev/null
+++ b/sbin/mount_nfs/Makefile.depend
@@ -0,0 +1,22 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/rpc \
+ include/rpcsvc \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/mount_nfs/mount_nfs.8 b/sbin/mount_nfs/mount_nfs.8
index 3a9cff54c883..473f51912321 100644
--- a/sbin/mount_nfs/mount_nfs.8
+++ b/sbin/mount_nfs/mount_nfs.8
@@ -63,6 +63,12 @@ It implements the mount protocol as described in RFC 1094, Appendix A and
.%T "NFS: Network File System Version 3 Protocol Specification" ,
Appendix I.
.Pp
+If the file system type is specified as ``oldnfs'', which implies this
+command is run as ``mount_oldnfs'', then it forces use of the old NFS
+client, which does not support the
+.Cm nfsv4
+option.
+.Pp
By default,
.Nm
keeps retrying until the mount succeeds.
@@ -387,7 +393,7 @@ Use the specified version number for NFS requests.
See the
.Cm nfsv2 ,
.Cm nfsv3 ,
-and
+and
.Cm nfsv4
options for details.
.It Cm wcommitsize Ns = Ns Aq Ar value
diff --git a/sbin/mount_nullfs/Makefile.depend b/sbin/mount_nullfs/Makefile.depend
new file mode 100644
index 000000000000..96aa2a21a959
--- /dev/null
+++ b/sbin/mount_nullfs/Makefile.depend
@@ -0,0 +1,19 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/mount_udf/Makefile b/sbin/mount_udf/Makefile
index 12d5d5822424..06ad9a768e4c 100644
--- a/sbin/mount_udf/Makefile
+++ b/sbin/mount_udf/Makefile
@@ -3,7 +3,8 @@
PROG= mount_udf
SRCS= mount_udf.c getmntopts.c
MAN= mount_udf.8
-LIBADD= kiconv
+DPADD= ${LIBKICONV}
+LDADD= -lkiconv
MOUNT= ${.CURDIR}/../mount
CFLAGS+= -I${MOUNT} -I${.CURDIR}/../../sys
diff --git a/sbin/mount_udf/Makefile.depend b/sbin/mount_udf/Makefile.depend
new file mode 100644
index 000000000000..24c6b245d3af
--- /dev/null
+++ b/sbin/mount_udf/Makefile.depend
@@ -0,0 +1,20 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libkiconv \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/mount_unionfs/Makefile.depend b/sbin/mount_unionfs/Makefile.depend
new file mode 100644
index 000000000000..96aa2a21a959
--- /dev/null
+++ b/sbin/mount_unionfs/Makefile.depend
@@ -0,0 +1,19 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/nandfs/Makefile b/sbin/nandfs/Makefile
index 5757f8c16886..8474b09c522d 100644
--- a/sbin/nandfs/Makefile
+++ b/sbin/nandfs/Makefile
@@ -4,6 +4,7 @@ PROG= nandfs
SRCS= nandfs.c lssnap.c mksnap.c rmsnap.c
MAN= nandfs.8
-LIBADD= nandfs
+DPADD= ${LIBNANDFS}
+LDADD= -lnandfs
.include <bsd.prog.mk>
diff --git a/sbin/natd/Makefile b/sbin/natd/Makefile
index 44e5b6f3b0f6..7d8b3e49eae1 100644
--- a/sbin/natd/Makefile
+++ b/sbin/natd/Makefile
@@ -3,7 +3,8 @@
PROG = natd
SRCS = natd.c icmp.c
WARNS?= 3
-LIBADD = alias
+LDADD = -lalias
+DPADD = ${LIBALIAS}
MAN = natd.8
.include <bsd.prog.mk>
diff --git a/sbin/natd/Makefile.depend b/sbin/natd/Makefile.depend
new file mode 100644
index 000000000000..0aa70dbca58f
--- /dev/null
+++ b/sbin/natd/Makefile.depend
@@ -0,0 +1,21 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libalias/libalias \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/newfs/Makefile b/sbin/newfs/Makefile
index 83801fd38947..d45143ba7a83 100644
--- a/sbin/newfs/Makefile
+++ b/sbin/newfs/Makefile
@@ -4,7 +4,8 @@
.PATH: ${.CURDIR}/../../sys/geom
PROG= newfs
-LIBADD= ufs util
+DPADD= ${LIBUFS} ${LIBUTIL}
+LDADD= -lufs -lutil
SRCS= newfs.c mkfs.c geom_bsd_enc.c
WARNS?= 3
diff --git a/sbin/newfs/Makefile.depend b/sbin/newfs/Makefile.depend
new file mode 100644
index 000000000000..f94cc5edbe53
--- /dev/null
+++ b/sbin/newfs/Makefile.depend
@@ -0,0 +1,21 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libufs \
+ lib/libutil \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/newfs/newfs.8 b/sbin/newfs/newfs.8
index a4c035814d6d..6764adcf91cd 100644
--- a/sbin/newfs/newfs.8
+++ b/sbin/newfs/newfs.8
@@ -310,10 +310,10 @@ on file systems that contain many small files.
.Xr fsck 8 ,
.Xr gjournal 8 ,
.Xr growfs 8 ,
-.Xr gvinum 8 ,
.Xr makefs 8 ,
.Xr mount 8 ,
-.Xr tunefs 8
+.Xr tunefs 8 ,
+.Xr gvinum 8
.Rs
.%A M. McKusick
.%A W. Joy
diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c
index 658bd427d7a0..59b7e61246bb 100644
--- a/sbin/newfs/newfs.c
+++ b/sbin/newfs/newfs.c
@@ -117,9 +117,11 @@ static u_char bootarea[BBSIZE];
static int is_file; /* work on a file, not a device */
static char *dkname;
static char *disktype;
+static int unlabeled;
static void getfssize(intmax_t *, const char *p, intmax_t, intmax_t);
static struct disklabel *getdisklabel(char *s);
+static void rewritelabel(char *s, struct disklabel *lp);
static void usage(void);
static int expand_number_int(const char *buf, int *num);
@@ -400,6 +402,12 @@ main(int argc, char *argv[])
pp->p_size *= secperblk;
}
mkfs(pp, special);
+ if (!unlabeled) {
+ if (realsectorsize != DEV_BSIZE)
+ pp->p_size /= realsectorsize / DEV_BSIZE;
+ if (!Nflag && bcmp(pp, &oldpartition, sizeof(oldpartition)))
+ rewritelabel(special, lp);
+ }
ufs_disk_close(&disk);
if (!jflag)
exit(0);
@@ -443,6 +451,9 @@ getdisklabel(char *s)
return &lab;
}
+ if (ioctl(disk.d_fd, DIOCGDINFO, (char *)&lab) != -1)
+ return (&lab);
+ unlabeled++;
if (disktype) {
lp = getdiskbyname(disktype);
if (lp != NULL)
@@ -451,6 +462,25 @@ getdisklabel(char *s)
return (NULL);
}
+void
+rewritelabel(char *s, struct disklabel *lp)
+{
+ if (unlabeled)
+ return;
+ lp->d_checksum = 0;
+ lp->d_checksum = dkcksum(lp);
+ if (is_file) {
+ bsd_disklabel_le_enc(bootarea + 0 /* labeloffset */ +
+ 1 /* labelsoffset */ * sectorsize, lp);
+ lseek(disk.d_fd, 0, SEEK_SET);
+ if (write(disk.d_fd, bootarea, BBSIZE) != BBSIZE)
+ errx(1, "cannot write label");
+ return;
+ }
+ if (ioctl(disk.d_fd, DIOCWDINFO, (char *)lp) == -1)
+ warn("ioctl (WDINFO): %s: can't rewrite disk label", s);
+}
+
static void
usage()
{
diff --git a/sbin/newfs_msdos/Makefile.depend b/sbin/newfs_msdos/Makefile.depend
new file mode 100644
index 000000000000..96aa2a21a959
--- /dev/null
+++ b/sbin/newfs_msdos/Makefile.depend
@@ -0,0 +1,19 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/newfs_msdos/newfs_msdos.8 b/sbin/newfs_msdos/newfs_msdos.8
index 0f1abb4e5cd5..d61043a57bd9 100644
--- a/sbin/newfs_msdos/newfs_msdos.8
+++ b/sbin/newfs_msdos/newfs_msdos.8
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 9, 2015
+.Dd October 1, 2013
.Dt NEWFS_MSDOS 8
.Os
.Sh NAME
@@ -112,7 +112,7 @@ only those characters permitted in regular DOS (8+3) filenames.
.It Fl O Ar OEM
OEM string (up to 8 characters).
The default is
-.Qq Li "BSD4.4 " .
+.Qq Li "BSD 4.4" .
.It Fl S Ar sector-size
Number of bytes per sector.
Acceptable values are powers of 2
diff --git a/sbin/newfs_msdos/newfs_msdos.c b/sbin/newfs_msdos/newfs_msdos.c
index 468578287671..f315d9810fba 100644
--- a/sbin/newfs_msdos/newfs_msdos.c
+++ b/sbin/newfs_msdos/newfs_msdos.c
@@ -829,26 +829,28 @@ getdiskinfo(int fd, const char *fname, const char *dtype, __unused int oflag,
if (lp == NULL) {
if (bpb->bpbBytesPerSec)
dlp.d_secsize = bpb->bpbBytesPerSec;
- if (bpb->bpbBytesPerSec == 0 && ioctl(fd, DIOCGSECTORSIZE,
- &dlp.d_secsize) == -1)
- err(1, "cannot get sector size");
+ if (ioctl(fd, DIOCGDINFO, &dlp) == -1) {
+ if (bpb->bpbBytesPerSec == 0 && ioctl(fd, DIOCGSECTORSIZE,
+ &dlp.d_secsize) == -1)
+ err(1, "cannot get sector size");
- dlp.d_secperunit = ms / dlp.d_secsize;
+ dlp.d_secperunit = ms / dlp.d_secsize;
- if (bpb->bpbSecPerTrack == 0 && ioctl(fd, DIOCGFWSECTORS,
- &dlp.d_nsectors) == -1) {
- warn("cannot get number of sectors per track");
- dlp.d_nsectors = 63;
- }
- if (bpb->bpbHeads == 0 &&
- ioctl(fd, DIOCGFWHEADS, &dlp.d_ntracks) == -1) {
- warn("cannot get number of heads");
- if (dlp.d_secperunit <= 63*1*1024)
- dlp.d_ntracks = 1;
- else if (dlp.d_secperunit <= 63*16*1024)
- dlp.d_ntracks = 16;
- else
- dlp.d_ntracks = 255;
+ if (bpb->bpbSecPerTrack == 0 && ioctl(fd, DIOCGFWSECTORS,
+ &dlp.d_nsectors) == -1) {
+ warn("cannot get number of sectors per track");
+ dlp.d_nsectors = 63;
+ }
+ if (bpb->bpbHeads == 0 &&
+ ioctl(fd, DIOCGFWHEADS, &dlp.d_ntracks) == -1) {
+ warn("cannot get number of heads");
+ if (dlp.d_secperunit <= 63*1*1024)
+ dlp.d_ntracks = 1;
+ else if (dlp.d_secperunit <= 63*16*1024)
+ dlp.d_ntracks = 16;
+ else
+ dlp.d_ntracks = 255;
+ }
}
hs = (ms / dlp.d_secsize) - dlp.d_secperunit;
diff --git a/sbin/newfs_nandfs/Makefile b/sbin/newfs_nandfs/Makefile
index 7a39fbb088e6..1d990eddf52c 100644
--- a/sbin/newfs_nandfs/Makefile
+++ b/sbin/newfs_nandfs/Makefile
@@ -3,6 +3,7 @@
PROG= newfs_nandfs
MAN= newfs_nandfs.8
-LIBADD= geom
+LDADD+= -lgeom
+DPADD+= ${LIBGEOM}
.include <bsd.prog.mk>
diff --git a/sbin/nfsiod/Makefile.depend b/sbin/nfsiod/Makefile.depend
new file mode 100644
index 000000000000..2d9ec507cd13
--- /dev/null
+++ b/sbin/nfsiod/Makefile.depend
@@ -0,0 +1,18 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/nos-tun/Makefile.depend b/sbin/nos-tun/Makefile.depend
new file mode 100644
index 000000000000..b68b4bb5daf9
--- /dev/null
+++ b/sbin/nos-tun/Makefile.depend
@@ -0,0 +1,20 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/nvmecontrol/Makefile.depend b/sbin/nvmecontrol/Makefile.depend
new file mode 100644
index 000000000000..96aa2a21a959
--- /dev/null
+++ b/sbin/nvmecontrol/Makefile.depend
@@ -0,0 +1,19 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/pfctl/Makefile b/sbin/pfctl/Makefile
index de3b7ec5012c..937f403569dd 100644
--- a/sbin/pfctl/Makefile
+++ b/sbin/pfctl/Makefile
@@ -28,6 +28,7 @@ CFLAGS+= -DWITH_INET
YFLAGS=
-LIBADD= m md
+LDADD+= -lm -lmd
+DPADD+= ${LIBM} ${LIBMD}
.include <bsd.prog.mk>
diff --git a/sbin/pfctl/Makefile.depend b/sbin/pfctl/Makefile.depend
new file mode 100644
index 000000000000..3114c66c6910
--- /dev/null
+++ b/sbin/pfctl/Makefile.depend
@@ -0,0 +1,24 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libmd \
+ lib/msun \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+parse.o: parse.c
+parse.po: parse.c
+.endif
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y
index aebf8a7d0931..99c26c0a33df 100644
--- a/sbin/pfctl/parse.y
+++ b/sbin/pfctl/parse.y
@@ -44,10 +44,10 @@ __FBSDID("$FreeBSD$");
#include <netinet/icmp6.h>
#include <net/pfvar.h>
#include <arpa/inet.h>
-#include <net/altq/altq.h>
-#include <net/altq/altq_cbq.h>
-#include <net/altq/altq_priq.h>
-#include <net/altq/altq_hfsc.h>
+#include <altq/altq.h>
+#include <altq/altq_cbq.h>
+#include <altq/altq_priq.h>
+#include <altq/altq_hfsc.h>
#include <stdio.h>
#include <unistd.h>
diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c
index c1ba12f4c3cb..f90fd70ffa63 100644
--- a/sbin/pfctl/pfctl.c
+++ b/sbin/pfctl/pfctl.c
@@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$");
#include <netinet/in.h>
#include <net/pfvar.h>
#include <arpa/inet.h>
-#include <net/altq/altq.h>
+#include <altq/altq.h>
#include <sys/sysctl.h>
#include <err.h>
diff --git a/sbin/pfctl/pfctl_altq.c b/sbin/pfctl/pfctl_altq.c
index 64f474ce0501..ae566f84df28 100644
--- a/sbin/pfctl/pfctl_altq.c
+++ b/sbin/pfctl/pfctl_altq.c
@@ -38,10 +38,10 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include <unistd.h>
-#include <net/altq/altq.h>
-#include <net/altq/altq_cbq.h>
-#include <net/altq/altq_priq.h>
-#include <net/altq/altq_hfsc.h>
+#include <altq/altq.h>
+#include <altq/altq_cbq.h>
+#include <altq/altq_priq.h>
+#include <altq/altq_hfsc.h>
#include "pfctl_parser.h"
#include "pfctl.h"
diff --git a/sbin/pfctl/pfctl_qstats.c b/sbin/pfctl/pfctl_qstats.c
index 0921d47fbe91..95371e47af44 100644
--- a/sbin/pfctl/pfctl_qstats.c
+++ b/sbin/pfctl/pfctl_qstats.c
@@ -34,10 +34,10 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include <unistd.h>
-#include <net/altq/altq.h>
-#include <net/altq/altq_cbq.h>
-#include <net/altq/altq_priq.h>
-#include <net/altq/altq_hfsc.h>
+#include <altq/altq.h>
+#include <altq/altq_cbq.h>
+#include <altq/altq_priq.h>
+#include <altq/altq_hfsc.h>
#include "pfctl.h"
#include "pfctl_parser.h"
diff --git a/sbin/pflogd/Makefile b/sbin/pflogd/Makefile
index 49a311e11bb7..fcff8eb45135 100644
--- a/sbin/pflogd/Makefile
+++ b/sbin/pflogd/Makefile
@@ -8,7 +8,8 @@ MAN= pflogd.8
CFLAGS+=-include ${.CURDIR}/../../lib/libpcap/config.h
-LIBADD= pcap
+LDADD= -lpcap
+DPADD= ${LIBPCAP}
WARNS?= 2
diff --git a/sbin/pflogd/Makefile.depend b/sbin/pflogd/Makefile.depend
new file mode 100644
index 000000000000..fb2e1ea9ff35
--- /dev/null
+++ b/sbin/pflogd/Makefile.depend
@@ -0,0 +1,20 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libpcap \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/ping/Makefile b/sbin/ping/Makefile
index 533f8b845d7a..57f82a8f72b7 100644
--- a/sbin/ping/Makefile
+++ b/sbin/ping/Makefile
@@ -8,16 +8,19 @@ MAN= ping.8
BINOWN= root
BINMODE=4555
WARNS?= 3
-LIBADD= m
+DPADD= ${LIBM}
+LDADD= -lm
.if ${MK_CASPER} != "no" && !defined(RESCUE)
-LIBADD+= capsicum
+DPADD+= ${LIBCAPSICUM} ${LIBNV}
+LDADD+= -lcapsicum -lnv
CFLAGS+=-DHAVE_LIBCAPSICUM
.endif
.if !defined(RELEASE_CRUNCH)
CFLAGS+=-DIPSEC
-LIBADD+= ipsec
+DPADD+= ${LIBIPSEC}
+LDADD+= -lipsec
.endif
.include <bsd.prog.mk>
diff --git a/sbin/ping/Makefile.depend b/sbin/ping/Makefile.depend
new file mode 100644
index 000000000000..aa5c26eba086
--- /dev/null
+++ b/sbin/ping/Makefile.depend
@@ -0,0 +1,24 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcapsicum \
+ lib/libcompiler_rt \
+ lib/libipsec \
+ lib/libnv \
+ lib/msun \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c
index 23d5696b3ea2..aeb301430fb6 100644
--- a/sbin/ping/ping.c
+++ b/sbin/ping/ping.c
@@ -713,7 +713,7 @@ main(int argc, char *const *argv)
ip->ip_hl = sizeof(struct ip) >> 2;
ip->ip_tos = tos;
ip->ip_id = 0;
- ip->ip_off = htons(df ? IP_DF : 0);
+ ip->ip_off = df ? IP_DF : 0;
ip->ip_ttl = ttl;
ip->ip_p = IPPROTO_ICMP;
ip->ip_src.s_addr = source ? sock_in.sin_addr.s_addr : INADDR_ANY;
@@ -737,6 +737,9 @@ main(int argc, char *const *argv)
if (cansandbox && cap_enter() < 0 && errno != ENOSYS)
err(1, "cap_enter");
+ if (cap_sandboxed())
+ fprintf(stderr, "capability mode sandbox enabled\n");
+
cap_rights_init(&rights, CAP_RECV, CAP_EVENT, CAP_SETSOCKOPT);
if (cap_rights_limit(srecv, &rights) < 0 && errno != ENOSYS)
err(1, "cap_rights_limit srecv");
@@ -1075,7 +1078,7 @@ pinger(void)
if (options & F_HDRINCL) {
cc += sizeof(struct ip);
ip = (struct ip *)outpackhdr;
- ip->ip_len = htons(cc);
+ ip->ip_len = cc;
ip->ip_sum = in_cksum((u_short *)outpackhdr, cc);
packet = outpackhdr;
}
diff --git a/sbin/ping6/Makefile b/sbin/ping6/Makefile
index 35a76e47f853..e40dc6eb9393 100644
--- a/sbin/ping6/Makefile
+++ b/sbin/ping6/Makefile
@@ -10,6 +10,7 @@ WARNS?= 3
BINOWN= root
BINMODE=4555
-LIBADD= ipsec m md
+LDADD= -lipsec -lm -lmd
+DPADD= ${LIBIPSEC} ${LIBM} ${LIBMD}
.include <bsd.prog.mk>
diff --git a/sbin/ping6/Makefile.depend b/sbin/ping6/Makefile.depend
new file mode 100644
index 000000000000..c657f0f52556
--- /dev/null
+++ b/sbin/ping6/Makefile.depend
@@ -0,0 +1,23 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libipsec \
+ lib/libmd \
+ lib/msun \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/ping6/ping6.c b/sbin/ping6/ping6.c
index d71c021ad458..fa314f6cb5c1 100644
--- a/sbin/ping6/ping6.c
+++ b/sbin/ping6/ping6.c
@@ -648,20 +648,11 @@ main(int argc, char *argv[])
err(1, "socket");
/* set the source address if specified. */
- if ((options & F_SRCADDR) != 0) {
- /* properly fill sin6_scope_id */
- if (IN6_IS_ADDR_LINKLOCAL(&src.sin6_addr) && (
- IN6_IS_ADDR_LINKLOCAL(&dst.sin6_addr) ||
- IN6_IS_ADDR_MC_LINKLOCAL(&dst.sin6_addr) ||
- IN6_IS_ADDR_MC_NODELOCAL(&dst.sin6_addr))) {
- if (src.sin6_scope_id == 0)
- src.sin6_scope_id = dst.sin6_scope_id;
- if (dst.sin6_scope_id == 0)
- dst.sin6_scope_id = src.sin6_scope_id;
- }
- if (bind(s, (struct sockaddr *)&src, srclen) != 0)
- err(1, "bind");
+ if ((options & F_SRCADDR) &&
+ bind(s, (struct sockaddr *)&src, srclen) != 0) {
+ err(1, "bind");
}
+
/* set the gateway (next hop) if specified */
if (gateway) {
memset(&hints, 0, sizeof(hints));
diff --git a/sbin/quotacheck/Makefile b/sbin/quotacheck/Makefile
index 7be3e3510503..51a88b7681c7 100644
--- a/sbin/quotacheck/Makefile
+++ b/sbin/quotacheck/Makefile
@@ -5,7 +5,8 @@ PROG= quotacheck
SRCS= quotacheck.c preen.c fsutil.c utilities.c
WARNS?= 2
MAN= quotacheck.8
-LIBADD= util
+DPADD= ${LIBUTIL}
+LDADD= -lutil
.PATH: ${.CURDIR}/../fsck ${.CURDIR}/../fsck_ffs
diff --git a/sbin/quotacheck/Makefile.depend b/sbin/quotacheck/Makefile.depend
new file mode 100644
index 000000000000..78b235bef5b2
--- /dev/null
+++ b/sbin/quotacheck/Makefile.depend
@@ -0,0 +1,20 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libutil \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/rcorder/Makefile b/sbin/rcorder/Makefile
index 2f1bbac1fa8f..b71aa4b83d37 100644
--- a/sbin/rcorder/Makefile
+++ b/sbin/rcorder/Makefile
@@ -5,10 +5,16 @@ PROG= rcorder
SRCS= ealloc.c hash.c rcorder.c
MAN= rcorder.8
-LIBADD= util
+LDADD= -lutil
+DPADD= ${LIBUTIL}
-CFLAGS+= -DORDER
+# XXX hack for make's hash.[ch]
+CFLAGS+= -DORDER -I.
-#CFLAGS+= -DDEBUG
+SRCS+= util.h
+CLEANFILES+= util.h
+
+util.h:
+ ln -sf ${.CURDIR}/../../lib/libutil/libutil.h ${.TARGET}
.include <bsd.prog.mk>
diff --git a/sbin/rcorder/Makefile.depend b/sbin/rcorder/Makefile.depend
new file mode 100644
index 000000000000..ed049c94b327
--- /dev/null
+++ b/sbin/rcorder/Makefile.depend
@@ -0,0 +1,22 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libutil \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+rcorder.o: util.h
+rcorder.po: util.h
+.endif
diff --git a/sbin/rcorder/rcorder.c b/sbin/rcorder/rcorder.c
index 8c46b4fd1def..83f6df839682 100644
--- a/sbin/rcorder/rcorder.c
+++ b/sbin/rcorder/rcorder.c
@@ -42,10 +42,10 @@ __FBSDID("$FreeBSD$");
#include <err.h>
#include <stdio.h>
-#include <libutil.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <util.h>
#include "ealloc.h"
#include "sprite.h"
diff --git a/sbin/reboot/Makefile.depend b/sbin/reboot/Makefile.depend
new file mode 100644
index 000000000000..96aa2a21a959
--- /dev/null
+++ b/sbin/reboot/Makefile.depend
@@ -0,0 +1,19 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/reboot/nextboot.8 b/sbin/reboot/nextboot.8
index 14573e2cbec5..7d4135298ac0 100644
--- a/sbin/reboot/nextboot.8
+++ b/sbin/reboot/nextboot.8
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd March 17, 2015
+.Dd January 31, 2012
.Dt NEXTBOOT 8
.Os
.Sh NAME
@@ -130,9 +130,3 @@ It is also my first attempt to write in Forth.
Finally, it does some evil things like writing to the file system before it
has been checked.
If it scrambles your file system, do not blame me.
-.Pp
-.Xr loader 8
-is only able to read ZFS, not write to it.
-.Pa nextboot.conf
-will NOT be reset in case of a kernel boot failure.
-
diff --git a/sbin/recoverdisk/Makefile.depend b/sbin/recoverdisk/Makefile.depend
new file mode 100644
index 000000000000..96aa2a21a959
--- /dev/null
+++ b/sbin/recoverdisk/Makefile.depend
@@ -0,0 +1,19 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/resolvconf/Makefile b/sbin/resolvconf/Makefile
index 2d4701eade42..18ef240d8465 100644
--- a/sbin/resolvconf/Makefile
+++ b/sbin/resolvconf/Makefile
@@ -5,7 +5,7 @@ DIST= ${.CURDIR}/../../contrib/openresolv
SCRIPTS= resolvconf
-FILES= libc dnsmasq named pdnsd pdns_recursor unbound
+FILES= libc dnsmasq named pdnsd unbound
FILESDIR= /libexec/resolvconf
MAN= resolvconf.conf.5 resolvconf.8
diff --git a/sbin/resolvconf/Makefile.depend b/sbin/resolvconf/Makefile.depend
new file mode 100644
index 000000000000..57b7e10c3d71
--- /dev/null
+++ b/sbin/resolvconf/Makefile.depend
@@ -0,0 +1,12 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/restore/Makefile.depend b/sbin/restore/Makefile.depend
new file mode 100644
index 000000000000..4a9f7867ec6d
--- /dev/null
+++ b/sbin/restore/Makefile.depend
@@ -0,0 +1,20 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/protocols \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/restore/dirs.c b/sbin/restore/dirs.c
index 7b308cd02415..b2cd8fd28869 100644
--- a/sbin/restore/dirs.c
+++ b/sbin/restore/dirs.c
@@ -80,8 +80,8 @@ static struct inotab *inotab[HASHSIZE];
*/
struct modeinfo {
ino_t ino;
- struct timespec ctimep[2];
- struct timespec mtimep[2];
+ struct timeval ctimep[2];
+ struct timeval mtimep[2];
mode_t mode;
uid_t uid;
gid_t gid;
@@ -656,8 +656,8 @@ setdirmodes(int flags)
else
(void) chown(cp, node.uid, node.gid);
(void) chmod(cp, node.mode);
- utimensat(AT_FDCWD, cp, node.ctimep, 0);
- utimensat(AT_FDCWD, cp, node.mtimep, 0);
+ utimes(cp, node.ctimep);
+ utimes(cp, node.mtimep);
(void) chflags(cp, node.flags);
}
ep->e_flags &= ~NEW;
@@ -746,13 +746,13 @@ allocinotab(struct context *ctxp, long seekpt)
return (itp);
node.ino = ctxp->ino;
node.mtimep[0].tv_sec = ctxp->atime_sec;
- node.mtimep[0].tv_nsec = ctxp->atime_nsec;
+ node.mtimep[0].tv_usec = ctxp->atime_nsec / 1000;
node.mtimep[1].tv_sec = ctxp->mtime_sec;
- node.mtimep[1].tv_nsec = ctxp->mtime_nsec;
+ node.mtimep[1].tv_usec = ctxp->mtime_nsec / 1000;
node.ctimep[0].tv_sec = ctxp->atime_sec;
- node.ctimep[0].tv_nsec = ctxp->atime_nsec;
+ node.ctimep[0].tv_usec = ctxp->atime_nsec / 1000;
node.ctimep[1].tv_sec = ctxp->birthtime_sec;
- node.ctimep[1].tv_nsec = ctxp->birthtime_nsec;
+ node.ctimep[1].tv_usec = ctxp->birthtime_nsec / 1000;
node.extsize = ctxp->extsize;
node.mode = ctxp->mode;
node.flags = ctxp->file_flags;
diff --git a/sbin/restore/tape.c b/sbin/restore/tape.c
index 9c9890f1b8a3..225fe3250bdb 100644
--- a/sbin/restore/tape.c
+++ b/sbin/restore/tape.c
@@ -569,20 +569,20 @@ extractfile(char *name)
gid_t gid;
mode_t mode;
int extsize;
- struct timespec mtimep[2], ctimep[2];
+ struct timeval mtimep[2], ctimep[2];
struct entry *ep;
char *buf;
curfile.name = name;
curfile.action = USING;
mtimep[0].tv_sec = curfile.atime_sec;
- mtimep[0].tv_nsec = curfile.atime_nsec;
+ mtimep[0].tv_usec = curfile.atime_nsec / 1000;
mtimep[1].tv_sec = curfile.mtime_sec;
- mtimep[1].tv_nsec = curfile.mtime_nsec;
+ mtimep[1].tv_usec = curfile.mtime_nsec / 1000;
ctimep[0].tv_sec = curfile.atime_sec;
- ctimep[0].tv_nsec = curfile.atime_nsec;
+ ctimep[0].tv_usec = curfile.atime_nsec / 1000;
ctimep[1].tv_sec = curfile.birthtime_sec;
- ctimep[1].tv_nsec = curfile.birthtime_nsec;
+ ctimep[1].tv_usec = curfile.birthtime_nsec / 1000;
extsize = curfile.extsize;
uid = getuid();
if (uid == 0)
@@ -628,10 +628,8 @@ extractfile(char *name)
set_extattr_link(name, buf, extsize);
(void) lchown(name, uid, gid);
(void) lchmod(name, mode);
- (void) utimensat(AT_FDCWD, name, ctimep,
- AT_SYMLINK_NOFOLLOW);
- (void) utimensat(AT_FDCWD, name, mtimep,
- AT_SYMLINK_NOFOLLOW);
+ (void) lutimes(name, ctimep);
+ (void) lutimes(name, mtimep);
(void) lchflags(name, flags);
return (GOOD);
}
@@ -660,8 +658,8 @@ extractfile(char *name)
}
(void) chown(name, uid, gid);
(void) chmod(name, mode);
- (void) utimensat(AT_FDCWD, name, ctimep, 0);
- (void) utimensat(AT_FDCWD, name, mtimep, 0);
+ (void) utimes(name, ctimep);
+ (void) utimes(name, mtimep);
(void) chflags(name, flags);
return (GOOD);
@@ -690,8 +688,8 @@ extractfile(char *name)
}
(void) chown(name, uid, gid);
(void) chmod(name, mode);
- (void) utimensat(AT_FDCWD, name, ctimep, 0);
- (void) utimensat(AT_FDCWD, name, mtimep, 0);
+ (void) utimes(name, ctimep);
+ (void) utimes(name, mtimep);
(void) chflags(name, flags);
return (GOOD);
@@ -716,8 +714,8 @@ extractfile(char *name)
set_extattr_fd(ofile, name, buf, extsize);
(void) fchown(ofile, uid, gid);
(void) fchmod(ofile, mode);
- (void) futimens(ofile, ctimep);
- (void) futimens(ofile, mtimep);
+ (void) futimes(ofile, ctimep);
+ (void) futimes(ofile, mtimep);
(void) fchflags(ofile, flags);
(void) close(ofile);
return (GOOD);
diff --git a/sbin/route/Makefile.depend b/sbin/route/Makefile.depend
new file mode 100644
index 000000000000..32760141ab1a
--- /dev/null
+++ b/sbin/route/Makefile.depend
@@ -0,0 +1,22 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+route.o: keywords.h
+route.po: keywords.h
+.endif
diff --git a/sbin/route/route.c b/sbin/route/route.c
index 1bce41ef4298..53ec2986341a 100644
--- a/sbin/route/route.c
+++ b/sbin/route/route.c
@@ -1137,11 +1137,19 @@ inet_makenetandmask(u_long net, struct sockaddr_in *sin,
static int
inet6_makenetandmask(struct sockaddr_in6 *sin6, const char *plen)
{
+ struct in6_addr in6;
if (plen == NULL) {
if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr) &&
- sin6->sin6_scope_id == 0)
+ sin6->sin6_scope_id == 0) {
plen = "0";
+ } else if ((sin6->sin6_addr.s6_addr[0] & 0xe0) == 0x20) {
+ /* aggregatable global unicast - RFC2374 */
+ memset(&in6, 0, sizeof(in6));
+ if (!memcmp(&sin6->sin6_addr.s6_addr[8],
+ &in6.s6_addr[8], 8))
+ plen = "64";
+ }
}
if (plen == NULL || strcmp(plen, "128") == 0)
diff --git a/sbin/routed/Makefile b/sbin/routed/Makefile
index 2308722c7191..8f2a8193318e 100644
--- a/sbin/routed/Makefile
+++ b/sbin/routed/Makefile
@@ -5,7 +5,8 @@ PROG= routed
MAN= routed.8
SRCS= if.c input.c main.c output.c parms.c radix.c rdisc.c table.c trace.c
WARNS?= 3
-LIBADD= md
+DPADD= ${LIBMD}
+LDADD= -lmd
SUBDIR= rtquery
diff --git a/sbin/routed/Makefile.depend b/sbin/routed/Makefile.depend
new file mode 100644
index 000000000000..2ceda9ee81ea
--- /dev/null
+++ b/sbin/routed/Makefile.depend
@@ -0,0 +1,22 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DEP_MACHINE := ${.PARSEFILE:E}
+
+DIRDEPS = \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/protocols \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libmd \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/routed/input.c b/sbin/routed/input.c
index 895ef507db7e..901c4f3e6b9e 100644
--- a/sbin/routed/input.c
+++ b/sbin/routed/input.c
@@ -288,10 +288,6 @@ input(struct sockaddr_in *from, /* received from this IP address */
/* Answer a query from a utility program
* with all we know.
*/
- if (aifp == NULL) {
- trace_pkt("ignore remote query");
- return;
- }
if (from->sin_port != htons(RIP_PORT)) {
/*
* insecure: query from non-router node
diff --git a/sbin/routed/routed.8 b/sbin/routed/routed.8
index 68d3f96abae5..ca5250b21efa 100644
--- a/sbin/routed/routed.8
+++ b/sbin/routed/routed.8
@@ -254,7 +254,7 @@ The following options are available:
allow
.Nm
to accept a RIP request from non-router node.
-When specified once,
+When specified once,
.Nm
replies to a route information query from neighbor nodes.
When specified twice,
diff --git a/sbin/routed/rtquery/Makefile b/sbin/routed/rtquery/Makefile
index 4df7dc29ace3..e5d0f5a65203 100644
--- a/sbin/routed/rtquery/Makefile
+++ b/sbin/routed/rtquery/Makefile
@@ -4,7 +4,8 @@
PROG= rtquery
MAN= rtquery.8
-LIBADD= md
+LDADD= -lmd
+DPADD= ${LIBMD}
WARNS?= 3
NO_WARRAY_BOUNDS=
diff --git a/sbin/routed/rtquery/Makefile.depend b/sbin/routed/rtquery/Makefile.depend
new file mode 100644
index 000000000000..beb04be9c6be
--- /dev/null
+++ b/sbin/routed/rtquery/Makefile.depend
@@ -0,0 +1,22 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/protocols \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libmd \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/rtsol/Makefile.depend b/sbin/rtsol/Makefile.depend
new file mode 100644
index 000000000000..b68b4bb5daf9
--- /dev/null
+++ b/sbin/rtsol/Makefile.depend
@@ -0,0 +1,20 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/savecore/Makefile b/sbin/savecore/Makefile
index 5134e4c546a7..f25745826029 100644
--- a/sbin/savecore/Makefile
+++ b/sbin/savecore/Makefile
@@ -1,7 +1,8 @@
# $FreeBSD$
PROG= savecore
-LIBADD= z xo
+DPADD= ${LIBZ}
+LDADD= -lz
MAN= savecore.8
.include <bsd.prog.mk>
diff --git a/sbin/savecore/Makefile.depend b/sbin/savecore/Makefile.depend
new file mode 100644
index 000000000000..4f4a210e3f59
--- /dev/null
+++ b/sbin/savecore/Makefile.depend
@@ -0,0 +1,20 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libz \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/savecore/savecore.c b/sbin/savecore/savecore.c
index 705261f92387..7a5fc4c937da 100644
--- a/sbin/savecore/savecore.c
+++ b/sbin/savecore/savecore.c
@@ -80,7 +80,6 @@ __FBSDID("$FreeBSD$");
#include <syslog.h>
#include <time.h>
#include <unistd.h>
-#include <libxo/xo.h>
/* The size of the buffer used for I/O. */
#define BUFFERSIZE (1024*1024)
@@ -99,28 +98,29 @@ static sig_atomic_t got_siginfo;
static void infohandler(int);
static void
-printheader(xo_handle_t *xo, const struct kerneldumpheader *h, const char *device,
+printheader(FILE *f, const struct kerneldumpheader *h, const char *device,
int bounds, const int status)
{
uint64_t dumplen;
time_t t;
const char *stat_str;
- xo_flush_h(xo);
- xo_emit_h(xo, "{Lwc:Dump header from device}{:dump_device/%s}\n", device);
- xo_emit_h(xo, "{P: }{Lwc:Architecture}{:architecture/%s}\n", h->architecture);
- xo_emit_h(xo, "{P: }{Lwc:Architecture Version}{:architecture_version/%u}\n", dtoh32(h->architectureversion));
+ fprintf(f, "Dump header from device %s\n", device);
+ fprintf(f, " Architecture: %s\n", h->architecture);
+ fprintf(f, " Architecture Version: %u\n",
+ dtoh32(h->architectureversion));
dumplen = dtoh64(h->dumplength);
- xo_emit_h(xo, "{P: }{Lwc:Dump Length}{:dump_length_bytes/%lld}\n", (long long)dumplen);
- xo_emit_h(xo, "{P: }{Lwc:Blocksize}{:blocksize/%d}\n", dtoh32(h->blocksize));
+ fprintf(f, " Dump Length: %lldB (%lld MB)\n", (long long)dumplen,
+ (long long)(dumplen >> 20));
+ fprintf(f, " Blocksize: %d\n", dtoh32(h->blocksize));
t = dtoh64(h->dumptime);
- xo_emit_h(xo, "{P: }{Lwc:Dumptime}{:dumptime/%s}", ctime(&t));
- xo_emit_h(xo, "{P: }{Lwc:Hostname}{:hostname/%s}\n", h->hostname);
- xo_emit_h(xo, "{P: }{Lwc:Magic}{:magic/%s}\n", h->magic);
- xo_emit_h(xo, "{P: }{Lwc:Version String}{:version_string/%s}", h->versionstring);
- xo_emit_h(xo, "{P: }{Lwc:Panic String}{:panic_string/%s}\n", h->panicstring);
- xo_emit_h(xo, "{P: }{Lwc:Dump Parity}{:dump_parity/%u}\n", h->parity);
- xo_emit_h(xo, "{P: }{Lwc:Bounds}{:bounds/%d}\n", bounds);
+ fprintf(f, " Dumptime: %s", ctime(&t));
+ fprintf(f, " Hostname: %s\n", h->hostname);
+ fprintf(f, " Magic: %s\n", h->magic);
+ fprintf(f, " Version String: %s", h->versionstring);
+ fprintf(f, " Panic String: %s\n", h->panicstring);
+ fprintf(f, " Dump Parity: %u\n", h->parity);
+ fprintf(f, " Bounds: %d\n", bounds);
switch(status) {
case STATUS_BAD:
@@ -132,8 +132,8 @@ printheader(xo_handle_t *xo, const struct kerneldumpheader *h, const char *devic
default:
stat_str = "unknown";
}
- xo_emit_h(xo, "{P: }{Lwc:Dump Status}{:dump_status/%s}\n", stat_str);
- xo_flush_h(xo);
+ fprintf(f, " Dump Status: %s\n", stat_str);
+ fflush(f);
}
static int
@@ -434,7 +434,6 @@ DoTextdumpFile(int fd, off_t dumpsize, off_t lasthd, char *buf,
static void
DoFile(const char *savedir, const char *device)
{
- xo_handle_t *xostdout, *xoinfo;
static char infoname[PATH_MAX], corename[PATH_MAX], linkname[PATH_MAX];
static char *buf = NULL;
struct kerneldumpheader kdhf, kdhl;
@@ -443,19 +442,13 @@ DoFile(const char *savedir, const char *device)
mode_t oumask;
int fd, fdinfo, error;
int bounds, status;
- u_int sectorsize, xostyle;
+ u_int sectorsize;
int istextdump;
bounds = getbounds();
mediasize = 0;
status = STATUS_UNKNOWN;
- xostdout = xo_create_to_file(stdout, XO_STYLE_TEXT, 0);
- if (xostdout == NULL) {
- syslog(LOG_ERR, "%s: %m", infoname);
- return;
- }
-
if (maxdumps > 0 && bounds == maxdumps)
bounds = 0;
@@ -581,10 +574,10 @@ DoFile(const char *savedir, const char *device)
if (verbose >= 2) {
printf("First dump headers:\n");
- printheader(xostdout, &kdhf, device, bounds, -1);
+ printheader(stdout, &kdhf, device, bounds, -1);
printf("\nLast dump headers:\n");
- printheader(xostdout, &kdhl, device, bounds, -1);
+ printheader(stdout, &kdhl, device, bounds, -1);
printf("\n");
}
@@ -633,7 +626,6 @@ DoFile(const char *savedir, const char *device)
nerr++;
goto closefd;
}
-
oumask = umask(S_IRWXG|S_IRWXO); /* Restrict access to the core file.*/
if (compress) {
snprintf(corename, sizeof(corename), "%s.%d.gz",
@@ -660,22 +652,10 @@ DoFile(const char *savedir, const char *device)
goto closefd;
}
- xostyle = xo_get_style(NULL);
- xoinfo = xo_create_to_file(info, xostyle, 0);
- if (xoinfo == NULL) {
- syslog(LOG_ERR, "%s: %m", infoname);
- nerr++;
- goto closefd;
- }
- xo_open_container_h(xoinfo, "crashdump");
-
if (verbose)
- printheader(xostdout, &kdhl, device, bounds, status);
+ printheader(stdout, &kdhl, device, bounds, status);
- printheader(xoinfo, &kdhl, device, bounds, status);
- xo_close_container_h(xoinfo, "crashdump");
- xo_flush_h(xoinfo);
- xo_finish_h(xoinfo);
+ printheader(info, &kdhl, device, bounds, status);
fclose(info);
syslog(LOG_NOTICE, "writing %score to %s/%s",
@@ -732,8 +712,6 @@ nuke:
syslog(LOG_ERR,
"error while clearing the dump header: %m");
}
- xo_close_container_h(xostdout, "crashdump");
- xo_finish_h(xostdout);
close(fd);
return;
@@ -747,7 +725,7 @@ closefd:
static void
usage(void)
{
- xo_error("%s\n%s\n%s\n",
+ fprintf(stderr, "%s\n%s\n%s\n",
"usage: savecore -c [-v] [device ...]",
" savecore -C [-v] [device ...]",
" savecore [-fkvz] [-m maxdumps] [directory [device ...]]");
@@ -767,10 +745,6 @@ main(int argc, char **argv)
openlog("savecore", LOG_PERROR, LOG_DAEMON);
signal(SIGINFO, infohandler);
- argc = xo_parse_args(argc, argv);
- if (argc < 0)
- exit(1);
-
while ((ch = getopt(argc, argv, "Ccfkm:vz")) != -1)
switch(ch) {
case 'C':
diff --git a/sbin/sconfig/Makefile.depend b/sbin/sconfig/Makefile.depend
new file mode 100644
index 000000000000..a83954553d0e
--- /dev/null
+++ b/sbin/sconfig/Makefile.depend
@@ -0,0 +1,19 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DEP_MACHINE := ${.PARSEFILE:E}
+
+DIRDEPS = \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/setkey/Makefile b/sbin/setkey/Makefile
index e974af5f0b15..bd04f07c1eb4 100644
--- a/sbin/setkey/Makefile
+++ b/sbin/setkey/Makefile
@@ -37,7 +37,8 @@ WARNS?= 1
CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../../lib/libipsec
YFLAGS= -d
-LIBADD= l y
+DPADD= ${LIBL} ${LIBY}
+LDADD= -ll -ly
CLEANFILES= y.tab.c y.tab.h key_test.o keytest
@@ -54,7 +55,8 @@ CFLAGS+= -DIPSEC_DEBUG -DYY_NO_UNPUT
CFLAGS+= -DINET6
.endif
CFLAGS+= -I.
-LIBADD+= ipsec
+DPADD+= ${LIBIPSEC}
+LDADD+= -lipsec
CLEANFILES+= scriptdump y.tab.h
#SCRIPTS= scriptdump
diff --git a/sbin/setkey/Makefile.depend b/sbin/setkey/Makefile.depend
new file mode 100644
index 000000000000..2c5eceab3944
--- /dev/null
+++ b/sbin/setkey/Makefile.depend
@@ -0,0 +1,29 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libipsec \
+ lib/liby \
+ usr.bin/lex/lib \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+parse.o: parse.c
+parse.po: parse.c
+token.o: token.c
+token.o: y.tab.h
+token.po: token.c
+token.po: y.tab.h
+.endif
diff --git a/sbin/shutdown/Makefile.depend b/sbin/shutdown/Makefile.depend
new file mode 100644
index 000000000000..96aa2a21a959
--- /dev/null
+++ b/sbin/shutdown/Makefile.depend
@@ -0,0 +1,19 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/shutdown/shutdown.8 b/sbin/shutdown/shutdown.8
index 4145ba5b64df..871efbed8b06 100644
--- a/sbin/shutdown/shutdown.8
+++ b/sbin/shutdown/shutdown.8
@@ -28,7 +28,7 @@
.\" @(#)shutdown.8 8.2 (Berkeley) 4/27/95
.\" $FreeBSD$
.\"
-.Dd December 15, 2014
+.Dd March 19, 2013
.Dt SHUTDOWN 8
.Os
.Sh NAME
@@ -118,15 +118,6 @@ to the current system values.
The first form brings the system down in
.Ar number
minutes and the second at the absolute time specified.
-.Ar +number
-may be specified in units other than minutes by appending the corresponding
-suffix:
-.Dq Li s ,
-.Dq Li sec ,
-.Dq Li m ,
-.Dq Li min .
-.Dq Li h ,
-.Dq Li hour .
.It Ar warning-message
Any other arguments comprise the warning message that is broadcast
to users currently logged into the system.
diff --git a/sbin/shutdown/shutdown.c b/sbin/shutdown/shutdown.c
index b04e0bd87de6..f53b3d8c98f9 100644
--- a/sbin/shutdown/shutdown.c
+++ b/sbin/shutdown/shutdown.c
@@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$");
#include <ctype.h>
#include <err.h>
-#include <errno.h>
#include <fcntl.h>
#include <paths.h>
#include <pwd.h>
@@ -323,8 +322,7 @@ timewarn(int timeleft)
(void)fprintf(pf, "System going down in %d minute%s\n\n",
timeleft / 60, (timeleft > 60) ? "s" : "");
else if (timeleft)
- (void)fprintf(pf, "System going down in %s30 seconds\n\n",
- (offset > 0 && offset < 30 ? "less than " : ""));
+ (void)fprintf(pf, "System going down in 30 seconds\n\n");
else
(void)fprintf(pf, "System going down IMMEDIATELY\n\n");
@@ -417,7 +415,6 @@ getoffset(char *timearg)
char *p;
time_t now;
int this_year;
- char *timeunit;
(void)time(&now);
@@ -430,25 +427,8 @@ getoffset(char *timearg)
if (*timearg == '+') { /* +minutes */
if (!isdigit(*++timearg))
badtime();
- errno = 0;
- offset = strtol(timearg, &timeunit, 10);
- if (offset < 0 || offset == LONG_MAX || errno != 0)
+ if ((offset = atoi(timearg) * 60) < 0)
badtime();
- if (timeunit[0] == '\0' || strcasecmp(timeunit, "m") == 0 ||
- strcasecmp(timeunit, "min") == 0 ||
- strcasecmp(timeunit, "mins") == 0) {
- offset *= 60;
- } else if (strcasecmp(timeunit, "h") == 0 ||
- strcasecmp(timeunit, "hour") == 0 ||
- strcasecmp(timeunit, "hours") == 0) {
- offset *= 60 * 60;
- } else if (strcasecmp(timeunit, "s") == 0 ||
- strcasecmp(timeunit, "sec") == 0 ||
- strcasecmp(timeunit, "secs") == 0) {
- offset *= 1;
- } else {
- badtime();
- }
shuttime = now + offset;
return;
}
diff --git a/sbin/spppcontrol/Makefile.depend b/sbin/spppcontrol/Makefile.depend
new file mode 100644
index 000000000000..96aa2a21a959
--- /dev/null
+++ b/sbin/spppcontrol/Makefile.depend
@@ -0,0 +1,19 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/sunlabel/Makefile b/sbin/sunlabel/Makefile
index 21ccfd751a68..ed64bee5809c 100644
--- a/sbin/sunlabel/Makefile
+++ b/sbin/sunlabel/Makefile
@@ -11,7 +11,8 @@ LINKS= ${BINDIR}/sunlabel ${BINDIR}/disklabel
MLINKS= sunlabel.8 disklabel.8
.endif
-LIBADD= geom
+DPADD= ${LIBGEOM}
+LDADD= -lgeom
.include <bsd.prog.mk>
diff --git a/sbin/sunlabel/Makefile.depend b/sbin/sunlabel/Makefile.depend
new file mode 100644
index 000000000000..25f093b1c085
--- /dev/null
+++ b/sbin/sunlabel/Makefile.depend
@@ -0,0 +1,20 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DEP_MACHINE := ${.PARSEFILE:E}
+
+DIRDEPS = \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libgeom \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/swapon/Makefile b/sbin/swapon/Makefile
index e9074be9c433..6f8e8df2e5a6 100644
--- a/sbin/swapon/Makefile
+++ b/sbin/swapon/Makefile
@@ -8,6 +8,7 @@ LINKS+= ${BINDIR}/swapon ${BINDIR}/swapctl
MLINKS= swapon.8 swapoff.8
MLINKS+=swapon.8 swapctl.8
-LIBADD= util
+DPADD= ${LIBUTIL}
+LDADD= -lutil
.include <bsd.prog.mk>
diff --git a/sbin/swapon/Makefile.depend b/sbin/swapon/Makefile.depend
new file mode 100644
index 000000000000..78b235bef5b2
--- /dev/null
+++ b/sbin/swapon/Makefile.depend
@@ -0,0 +1,20 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libutil \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/sysctl/Makefile.depend b/sbin/sysctl/Makefile.depend
new file mode 100644
index 000000000000..96aa2a21a959
--- /dev/null
+++ b/sbin/sysctl/Makefile.depend
@@ -0,0 +1,19 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/sysctl/sysctl.8 b/sbin/sysctl/sysctl.8
index cb8145e512cd..b81de6e8a312 100644
--- a/sbin/sysctl/sysctl.8
+++ b/sbin/sysctl/sysctl.8
@@ -28,7 +28,7 @@
.\" From: @(#)sysctl.8 8.1 (Berkeley) 6/6/93
.\" $FreeBSD$
.\"
-.Dd February 12, 2015
+.Dd December 13, 2012
.Dt SYSCTL 8
.Os
.Sh NAME
@@ -37,13 +37,11 @@
.Sh SYNOPSIS
.Nm
.Op Fl bdehiNnoRTqx
-.Op Fl B Ar bufsize
.Op Fl f Ar filename
.Ar name Ns Op = Ns Ar value
.Ar ...
.Nm
.Op Fl bdehNnoRTqx
-.Op Fl B Ar bufsize
.Fl a
.Sh DESCRIPTION
The
@@ -70,15 +68,6 @@ the command line.
Force the value of the variable(s) to be output in raw, binary format.
No names are printed and no terminating newlines are output.
This is mostly useful with a single variable.
-.It Fl B Ar bufsize
-Set the buffer size to read from the
-.Nm
-to
-.Ar bufsize .
-This is necessary for a
-.Nm
-that has variable length, and the probe value of 0 is a valid length, such as
-.Va kern.arandom .
.It Fl d
Print the description of the variable instead of its value.
.It Fl e
@@ -139,7 +128,7 @@ Suppress some warnings generated by
.Nm
to standard error.
.It Fl T
-Display only variables that are settable via loader (CTLFLAG_TUN).
+Display only variables that are setable via loader (CTLFLAG_TUN).
.It Fl W
Display only writable variables that are not statistical.
Useful for determining the set of runtime tunable sysctls.
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c
index f32112013610..a6ea9f9891a5 100644
--- a/sbin/sysctl/sysctl.c
+++ b/sbin/sysctl/sysctl.c
@@ -71,7 +71,7 @@ static const char rcsid[] =
static const char *conffile;
-static int aflag, bflag, Bflag, dflag, eflag, hflag, iflag;
+static int aflag, bflag, dflag, eflag, hflag, iflag;
static int Nflag, nflag, oflag, qflag, Tflag, Wflag, xflag;
static int oidfmt(int *, int, char *, u_int *);
@@ -112,8 +112,8 @@ usage(void)
{
(void)fprintf(stderr, "%s\n%s\n",
- "usage: sysctl [-bdehiNnoqTWx] [ -B <bufsize> ] [-f filename] name[=value] ...",
- " sysctl [-bdehNnoqTWx] [ -B <bufsize> ] -a");
+ "usage: sysctl [-bdehiNnoqTWx] [-f filename] name[=value] ...",
+ " sysctl [-bdehNnoqTWx] -a");
exit(1);
}
@@ -127,7 +127,7 @@ main(int argc, char **argv)
setbuf(stdout,0);
setbuf(stderr,0);
- while ((ch = getopt(argc, argv, "AabB:def:hiNnoqTwWxX")) != -1) {
+ while ((ch = getopt(argc, argv, "Aabdef:hiNnoqTwWxX")) != -1) {
switch (ch) {
case 'A':
/* compatibility */
@@ -139,9 +139,6 @@ main(int argc, char **argv)
case 'b':
bflag = 1;
break;
- case 'B':
- Bflag = strtol(optarg, NULL, 0);
- break;
case 'd':
dflag = 1;
break;
@@ -225,7 +222,7 @@ parse(const char *string, int lineno)
unsigned int uintval;
long longval;
unsigned long ulongval;
- size_t newsize = Bflag;
+ size_t newsize = 0;
int64_t i64val;
uint64_t u64val;
int mib[CTL_MAXNAME];
@@ -682,18 +679,15 @@ strIKtoi(const char *str, char **endptrp)
p = &str[len - 1];
if (*p == 'C' || *p == 'F') {
temp = strtof(str, endptrp);
- if (*endptrp != str && *endptrp == p && errno == 0) {
+ if (*endptrp != str && *endptrp == p && errno != 0) {
if (*p == 'F')
temp = (temp - 32) * 5 / 9;
- *endptrp = NULL;
return (temp * 10 + 2732);
}
} else {
kelv = (int)strtol(str, endptrp, 10);
- if (*endptrp != str && *endptrp == p && errno == 0) {
- *endptrp = NULL;
+ if (*endptrp != str && *endptrp == p && errno != 0)
return (kelv);
- }
}
errno = ERANGE;
@@ -818,13 +812,9 @@ show_var(int *oid, int nlen)
return (0);
}
/* find an estimate of how much we need for this var */
- if (Bflag)
- j = Bflag;
- else {
- j = 0;
- i = sysctl(oid, nlen, 0, &j, 0, 0);
- j += j; /* we want to be sure :-) */
- }
+ j = 0;
+ i = sysctl(oid, nlen, 0, &j, 0, 0);
+ j += j; /* we want to be sure :-) */
val = oval = malloc(j + 1);
if (val == NULL) {
diff --git a/sbin/tunefs/Makefile b/sbin/tunefs/Makefile
index 07fe3b1ccaa1..d5313c445526 100644
--- a/sbin/tunefs/Makefile
+++ b/sbin/tunefs/Makefile
@@ -2,7 +2,8 @@
# $FreeBSD$
PROG= tunefs
-LIBADD= ufs
+DPADD= ${LIBUFS}
+LDADD= -lufs
MAN= tunefs.8
WARNS= 3
diff --git a/sbin/tunefs/Makefile.depend b/sbin/tunefs/Makefile.depend
new file mode 100644
index 000000000000..66da85cb1de1
--- /dev/null
+++ b/sbin/tunefs/Makefile.depend
@@ -0,0 +1,20 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libufs \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/umount/Makefile.depend b/sbin/umount/Makefile.depend
new file mode 100644
index 000000000000..c1655db8b437
--- /dev/null
+++ b/sbin/umount/Makefile.depend
@@ -0,0 +1,21 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/rpc \
+ include/rpcsvc \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/sbin/umount/umount.8 b/sbin/umount/umount.8
index e62bcc5dad58..cb3a97b8ed23 100644
--- a/sbin/umount/umount.8
+++ b/sbin/umount/umount.8
@@ -28,7 +28,7 @@
.\" @(#)umount.8 8.2 (Berkeley) 5/8/95
.\" $FreeBSD$
.\"
-.Dd November 22, 2014
+.Dd May 31, 2011
.Dt UMOUNT 8
.Os
.Sh NAME
@@ -140,7 +140,6 @@ file system table
.Sh SEE ALSO
.Xr unmount 2 ,
.Xr fstab 5 ,
-.Xr autounmountd 8 ,
.Xr mount 8
.Sh HISTORY
A