summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2015-11-11 11:08:21 -0200
committerRenato Botelho <renato@netgate.com>2015-11-11 11:08:21 -0200
commit4119672798028ff673a738690b48575973689004 (patch)
tree6a05ea1f50fa6610fe798bbf45852d32a83ab41a /usr.sbin
parent5e6268df600406a1570e822ac652576059d820e3 (diff)
parent2867f2c1d4795c2446a1c1d0b30db57d3aaca364 (diff)
downloadFreeBSD-src-4119672798028ff673a738690b48575973689004.zip
FreeBSD-src-4119672798028ff673a738690b48575973689004.tar.gz
Merge remote-tracking branch 'origin/stable/10' into devel
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bhyve/bhyverun.c3
-rw-r--r--usr.sbin/bluetooth/sdpcontrol/search.c52
-rw-r--r--usr.sbin/makefs/Makefile6
-rw-r--r--usr.sbin/makefs/cd9660.c6
-rw-r--r--usr.sbin/makefs/cd9660/cd9660_write.c6
-rw-r--r--usr.sbin/makefs/cd9660/iso9660_rrip.c9
-rw-r--r--usr.sbin/makefs/ffs.c4
-rw-r--r--usr.sbin/makefs/ffs/ffs_bswap.c8
-rw-r--r--usr.sbin/makefs/ffs/mkfs.c15
-rw-r--r--usr.sbin/makefs/makefs.811
-rw-r--r--usr.sbin/makefs/makefs.c14
-rw-r--r--usr.sbin/makefs/makefs.h1
-rw-r--r--usr.sbin/makefs/tests/Makefile17
-rwxr-xr-xusr.sbin/makefs/tests/makefs_cd9660_tests.sh373
-rwxr-xr-xusr.sbin/makefs/tests/makefs_ffs_tests.sh237
-rwxr-xr-xusr.sbin/makefs/tests/makefs_tests_common.sh152
-rw-r--r--usr.sbin/rtsold/rtsold.c10
17 files changed, 883 insertions, 41 deletions
diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c
index ee0f106..5b277af 100644
--- a/usr.sbin/bhyve/bhyverun.c
+++ b/usr.sbin/bhyve/bhyverun.c
@@ -258,7 +258,8 @@ fbsdrun_addcpu(struct vmctx *ctx, int fromcpu, int newcpu, uint64_t rip)
* with vm_suspend().
*/
error = vm_activate_cpu(ctx, newcpu);
- assert(error == 0);
+ if (error != 0)
+ err(EX_OSERR, "could not activate CPU %d", newcpu);
CPU_SET_ATOMIC(newcpu, &cpumask);
diff --git a/usr.sbin/bluetooth/sdpcontrol/search.c b/usr.sbin/bluetooth/sdpcontrol/search.c
index e7d8244..09ef5a3 100644
--- a/usr.sbin/bluetooth/sdpcontrol/search.c
+++ b/usr.sbin/bluetooth/sdpcontrol/search.c
@@ -102,6 +102,12 @@ print_service_class_id_list(uint8_t const *start, uint8_t const *end)
/* NOT REACHED */
}
+ if (len > (end - start)) {
+ fprintf(stderr, "Invalid Service Class ID List. " \
+ "Too long len=%d\n", len);
+ return;
+ }
+
while (start < end) {
SDP_GET8(type, start);
switch (type) {
@@ -258,28 +264,31 @@ print_protocol_descriptor(uint8_t const *start, uint8_t const *end)
case SDP_DATA_STR8:
case SDP_DATA_URL8:
SDP_GET8(len, start);
- fprintf(stdout, "%*.*s\n", len, len, (char *) start);
- start += len;
+ for (; start < end && len > 0; start ++, len --)
+ fprintf(stdout, "%c", *start);
+ fprintf(stdout, "\n");
break;
case SDP_DATA_STR16:
case SDP_DATA_URL16:
SDP_GET16(len, start);
- fprintf(stdout, "%*.*s\n", len, len, (char *) start);
- start += len;
+ for (; start < end && len > 0; start ++, len --)
+ fprintf(stdout, "%c", *start);
+ fprintf(stdout, "\n");
break;
case SDP_DATA_STR32:
case SDP_DATA_URL32:
SDP_GET32(len, start);
- fprintf(stdout, "%*.*s\n", len, len, (char *) start);
- start += len;
+ for (; start < end && len > 0; start ++, len --)
+ fprintf(stdout, "%c", *start);
+ fprintf(stdout, "\n");
break;
case SDP_DATA_SEQ8:
case SDP_DATA_ALT8:
SDP_GET8(len, start);
- for (; len > 0; start ++, len --)
+ for (; start < end && len > 0; start ++, len --)
fprintf(stdout, "%#2.2x ", *start);
fprintf(stdout, "\n");
break;
@@ -287,7 +296,7 @@ print_protocol_descriptor(uint8_t const *start, uint8_t const *end)
case SDP_DATA_SEQ16:
case SDP_DATA_ALT16:
SDP_GET16(len, start);
- for (; len > 0; start ++, len --)
+ for (; start < end && len > 0; start ++, len --)
fprintf(stdout, "%#2.2x ", *start);
fprintf(stdout, "\n");
break;
@@ -295,7 +304,7 @@ print_protocol_descriptor(uint8_t const *start, uint8_t const *end)
case SDP_DATA_SEQ32:
case SDP_DATA_ALT32:
SDP_GET32(len, start);
- for (; len > 0; start ++, len --)
+ for (; start < end && len > 0; start ++, len --)
fprintf(stdout, "%#2.2x ", *start);
fprintf(stdout, "\n");
break;
@@ -341,6 +350,12 @@ print_protocol_descriptor_list(uint8_t const *start, uint8_t const *end)
/* NOT REACHED */
}
+ if (len > (end - start)) {
+ fprintf(stderr, "Invalid Protocol Descriptor List. " \
+ "Too long, len=%d\n", len);
+ return;
+ }
+
while (start < end) {
SDP_GET8(type, start);
switch (type) {
@@ -363,6 +378,12 @@ print_protocol_descriptor_list(uint8_t const *start, uint8_t const *end)
/* NOT REACHED */
}
+ if (len > (end - start)) {
+ fprintf(stderr, "Invalid Protocol Descriptor List. " \
+ "Too long, len=%d\n", len);
+ return;
+ }
+
print_protocol_descriptor(start, start + len);
start += len;
}
@@ -415,6 +436,12 @@ print_bluetooth_profile_descriptor_list(uint8_t const *start, uint8_t const *end
/* NOT REACHED */
}
+ if (len > (end - start)) {
+ fprintf(stderr, "Invalid Bluetooth Profile Descriptor List. " \
+ "Too long, len=%d\n", len);
+ return;
+ }
+
while (start < end) {
SDP_GET8(type, start);
switch (type) {
@@ -438,6 +465,13 @@ print_bluetooth_profile_descriptor_list(uint8_t const *start, uint8_t const *end
/* NOT REACHED */
}
+ if (len > (end - start)) {
+ fprintf(stderr, "Invalid Bluetooth Profile " \
+ "Descriptor List. " \
+ "Too long, len=%d\n", len);
+ return;
+ }
+
/* Get UUID */
SDP_GET8(type, start);
switch (type) {
diff --git a/usr.sbin/makefs/Makefile b/usr.sbin/makefs/Makefile
index 6253148..f1afc55 100644
--- a/usr.sbin/makefs/Makefile
+++ b/usr.sbin/makefs/Makefile
@@ -1,5 +1,7 @@
# $FreeBSD$
+.include <bsd.own.mk>
+
PROG= makefs
CFLAGS+=-I${.CURDIR}
@@ -38,4 +40,8 @@ LDADD+= ${LIBNETBSD}
DPADD+= ${LIBSBUF} ${LIBUTIL}
LDADD+= -lsbuf -lutil
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/makefs/cd9660.c b/usr.sbin/makefs/cd9660.c
index ea4ed44..dcee66f 100644
--- a/usr.sbin/makefs/cd9660.c
+++ b/usr.sbin/makefs/cd9660.c
@@ -296,8 +296,8 @@ cd9660_parse_opts(const char *option, fsinfo_t *fsopts)
int rv;
/* Set up allowed options - integer options ONLY */
option_t cd9660_options[] = {
- { "l", &diskStructure.isoLevel, 1, 3, "ISO Level" },
- { "isolevel", &diskStructure.isoLevel, 1, 3, "ISO Level" },
+ { "l", &diskStructure.isoLevel, 1, 2, "ISO Level" },
+ { "isolevel", &diskStructure.isoLevel, 1, 2, "ISO Level" },
{ "verbose", &diskStructure.verbose_level, 0, 2,
"Turns on verbose output" },
{ "v", &diskStructure.verbose_level, 0 , 2,
@@ -1055,6 +1055,7 @@ cd9660_rename_filename(cd9660node *iter, int num, int delete_chars)
if (diskStructure.verbose_level > 0)
printf("Rename_filename called\n");
+ assert(1 <= diskStructure.isoLevel && diskStructure.isoLevel <= 2);
/* TODO : A LOT of chanes regarding 8.3 filenames */
if (diskStructure.isoLevel == 1)
maxlength = 8;
@@ -1730,6 +1731,7 @@ cd9660_joliet_convert_filename(const char *oldname, char *newname, int is_file)
static int
cd9660_convert_filename(const char *oldname, char *newname, int is_file)
{
+ assert(1 <= diskStructure.isoLevel && diskStructure.isoLevel <= 2);
/* NEW */
cd9660_filename_conversion_functor conversion_function = 0;
if (diskStructure.isoLevel == 1)
diff --git a/usr.sbin/makefs/cd9660/cd9660_write.c b/usr.sbin/makefs/cd9660/cd9660_write.c
index f27a76f..e17752a 100644
--- a/usr.sbin/makefs/cd9660/cd9660_write.c
+++ b/usr.sbin/makefs/cd9660/cd9660_write.c
@@ -165,7 +165,7 @@ cd9660_write_path_table(FILE *fd, off_t sector, int mode)
diskStructure.pathTableLength);
unsigned char *buffer;
unsigned char *buffer_head;
- int len;
+ int len, ret;
path_table_entry temp_entry;
cd9660node *ptcur;
@@ -213,8 +213,10 @@ cd9660_write_path_table(FILE *fd, off_t sector, int mode)
ptcur = ptcur->ptnext;
}
- return cd9660_write_filedata(fd, sector, buffer_head,
+ ret = cd9660_write_filedata(fd, sector, buffer_head,
path_table_sectors);
+ free(buffer_head);
+ return ret;
}
diff --git a/usr.sbin/makefs/cd9660/iso9660_rrip.c b/usr.sbin/makefs/cd9660/iso9660_rrip.c
index 5382857..749747b 100644
--- a/usr.sbin/makefs/cd9660/iso9660_rrip.c
+++ b/usr.sbin/makefs/cd9660/iso9660_rrip.c
@@ -1,4 +1,4 @@
-/* $NetBSD: iso9660_rrip.c,v 1.11 2012/04/29 13:32:21 joerg Exp $ */
+/* $NetBSD: iso9660_rrip.c,v 1.14 2014/05/30 13:14:47 martin Exp $ */
/*
* Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan
@@ -656,13 +656,14 @@ cd9660node_rrip_pn(struct ISO_SUSP_ATTRIBUTES *pn_field, fsnode *fnode)
pn_field->attr.rr_entry.PN.h.length[0] = 20;
pn_field->attr.rr_entry.PN.h.version[0] = 1;
- if (sizeof (fnode->inode->st.st_dev) > 32)
- cd9660_bothendian_dword((uint64_t)fnode->inode->st.st_dev >> 32,
+ if (sizeof (fnode->inode->st.st_rdev) > 4)
+ cd9660_bothendian_dword(
+ (uint64_t)fnode->inode->st.st_rdev >> 32,
pn_field->attr.rr_entry.PN.high);
else
cd9660_bothendian_dword(0, pn_field->attr.rr_entry.PN.high);
- cd9660_bothendian_dword(fnode->inode->st.st_dev & 0xffffffff,
+ cd9660_bothendian_dword(fnode->inode->st.st_rdev & 0xffffffff,
pn_field->attr.rr_entry.PN.low);
return 1;
}
diff --git a/usr.sbin/makefs/ffs.c b/usr.sbin/makefs/ffs.c
index 459d9ed..fb5403e 100644
--- a/usr.sbin/makefs/ffs.c
+++ b/usr.sbin/makefs/ffs.c
@@ -410,6 +410,10 @@ ffs_validate(const char *dir, fsnode *root, fsinfo_t *fsopts)
/* round up to the next block */
fsopts->size = roundup(fsopts->size, ffs_opts->bsize);
+ /* round up to requested block size, if any */
+ if (fsopts->roundup > 0)
+ fsopts->size = roundup(fsopts->size, fsopts->roundup);
+
/* calculate density if necessary */
if (ffs_opts->density == -1)
ffs_opts->density = fsopts->size / fsopts->inodes + 1;
diff --git a/usr.sbin/makefs/ffs/ffs_bswap.c b/usr.sbin/makefs/ffs/ffs_bswap.c
index a1a1c46..e62eb19 100644
--- a/usr.sbin/makefs/ffs/ffs_bswap.c
+++ b/usr.sbin/makefs/ffs/ffs_bswap.c
@@ -67,7 +67,7 @@ void ffs_csumtotal_swap(struct csum_total *o, struct csum_total *n);
void
ffs_sb_swap(struct fs *o, struct fs *n)
{
- int i;
+ size_t i;
u_int32_t *o32, *n32;
/*
@@ -97,7 +97,7 @@ ffs_sb_swap(struct fs *o, struct fs *n)
n->fs_csaddr = bswap64(o->fs_csaddr);
n->fs_pendingblocks = bswap64(o->fs_pendingblocks);
n->fs_pendinginodes = bswap32(o->fs_pendinginodes);
-
+
/* These fields overlap with the second half of the
* historic FS_42POSTBLFMT postbl table
*/
@@ -171,9 +171,9 @@ ffs_dinode2_swap(struct ufs2_dinode *o, struct ufs2_dinode *n)
void
ffs_csum_swap(struct csum *o, struct csum *n, int size)
{
- int i;
+ size_t i;
u_int32_t *oint, *nint;
-
+
oint = (u_int32_t*)o;
nint = (u_int32_t*)n;
diff --git a/usr.sbin/makefs/ffs/mkfs.c b/usr.sbin/makefs/ffs/mkfs.c
index f99ecab..b1bdd09 100644
--- a/usr.sbin/makefs/ffs/mkfs.c
+++ b/usr.sbin/makefs/ffs/mkfs.c
@@ -248,15 +248,16 @@ ffs_mkfs(const char *fsys, const fsinfo_t *fsopts)
exit(21);
}
sblock.fs_fsbtodb = ilog2(sblock.fs_fsize / sectorsize);
- sblock.fs_size = fssize = dbtofsb(&sblock, fssize);
+ sblock.fs_size = sblock.fs_providersize = fssize =
+ dbtofsb(&sblock, fssize);
if (Oflag <= 1) {
sblock.fs_magic = FS_UFS1_MAGIC;
sblock.fs_sblockloc = SBLOCK_UFS1;
- sblock.fs_nindir = sblock.fs_bsize / sizeof(int32_t);
+ sblock.fs_nindir = sblock.fs_bsize / sizeof(ufs1_daddr_t);
sblock.fs_inopb = sblock.fs_bsize / sizeof(struct ufs1_dinode);
sblock.fs_maxsymlinklen = ((NDADDR + NIADDR) *
- sizeof (int32_t));
+ sizeof (ufs1_daddr_t));
sblock.fs_old_inodefmt = FS_44INODEFMT;
sblock.fs_old_cgoffset = 0;
sblock.fs_old_cgmask = 0xffffffff;
@@ -272,15 +273,11 @@ ffs_mkfs(const char *fsys, const fsinfo_t *fsopts)
sblock.fs_old_nrpos = 1;
} else {
sblock.fs_magic = FS_UFS2_MAGIC;
-#if 0 /* XXX makefs is used for small filesystems. */
sblock.fs_sblockloc = SBLOCK_UFS2;
-#else
- sblock.fs_sblockloc = SBLOCK_UFS1;
-#endif
- sblock.fs_nindir = sblock.fs_bsize / sizeof(int64_t);
+ sblock.fs_nindir = sblock.fs_bsize / sizeof(ufs2_daddr_t);
sblock.fs_inopb = sblock.fs_bsize / sizeof(struct ufs2_dinode);
sblock.fs_maxsymlinklen = ((NDADDR + NIADDR) *
- sizeof (int64_t));
+ sizeof (ufs2_daddr_t));
}
sblock.fs_sblkno =
diff --git a/usr.sbin/makefs/makefs.8 b/usr.sbin/makefs/makefs.8
index 51e536f..6b8f5cd 100644
--- a/usr.sbin/makefs/makefs.8
+++ b/usr.sbin/makefs/makefs.8
@@ -35,7 +35,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd August 16, 2013
+.Dd October 29, 2015
.Dt MAKEFS 8
.Os
.Sh NAME
@@ -53,6 +53,7 @@
.Op Fl m Ar maximum-size
.Op Fl N Ar userdb-dir
.Op Fl o Ar fs-options
+.Op Fl R Ar roundup-size
.Op Fl S Ar sector-size
.Op Fl s Ar image-size
.Op Fl t Ar fs-type
@@ -195,6 +196,14 @@ Deprecated.
See the
.Fl Z
flag.
+.It Fl R Ar roundup-size
+Round the image up to
+.Ar roundup-size .
+.Ar roundup-size
+should be a multiple of the file system block size.
+This option only applies to the
+.Sy ffs
+file system type.
.It Fl S Ar sector-size
Set the file system sector size to
.Ar sector-size .
diff --git a/usr.sbin/makefs/makefs.c b/usr.sbin/makefs/makefs.c
index bf10034..bca9722 100644
--- a/usr.sbin/makefs/makefs.c
+++ b/usr.sbin/makefs/makefs.c
@@ -113,7 +113,7 @@ main(int argc, char *argv[])
start_time.tv_sec = start.tv_sec;
start_time.tv_nsec = start.tv_usec * 1000;
- while ((ch = getopt(argc, argv, "B:b:Dd:f:F:M:m:N:o:ps:S:t:xZ")) != -1) {
+ while ((ch = getopt(argc, argv, "B:b:Dd:f:F:M:m:N:o:pr:s:S:t:xZ")) != -1) {
switch (ch) {
case 'B':
@@ -209,6 +209,12 @@ main(int argc, char *argv[])
fsoptions.sparse = 1;
break;
+ case 'R':
+ /* Round image size up to specified block size */
+ fsoptions.roundup =
+ strsuftoll("roundup-size", optarg, 0, LLONG_MAX);
+ break;
+
case 's':
fsoptions.minsize = fsoptions.maxsize =
strsuftoll("size", optarg, 1LL, LLONG_MAX);
@@ -359,9 +365,9 @@ usage(void)
prog = getprogname();
fprintf(stderr,
"usage: %s [-t fs-type] [-o fs-options] [-d debug-mask] [-B endian]\n"
-"\t[-S sector-size] [-M minimum-size] [-m maximum-size] [-s image-size]\n"
-"\t[-b free-blocks] [-f free-files] [-F mtree-specfile] [-xZ]\n"
-"\t[-N userdb-dir] image-file directory | manifest [extra-directory ...]\n",
+"\t[-S sector-size] [-M minimum-size] [-m maximum-size] [-R roundup-size]\n"
+"\t[-s image-size] [-b free-blocks] [-f free-files] [-F mtree-specfile]\n"
+"\t[-xZ] [-N userdb-dir] image-file directory | manifest [extra-directory ...]\n",
prog);
exit(1);
}
diff --git a/usr.sbin/makefs/makefs.h b/usr.sbin/makefs/makefs.h
index 5ab0444..ba80f74 100644
--- a/usr.sbin/makefs/makefs.h
+++ b/usr.sbin/makefs/makefs.h
@@ -130,6 +130,7 @@ typedef struct {
int needswap; /* non-zero if byte swapping needed */
int sectorsize; /* sector size */
int sparse; /* sparse image, don't fill it with zeros */
+ off_t roundup; /* round image size up to this value */
void *fs_specific; /* File system specific additions. */
} fsinfo_t;
diff --git a/usr.sbin/makefs/tests/Makefile b/usr.sbin/makefs/tests/Makefile
new file mode 100644
index 0000000..0d1a1b6
--- /dev/null
+++ b/usr.sbin/makefs/tests/Makefile
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/usr.sbin/makefs
+
+ATF_TESTS_SH+= makefs_cd9660_tests
+ATF_TESTS_SH+= makefs_ffs_tests
+
+BINDIR= ${TESTSDIR}
+
+SCRIPTS+= makefs_tests_common.sh
+SCRIPTSNAME_makefs_tests_common.sh= makefs_tests_common.sh
+
+.for t in ${ATF_TESTS_SH}
+TEST_METADATA.$t+= required_user="root"
+.endfor
+
+.include <bsd.test.mk>
diff --git a/usr.sbin/makefs/tests/makefs_cd9660_tests.sh b/usr.sbin/makefs/tests/makefs_cd9660_tests.sh
new file mode 100755
index 0000000..161b56b
--- /dev/null
+++ b/usr.sbin/makefs/tests/makefs_cd9660_tests.sh
@@ -0,0 +1,373 @@
+#
+# Copyright 2015 EMC Corp.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * 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 COPYRIGHT HOLDERS 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 COPYRIGHT
+# OWNER 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$
+#
+
+# A note on specs:
+# - A copy of the ISO-9660 spec can be found here:
+# http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-119.pdf
+# - Any references to `rockridge` are referring to the `Rock Ridge` extensions
+# of the ISO-9660 spec. A copy of the draft `IEEE-P1282` spec can be found
+# here:
+# http://www.ymi.com/ymi/sites/default/files/pdf/Rockridge.pdf
+
+MAKEFS="makefs -t cd9660"
+MOUNT="mount_cd9660"
+
+. "$(dirname "$0")/makefs_tests_common.sh"
+
+common_cleanup()
+{
+ if ! test_md_device=$(cat $TEST_MD_DEVICE_FILE); then
+ echo "$TEST_MD_DEVICE_FILE could not be opened; has an md(4) device been attached?"
+ return
+ fi
+
+ umount -f /dev/$test_md_device || :
+ mdconfig -d -u $test_md_device || :
+}
+
+check_base_iso9660_image_contents()
+{
+ # Symlinks are treated like files when rockridge support isn't
+ # specified
+ check_image_contents "$@" -X c
+
+ atf_check -e empty -o empty -s exit:0 test -L $TEST_INPUTS_DIR/c
+ atf_check -e empty -o empty -s exit:0 test -f $TEST_MOUNT_DIR/c
+}
+
+atf_test_case D_flag cleanup
+D_flag_body()
+{
+ atf_skip "makefs crashes with SIGBUS with dupe mtree entries; see FreeBSD bug # 192839"
+
+ create_test_inputs
+
+ atf_check -e empty -o save:$TEST_SPEC_FILE -s exit:0 \
+ mtree -cp $TEST_INPUTS_DIR
+ atf_check -e empty -o not-empty -s exit:0 \
+ $MAKEFS -F $TEST_SPEC_FILE -M 1m $TEST_IMAGE $TEST_INPUTS_DIR
+
+ atf_check -e empty -o empty -s exit:0 \
+ cp $TEST_SPEC_FILE spec2.mtree
+ atf_check -e empty -o save:dupe_$TEST_SPEC_FILE -s exit:0 \
+ cat $TEST_SPEC_FILE spec2.mtree
+
+ atf_check -e empty -o not-empty -s not-exit:0 \
+ $MAKEFS -F dupe_$TEST_SPEC_FILE -M 1m $TEST_IMAGE $TEST_INPUTS_DIR
+ atf_check -e empty -o not-empty -s exit:0 \
+ $MAKEFS -D -F dupe_$TEST_SPEC_FILE -M 1m $TEST_IMAGE $TEST_INPUTS_DIR
+}
+D_flag_cleanup()
+{
+ common_cleanup
+}
+
+atf_test_case F_flag cleanup
+F_flag_body()
+{
+ create_test_inputs
+
+ atf_check -e empty -o save:$TEST_SPEC_FILE -s exit:0 \
+ mtree -cp $TEST_INPUTS_DIR
+
+ atf_check -e empty -o empty -s exit:0 \
+ $MAKEFS -F $TEST_SPEC_FILE -M 1m $TEST_IMAGE $TEST_INPUTS_DIR
+
+ mount_image
+ check_base_iso9660_image_contents
+}
+F_flag_cleanup()
+{
+ common_cleanup
+}
+
+atf_test_case from_mtree_spec_file cleanup
+from_mtree_spec_file_body()
+{
+ create_test_inputs
+
+ atf_check -e empty -o save:$TEST_SPEC_FILE -s exit:0 \
+ mtree -c -k "$DEFAULT_MTREE_KEYWORDS" -p $TEST_INPUTS_DIR
+ cd $TEST_INPUTS_DIR
+ atf_check -e empty -o empty -s exit:0 \
+ $MAKEFS $TEST_IMAGE $TEST_SPEC_FILE
+ cd -
+
+ mount_image
+ check_base_iso9660_image_contents
+}
+from_mtree_spec_file_cleanup()
+{
+ common_cleanup
+}
+
+atf_test_case from_multiple_dirs cleanup
+from_multiple_dirs_body()
+{
+ test_inputs_dir2=$TMPDIR/inputs2
+
+ create_test_inputs
+
+ atf_check -e empty -o empty -s exit:0 mkdir -p $test_inputs_dir2
+ atf_check -e empty -o empty -s exit:0 \
+ touch $test_inputs_dir2/multiple_dirs_test_file
+
+ atf_check -e empty -o empty -s exit:0 \
+ $MAKEFS $TEST_IMAGE $TEST_INPUTS_DIR $test_inputs_dir2
+
+ mount_image
+ check_base_iso9660_image_contents -d $test_inputs_dir2
+}
+from_multiple_dirs_cleanup()
+{
+ common_cleanup
+}
+
+atf_test_case from_single_dir cleanup
+from_single_dir_body()
+{
+ create_test_inputs
+
+ atf_check -e empty -o empty -s exit:0 \
+ $MAKEFS $TEST_IMAGE $TEST_INPUTS_DIR
+
+ mount_image
+ check_base_iso9660_image_contents
+}
+from_single_dir_cleanup()
+{
+ common_cleanup
+}
+
+atf_test_case o_flag_allow_deep_trees cleanup
+o_flag_allow_deep_trees_body()
+{
+ create_test_inputs
+
+ # Make sure the "more than 8 levels deep" requirement is met.
+ atf_check -e empty -o empty -s exit:0 \
+ mkdir -p $TEST_INPUTS_DIR/a/b/c/d/e/f/g/h/i/j
+
+ atf_check -e empty -o empty -s exit:0 \
+ $MAKEFS -o allow-deep-trees $TEST_IMAGE $TEST_INPUTS_DIR
+
+ mount_image
+ check_base_iso9660_image_contents
+}
+o_flag_allow_deep_trees_cleanup()
+{
+ common_cleanup
+}
+
+atf_test_case o_flag_allow_max_name cleanup
+o_flag_allow_max_name_body()
+{
+ atf_expect_fail "-o allow-max-name doesn't appear to be implemented on FreeBSD's copy of makefs [yet]"
+
+ create_test_inputs
+
+ long_path=$TEST_INPUTS_DIR/$(jot -s '' -b 0 37)
+
+ # Make sure the "37 char name" limit requirement is met.
+ atf_check -e empty -o empty -s exit:0 touch $long_path
+
+ atf_check -e empty -o empty -s exit:0 \
+ $MAKEFS -o allow-max-name $TEST_IMAGE $TEST_INPUTS_DIR
+
+ mount_image
+ check_base_iso9660_image_contents
+}
+o_flag_allow_max_name_cleanup()
+{
+ common_cleanup
+}
+
+atf_test_case o_flag_isolevel_1 cleanup
+o_flag_isolevel_1_body()
+{
+ atf_expect_fail "this testcase needs work; the filenames generated seem incorrect/corrupt"
+
+ create_test_inputs
+
+ atf_check -e empty -o empty -s exit:0 \
+ $MAKEFS -o isolevel=1 $TEST_IMAGE $TEST_INPUTS_DIR
+
+ mount_image
+ check_base_iso9660_image_contents
+}
+o_flag_isolevel_1_cleanup()
+{
+ common_cleanup
+}
+
+atf_test_case o_flag_isolevel_2 cleanup
+o_flag_isolevel_2_body()
+{
+ create_test_inputs
+
+ atf_check -e empty -o empty -s exit:0 \
+ $MAKEFS -o isolevel=2 $TEST_IMAGE $TEST_INPUTS_DIR
+
+ mount_image
+ check_base_iso9660_image_contents
+}
+o_flag_isolevel_2_cleanup()
+{
+ common_cleanup
+}
+
+atf_test_case o_flag_isolevel_3 cleanup
+o_flag_isolevel_3_body()
+{
+ create_test_inputs
+
+ # XXX: isolevel=3 isn't implemented yet. See FreeBSD bug # 203645
+ if true; then
+ atf_check -e match:'makefs: ISO Level 3 is greater than 2\.' -o empty -s not-exit:0 \
+ $MAKEFS -o isolevel=3 $TEST_IMAGE $TEST_INPUTS_DIR
+ else
+ atf_check -e empty -o empty -s exit:0 \
+ $MAKEFS -o isolevel=3 $TEST_IMAGE $TEST_INPUTS_DIR
+ mount_image
+ check_base_iso9660_image_contents
+ fi
+}
+o_flag_isolevel_3_cleanup()
+{
+ common_cleanup
+}
+
+atf_test_case o_flag_preparer
+o_flag_preparer_body()
+{
+ create_test_dirs
+
+ preparer='My Very First ISO'
+ preparer_uppercase="$(echo $preparer | tr '[[:lower:]]' '[[:upper:]]')"
+
+ atf_check -e empty -o empty -s exit:0 touch $TEST_INPUTS_DIR/dummy_file
+ atf_check -e empty -o empty -s exit:0 \
+ $MAKEFS -o preparer="$preparer" $TEST_IMAGE $TEST_INPUTS_DIR
+ atf_check -e empty -o match:"$preparer_uppercase" -s exit:0 \
+ strings $TEST_IMAGE
+}
+
+atf_test_case o_flag_publisher
+o_flag_publisher_body()
+{
+ create_test_dirs
+
+ publisher='My Super Awesome Publishing Company LTD'
+ publisher_uppercase="$(echo $publisher | tr '[[:lower:]]' '[[:upper:]]')"
+
+ atf_check -e empty -o empty -s exit:0 touch $TEST_INPUTS_DIR/dummy_file
+ atf_check -e empty -o empty -s exit:0 \
+ $MAKEFS -o publisher="$publisher" $TEST_IMAGE $TEST_INPUTS_DIR
+ atf_check -e empty -o match:"$publisher_uppercase" -s exit:0 \
+ strings $TEST_IMAGE
+}
+
+atf_test_case o_flag_rockridge cleanup
+o_flag_rockridge_body()
+{
+ create_test_dirs
+
+ # Make sure the "more than 8 levels deep" requirement is met.
+ atf_check -e empty -o empty -s exit:0 \
+ mkdir -p $TEST_INPUTS_DIR/a/b/c/d/e/f/g/h/i/j
+
+ # Make sure the "pathname larger than 255 chars" requirement is met.
+ #
+ # $long_path's needs to be nested in a directory, as creating it
+ # outright as a 256 char filename via touch will fail with ENAMETOOLONG
+ long_path=$TEST_INPUTS_DIR/$(jot -s '/' -b "$(jot -s '' -b 0 64)" 4)
+ atf_check -e empty -o empty -s exit:0 mkdir -p "$(dirname $long_path)"
+ atf_check -e empty -o empty -s exit:0 touch "$long_path"
+
+ atf_check -e empty -o empty -s exit:0 \
+ $MAKEFS -o rockridge $TEST_IMAGE $TEST_INPUTS_DIR
+
+ mount_image
+ check_image_contents -X .rr_moved
+
+ # .rr_moved is a special directory created when you have deep directory
+ # trees with rock ridge extensions on
+ atf_check -e empty -o empty -s exit:0 \
+ test -d $TEST_MOUNT_DIR/.rr_moved
+}
+o_flag_rockridge_cleanup()
+{
+ common_cleanup
+}
+
+atf_test_case o_flag_rockridge_dev_nodes cleanup
+o_flag_rockridge_dev_nodes_head()
+{
+ atf_set "descr" "Functional tests to ensure that dev nodes are handled properly with rockridge extensions (NetBSD kern/48852; FreeBSD bug 203648)"
+}
+o_flag_rockridge_dev_nodes_body()
+{
+ create_test_dirs
+
+ (tar -cvf - -C /dev null && touch .tar_ok) | \
+ atf_check -e not-empty -o empty -s exit:0 tar -xvf - -C "$TEST_INPUTS_DIR"
+
+ atf_check -e empty -o empty -s exit:0 test -c $TEST_INPUTS_DIR/null
+ atf_check -e empty -o empty -s exit:0 test -f .tar_ok
+
+ atf_check -e empty -o empty -s exit:0 \
+ $MAKEFS -o rockridge $TEST_IMAGE $TEST_INPUTS_DIR
+
+ mount_image
+ check_image_contents
+}
+o_flag_rockridge_dev_nodes_cleanup()
+{
+ common_cleanup
+}
+
+atf_init_test_cases()
+{
+ atf_add_test_case D_flag
+ atf_add_test_case F_flag
+
+ atf_add_test_case from_mtree_spec_file
+ atf_add_test_case from_multiple_dirs
+ atf_add_test_case from_single_dir
+
+ atf_add_test_case o_flag_allow_deep_trees
+ atf_add_test_case o_flag_allow_max_name
+ atf_add_test_case o_flag_isolevel_1
+ atf_add_test_case o_flag_isolevel_2
+ atf_add_test_case o_flag_isolevel_3
+ atf_add_test_case o_flag_preparer
+ atf_add_test_case o_flag_publisher
+ atf_add_test_case o_flag_rockridge
+ atf_add_test_case o_flag_rockridge_dev_nodes
+}
diff --git a/usr.sbin/makefs/tests/makefs_ffs_tests.sh b/usr.sbin/makefs/tests/makefs_ffs_tests.sh
new file mode 100755
index 0000000..121c2a2
--- /dev/null
+++ b/usr.sbin/makefs/tests/makefs_ffs_tests.sh
@@ -0,0 +1,237 @@
+#
+# Copyright 2015 EMC Corp.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * 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 COPYRIGHT HOLDERS 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 COPYRIGHT
+# OWNER 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$
+#
+
+MAKEFS="makefs -t ffs"
+MOUNT="mount"
+
+. "$(dirname "$0")/makefs_tests_common.sh"
+
+TEST_TUNEFS_OUTPUT=$TMPDIR/tunefs.output
+
+common_cleanup()
+{
+ if ! test_md_device=$(cat $TEST_MD_DEVICE_FILE); then
+ echo "$TEST_MD_DEVICE_FILE could not be opened; has an md(4) device been attached?"
+ return
+ fi
+
+ umount -f /dev/$test_md_device || :
+ mdconfig -d -u $test_md_device || :
+}
+
+check_ffs_image_contents()
+{
+ atf_check -e save:$TEST_TUNEFS_OUTPUT -o empty -s exit:0 \
+ tunefs -p /dev/$(cat $TEST_MD_DEVICE_FILE)
+
+ check_image_contents "$@"
+}
+
+atf_test_case D_flag cleanup
+D_flag_body()
+{
+ atf_skip "makefs crashes with SIGBUS with dupe mtree entries; see FreeBSD bug # 192839"
+
+ create_test_inputs
+
+ atf_check -e empty -o save:$TEST_SPEC_FILE -s exit:0 \
+ mtree -cp $TEST_INPUTS_DIR
+ atf_check -e empty -o not-empty -s exit:0 \
+ $MAKEFS -F $TEST_SPEC_FILE -M 1m $TEST_IMAGE $TEST_INPUTS_DIR
+
+ atf_check -e empty -o empty -s exit:0 \
+ cp $TEST_SPEC_FILE spec2.mtree
+ atf_check -e empty -o save:dupe_$TEST_SPEC_FILE -s exit:0 \
+ cat $TEST_SPEC_FILE spec2.mtree
+
+ atf_check -e empty -o not-empty -s not-exit:0 \
+ $MAKEFS -F dupe_$TEST_SPEC_FILE -M 1m $TEST_IMAGE $TEST_INPUTS_DIR
+ atf_check -e empty -o not-empty -s exit:0 \
+ $MAKEFS -D -F dupe_$TEST_SPEC_FILE -M 1m $TEST_IMAGE $TEST_INPUTS_DIR
+}
+D_flag_cleanup()
+{
+ common_cleanup
+}
+
+atf_test_case F_flag cleanup
+F_flag_body()
+{
+ create_test_inputs
+
+ atf_check -e empty -o save:$TEST_SPEC_FILE -s exit:0 \
+ mtree -cp $TEST_INPUTS_DIR
+
+ atf_check -e empty -o not-empty -s exit:0 \
+ $MAKEFS -F $TEST_SPEC_FILE -M 1m $TEST_IMAGE $TEST_INPUTS_DIR
+
+ mount_image
+ check_ffs_image_contents
+}
+F_flag_cleanup()
+{
+ common_cleanup
+}
+
+atf_test_case from_mtree_spec_file cleanup
+from_mtree_spec_file_body()
+{
+ create_test_inputs
+
+ atf_check -e empty -o save:$TEST_SPEC_FILE -s exit:0 \
+ mtree -c -k "$DEFAULT_MTREE_KEYWORDS" -p $TEST_INPUTS_DIR
+
+ cd $TEST_INPUTS_DIR
+ atf_check -e empty -o not-empty -s exit:0 \
+ $MAKEFS $TEST_IMAGE $TEST_SPEC_FILE
+ cd -
+
+ mount_image
+ check_ffs_image_contents
+}
+from_mtree_spec_file_cleanup()
+{
+ common_cleanup
+}
+
+atf_test_case from_multiple_dirs cleanup
+from_multiple_dirs_body()
+{
+ test_inputs_dir2=$TMPDIR/inputs2
+
+ create_test_inputs
+
+ atf_check -e empty -o empty -s exit:0 mkdir -p $test_inputs_dir2
+ atf_check -e empty -o empty -s exit:0 \
+ touch $test_inputs_dir2/multiple_dirs_test_file
+
+ atf_check -e empty -o not-empty -s exit:0 \
+ $MAKEFS $TEST_IMAGE $TEST_INPUTS_DIR $test_inputs_dir2
+
+ mount_image
+ check_image_contents -d $test_inputs_dir2
+}
+from_multiple_dirs_cleanup()
+{
+ common_cleanup
+}
+
+atf_test_case from_single_dir cleanup
+from_single_dir_body()
+{
+ create_test_inputs
+
+ atf_check -e empty -o not-empty -s exit:0 \
+ $MAKEFS -M 1m $TEST_IMAGE $TEST_INPUTS_DIR
+
+ mount_image
+ check_ffs_image_contents
+}
+from_single_dir_cleanup()
+{
+ common_cleanup
+}
+
+atf_test_case o_flag_version_1 cleanup
+o_flag_version_1_body()
+{
+ ffs_version=1
+
+ platform=$(uname)
+ case "$platform" in
+ FreeBSD)
+ ffs_label=UFS${ffs_version}
+ ;;
+ NetBSD)
+ ffs_label=FFSv${ffs_version}
+ ;;
+ *)
+ atf_skip "Unsupported platform"
+ ;;
+ esac
+
+ create_test_inputs
+
+ atf_check -e empty -o not-empty -s exit:0 \
+ $MAKEFS -M 1m -o version=$ffs_version $TEST_IMAGE $TEST_INPUTS_DIR
+
+ mount_image
+ atf_check -e empty -o match:"$ffs_label" dumpfs $TEST_MOUNT_DIR
+ check_ffs_image_contents
+}
+o_flag_version_1_cleanup()
+{
+ common_cleanup
+}
+
+atf_test_case o_flag_version_2 cleanup
+o_flag_version_2_body()
+{
+ ffs_version=2
+
+ platform=$(uname)
+ case "$platform" in
+ FreeBSD)
+ ffs_label=UFS${ffs_version}
+ ;;
+ NetBSD)
+ ffs_label=FFSv${ffs_version}
+ ;;
+ *)
+ atf_skip "Unsupported platform"
+ ;;
+ esac
+
+ create_test_inputs
+
+ atf_check -e empty -o not-empty -s exit:0 \
+ $MAKEFS -M 1m -o version=$ffs_version $TEST_IMAGE $TEST_INPUTS_DIR
+
+ mount_image
+ atf_check -e empty -o match:"$ffs_label" dumpfs $TEST_MOUNT_DIR
+ check_ffs_image_contents
+}
+o_flag_version_2_cleanup()
+{
+ common_cleanup
+}
+
+atf_init_test_cases()
+{
+
+ atf_add_test_case D_flag
+ atf_add_test_case F_flag
+
+ atf_add_test_case from_mtree_spec_file
+ atf_add_test_case from_multiple_dirs
+ atf_add_test_case from_single_dir
+
+ atf_add_test_case o_flag_version_1
+ atf_add_test_case o_flag_version_2
+}
diff --git a/usr.sbin/makefs/tests/makefs_tests_common.sh b/usr.sbin/makefs/tests/makefs_tests_common.sh
new file mode 100755
index 0000000..add0b88
--- /dev/null
+++ b/usr.sbin/makefs/tests/makefs_tests_common.sh
@@ -0,0 +1,152 @@
+#
+# Copyright 2015 EMC Corp.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * 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 COPYRIGHT HOLDERS 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 COPYRIGHT
+# OWNER 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$
+#
+
+KB=1024
+: ${TMPDIR=/tmp}
+# TODO: add mtree `time` support; get a lot of errors like this right now when
+# passing generating disk images with keyword mtree support, like:
+#
+# `[...]/mtree.spec:8: error: time: invalid value '1446458503'`
+#
+#DEFAULT_MTREE_KEYWORDS="type,mode,gid,uid,size,link,time"
+DEFAULT_MTREE_KEYWORDS="type,mode,gid,uid,size,link"
+TEST_IMAGE="$TMPDIR/test.img"
+TEST_INPUTS_DIR="$TMPDIR/inputs"
+TEST_MD_DEVICE_FILE="$TMPDIR/md.output"
+TEST_MOUNT_DIR="$TMPDIR/mnt"
+TEST_SPEC_FILE="$TMPDIR/mtree.spec"
+
+check_image_contents()
+{
+ local directories=$TEST_INPUTS_DIR
+ local excludes mtree_excludes_arg mtree_file
+ local mtree_keywords="$DEFAULT_MTREE_KEYWORDS"
+
+ while getopts "d:f:m:X:" flag; do
+ case "$flag" in
+ d)
+ directories="$directories $OPTARG"
+ ;;
+ f)
+ mtree_file=$OPTARG
+ ;;
+ m)
+ mtree_keywords=$OPTARG
+ ;;
+ X)
+ excludes="$excludes $OPTARG"
+ ;;
+ *)
+ echo "usage: check_image_contents [-d directory ...] [-f mtree-file] [-m mtree-keywords] [-X exclude]"
+ atf_fail "unhandled option: $flag"
+ ;;
+ esac
+ done
+
+ if [ -n "$excludes" ]; then
+ echo "$excludes" | tr ' ' '\n' > excludes.txt
+ mtree_excludes_arg="-X excludes.txt"
+ fi
+
+ if [ -z "$mtree_file" ]; then
+ mtree_file=input_spec.mtree
+ for directory in $directories; do
+ mtree -c -k $mtree_keywords -p $directory $mtree_excludes_arg
+ done > $mtree_file
+ fi
+
+ echo "<---- Input spec BEGIN ---->"
+ cat $mtree_file
+ echo "<---- Input spec END ---->"
+ atf_check -e empty -o empty -s exit:0 \
+ mtree -UW -f $mtree_file \
+ -p $TEST_MOUNT_DIR \
+ $mtree_excludes_arg
+}
+
+create_test_dirs()
+{
+ atf_check -e empty -s exit:0 mkdir -m 0777 -p $TEST_MOUNT_DIR
+ atf_check -e empty -s exit:0 mkdir -m 0777 -p $TEST_INPUTS_DIR
+}
+
+create_test_inputs()
+{
+ create_test_dirs
+
+ cd $TEST_INPUTS_DIR
+
+ atf_check -e empty -s exit:0 mkdir -m 0755 -p a/b/1
+ atf_check -e empty -s exit:0 ln -s a/b c
+ atf_check -e empty -s exit:0 touch d
+ atf_check -e empty -s exit:0 ln d e
+ atf_check -e empty -s exit:0 touch .f
+ atf_check -e empty -s exit:0 mkdir .g
+ # XXX: fifos on the filesystem don't match fifos created by makefs for
+ # some odd reason.
+ #atf_check -e empty -s exit:0 mkfifo h
+ atf_check -e ignore -s exit:0 dd if=/dev/zero of=i count=1000 bs=1
+ atf_check -e empty -s exit:0 touch klmn
+ atf_check -e empty -s exit:0 touch opqr
+ atf_check -e empty -s exit:0 touch stuv
+ atf_check -e empty -s exit:0 install -m 0755 /dev/null wxyz
+ atf_check -e empty -s exit:0 touch 0b00000001
+ atf_check -e empty -s exit:0 touch 0b00000010
+ atf_check -e empty -s exit:0 touch 0b00000011
+ atf_check -e empty -s exit:0 touch 0b00000100
+ atf_check -e empty -s exit:0 touch 0b00000101
+ atf_check -e empty -s exit:0 touch 0b00000110
+ atf_check -e empty -s exit:0 touch 0b00000111
+ atf_check -e empty -s exit:0 touch 0b00001000
+ atf_check -e empty -s exit:0 touch 0b00001001
+ atf_check -e empty -s exit:0 touch 0b00001010
+ atf_check -e empty -s exit:0 touch 0b00001011
+ atf_check -e empty -s exit:0 touch 0b00001100
+ atf_check -e empty -s exit:0 touch 0b00001101
+ atf_check -e empty -s exit:0 touch 0b00001110
+
+ for filesize in 1 512 $(( 2 * $KB )) $(( 10 * $KB )) $(( 512 * $KB )); \
+ do
+ atf_check -e ignore -o empty -s exit:0 \
+ dd if=/dev/zero of=${filesize}.file bs=1 \
+ count=1 oseek=${filesize} conv=sparse
+ files="${files} ${filesize}.file"
+ done
+
+ cd -
+}
+
+mount_image()
+{
+ atf_check -e empty -o save:$TEST_MD_DEVICE_FILE -s exit:0 \
+ mdconfig -a -f $TEST_IMAGE
+ atf_check -e empty -o empty -s exit:0 \
+ $MOUNT /dev/$(cat $TEST_MD_DEVICE_FILE) $TEST_MOUNT_DIR
+}
+
diff --git a/usr.sbin/rtsold/rtsold.c b/usr.sbin/rtsold/rtsold.c
index 46bdb1e..7710537 100644
--- a/usr.sbin/rtsold/rtsold.c
+++ b/usr.sbin/rtsold/rtsold.c
@@ -834,15 +834,15 @@ static void
usage(void)
{
#ifndef SMALL
- fprintf(stderr, "usage: rtsold [-adDfFm1] [-O script-name] "
- "[-P pidfile] [-R script-name] interfaces...\n");
fprintf(stderr, "usage: rtsold [-dDfFm1] [-O script-name] "
- "[-P pidfile] [-R script-name] -a\n");
+ "[-p pidfile] [-R script-name] interface ...\n");
+ fprintf(stderr, "usage: rtsold [-dDfFm1] [-O script-name] "
+ "[-p pidfile] [-R script-name] -a\n");
#else
fprintf(stderr, "usage: rtsol [-dDF] [-O script-name] "
- "[-P pidfile] [-R script-name] interfaces...\n");
+ "[-p pidfile] [-R script-name] interface ...\n");
fprintf(stderr, "usage: rtsol [-dDF] [-O script-name] "
- "[-P pidfile] [-R script-name] -a\n");
+ "[-p pidfile] [-R script-name] -a\n");
#endif
}
OpenPOWER on IntegriCloud