Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 May 2025 18:06:43 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 4c317815f1c2 - main - efivar: Move to new ioctl struct
Message-ID:  <202505011806.541I6hgV066712@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=4c317815f1c220033ab9e1da8b3e22c0e2180fcb

commit 4c317815f1c220033ab9e1da8b3e22c0e2180fcb
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2025-05-01 17:53:47 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2025-05-01 17:55:05 +0000

    efivar: Move to new ioctl struct
    
    Move to the newer ioctl 'struct efi_var_ioctl' which uses efi_guid_t
    instead of struct uuid. This allows for direct assignment agaain.
    
    Sponsored by:           Netflix
    Reviewed by:            tsoome, kib
    Differential Revision:  https://reviews.freebsd.org/D50058
---
 lib/libefivar/efivar.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/lib/libefivar/efivar.c b/lib/libefivar/efivar.c
index e28987ff001d..b380ae285831 100644
--- a/lib/libefivar/efivar.c
+++ b/lib/libefivar/efivar.c
@@ -120,7 +120,7 @@ efi_open_dev(void)
 }
 
 static void
-efi_var_reset(struct efi_var_ioc *var)
+efi_var_reset(struct efi_var_ioctl *var)
 {
 	var->name = NULL;
 	var->namesize = 0;
@@ -161,7 +161,7 @@ int
 efi_get_variable(efi_guid_t guid, const char *name,
     uint8_t **data, size_t *data_size, uint32_t *attributes)
 {
-	struct efi_var_ioc var;
+	struct efi_var_ioctl var;
 	int rv;
 	static uint8_t buf[1024*32];
 
@@ -172,7 +172,7 @@ efi_get_variable(efi_guid_t guid, const char *name,
 	rv = utf8_to_ucs2(name, &var.name, &var.namesize);
 	if (rv != 0)
 		goto errout;
-	memcpy(&var.vendor, &guid, sizeof(guid));
+	var.vendor = guid;
 	var.data = buf;
 	var.datasize = sizeof(buf);
 	rv = ioctl(efi_fd, EFIIOC_VAR_GET, &var);
@@ -211,7 +211,7 @@ efi_get_variable_size(efi_guid_t guid, const char *name,
 int
 efi_get_next_variable_name(efi_guid_t **guid, char **name)
 {
-	struct efi_var_ioc var;
+	struct efi_var_ioctl var;
 	int rv;
 	static efi_char *buf;
 	static size_t buflen = 256 * sizeof(efi_char);
@@ -240,7 +240,7 @@ again:
 		rv = utf8_to_ucs2(*name, &var.name, &size);
 		if (rv != 0)
 			goto errout;
-		memcpy(&var.vendor, *guid, sizeof(**guid));
+		var.vendor = **guid;
 	}
 	rv = ioctl(efi_fd, EFIIOC_VAR_NEXT, &var);
 	if (rv == 0 && var.name == NULL) {
@@ -266,7 +266,7 @@ again:
 		rv = ucs2_to_utf8(var.name, name);
 		if (rv != 0)
 			goto errout;
-		memcpy(&retguid, &var.vendor, sizeof(retguid));
+		retguid = var.vendor;
 		*guid = &retguid;
 	}
 errout:
@@ -351,7 +351,7 @@ int
 efi_set_variable(efi_guid_t guid, const char *name,
     uint8_t *data, size_t data_size, uint32_t attributes)
 {
-	struct efi_var_ioc var;
+	struct efi_var_ioctl var;
 	int rv;
 
 	if (efi_open_dev() == -1)
@@ -361,7 +361,7 @@ efi_set_variable(efi_guid_t guid, const char *name,
 	rv = utf8_to_ucs2(name, &var.name, &var.namesize);
 	if (rv != 0)
 		goto errout;
-	memcpy(&var.vendor, &guid, sizeof(guid));
+	var.vendor = guid;
 	var.data = data;
 	var.datasize = data_size;
 	var.attrib = attributes;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202505011806.541I6hgV066712>