Module Name: src Committed By: christos Date: Thu Feb 27 17:26:56 UTC 2025
Modified Files: src/sbin/efi: certs.c devpath.h devpath2.c main.c showvar.c showvar.h Log Message: make this compile with clang. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sbin/efi/certs.c src/sbin/efi/showvar.c cvs rdiff -u -r1.1 -r1.2 src/sbin/efi/devpath.h src/sbin/efi/devpath2.c \ src/sbin/efi/main.c src/sbin/efi/showvar.h 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/certs.c diff -u src/sbin/efi/certs.c:1.2 src/sbin/efi/certs.c:1.3 --- src/sbin/efi/certs.c:1.2 Tue Feb 25 15:23:19 2025 +++ src/sbin/efi/certs.c Thu Feb 27 12:26:56 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: certs.c,v 1.2 2025/02/25 20:23:19 rillig Exp $ */ +/* $NetBSD: certs.c,v 1.3 2025/02/27 17:26:56 christos 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.2 2025/02/25 20:23:19 rillig Exp $"); +__RCSID("$NetBSD: certs.c,v 1.3 2025/02/27 17:26:56 christos Exp $"); #endif /* not lint */ #include <assert.h> @@ -220,7 +220,8 @@ sigfn256(const void *vp, size_t sz, int printf("%*sOwner: ", indent, ""); uuid_printf(&s->uuid); printf("\n"); - show_data((void *)&s->ToBeSignedHash, sizeof(s->ToBeSignedHash), " "); + show_data((const void *)&s->ToBeSignedHash, sizeof(s->ToBeSignedHash), + " "); printf("%*sTimeOfRevocation: ", indent, ""); show_time(&s->TimeOfRevocation, indent); return 0; @@ -239,7 +240,8 @@ sigfn384(const void *vp, size_t sz, int printf("%*sOwner: ", indent, ""); uuid_printf(&s->uuid); printf("\n"); - show_data((void *)&s->ToBeSignedHash, sizeof(s->ToBeSignedHash), " "); + show_data((const void *)&s->ToBeSignedHash, sizeof(s->ToBeSignedHash), + " "); printf("%*sTimeOfRevocation: ", indent, ""); show_time(&s->TimeOfRevocation, indent); return 0; @@ -258,7 +260,8 @@ sigfn512(const void *vp, size_t sz, int printf("%*sOwner: ", indent, ""); uuid_printf(&s->uuid); printf("\n"); - show_data((void *)&s->ToBeSignedHash, sizeof(s->ToBeSignedHash), " "); + show_data((const void *)&s->ToBeSignedHash, sizeof(s->ToBeSignedHash), + " "); printf("%*sTimeOfRevocation: ", indent, ""); show_time(&s->TimeOfRevocation, indent); return 0; Index: src/sbin/efi/showvar.c diff -u src/sbin/efi/showvar.c:1.2 src/sbin/efi/showvar.c:1.3 --- src/sbin/efi/showvar.c:1.2 Tue Feb 25 17:11:36 2025 +++ src/sbin/efi/showvar.c Thu Feb 27 12:26:56 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: showvar.c,v 1.2 2025/02/25 22:11:36 christos Exp $ */ +/* $NetBSD: showvar.c,v 1.3 2025/02/27 17:26:56 christos 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.2 2025/02/25 22:11:36 christos Exp $"); +__RCSID("$NetBSD: showvar.c,v 1.3 2025/02/27 17:26:56 christos Exp $"); #endif /* not lint */ #include <sys/efiio.h> @@ -321,7 +321,7 @@ format_optional_data(char *od, size_t sz } static int -show_boot_data(efi_var_t *v, int debug, uint max_namelen) +show_boot_data(efi_var_t *v, uint debug, uint max_namelen) { struct { char *name; @@ -481,7 +481,7 @@ varcmpsrchfn(const void *a, const void * } PUBLIC int -show_variable(efi_var_t *v, int debug, uint max_namelen) +show_variable(efi_var_t *v, uint debug, uint max_namelen) { #define REGEXP_BOOTXXXX "^((Key)|(Boot)|(lBoot)|(Driver)|(SysPrep)|(OsRecovery))[0-9,A-F]{4}$" static regex_t preg = { .re_magic = 0, }; Index: src/sbin/efi/devpath.h diff -u src/sbin/efi/devpath.h:1.1 src/sbin/efi/devpath.h:1.2 --- src/sbin/efi/devpath.h:1.1 Mon Feb 24 08:47:56 2025 +++ src/sbin/efi/devpath.h Thu Feb 27 12:26:56 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: devpath.h,v 1.1 2025/02/24 13:47:56 christos Exp $ */ +/* $NetBSD: devpath.h,v 1.2 2025/02/27 17:26:56 christos 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.1 2025/02/24 13:47:56 christos Exp $"); +__RCSID("$NetBSD: devpath.h,v 1.2 2025/02/27 17:26:56 christos Exp $"); #endif /* not lint */ #include <stdlib.h> @@ -38,7 +38,7 @@ typedef struct EFI_DEVICE_PATH_PROTOCOL uint8_t SubType; // uint8_t Length[2]; uint16_t Length; - uint8_t Data[]; +// uint8_t Data[]; } EFI_DEVICE_PATH_PROTOCOL; typedef EFI_DEVICE_PATH_PROTOCOL devpath_t; Index: src/sbin/efi/devpath2.c diff -u src/sbin/efi/devpath2.c:1.1 src/sbin/efi/devpath2.c:1.2 --- src/sbin/efi/devpath2.c:1.1 Mon Feb 24 08:47:56 2025 +++ src/sbin/efi/devpath2.c Thu Feb 27 12:26:56 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: devpath2.c,v 1.1 2025/02/24 13:47:56 christos Exp $ */ +/* $NetBSD: devpath2.c,v 1.2 2025/02/27 17:26:56 christos 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.1 2025/02/24 13:47:56 christos Exp $"); +__RCSID("$NetBSD: devpath2.c,v 1.2 2025/02/27 17:26:56 christos Exp $"); #endif /* not lint */ #include <assert.h> @@ -261,12 +261,13 @@ devpath_acpi_nvdimm(devpath_t *dp, devpa } } +#ifdef notdef static inline void devpath_acpi_unknown(devpath_t *dp, devpath_elm_t *path, devpath_elm_t *dbg) { path->sz = easprintf(&path->cp, "Msg(%d,%s)", dp->SubType, - encode_data(dp->Data, dp->Length - 4)); + encode_data(((uint8_t *)dp) + 4, dp->Length - 4)); if (dbg != NULL) { dbg->sz = easprintf(&dbg->cp, @@ -274,6 +275,7 @@ devpath_acpi_unknown(devpath_t *dp, devp DEVPATH_DAT_HDR(dp)); } } +#endif PUBLIC void devpath_acpi(devpath_t *dp, devpath_elm_t *path, devpath_elm_t *dbg) Index: src/sbin/efi/main.c diff -u src/sbin/efi/main.c:1.1 src/sbin/efi/main.c:1.2 --- src/sbin/efi/main.c:1.1 Mon Feb 24 08:47:57 2025 +++ src/sbin/efi/main.c Thu Feb 27 12:26:56 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.1 2025/02/24 13:47:57 christos Exp $ */ +/* $NetBSD: main.c,v 1.2 2025/02/27 17:26:56 christos 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.1 2025/02/24 13:47:57 christos Exp $"); +__RCSID("$NetBSD: main.c,v 1.2 2025/02/27 17:26:56 christos Exp $"); #endif /* not lint */ #include <sys/efiio.h> @@ -153,7 +153,7 @@ enum { _X(show, NULL) \ _X(show_gpt, show_gpt) -static void __dead +static void __dead __printflike(1, 2) usage(const char *fmt, ...) { const char *progname = getprogname(); Index: src/sbin/efi/showvar.h diff -u src/sbin/efi/showvar.h:1.1 src/sbin/efi/showvar.h:1.2 --- src/sbin/efi/showvar.h:1.1 Mon Feb 24 08:47:57 2025 +++ src/sbin/efi/showvar.h Thu Feb 27 12:26:56 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: showvar.h,v 1.1 2025/02/24 13:47:57 christos Exp $ */ +/* $NetBSD: showvar.h,v 1.2 2025/02/27 17:26:56 christos Exp $ */ /* * Redistribution and use in source and binary forms, with or without @@ -27,10 +27,10 @@ #define _SHOWEFI_H_ #ifndef lint -__RCSID("$NetBSD: showvar.h,v 1.1 2025/02/24 13:47:57 christos Exp $"); +__RCSID("$NetBSD: showvar.h,v 1.2 2025/02/27 17:26:56 christos Exp $"); #endif /* not lint */ int show_generic_data(efi_var_t *, uint); -int show_variable(efi_var_t *, int, uint); +int show_variable(efi_var_t *, uint, uint); #endif /* _SHOWEFI_H_ */