Module Name: src Committed By: riastradh Date: Sun Mar 2 00:03:41 UTC 2025
Modified Files: src/sbin/efi: Makefile bootvar.c certs.c devpath.h devpath1.c devpath2.c devpath3.c devpath4.c efiio.c getvars.c gptsubr.c main.c setvar.c showvar.c utils.c Log Message: efi(8): Nix trailing whitespace. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sbin/efi/Makefile src/sbin/efi/devpath.h \ src/sbin/efi/devpath1.c src/sbin/efi/devpath2.c src/sbin/efi/gptsubr.c \ src/sbin/efi/utils.c cvs rdiff -u -r1.1 -r1.2 src/sbin/efi/bootvar.c src/sbin/efi/efiio.c \ src/sbin/efi/getvars.c src/sbin/efi/setvar.c cvs rdiff -u -r1.3 -r1.4 src/sbin/efi/certs.c src/sbin/efi/devpath3.c \ src/sbin/efi/devpath4.c src/sbin/efi/main.c src/sbin/efi/showvar.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sbin/efi/Makefile diff -u src/sbin/efi/Makefile:1.2 src/sbin/efi/Makefile:1.3 --- src/sbin/efi/Makefile:1.2 Tue Feb 25 20:23:19 2025 +++ src/sbin/efi/Makefile Sun Mar 2 00:03:41 2025 @@ -1,6 +1,6 @@ -# $NetBSD: Makefile,v 1.2 2025/02/25 20:23:19 rillig Exp $ +# $NetBSD: Makefile,v 1.3 2025/03/02 00:03:41 riastradh Exp $ -WARNS=9 +WARNS=9 .include <bsd.init.mk> Index: src/sbin/efi/devpath.h diff -u src/sbin/efi/devpath.h:1.2 src/sbin/efi/devpath.h:1.3 --- src/sbin/efi/devpath.h:1.2 Thu Feb 27 17:26:56 2025 +++ src/sbin/efi/devpath.h Sun Mar 2 00:03:41 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: devpath.h,v 1.2 2025/02/27 17:26:56 christos Exp $ */ +/* $NetBSD: devpath.h,v 1.3 2025/03/02 00:03:41 riastradh Exp $ */ /* * Redistribution and use in source and binary forms, with or without @@ -27,7 +27,7 @@ #define _DEVPATH_H_ #ifndef lint -__RCSID("$NetBSD: devpath.h,v 1.2 2025/02/27 17:26:56 christos Exp $"); +__RCSID("$NetBSD: devpath.h,v 1.3 2025/03/02 00:03:41 riastradh Exp $"); #endif /* not lint */ #include <stdlib.h> @@ -55,7 +55,7 @@ enum { DEVPATH_TYPE_MEDIA = 4, DEVPATH_TYPE_BIOS = 5, DEVPATH_TYPE_END = 0x7f, -}; +}; #define DEVPATH_END_ALL \ ((EFI_DEVICE_PATH_PROTOCOL){.Type = 0x7f, .SubType = 0xff, .Length = 0x04}) @@ -105,7 +105,7 @@ devpath_type_name(size_t type) static inline void devpath_hdr(devpath_t *dp, devpath_elm_t *elm) { - + elm->sz = (size_t)easprintf(&elm->cp, DEVPATH_FMT_HDR, DEVPATH_DAT_HDR(dp)); } Index: src/sbin/efi/devpath1.c diff -u src/sbin/efi/devpath1.c:1.2 src/sbin/efi/devpath1.c:1.3 --- src/sbin/efi/devpath1.c:1.2 Mon Feb 24 15:42:05 2025 +++ src/sbin/efi/devpath1.c Sun Mar 2 00:03:41 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: devpath1.c,v 1.2 2025/02/24 15:42:05 martin Exp $ */ +/* $NetBSD: devpath1.c,v 1.3 2025/03/02 00:03:41 riastradh Exp $ */ /* * Redistribution and use in source and binary forms, with or without @@ -25,7 +25,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: devpath1.c,v 1.2 2025/02/24 15:42:05 martin Exp $"); +__RCSID("$NetBSD: devpath1.c,v 1.3 2025/03/02 00:03:41 riastradh Exp $"); #endif /* not lint */ #include <sys/uuid.h> @@ -171,7 +171,7 @@ devpath_hw_memmap(devpath_t *dp, devpath p->MemoryType, typename, p->StartAddress, p->EndAddress); - + } } Index: src/sbin/efi/devpath2.c diff -u src/sbin/efi/devpath2.c:1.2 src/sbin/efi/devpath2.c:1.3 --- src/sbin/efi/devpath2.c:1.2 Thu Feb 27 17:26:56 2025 +++ src/sbin/efi/devpath2.c Sun Mar 2 00:03:41 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: devpath2.c,v 1.2 2025/02/27 17:26:56 christos Exp $ */ +/* $NetBSD: devpath2.c,v 1.3 2025/03/02 00:03:41 riastradh Exp $ */ /* * Redistribution and use in source and binary forms, with or without @@ -25,7 +25,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: devpath2.c,v 1.2 2025/02/27 17:26:56 christos Exp $"); +__RCSID("$NetBSD: devpath2.c,v 1.3 2025/03/02 00:03:41 riastradh Exp $"); #endif /* not lint */ #include <assert.h> @@ -49,7 +49,6 @@ __RCSID("$NetBSD: devpath2.c,v 1.2 2025/ * algorithm. */ - #define PNP0A03 0x0a0341d0 #define PNP0A08 0x0a0841d0 @@ -268,7 +267,7 @@ devpath_acpi_unknown(devpath_t *dp, devp path->sz = easprintf(&path->cp, "Msg(%d,%s)", dp->SubType, encode_data(((uint8_t *)dp) + 4, dp->Length - 4)); - + if (dbg != NULL) { dbg->sz = easprintf(&dbg->cp, DEVPATH_FMT_HDR, Index: src/sbin/efi/gptsubr.c diff -u src/sbin/efi/gptsubr.c:1.2 src/sbin/efi/gptsubr.c:1.3 --- src/sbin/efi/gptsubr.c:1.2 Mon Feb 24 15:42:05 2025 +++ src/sbin/efi/gptsubr.c Sun Mar 2 00:03:41 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: gptsubr.c,v 1.2 2025/02/24 15:42:05 martin Exp $ */ +/* $NetBSD: gptsubr.c,v 1.3 2025/03/02 00:03:41 riastradh Exp $ */ /* * Redistribution and use in source and binary forms, with or without @@ -25,7 +25,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: gptsubr.c,v 1.2 2025/02/24 15:42:05 martin Exp $"); +__RCSID("$NetBSD: gptsubr.c,v 1.3 2025/03/02 00:03:41 riastradh Exp $"); #endif /* not lint */ #include <sys/param.h> @@ -222,21 +222,21 @@ show_map(map_t m, struct map_widths w) uuid_to_string(&uuid, &part_guid, &status); type_uuid = estrdup(""); break; - + case MAP_TYPE_GPT_PART: ent = m->map_data; memcpy(&uuid, ent->ent_type, sizeof(uuid)); uuid_to_string(&uuid, &type_uuid, &status); - + memcpy(&uuid, ent->ent_guid, sizeof(uuid)); uuid_to_string(&uuid, &part_guid, &status); - + ent_attr = ent->ent_attr; memcpy(&gpt_uuid, ent->ent_type, sizeof(uuid)); gpt_uuid_snprintf(ent_type, sizeof(ent_type), "%s", gpt_uuid); - + /* * Use the gpt.c code here rather than our * ucs2_to_utf8() as we are in their world. @@ -245,7 +245,7 @@ show_map(map_t m, struct map_widths w) ent_desc, sizeof(ent_desc)); break; - + case MAP_TYPE_MBR_PART: part_guid = estrdup(""); type_uuid = estrdup(""); @@ -282,7 +282,7 @@ show_map(map_t m, struct map_widths w) ent_type, map_type_name(m->map_type), ent_desc); - + free(part_guid); free(type_uuid); } @@ -334,11 +334,11 @@ parent_of_fname(const char *fname) b = basename(vfsb.f_mntfromname); d = dirname(vfsb.f_mntfromname); easprintf(&p, "%s/r%s", d, b); - + fd = open(p, O_RDONLY); if (fd == -1) err(EXIT_FAILURE, "open"); - + rv = ioctl(fd, DIOCGWEDGEINFO, &dkinfo); close(fd); @@ -348,7 +348,7 @@ parent_of_fname(const char *fname) } warn("ioctl: DIOCGWEDGEINFO"); - + /* * Hum. No wedges? Assume we have the old disklabel * "/dev/rwd0x" syntax. Convert it to "/dev/rwd0d". @@ -502,7 +502,7 @@ find_partition_idx(const char *fname, in int fd = open(p, O_RDONLY); if (fd == -1) err(EXIT_FAILURE, "open"); - + rv = ioctl(fd, DIOCGWEDGEINFO, &dkinfo); if (rv != -1) { parent = dkinfo.dkw_parent; @@ -511,28 +511,28 @@ find_partition_idx(const char *fname, in } else { struct disklabel dl; - + warn("ioctl: DIOCGWEDGEINFO"); - + rv = ioctl(fd, DIOCGDINFO, &dl); if (rv == -1) err(EXIT_FAILURE, "ioctl: DIOCGDINFO"); - + size_t n = strlen(p); - + int pnum = p[n - 1] - 'a'; p[n - 1] = 'd'; - + printf("num_parts: %u\n", dl.d_npartitions); printf("partition %d\n", pnum); printf(" offset = %u (%#x)\n", dl.d_partitions[pnum].p_offset, dl.d_partitions[pnum].p_offset); printf(" size = %u (%#x)\n", dl.d_partitions[pnum].p_size, dl.d_partitions[pnum].p_size); - + parent = p; // vfsbuf.f_mntfromname; offset = dl.d_partitions[pnum].p_offset; size = dl.d_partitions[pnum].p_size; } - + close(fd); free(p); } @@ -604,7 +604,7 @@ find_partition_pathname(const char *fnam if (vfsbuf.f_mntonname[i] != '\0') errx(EXIT_FAILURE, "mntonname mismatch: %s", vfsbuf.f_mntonname + i); - + pname = estrdup(rname + i); free(rname); Index: src/sbin/efi/utils.c diff -u src/sbin/efi/utils.c:1.2 src/sbin/efi/utils.c:1.3 --- src/sbin/efi/utils.c:1.2 Tue Feb 25 22:11:36 2025 +++ src/sbin/efi/utils.c Sun Mar 2 00:03:41 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: utils.c,v 1.2 2025/02/25 22:11:36 christos Exp $ */ +/* $NetBSD: utils.c,v 1.3 2025/03/02 00:03:41 riastradh Exp $ */ /* * Redistribution and use in source and binary forms, with or without @@ -25,7 +25,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: utils.c,v 1.2 2025/02/25 22:11:36 christos Exp $"); +__RCSID("$NetBSD: utils.c,v 1.3 2025/03/02 00:03:41 riastradh Exp $"); #endif /* not lint */ #include <sys/uuid.h> @@ -253,7 +253,6 @@ utf8_to_ucs2(const char *ibuf, size_t is return dst; } - PUBLIC size_t utf8_to_ucs2_size(const char *src) { Index: src/sbin/efi/bootvar.c diff -u src/sbin/efi/bootvar.c:1.1 src/sbin/efi/bootvar.c:1.2 --- src/sbin/efi/bootvar.c:1.1 Mon Feb 24 13:47:55 2025 +++ src/sbin/efi/bootvar.c Sun Mar 2 00:03:41 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: bootvar.c,v 1.1 2025/02/24 13:47:55 christos Exp $ */ +/* $NetBSD: bootvar.c,v 1.2 2025/03/02 00:03:41 riastradh Exp $ */ /* * Redistribution and use in source and binary forms, with or without @@ -25,7 +25,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: bootvar.c,v 1.1 2025/02/24 13:47:55 christos Exp $"); +__RCSID("$NetBSD: bootvar.c,v 1.2 2025/03/02 00:03:41 riastradh Exp $"); #endif /* not lint */ #include <sys/queue.h> @@ -79,7 +79,7 @@ new_blk(uint8_t type, uint8_t subtype, u if (type == 0) /* non-devpath */ return bb; - + bb->u.path->Type = type; bb->u.path->SubType = subtype; bb->u.path->Length = length; @@ -113,7 +113,7 @@ create_bootbody(const char *label, uint3 body_size = sizeof(*bb->u.body) + desc_size; bb = new_blk(0, 0, (uint16_t)body_size); - + bb->u.body->Attributes = attrib; size = desc_size; @@ -135,7 +135,7 @@ create_devpath_media_hd(const char *dev, uint8_t PartitionFormat; #define PARTITION_FORMAT_MBR 0x01 #define PARTITION_FORMAT_GPT 0x02 - + uint8_t SignatureType; #define SIGNATURE_TYPE_NONE 0x00 #define SIGNATURE_TYPE_MBR 0x01 @@ -211,7 +211,7 @@ static boot_blk_t * create_optdata(const char *fname) { boot_blk_t *bb; - + bb = new_blk(0, 0, 0); bb->u.vp = read_file(fname, &bb->size); return bb; @@ -241,7 +241,7 @@ make_bootvar_data(const char *dev, uint bb = create_devpath_end(); SIMPLEQ_INSERT_TAIL(&head, bb, entry); FilePathListLength += bb->size; - + if (fname == NULL) { OptDataLength = 0; } @@ -280,6 +280,6 @@ find_new_bootvar(efi_var_t **var_array, break; } lastidx = idx; - } + } return lastidx + 1; } Index: src/sbin/efi/efiio.c diff -u src/sbin/efi/efiio.c:1.1 src/sbin/efi/efiio.c:1.2 --- src/sbin/efi/efiio.c:1.1 Mon Feb 24 13:47:56 2025 +++ src/sbin/efi/efiio.c Sun Mar 2 00:03:41 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: efiio.c,v 1.1 2025/02/24 13:47:56 christos Exp $ */ +/* $NetBSD: efiio.c,v 1.2 2025/03/02 00:03:41 riastradh Exp $ */ /* * Redistribution and use in source and binary forms, with or without @@ -25,7 +25,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: efiio.c,v 1.1 2025/02/24 13:47:56 christos Exp $"); +__RCSID("$NetBSD: efiio.c,v 1.2 2025/03/02 00:03:41 riastradh Exp $"); #endif /* not lint */ #include <sys/efiio.h> @@ -149,7 +149,7 @@ get_variable_info(int fd, bool (*choose) if (errno == ENOENT) break; - + /* XXX: ev is likely to be zero */ buf = ucs2_to_utf8(ev.name, ev.namesize, NULL, NULL); err(EXIT_FAILURE, "%s: '%s'", __func__, buf); @@ -165,7 +165,7 @@ get_variable_info(int fd, bool (*choose) cnt++; fn(&ev, arg); - + free(ev.data); } free(ev.name); Index: src/sbin/efi/getvars.c diff -u src/sbin/efi/getvars.c:1.1 src/sbin/efi/getvars.c:1.2 --- src/sbin/efi/getvars.c:1.1 Mon Feb 24 13:47:56 2025 +++ src/sbin/efi/getvars.c Sun Mar 2 00:03:41 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: getvars.c,v 1.1 2025/02/24 13:47:56 christos Exp $ */ +/* $NetBSD: getvars.c,v 1.2 2025/03/02 00:03:41 riastradh Exp $ */ /* * Redistribution and use in source and binary forms, with or without @@ -25,7 +25,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: getvars.c,v 1.1 2025/02/24 13:47:56 christos Exp $"); +__RCSID("$NetBSD: getvars.c,v 1.2 2025/03/02 00:03:41 riastradh Exp $"); #endif /* not lint */ #include <sys/efiio.h> @@ -150,7 +150,7 @@ get_variables(int fd, const char *regexp args.list_head = &list_head; if (regcomp(&args.preg, regexp, REG_EXTENDED) != 0) err(EXIT_FAILURE, "regcomp: %s", regexp); - + var_cnt = get_variable_info(fd, choose_variable, save_variable, &args); regfree(&args.preg); @@ -161,7 +161,7 @@ get_variables(int fd, const char *regexp var_array[i++] = &elm->v; } qsort(var_array, var_cnt, sizeof(*var_array), var_name_cmp); - + *array_ptr = var_array; *array_cnt = var_cnt; @@ -171,7 +171,7 @@ get_variables(int fd, const char *regexp static void free_efi_var_ioc(efi_var_ioc_t *ev) { - + free(ev->name); free(ev->data); memset(ev, 0, sizeof(*ev)); @@ -180,7 +180,7 @@ free_efi_var_ioc(efi_var_ioc_t *ev) static void free_efi_var(efi_var_t *v) { - + free(v->name); memset(v, 0, sizeof(*v)); } @@ -190,7 +190,7 @@ free_variables(void *vp) { efi_var_head_t *list_head = vp; efi_var_elm_t *elm; - + while (!SLIST_EMPTY(list_head)) { elm = SLIST_FIRST(list_head); SLIST_REMOVE_HEAD(list_head, entry); Index: src/sbin/efi/setvar.c diff -u src/sbin/efi/setvar.c:1.1 src/sbin/efi/setvar.c:1.2 --- src/sbin/efi/setvar.c:1.1 Mon Feb 24 13:47:57 2025 +++ src/sbin/efi/setvar.c Sun Mar 2 00:03:41 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: setvar.c,v 1.1 2025/02/24 13:47:57 christos Exp $ */ +/* $NetBSD: setvar.c,v 1.2 2025/03/02 00:03:41 riastradh Exp $ */ /* * Redistribution and use in source and binary forms, with or without @@ -25,7 +25,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: setvar.c,v 1.1 2025/02/24 13:47:57 christos Exp $"); +__RCSID("$NetBSD: setvar.c,v 1.2 2025/03/02 00:03:41 riastradh Exp $"); #endif /* not lint */ #include <sys/efiio.h> @@ -112,7 +112,7 @@ prefix_bootorder(int fd, const char *tar ev.data = data; ev.datasize = datasize; - + rv = set_variable(fd, &ev); free(ev.data); if (rv == -1) @@ -159,7 +159,7 @@ remove_bootorder(int fd, const char *tar } ev.data = data; ev.datasize = j * sizeof(*data); - + rv = set_variable(fd, &ev); free(ev.data); if (rv == -1) @@ -207,7 +207,7 @@ delete_variable(int fd, const char *varn EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS); - + rv = set_variable(fd, &ev); free(ev.name); return rv; @@ -279,7 +279,7 @@ set_bootnext(int fd, uint16_t bootnum) ev.data = &bootnum; ev.datasize = sizeof(bootnum); - + printf("set BootNext = Boot%04X\n", bootnum); rv = set_variable(fd, &ev); @@ -308,7 +308,6 @@ set_timeout(int fd, uint16_t timeout) struct efi_var_ioc ev; int rv; - efi_var_init(&ev, TIMEOUT, &EFI_GLOBAL_VARIABLE, EFI_VARIABLE_NON_VOLATILE | @@ -317,7 +316,7 @@ set_timeout(int fd, uint16_t timeout) ev.data = &timeout; ev.datasize = sizeof(timeout); - + printf("set Timeout = %u seconds\n", timeout); rv = set_variable(fd, &ev); @@ -347,7 +346,7 @@ set_active(int efi_fd, const char *targe boot_var_t *bb; char *name; int rv; - + easprintf(&name, "%s%04X", target, bootnum); ev = get_variable(efi_fd, name, &EFI_GLOBAL_VARIABLE, 0); free(name); @@ -357,7 +356,7 @@ set_active(int efi_fd, const char *targe bb->Attributes |= LOAD_OPTION_ACTIVE; else bb->Attributes &= (uint32_t)(~LOAD_OPTION_ACTIVE); - + rv = set_variable(efi_fd, &ev); if (rv == -1) err(EXIT_FAILURE, "set_variable"); @@ -377,7 +376,7 @@ del_variable(int fd, const char *varname EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS); - + rv = set_variable(fd, &ev); free(ev.name); return rv; @@ -397,10 +396,10 @@ del_variable(int efi_fd, const char *tar if (rv == -1) err(EXIT_FAILURE, "del_variable"); - + rv = remove_bootorder(efi_fd, target, NULL, bootnum); if (rv == -1) err(EXIT_FAILURE, "remove_bootorder"); - + return rv; } Index: src/sbin/efi/certs.c diff -u src/sbin/efi/certs.c:1.3 src/sbin/efi/certs.c:1.4 --- src/sbin/efi/certs.c:1.3 Thu Feb 27 17:26:56 2025 +++ src/sbin/efi/certs.c Sun Mar 2 00:03:41 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: certs.c,v 1.3 2025/02/27 17:26:56 christos Exp $ */ +/* $NetBSD: certs.c,v 1.4 2025/03/02 00:03:41 riastradh Exp $ */ /* * Redistribution and use in source and binary forms, with or without @@ -25,7 +25,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: certs.c,v 1.3 2025/02/27 17:26:56 christos Exp $"); +__RCSID("$NetBSD: certs.c,v 1.4 2025/03/02 00:03:41 riastradh Exp $"); #endif /* not lint */ #include <assert.h> @@ -350,9 +350,9 @@ show_signature_list_header(EFI_SIGNATURE lp->SignatureHeaderSize, lp->SignatureHeaderSize); printf("%*sSigSize: %d (0x%x)\n", indent, "", lp->SignatureSize, lp->SignatureSize); - + return tp; -} +} static int parse_signature_list(const uint8_t *bp, size_t sz, int indent) Index: src/sbin/efi/devpath3.c diff -u src/sbin/efi/devpath3.c:1.3 src/sbin/efi/devpath3.c:1.4 --- src/sbin/efi/devpath3.c:1.3 Tue Feb 25 22:11:36 2025 +++ src/sbin/efi/devpath3.c Sun Mar 2 00:03:41 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: devpath3.c,v 1.3 2025/02/25 22:11:36 christos Exp $ */ +/* $NetBSD: devpath3.c,v 1.4 2025/03/02 00:03:41 riastradh Exp $ */ /* * Redistribution and use in source and binary forms, with or without @@ -25,7 +25,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: devpath3.c,v 1.3 2025/02/25 22:11:36 christos Exp $"); +__RCSID("$NetBSD: devpath3.c,v 1.4 2025/03/02 00:03:41 riastradh Exp $"); #endif /* not lint */ #include <arpa/inet.h> @@ -143,7 +143,7 @@ ipv6_addr(struct in6_addr *addr) static inline char * ipv6_type(uint8_t type) { - + switch (type) { case 0: return estrdup("Static"); case 1: return estrdup("StatelessAutoConfigure"); @@ -389,7 +389,7 @@ devpath_msg_uartflowctl(devpath_t *dp, d case 2: fc_str = "XonXoff"; break; default: fc_str = "????"; break; } - + path->sz = easprintf(&path->cp, "UartFlowCtrl(%s)", fc_str); if (dbg != NULL) { @@ -800,7 +800,7 @@ devpath_msg_ipv6(devpath_t *dp, devpath_ static inline const char * uart_parity(uint8_t n) { - + switch (n) { case 0: return "D"; case 1: return "N"; @@ -1047,7 +1047,6 @@ datdgst_name(uint16_t LoginOptions) } } - static inline const char * auth_name(uint16_t LoginOptions) { @@ -1272,7 +1271,6 @@ devpath_msg_nvme(devpath_t *dp, devpath_ } } - static void devpath_msg_uri(devpath_t *dp, devpath_elm_t *path, devpath_elm_t *dbg) { /* See 10.3.4.22 */ @@ -1283,7 +1281,7 @@ devpath_msg_uri(devpath_t *dp, devpath_e __CTASSERT(sizeof(*p) == 4); size_t len; char *buf; - + len = dp->Length - 4; buf = emalloc(len + 1); @@ -1542,8 +1540,6 @@ devpath_msg_dns(devpath_t *dp, devpath_e } } } - - } } Index: src/sbin/efi/devpath4.c diff -u src/sbin/efi/devpath4.c:1.3 src/sbin/efi/devpath4.c:1.4 --- src/sbin/efi/devpath4.c:1.3 Tue Feb 25 22:11:36 2025 +++ src/sbin/efi/devpath4.c Sun Mar 2 00:03:41 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: devpath4.c,v 1.3 2025/02/25 22:11:36 christos Exp $ */ +/* $NetBSD: devpath4.c,v 1.4 2025/03/02 00:03:41 riastradh Exp $ */ /* * Redistribution and use in source and binary forms, with or without @@ -25,7 +25,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: devpath4.c,v 1.3 2025/02/25 22:11:36 christos Exp $"); +__RCSID("$NetBSD: devpath4.c,v 1.4 2025/03/02 00:03:41 riastradh Exp $"); #endif /* not lint */ #include <sys/uuid.h> @@ -95,7 +95,7 @@ devpath_media_harddisk(devpath_t *dp, de uuid_str, p->PartitionStart, p->PartitionSize); - + if (dbg != NULL) { const char *name_SignatureType; @@ -105,7 +105,7 @@ devpath_media_harddisk(devpath_t *dp, de case SIGNATURE_TYPE_GUID: name_SignatureType = "GUID"; break; default: name_SignatureType = "unknown"; break; } - + dbg->sz = easprintf(&dbg->cp, DEVPATH_FMT_HDR DEVPATH_FMT(PartitionNumber: %u\n) @@ -140,7 +140,7 @@ devpath_media_cdrom(devpath_t *dp, devpa path->sz = easprintf(&path->cp, "CDROM(0x%x,0x%016" PRIx64 ",0x%016" PRIx64 ")", p->BootEntry, p->PartitionStart, p->PartitionSize); - + if (dbg != NULL) { dbg->sz = easprintf(&dbg->cp, DEVPATH_FMT_HDR @@ -169,7 +169,7 @@ devpath_media_vendor(devpath_t *dp, devp uuid_snprintf(uuid_str, sizeof(uuid_str), &p->VendorGUID); path->sz = easprintf(&path->cp, "VenMedia(%s)", uuid_str); - + if (dbg != NULL) { dbg->sz = easprintf(&dbg->cp, DEVPATH_FMT_HDR @@ -192,7 +192,7 @@ devpath_media_filepath(devpath_t *dp, de PathName = ucs2_to_utf8(p->PathName, sz, NULL, NULL); path->sz = easprintf(&path->cp, "File(%s)", PathName); - + if (dbg != NULL) { dbg->sz = easprintf(&dbg->cp, DEVPATH_FMT_HDR Index: src/sbin/efi/main.c diff -u src/sbin/efi/main.c:1.3 src/sbin/efi/main.c:1.4 --- src/sbin/efi/main.c:1.3 Thu Feb 27 19:32:28 2025 +++ src/sbin/efi/main.c Sun Mar 2 00:03:41 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.3 2025/02/27 19:32:28 jakllsch Exp $ */ +/* $NetBSD: main.c,v 1.4 2025/03/02 00:03:41 riastradh Exp $ */ /* * Redistribution and use in source and binary forms, with or without @@ -25,7 +25,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: main.c,v 1.3 2025/02/27 19:32:28 jakllsch Exp $"); +__RCSID("$NetBSD: main.c,v 1.4 2025/03/02 00:03:41 riastradh Exp $"); #endif /* not lint */ #include <sys/efiio.h> @@ -137,7 +137,6 @@ enum { #define IS_TARGET_DRIVER(opt) ((opt).target[0] == TARGET_DRIVER[0]) - #define ACTION_LIST \ _X(active, NULL) \ _X(create, NULL) \ @@ -175,7 +174,7 @@ usage(const char *fmt, ...) if (fmt != NULL) { va_list ap; - + va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); @@ -194,7 +193,6 @@ usage(const char *fmt, ...) exit(EXIT_SUCCESS); } - static int __used append_optional_data(const char *fname, efi_var_ioc_t *ev) { @@ -243,7 +241,7 @@ typedef enum { #define IS_MBR_SIG_FORCE(o) ((o).mbr_sig_write == MBR_SIG_WRITE_FORCE) -static struct options { /* setable options */ +static struct options { /* setable options */ #define _X(t,n,v) t n; OPT_LIST #undef _X @@ -565,7 +563,7 @@ main(int argc, char **argv) case act_show_gpt: assert(0); break; /* handled above */ default: break; } - + /* * The following actions are handled below and require a call * to get_variables() using a regexp. Setup the regexp here. @@ -617,7 +615,7 @@ main(int argc, char **argv) */ bootnum = (uint16_t)find_new_bootvar(var_array, var_cnt, opt.target); easprintf(&v.name, "%s%04X", opt.target, bootnum); - + if (!opt.quiet) printf("creating: %s\n", v.name); @@ -644,7 +642,7 @@ main(int argc, char **argv) opt.debug &= (uint)~DEBUG_BRIEF_BIT; opt.debug |= DEBUG_VERBOSE_BIT; show_variable(&v, opt.debug, 0); - + printf("are you sure? [y/n] "); if (getchar() != 'y') goto done; @@ -702,10 +700,10 @@ main(int argc, char **argv) assert(0); break; } - + done: free_variables(var_hdl); close(efi_fd); - + return 0; } Index: src/sbin/efi/showvar.c diff -u src/sbin/efi/showvar.c:1.3 src/sbin/efi/showvar.c:1.4 --- src/sbin/efi/showvar.c:1.3 Thu Feb 27 17:26:56 2025 +++ src/sbin/efi/showvar.c Sun Mar 2 00:03:41 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: showvar.c,v 1.3 2025/02/27 17:26:56 christos Exp $ */ +/* $NetBSD: showvar.c,v 1.4 2025/03/02 00:03:41 riastradh Exp $ */ /* * Redistribution and use in source and binary forms, with or without @@ -25,7 +25,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: showvar.c,v 1.3 2025/02/27 17:26:56 christos Exp $"); +__RCSID("$NetBSD: showvar.c,v 1.4 2025/03/02 00:03:41 riastradh Exp $"); #endif /* not lint */ #include <sys/efiio.h> @@ -279,7 +279,7 @@ show_key_data(efi_var_t *v, bool dbg) if (c != '\0') *cp = c; /* restore the buffer */ - + for (uint i = 0; i < u.ko->KeyData.Options.InputKeyCount; i++) printf(" {%04x, %04x}", u.ko->Keys[i].ScanCode, u.ko->Keys[i].UnicodeChar); @@ -291,9 +291,9 @@ show_key_data(efi_var_t *v, bool dbg) printf(" BootOption: Boot%04X\n", u.ko->BootOption); for (uint i = 0; i < u.ko->KeyData.Options.InputKeyCount; i++) { printf(" Keys[%u].ScanCode: 0x%04x\n", i, - u.ko->Keys[i].ScanCode); + u.ko->Keys[i].ScanCode); printf(" Keys[%u].UnicodeChar: 0x%04x\n", i, - u.ko->Keys[i].UnicodeChar); + u.ko->Keys[i].UnicodeChar); } if (desc) printf(" Desc: %s\n", desc); @@ -373,7 +373,7 @@ show_boot_data(efi_var_t *v, uint debug, args = format_optional_data(info.OptionalData, info.OptionalDataSize); - + printf("\t%s%s", path, args);/* XXX: make this conditional on verbose? */ free(args); free(path); @@ -383,7 +383,7 @@ show_boot_data(efi_var_t *v, uint debug, if (dbg) { char attr_str[256]; - + snprintb(attr_str, sizeof(attr_str), LOAD_OPTION_BITS, info.Attributes); printf(" Attr: %s\n", attr_str); @@ -399,7 +399,7 @@ show_boot_data(efi_var_t *v, uint debug, free(info.Description); return 0; -} +} /************************************************************************/