summaryrefslogtreecommitdiffstats
path: root/usr.sbin/makefs
diff options
context:
space:
mode:
authornatano <natano@openbsd.org>2016-10-26 07:53:47 +0000
committernatano <natano@openbsd.org>2016-10-26 07:53:47 +0000
commit40854474906ccbd9be002e7ff4923260a68317e0 (patch)
tree6b4e5b699cb68b228b96505a4525cbd752820497 /usr.sbin/makefs
parentvmd(8)/vmctl(8) for i386. Some ugliness in #ifdef __i386__ areas will be (diff)
downloadwireguard-openbsd-40854474906ccbd9be002e7ff4923260a68317e0.tar.xz
wireguard-openbsd-40854474906ccbd9be002e7ff4923260a68317e0.zip
Remove FS-specific option descriptions from the source code. We have a
manual for that. While there document the isolevel option and remove some dysfunctional cd9660 options.
Diffstat (limited to 'usr.sbin/makefs')
-rw-r--r--usr.sbin/makefs/cd9660.c102
-rw-r--r--usr.sbin/makefs/cd9660.h6
-rw-r--r--usr.sbin/makefs/ffs.c35
-rw-r--r--usr.sbin/makefs/makefs.813
-rw-r--r--usr.sbin/makefs/makefs.c4
-rw-r--r--usr.sbin/makefs/makefs.h3
-rw-r--r--usr.sbin/makefs/msdos.c5
-rw-r--r--usr.sbin/makefs/msdos/mkfs_msdos.h48
8 files changed, 82 insertions, 134 deletions
diff --git a/usr.sbin/makefs/cd9660.c b/usr.sbin/makefs/cd9660.c
index 1632411e65c..5825e4c5583 100644
--- a/usr.sbin/makefs/cd9660.c
+++ b/usr.sbin/makefs/cd9660.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cd9660.c,v 1.13 2016/10/23 11:09:38 natano Exp $ */
+/* $OpenBSD: cd9660.c,v 1.14 2016/10/26 07:53:47 natano Exp $ */
/* $NetBSD: cd9660.c,v 1.52 2015/12/24 15:52:37 christos Exp $ */
/*
@@ -206,9 +206,6 @@ cd9660_set_defaults(iso9660_disk *diskStructure)
/* Spec breaking functionality */
diskStructure->allow_deep_trees =
- diskStructure->allow_max_name =
- diskStructure->allow_illegal_chars =
- diskStructure->allow_lowercase =
diskStructure->allow_multidot =
diskStructure->omit_trailing_period = 0;
@@ -230,7 +227,6 @@ cd9660_set_defaults(iso9660_disk *diskStructure)
diskStructure->has_generic_bootimage = 0;
diskStructure->generic_bootimage = NULL;
- diskStructure->boot_image_directory = 0;
/*memset(diskStructure->boot_descriptor, 0, 2048);*/
diskStructure->is_bootable = 0;
@@ -243,50 +239,38 @@ cd9660_prep_opts(fsinfo_t *fsopts)
{
iso9660_disk *diskStructure = ecalloc(1, sizeof(*diskStructure));
-#define OPT_STR(name, desc) \
- { name, NULL, OPT_STRBUF, 0, 0, desc }
+#define OPT_STR(name) \
+ { name, NULL, OPT_STRBUF, 0, 0 }
-#define OPT_NUM(name, field, min, max, desc) \
+#define OPT_NUM(name, field, min, max) \
{ name, &diskStructure->field, \
sizeof(diskStructure->field) == 8 ? OPT_INT64 : \
(sizeof(diskStructure->field) == 4 ? OPT_INT32 : \
(sizeof(diskStructure->field) == 2 ? OPT_INT16 : OPT_INT8)), \
- min, max, desc }
+ min, max }
-#define OPT_BOOL(name, field, desc) \
- OPT_NUM(name, field, 0, 1, desc)
+#define OPT_BOOL(name, field) \
+ OPT_NUM(name, field, 0, 1)
const option_t cd9660_options[] = {
- OPT_BOOL("allow-deep-trees", allow_deep_trees,
- "Allow trees more than 8 levels"),
- OPT_BOOL("allow-illegal-chars", allow_illegal_chars,
- "Allow illegal characters in filenames"),
- OPT_BOOL("allow-lowercase", allow_lowercase,
- "Allow lowercase characters in filenames"),
- OPT_BOOL("allow-max-name", allow_max_name,
- "Allow 37 char filenames (unimplemented)"),
- OPT_BOOL("allow-multidot", allow_multidot,
- "Allow multiple periods in filenames"),
- OPT_STR("applicationid", "Application Identifier"),
- OPT_STR("boot-load-segment", "Boot load segment"),
- OPT_STR("bootimage", "Boot image parameter"),
- OPT_STR("bootimagedir", "Boot image directory"),
- OPT_BOOL("chrp-boot", chrp_boot, "Enable CHRP boot"),
- OPT_STR("generic-bootimage", "Generic boot image param"),
- OPT_STR("hard-disk-boot", "Boot from hard disk"),
- OPT_NUM("isolevel", isoLevel, 1, 3, "ISO Level"),
- OPT_STR("label", "Disk Label"),
- OPT_STR("no-boot", "No boot support"),
- OPT_STR("no-emul-boot", "No boot emulation"),
- OPT_BOOL("no-trailing-padding", include_padding_areas,
- "Include padding areas"),
- OPT_BOOL("omit-trailing-period", omit_trailing_period,
- "Omit trailing periods in filenames"),
- OPT_STR("preparer", "Preparer Identifier"),
- OPT_STR("publisher", "Publisher Identifier"),
- OPT_BOOL("rockridge", rock_ridge_enabled,
- "Enable Rock-Ridge extensions"),
- OPT_STR("volumeid", "Volume Set Identifier"),
+ OPT_BOOL("allow-deep-trees", allow_deep_trees),
+ OPT_BOOL("allow-multidot", allow_multidot),
+ OPT_STR("applicationid"),
+ OPT_STR("boot-load-segment"),
+ OPT_STR("bootimage"),
+ OPT_BOOL("chrp-boot", chrp_boot),
+ OPT_STR("generic-bootimage"),
+ OPT_STR("hard-disk-boot"),
+ OPT_NUM("isolevel", isoLevel, 1, 3),
+ OPT_STR("label"),
+ OPT_STR("no-boot"),
+ OPT_STR("no-emul-boot"),
+ OPT_BOOL("no-trailing-padding", include_padding_areas),
+ OPT_BOOL("omit-trailing-period", omit_trailing_period),
+ OPT_STR("preparer"),
+ OPT_STR("publisher"),
+ OPT_BOOL("rockridge", rock_ridge_enabled),
+ OPT_STR("volumeid"),
{ .name = NULL }
};
@@ -311,7 +295,7 @@ cd9660_arguments_set_string(const char *val, const char *fieldtitle,
int test;
if (val == NULL)
- warnx("error: The %s requires a string argument", fieldtitle);
+ warnx("error: '%s' requires a string argument", fieldtitle);
else if ((len = strlen(val)) <= length) {
if (testmode == 'd')
test = cd9660_valid_d_chars(val);
@@ -323,10 +307,10 @@ cd9660_arguments_set_string(const char *val, const char *fieldtitle,
cd9660_uppercase_characters(dest, len);
return 1;
} else
- warnx("error: The %s must be composed of "
- "%c-characters", fieldtitle, testmode);
+ warnx("error: '%s' must be composed of %c-characters",
+ fieldtitle, testmode);
} else
- warnx("error: The %s must be at most 32 characters long",
+ warnx("error: '%s' must be at most 32 characters long",
fieldtitle);
return 0;
}
@@ -342,7 +326,7 @@ cd9660_parse_opts(const char *option, fsinfo_t *fsopts)
iso9660_disk *diskStructure = fsopts->fs_specific;
option_t *cd9660_options = fsopts->fs_options;
char buf[1024];
- const char *name, *desc;
+ const char *name;
assert(option != NULL);
@@ -355,10 +339,9 @@ cd9660_parse_opts(const char *option, fsinfo_t *fsopts)
name = cd9660_options[i].name;
- desc = cd9660_options[i].desc;
if (strcmp(name, "applicationid") == 0) {
- rv = cd9660_arguments_set_string(buf, desc, 128, 'a',
+ rv = cd9660_arguments_set_string(buf, name, 128, 'a',
diskStructure->primaryDescriptor.application_id);
} else if (strcmp(name, "boot-load-segment") == 0) {
if (buf[0] == '\0') {
@@ -377,21 +360,6 @@ cd9660_parse_opts(const char *option, fsinfo_t *fsopts)
rv = 0;
} else
rv = cd9660_add_boot_disk(diskStructure, buf);
- } else if (strcmp(name, "bootimagedir") == 0) {
- /*
- * XXXfvdl this is unused.
- */
- if (buf[0] == '\0') {
- warnx("The Boot Image Directory parameter"
- " requires a directory name");
- rv = 0;
- } else {
- diskStructure->boot_image_directory =
- emalloc(strlen(buf) + 1);
- /* BIG TODO: Add the max length function here */
- rv = cd9660_arguments_set_string(buf, desc, 12,
- 'd', diskStructure->boot_image_directory);
- }
} else if (strcmp(name, "generic-bootimage") == 0) {
if (buf[0] == '\0') {
warnx("The Generic Boot Image parameter requires a"
@@ -400,16 +368,16 @@ cd9660_parse_opts(const char *option, fsinfo_t *fsopts)
} else
rv = cd9660_add_generic_bootimage(diskStructure, buf);
} else if (strcmp(name, "label") == 0) {
- rv = cd9660_arguments_set_string(buf, desc, 32, 'd',
+ rv = cd9660_arguments_set_string(buf, name, 32, 'd',
diskStructure->primaryDescriptor.volume_id);
} else if (strcmp(name, "preparer") == 0) {
- rv = cd9660_arguments_set_string(buf, desc, 128, 'a',
+ rv = cd9660_arguments_set_string(buf, name, 128, 'a',
diskStructure->primaryDescriptor.preparer_id);
} else if (strcmp(name, "publisher") == 0) {
- rv = cd9660_arguments_set_string(buf, desc, 128, 'a',
+ rv = cd9660_arguments_set_string(buf, name, 128, 'a',
diskStructure->primaryDescriptor.publisher_id);
} else if (strcmp(name, "volumeid") == 0) {
- rv = cd9660_arguments_set_string(buf, desc, 128, 'a',
+ rv = cd9660_arguments_set_string(buf, name, 128, 'a',
diskStructure->primaryDescriptor.volume_set_id);
} else if (strcmp(name, "hard-disk-boot") == 0 ||
strcmp(name, "no-boot") == 0 ||
diff --git a/usr.sbin/makefs/cd9660.h b/usr.sbin/makefs/cd9660.h
index 4cf3f1e31ad..0ae76877036 100644
--- a/usr.sbin/makefs/cd9660.h
+++ b/usr.sbin/makefs/cd9660.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cd9660.h,v 1.8 2016/10/23 11:09:38 natano Exp $ */
+/* $OpenBSD: cd9660.h,v 1.9 2016/10/26 07:53:47 natano Exp $ */
/* $NetBSD: cd9660.h,v 1.21 2015/12/24 15:52:37 christos Exp $ */
/*
@@ -274,9 +274,6 @@ typedef struct _iso9660_disk {
/* Spec breaking options */
int allow_deep_trees;
- int allow_max_name; /* Allow 37 char filenames*/
- int allow_illegal_chars; /* ~, !, # */
- int allow_lowercase;
int allow_multidot;
int omit_trailing_period;
@@ -287,7 +284,6 @@ typedef struct _iso9660_disk {
int is_bootable;/* Default to 0 */
int64_t boot_catalog_sector;
boot_volume_descriptor *boot_descriptor;
- char * boot_image_directory;
TAILQ_HEAD(boot_image_list,cd9660_boot_image) boot_images;
int image_serialno;
diff --git a/usr.sbin/makefs/ffs.c b/usr.sbin/makefs/ffs.c
index 9c1197d35fb..c6eedbc9cb5 100644
--- a/usr.sbin/makefs/ffs.c
+++ b/usr.sbin/makefs/ffs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs.c,v 1.17 2016/10/23 10:22:21 natano Exp $ */
+/* $OpenBSD: ffs.c,v 1.18 2016/10/26 07:53:47 natano Exp $ */
/* $NetBSD: ffs.c,v 1.66 2015/12/21 00:58:08 christos Exp $ */
/*
@@ -137,27 +137,18 @@ ffs_prep_opts(fsinfo_t *fsopts)
ffs_opt_t *ffs_opts = ecalloc(1, sizeof(*ffs_opts));
const option_t ffs_options[] = {
- { "avgfilesize", &ffs_opts->avgfilesize, OPT_INT32,
- 1, INT_MAX, "expected average file size" },
- { "avgfpdir", &ffs_opts->avgfpdir, OPT_INT32,
- 1, INT_MAX, "expected # of files per directory" },
- { "bsize", &ffs_opts->bsize, OPT_INT32, 1, INT_MAX, "block size" },
- { "density", &ffs_opts->density, OPT_INT32,
- 1, INT_MAX, "bytes per inode" },
- { "extent", &ffs_opts->maxbsize, OPT_INT32,
- 1, INT_MAX, "maximum # extent size" },
- { "fsize", &ffs_opts->fsize, OPT_INT32,
- 1, INT_MAX, "fragment size" },
- { "label", ffs_opts->label, OPT_STRARRAY,
- 1, sizeof(ffs_opts->label), "UFS label" },
- { "maxbpcg", &ffs_opts->maxblkspercg, OPT_INT32,
- 1, INT_MAX, "max # of blocks per group" },
- { "maxbpg", &ffs_opts->maxbpg, OPT_INT32,
- 1, INT_MAX, "max blocks per file in a cg" },
- { "minfree", &ffs_opts->minfree, OPT_INT32, 0, 99, "minfree" },
- { "optimization", NULL, OPT_STRBUF,
- 0, 0, "Optimization (time|space)" },
- { "version", &ffs_opts->version, OPT_INT32, 1, 2, "UFS version" },
+ { "avgfilesize", &ffs_opts->avgfilesize, OPT_INT32, 1, INT_MAX },
+ { "avgfpdir", &ffs_opts->avgfpdir, OPT_INT32, 1, INT_MAX },
+ { "bsize", &ffs_opts->bsize, OPT_INT32, 1, INT_MAX },
+ { "density", &ffs_opts->density, OPT_INT32, 1, INT_MAX },
+ { "extent", &ffs_opts->maxbsize, OPT_INT32, 1, INT_MAX },
+ { "fsize", &ffs_opts->fsize, OPT_INT32, 1, INT_MAX },
+ { "label", ffs_opts->label, OPT_STRARRAY, 1, MAXVOLLEN },
+ { "maxbpcg", &ffs_opts->maxblkspercg, OPT_INT32, 1, INT_MAX },
+ { "maxbpg", &ffs_opts->maxbpg, OPT_INT32, 1, INT_MAX },
+ { "minfree", &ffs_opts->minfree, OPT_INT32, 0, 99 },
+ { "optimization", NULL, OPT_STRBUF, 0, 0 },
+ { "version", &ffs_opts->version, OPT_INT32, 1, 2 },
{ .name = NULL }
};
diff --git a/usr.sbin/makefs/makefs.8 b/usr.sbin/makefs/makefs.8
index 5291e995066..69153e22f39 100644
--- a/usr.sbin/makefs/makefs.8
+++ b/usr.sbin/makefs/makefs.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: makefs.8,v 1.11 2016/10/24 15:06:49 jmc Exp $
+.\" $OpenBSD: makefs.8,v 1.12 2016/10/26 07:53:47 natano Exp $
.\" $NetBSD: makefs.8,v 1.55 2015/11/25 16:32:00 wiz Exp $
.\"
.\" Copyright (c) 2001-2003 Wasabi Systems, Inc.
@@ -34,7 +34,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: October 24 2016 $
+.Dd $Mdocdate: October 26 2016 $
.Dt MAKEFS 8
.Os
.Sh NAME
@@ -190,13 +190,6 @@ The following keywords are supported:
.It Sy allow-deep-trees
Allow the directory structure to exceed the maximum specified in
the spec.
-.\" .It Sy allow-illegal-chars
-.\" Unknown
-.\" .It Sy allow-lowercase
-.\" Unknown
-.It Sy allow-max-name
-Allow 37 instead of 33 characters for filenames by omitting the
-version ID.
.It Sy allow-multidot
Allow multiple dots in a filename.
.It Sy applicationid
@@ -221,6 +214,8 @@ boot.
Load a generic boot image into the first 32K of the CD9660 image.
.It Sy hard-disk-boot
Boot image is a hard disk image.
+.It Sy isolevel
+ISO Level.
.It Sy label
Label name of the image.
.It Sy no-boot
diff --git a/usr.sbin/makefs/makefs.c b/usr.sbin/makefs/makefs.c
index 95ef7b82fc6..38223e3b347 100644
--- a/usr.sbin/makefs/makefs.c
+++ b/usr.sbin/makefs/makefs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: makefs.c,v 1.16 2016/10/25 07:59:45 jmc Exp $ */
+/* $OpenBSD: makefs.c,v 1.17 2016/10/26 07:53:47 natano Exp $ */
/* $NetBSD: makefs.c,v 1.53 2015/11/27 15:10:32 joerg Exp $ */
/*
@@ -240,7 +240,7 @@ set_option_var(const option_t *options, const char *var, const char *val,
*(type *)options[i].value = 1; \
break; \
} \
- *(type *)options[i].value = (type)strsuftoll(options[i].desc, val, \
+ *(type *)options[i].value = (type)strsuftoll(options[i].name, val, \
options[i].minimum, options[i].maximum); break
for (i = 0; options[i].name != NULL; i++) {
diff --git a/usr.sbin/makefs/makefs.h b/usr.sbin/makefs/makefs.h
index f53d38716f5..617943acc38 100644
--- a/usr.sbin/makefs/makefs.h
+++ b/usr.sbin/makefs/makefs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: makefs.h,v 1.10 2016/10/23 10:22:21 natano Exp $ */
+/* $OpenBSD: makefs.h,v 1.11 2016/10/26 07:53:47 natano Exp $ */
/* $NetBSD: makefs.h,v 1.36 2015/11/25 00:48:49 christos Exp $ */
/*
@@ -123,7 +123,6 @@ typedef struct {
opttype_t type; /* type of entry */
long long minimum; /* minimum for value */
long long maximum; /* maximum for value */
- const char *desc; /* option description */
} option_t;
/*
diff --git a/usr.sbin/makefs/msdos.c b/usr.sbin/makefs/msdos.c
index 3631a107530..75a0072b477 100644
--- a/usr.sbin/makefs/msdos.c
+++ b/usr.sbin/makefs/msdos.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: msdos.c,v 1.8 2016/10/23 10:22:21 natano Exp $ */
+/* $OpenBSD: msdos.c,v 1.9 2016/10/26 07:53:47 natano Exp $ */
/* $NetBSD: msdos.c,v 1.16 2016/01/30 09:59:27 mlelstv Exp $ */
/*-
@@ -52,7 +52,7 @@ msdos_prep_opts(fsinfo_t *fsopts)
{
struct msdos_options *msdos_opt = ecalloc(1, sizeof(*msdos_opt));
const option_t msdos_options[] = {
-#define AOPT(_type, _name, _min, _desc) { \
+#define AOPT(_type, _name, _min) { \
.name = # _name, \
.type = _min == -1 ? OPT_STRPTR : \
(_min == -2 ? OPT_BOOL : \
@@ -64,7 +64,6 @@ msdos_prep_opts(fsinfo_t *fsopts)
.maximum = sizeof(_type) == 1 ? 0xff : \
(sizeof(_type) == 2 ? 0xffff : \
(sizeof(_type) == 4 ? 0xffffffff : 0xffffffffffffffffLL)), \
- .desc = _desc, \
},
ALLOPTS
#undef AOPT
diff --git a/usr.sbin/makefs/msdos/mkfs_msdos.h b/usr.sbin/makefs/msdos/mkfs_msdos.h
index 9c194cac591..eb839569dc9 100644
--- a/usr.sbin/makefs/msdos/mkfs_msdos.h
+++ b/usr.sbin/makefs/msdos/mkfs_msdos.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mkfs_msdos.h,v 1.4 2016/10/23 10:58:45 natano Exp $ */
+/* $OpenBSD: mkfs_msdos.h,v 1.5 2016/10/26 07:53:47 natano Exp $ */
/* $NetBSD: mkfs_msdos.h,v 1.3 2015/10/16 17:38:17 christos Exp $ */
/*-
@@ -33,31 +33,31 @@
#include <sys/types.h>
#define ALLOPTS \
-AOPT(uint16_t, backup_sector, 1, "Backup sector") \
-AOPT(uint32_t, block_size, 1, "Block size") \
-AOPT(char *, bootstrap, -1, "Bootstrap file") \
-AOPT(uint16_t, bytes_per_sector, 1, "Bytes per sector") \
-AOPT(off_t, create_size, 0, "Create file") \
-AOPT(uint16_t, directory_entries, 1, "Directory entries") \
-AOPT(uint16_t, drive_heads, 1, "Drive heads") \
-AOPT(uint8_t, fat_type, 12, "FAT type (12, 16, or 32)") \
-AOPT(char *, floppy, -1, "Standard format floppies (160,180,320,360,640,720,1200,1232,1440,2880)") \
-AOPT(uint32_t, hidden_sectors, 0, "Hidden sectors") \
-AOPT(uint16_t, info_sector, 1, "Info sector") \
-AOPT(uint8_t, media_descriptor, 0, "Media descriptor") \
-AOPT(uint8_t, num_FAT, 1, "Number of FATs") \
-AOPT(char *, OEM_string, -1, "OEM string") \
-AOPT(off_t, offset, 0, "Offset in device") \
-AOPT(uint16_t, reserved_sectors, 1, "Reserved sectors") \
-AOPT(uint8_t, sectors_per_cluster, 1, "Sectors per cluster") \
-AOPT(uint32_t, sectors_per_fat, 1, "Sectors per FAT") \
-AOPT(uint16_t, sectors_per_track, 1, "Sectors per track") \
-AOPT(uint32_t, size, 1, "File System size") \
-AOPT(uint32_t, volume_id, 0, "Volume ID") \
-AOPT(char *, volume_label, -1, "Volume Label")
+AOPT(uint16_t, backup_sector, 1) \
+AOPT(uint32_t, block_size, 1) \
+AOPT(char *, bootstrap, -1) \
+AOPT(uint16_t, bytes_per_sector, 1) \
+AOPT(off_t, create_size, 0) \
+AOPT(uint16_t, directory_entries, 1) \
+AOPT(uint16_t, drive_heads, 1) \
+AOPT(uint8_t, fat_type, 12) \
+AOPT(char *, floppy, -1) \
+AOPT(uint32_t, hidden_sectors, 0) \
+AOPT(uint16_t, info_sector, 1) \
+AOPT(uint8_t, media_descriptor, 0) \
+AOPT(uint8_t, num_FAT, 1) \
+AOPT(char *, OEM_string, -1) \
+AOPT(off_t, offset, 0) \
+AOPT(uint16_t, reserved_sectors, 1) \
+AOPT(uint8_t, sectors_per_cluster, 1) \
+AOPT(uint32_t, sectors_per_fat, 1) \
+AOPT(uint16_t, sectors_per_track, 1) \
+AOPT(uint32_t, size, 1) \
+AOPT(uint32_t, volume_id, 0) \
+AOPT(char *, volume_label, -1)
struct msdos_options {
-#define AOPT(_type, _name, _min, _desc) _type _name;
+#define AOPT(_type, _name, _min) _type _name;
ALLOPTS
#undef AOPT
uint32_t volume_id_set:1;