diff options
author | natano <natano@openbsd.org> | 2016-10-23 10:22:21 +0000 |
---|---|---|
committer | natano <natano@openbsd.org> | 2016-10-23 10:22:21 +0000 |
commit | 13b03f7914b3151d945c1ddd3d63e053a9f70520 (patch) | |
tree | 2e18b6b3d2ee8abc2157b638d99528869d6547e6 /usr.sbin/makefs | |
parent | Exit autoinstall in case of missing / or duplicate mountpoints. (diff) | |
download | wireguard-openbsd-13b03f7914b3151d945c1ddd3d63e053a9f70520.tar.xz wireguard-openbsd-13b03f7914b3151d945c1ddd3d63e053a9f70520.zip |
Remove short option names for -o.
Diffstat (limited to 'usr.sbin/makefs')
-rw-r--r-- | usr.sbin/makefs/cd9660.c | 191 | ||||
-rw-r--r-- | usr.sbin/makefs/ffs.c | 43 | ||||
-rw-r--r-- | usr.sbin/makefs/makefs.c | 11 | ||||
-rw-r--r-- | usr.sbin/makefs/makefs.h | 3 | ||||
-rw-r--r-- | usr.sbin/makefs/msdos.c | 9 | ||||
-rw-r--r-- | usr.sbin/makefs/msdos/mkfs_msdos.h | 50 |
6 files changed, 137 insertions, 170 deletions
diff --git a/usr.sbin/makefs/cd9660.c b/usr.sbin/makefs/cd9660.c index 6a00c2ccdba..3ad4e5cfb1a 100644 --- a/usr.sbin/makefs/cd9660.c +++ b/usr.sbin/makefs/cd9660.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cd9660.c,v 1.10 2016/10/22 20:50:21 natano Exp $ */ +/* $OpenBSD: cd9660.c,v 1.11 2016/10/23 10:22:21 natano Exp $ */ /* $NetBSD: cd9660.c,v 1.52 2015/12/24 15:52:37 christos Exp $ */ /* @@ -245,59 +245,53 @@ cd9660_prep_opts(fsinfo_t *fsopts) { iso9660_disk *diskStructure = ecalloc(1, sizeof(*diskStructure)); -#define OPT_STR(letter, name, desc) \ - { letter, name, NULL, OPT_STRBUF, 0, 0, desc } +#define OPT_STR(name, desc) \ + { name, NULL, OPT_STRBUF, 0, 0, desc } -#define OPT_NUM(letter, name, field, min, max, desc) \ - { letter, name, &diskStructure->field, \ +#define OPT_NUM(name, field, min, max, desc) \ + { 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 } -#define OPT_BOOL(letter, name, field, desc) \ - OPT_NUM(letter, name, field, 0, 1, desc) +#define OPT_BOOL(name, field, desc) \ + OPT_NUM(name, field, 0, 1, desc) const option_t cd9660_options[] = { - OPT_NUM('l', "isolevel", isoLevel, - 1, 3, "ISO Level"), - OPT_NUM('v', "verbose", verbose_level, - 0, 2, "Turns on verbose output"), - - OPT_BOOL('R', "rockridge", rock_ridge_enabled, - "Enable Rock-Ridge extensions"), - OPT_BOOL('C', "chrp-boot", chrp_boot, - "Enable CHRP boot"), - OPT_BOOL('K', "keep-bad-images", keep_bad_images, - "Keep bad images"), - OPT_BOOL('D', "allow-deep-trees", allow_deep_trees, + OPT_BOOL("allow-deep-trees", allow_deep_trees, "Allow trees more than 8 levels"), - OPT_BOOL('a', "allow-max-name", allow_max_name, - "Allow 37 char filenames (unimplemented)"), - OPT_BOOL('i', "allow-illegal-chars", allow_illegal_chars, + OPT_BOOL("allow-illegal-chars", allow_illegal_chars, "Allow illegal characters in filenames"), - OPT_BOOL('D', "allow-multidot", allow_multidot, - "Allow multiple periods in filenames"), - OPT_BOOL('o', "omit-trailing-period", omit_trailing_period, - "Omit trailing periods in filenames"), - OPT_BOOL('\0', "allow-lowercase", allow_lowercase, + OPT_BOOL("allow-lowercase", allow_lowercase, "Allow lowercase characters in filenames"), - OPT_BOOL('\0', "no-trailing-padding", include_padding_areas, + 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_BOOL("keep-bad-images", keep_bad_images, "Keep bad images"), + 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_STR('A', "applicationid", "Application Identifier"), - OPT_STR('P', "publisher", "Publisher Identifier"), - OPT_STR('p', "preparer", "Preparer Identifier"), - OPT_STR('L', "label", "Disk Label"), - OPT_STR('V', "volumeid", "Volume Set Identifier"), - OPT_STR('B', "bootimage", "Boot image parameter"), - OPT_STR('G', "generic-bootimage", "Generic boot image param"), - OPT_STR('\0', "bootimagedir", "Boot image directory"), - OPT_STR('\0', "no-emul-boot", "No boot emulation"), - OPT_STR('\0', "no-boot", "No boot support"), - OPT_STR('\0', "hard-disk-boot", "Boot from hard disk"), - OPT_STR('\0', "boot-load-segment", "Boot load segment"), - + 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_NUM("verbose", verbose_level, + 0, 2, "Turns on verbose output"), + OPT_STR("volumeid", "Volume Set Identifier"), { .name = NULL } }; @@ -367,83 +361,70 @@ cd9660_parse_opts(const char *option, fsinfo_t *fsopts) name = cd9660_options[i].name; desc = cd9660_options[i].desc; - switch (cd9660_options[i].letter) { - case 'h': - case 'S': - rv = 0; /* this is not handled yet */ - break; - case 'L': - rv = cd9660_arguments_set_string(buf, desc, 32, 'd', - diskStructure->primaryDescriptor.volume_id); - break; - case 'A': + + if (strcmp(name, "applicationid") == 0) { rv = cd9660_arguments_set_string(buf, desc, 128, 'a', diskStructure->primaryDescriptor.application_id); - break; - case 'P': - rv = cd9660_arguments_set_string(buf, desc, 128, 'a', - diskStructure->primaryDescriptor.publisher_id); - break; - case 'p': - rv = cd9660_arguments_set_string(buf, desc, 128, 'a', - diskStructure->primaryDescriptor.preparer_id); - break; - case 'V': - rv = cd9660_arguments_set_string(buf, desc, 128, 'a', - diskStructure->primaryDescriptor.volume_set_id); - break; - /* Boot options */ - case 'B': + } else if (strcmp(name, "boot-load-segment") == 0) { + if (buf[0] == '\0') { + warnx("Option `%s' doesn't contain a value", + name); + rv = 0; + } else { + cd9660_eltorito_add_boot_option(diskStructure, + name, buf); + rv = 1; + } + } else if (strcmp(name, "bootimage") == 0) { if (buf[0] == '\0') { warnx("The Boot Image parameter requires a valid boot" " information string"); rv = 0; } else rv = cd9660_add_boot_disk(diskStructure, buf); - break; - case 'G': + } 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" " valid boot information string"); rv = 0; } else rv = cd9660_add_generic_bootimage(diskStructure, buf); - break; - default: - 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, "no-emul-boot") == 0 || - strcmp(name, "no-boot") == 0 || - strcmp(name, "hard-disk-boot") == 0) { - /* RRIP */ - cd9660_eltorito_add_boot_option(diskStructure, name, 0); - rv = 1; - } else if (strcmp(name, "boot-load-segment") == 0) { - if (buf[0] == '\0') { - warnx("Option `%s' doesn't contain a value", - name); - rv = 0; - } else { - cd9660_eltorito_add_boot_option(diskStructure, - name, buf); - rv = 1; - } - } else - rv = 1; - } + } else if (strcmp(name, "label") == 0) { + rv = cd9660_arguments_set_string(buf, desc, 32, 'd', + diskStructure->primaryDescriptor.volume_id); + } else if (strcmp(name, "preparer") == 0) { + rv = cd9660_arguments_set_string(buf, desc, 128, 'a', + diskStructure->primaryDescriptor.preparer_id); + } else if (strcmp(name, "publisher") == 0) { + rv = cd9660_arguments_set_string(buf, desc, 128, 'a', + diskStructure->primaryDescriptor.publisher_id); + } else if (strcmp(name, "volumeid") == 0) { + rv = cd9660_arguments_set_string(buf, desc, 128, 'a', + diskStructure->primaryDescriptor.volume_set_id); + } else if (strcmp(name, "hard-disk-boot") == 0 || + strcmp(name, "no-boot") == 0 || + strcmp(name, "no-emul-boot") == 0) { + /* RRIP */ + cd9660_eltorito_add_boot_option(diskStructure, name, 0); + rv = 1; + } else + rv = 1; + return rv; } diff --git a/usr.sbin/makefs/ffs.c b/usr.sbin/makefs/ffs.c index 182eb79e4c9..9c1197d35fb 100644 --- a/usr.sbin/makefs/ffs.c +++ b/usr.sbin/makefs/ffs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs.c,v 1.16 2016/10/22 19:43:50 natano Exp $ */ +/* $OpenBSD: ffs.c,v 1.17 2016/10/23 10:22:21 natano Exp $ */ /* $NetBSD: ffs.c,v 1.66 2015/12/21 00:58:08 christos Exp $ */ /* @@ -137,30 +137,27 @@ ffs_prep_opts(fsinfo_t *fsopts) ffs_opt_t *ffs_opts = ecalloc(1, sizeof(*ffs_opts)); const option_t ffs_options[] = { - { 'b', "bsize", &ffs_opts->bsize, OPT_INT32, - 1, INT_MAX, "block size" }, - { 'f', "fsize", &ffs_opts->fsize, OPT_INT32, - 1, INT_MAX, "fragment size" }, - { 'd', "density", &ffs_opts->density, OPT_INT32, - 1, INT_MAX, "bytes per inode" }, - { 'm', "minfree", &ffs_opts->minfree, OPT_INT32, - 0, 99, "minfree" }, - { 'M', "maxbpg", &ffs_opts->maxbpg, OPT_INT32, - 1, INT_MAX, "max blocks per file in a cg" }, - { 'a', "avgfilesize", &ffs_opts->avgfilesize, OPT_INT32, + { "avgfilesize", &ffs_opts->avgfilesize, OPT_INT32, 1, INT_MAX, "expected average file size" }, - { 'n', "avgfpdir", &ffs_opts->avgfpdir, OPT_INT32, + { "avgfpdir", &ffs_opts->avgfpdir, OPT_INT32, 1, INT_MAX, "expected # of files per directory" }, - { 'x', "extent", &ffs_opts->maxbsize, OPT_INT32, + { "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" }, - { 'g', "maxbpcg", &ffs_opts->maxblkspercg, OPT_INT32, + { "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" }, - { 'v', "version", &ffs_opts->version, OPT_INT32, - 1, 2, "UFS version" }, - { 'o', "optimization", NULL, OPT_STRBUF, + { "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)" }, - { 'l', "label", ffs_opts->label, OPT_STRARRAY, - 1, sizeof(ffs_opts->label), "UFS label" }, + { "version", &ffs_opts->version, OPT_INT32, 1, 2, "UFS version" }, { .name = NULL } }; @@ -207,8 +204,7 @@ ffs_parse_opts(const char *option, fsinfo_t *fsopts) if (ffs_options[rv].name == NULL) abort(); - switch (ffs_options[rv].letter) { - case 'o': + if (strcmp(ffs_options[rv].name, "optimization") == 0) { if (strcmp(buf, "time") == 0) { ffs_opts->optimization = FS_OPTTIME; } else if (strcmp(buf, "space") == 0) { @@ -217,9 +213,6 @@ ffs_parse_opts(const char *option, fsinfo_t *fsopts) warnx("Invalid optimization `%s'", buf); return 0; } - break; - default: - break; } return 1; } diff --git a/usr.sbin/makefs/makefs.c b/usr.sbin/makefs/makefs.c index a4fced6be3e..a36629b2eb4 100644 --- a/usr.sbin/makefs/makefs.c +++ b/usr.sbin/makefs/makefs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: makefs.c,v 1.14 2016/10/22 20:50:21 natano Exp $ */ +/* $OpenBSD: makefs.c,v 1.15 2016/10/23 10:22:21 natano Exp $ */ /* $NetBSD: makefs.c,v 1.53 2015/11/27 15:10:32 joerg Exp $ */ /* @@ -244,10 +244,7 @@ set_option_var(const option_t *options, const char *var, const char *val, options[i].minimum, options[i].maximum); break for (i = 0; options[i].name != NULL; i++) { - if (var[1] == '\0') { - if (options[i].letter != var[0]) - continue; - } else if (strcmp(options[i].name, var) != 0) + if (strcmp(options[i].name, var) != 0) continue; switch (options[i].type) { case OPT_BOOL: @@ -352,9 +349,7 @@ usage(fstype_t *fstype, fsinfo_t *fsoptions) fprintf(stderr, "\n%s specific options:\n", fstype->type); for (i = 0; o[i].name != NULL; i++) - fprintf(stderr, "\t%c%c%20.20s\t%s\n", - o[i].letter ? o[i].letter : ' ', - o[i].letter ? ',' : ' ', + fprintf(stderr, "\t%-20.20s\t%s\n", o[i].name, o[i].desc); } exit(1); diff --git a/usr.sbin/makefs/makefs.h b/usr.sbin/makefs/makefs.h index fbd5726b37a..f53d38716f5 100644 --- a/usr.sbin/makefs/makefs.h +++ b/usr.sbin/makefs/makefs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: makefs.h,v 1.9 2016/10/22 19:20:36 natano Exp $ */ +/* $OpenBSD: makefs.h,v 1.10 2016/10/23 10:22:21 natano Exp $ */ /* $NetBSD: makefs.h,v 1.36 2015/11/25 00:48:49 christos Exp $ */ /* @@ -118,7 +118,6 @@ typedef enum { } opttype_t; typedef struct { - char letter; /* option letter NUL for none */ const char *name; /* option name */ void *value; /* where to stuff the value */ opttype_t type; /* type of entry */ diff --git a/usr.sbin/makefs/msdos.c b/usr.sbin/makefs/msdos.c index dafaced4765..3631a107530 100644 --- a/usr.sbin/makefs/msdos.c +++ b/usr.sbin/makefs/msdos.c @@ -1,4 +1,4 @@ -/* $OpenBSD: msdos.c,v 1.7 2016/10/22 18:17:14 natano Exp $ */ +/* $OpenBSD: msdos.c,v 1.8 2016/10/23 10:22:21 natano Exp $ */ /* $NetBSD: msdos.c,v 1.16 2016/01/30 09:59:27 mlelstv Exp $ */ /*- @@ -52,20 +52,19 @@ msdos_prep_opts(fsinfo_t *fsopts) { struct msdos_options *msdos_opt = ecalloc(1, sizeof(*msdos_opt)); const option_t msdos_options[] = { -#define AOPT(_opt, _type, _name, _min, _desc) { \ - .letter = _opt, \ +#define AOPT(_type, _name, _min, _desc) { \ .name = # _name, \ .type = _min == -1 ? OPT_STRPTR : \ (_min == -2 ? OPT_BOOL : \ (sizeof(_type) == 1 ? OPT_INT8 : \ (sizeof(_type) == 2 ? OPT_INT16 : \ (sizeof(_type) == 4 ? OPT_INT32 : OPT_INT64)))), \ - .value = &msdos_opt->_name, \ + .value = &msdos_opt->_name, \ .minimum = _min, \ .maximum = sizeof(_type) == 1 ? 0xff : \ (sizeof(_type) == 2 ? 0xffff : \ (sizeof(_type) == 4 ? 0xffffffff : 0xffffffffffffffffLL)), \ - .desc = _desc, \ + .desc = _desc, \ }, ALLOPTS #undef AOPT diff --git a/usr.sbin/makefs/msdos/mkfs_msdos.h b/usr.sbin/makefs/msdos/mkfs_msdos.h index f43ad01d84e..8f90b2cf556 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.2 2016/10/22 20:50:21 natano Exp $ */ +/* $OpenBSD: mkfs_msdos.h,v 1.3 2016/10/23 10:22:21 natano Exp $ */ /* $NetBSD: mkfs_msdos.h,v 1.3 2015/10/16 17:38:17 christos Exp $ */ /*- @@ -33,32 +33,32 @@ #include <sys/types.h> #define ALLOPTS \ -AOPT('@', off_t, offset, 0, "Offset in device") \ -AOPT('B', char *, bootstrap, -1, "Bootstrap file") \ -AOPT('C', off_t, create_size, 0, "Create file") \ -AOPT('F', uint8_t, fat_type, 12, "FAT type (12, 16, or 32)") \ -AOPT('I', uint32_t, volume_id, 0, "Volume ID") \ -AOPT('L', char *, volume_label, -1, "Volume Label") \ -AOPT('N', int, no_create, -2, "Don't create filesystem, print params only") \ -AOPT('O', char *, OEM_string, -1, "OEM string") \ -AOPT('S', uint16_t, bytes_per_sector, 1, "Bytes per sector") \ -AOPT('a', uint32_t, sectors_per_fat, 1, "Sectors per FAT") \ -AOPT('b', uint32_t, block_size, 1, "Block size") \ -AOPT('c', uint8_t, sectors_per_cluster, 1, "Sectors per cluster") \ -AOPT('e', uint16_t, directory_entries, 1, "Directory entries") \ -AOPT('f', char *, floppy, -1, "Standard format floppies (160,180,320,360,640,720,1200,1232,1440,2880)") \ -AOPT('h', uint16_t, drive_heads, 1, "Drive heads") \ -AOPT('i', uint16_t, info_sector, 1, "Info sector") \ -AOPT('k', uint16_t, backup_sector, 1, "Backup sector") \ -AOPT('m', uint8_t, media_descriptor, 0, "Media descriptor") \ -AOPT('n', uint8_t, num_FAT, 1, "Number of FATs") \ -AOPT('o', uint32_t, hidden_sectors, 0, "Hidden sectors") \ -AOPT('r', uint16_t, reserved_sectors, 1, "Reserved sectors") \ -AOPT('s', uint32_t, size, 1, "File System size") \ -AOPT('u', uint16_t, sectors_per_track, 1, "Sectors per track") +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(int, no_create, -2, "Don't create filesystem, print params only") \ +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") struct msdos_options { -#define AOPT(_opt, _type, _name, _min, _desc) _type _name; +#define AOPT(_type, _name, _min, _desc) _type _name; ALLOPTS #undef AOPT uint32_t volume_id_set:1; |