svn commit: r333381 - head/usr.sbin/efibootmgr

Warner Losh imp at FreeBSD.org
Tue May 8 18:25:38 UTC 2018


Author: imp
Date: Tue May  8 18:25:37 2018
New Revision: 333381
URL: https://svnweb.freebsd.org/changeset/base/333381

Log:
  Inline print_order(). It's used one palce.

Modified:
  head/usr.sbin/efibootmgr/efibootmgr.c

Modified: head/usr.sbin/efibootmgr/efibootmgr.c
==============================================================================
--- head/usr.sbin/efibootmgr/efibootmgr.c	Tue May  8 18:18:27 2018	(r333380)
+++ head/usr.sbin/efibootmgr/efibootmgr.c	Tue May  8 18:25:37 2018	(r333381)
@@ -279,27 +279,6 @@ parse_args(int argc, char *argv[])
 
 
 static void
-print_order(void)
-{
-	uint32_t attrs;
-	uint8_t *data;
-	size_t size, i;
-
-	if (efi_get_variable(EFI_GLOBAL_GUID, "BootOrder", &data, &size, &attrs) < 0) {
-		printf("BootOrder : Couldn't get value for BootOrder\n");
-		return;
-	}
-
-	if (size % 2 == 1)
-		errx(1, "Bad BootOrder variable: odd length");
-
-	printf("BootOrder : ");
-	for (i = 0; i < size; i += 2)
-		printf("%04x%s", le16dec(data + i), i == size - 2 ? "\n" : ", ");
-}
-
-
-static void
 read_vars(void)
 {
 
@@ -808,7 +787,14 @@ print_boot_vars(bool verbose)
 	if (ret > 0) {
 		printf("Timeout : %d seconds\n", le16dec(data));
 	}
-	print_order();
+
+	if (efi_get_variable(EFI_GLOBAL_GUID, "BootOrder", &data, &size, &attrs) > 0) {
+		if (size % 2 == 1)
+			warn("Bad BootOrder variable: odd length %d", (int)size);
+		printf("BootOrder : ");
+		for (size_t i = 0; i < size; i += 2)
+			printf("%04x%s", le16dec(data + i), i == size - 2 ? "\n" : ", ");
+	}
 
 	/* now we want to fetch 'em all fresh again
 	 * which possibly includes a newly created bootvar


More information about the svn-src-head mailing list