From owner-svn-src-all@freebsd.org Tue May 8 18:25:38 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 36420FC529B; Tue, 8 May 2018 18:25:38 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E049D7097E; Tue, 8 May 2018 18:25:37 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C303C2DED0; Tue, 8 May 2018 18:25:37 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w48IPbDY071528; Tue, 8 May 2018 18:25:37 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w48IPbJE071527; Tue, 8 May 2018 18:25:37 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201805081825.w48IPbJE071527@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 8 May 2018 18:25:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r333381 - head/usr.sbin/efibootmgr X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/usr.sbin/efibootmgr X-SVN-Commit-Revision: 333381 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 May 2018 18:25:38 -0000 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