From owner-svn-src-head@freebsd.org Fri Mar 3 20:23:16 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 00446CF729D; Fri, 3 Mar 2017 20:23:16 +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 mx1.freebsd.org (Postfix) with ESMTPS id C02D01FE2; Fri, 3 Mar 2017 20:23:15 +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 v23KNEd8063297; Fri, 3 Mar 2017 20:23:14 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v23KNEaj063296; Fri, 3 Mar 2017 20:23:14 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201703032023.v23KNEaj063296@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 3 Mar 2017 20:23:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r314620 - head/usr.sbin/efivar X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Mar 2017 20:23:16 -0000 Author: imp Date: Fri Mar 3 20:23:14 2017 New Revision: 314620 URL: https://svnweb.freebsd.org/changeset/base/314620 Log: Implement -d / --device-path to print the ascii representation of a variable that contains a UEFI device path. Sponsored by: Netflix Modified: head/usr.sbin/efivar/efivar.c Modified: head/usr.sbin/efivar/efivar.c ============================================================================== --- head/usr.sbin/efivar/efivar.c Fri Mar 3 20:23:10 2017 (r314619) +++ head/usr.sbin/efivar/efivar.c Fri Mar 3 20:23:14 2017 (r314620) @@ -45,6 +45,8 @@ static struct option longopts[] = { { "attributes", required_argument, NULL, 't' }, { "binary", no_argument, NULL, 'b' }, { "delete", no_argument, NULL, 'D' }, + { "device", no_argument, NULL, 'd' }, + { "device-path", no_argument, NULL, 'd' }, { "fromfile", required_argument, NULL, 'f' }, { "guid", no_argument, NULL, 'g' }, { "hex", no_argument, NULL, 'H' }, @@ -197,6 +199,13 @@ bindump(uint8_t *data, size_t datalen) } static void +devpath_dump(uint8_t *data, size_t datalen) +{ + + fprintf(stderr, "junk %p %zu\n", data, datalen); +} + +static void pretty_guid(efi_guid_t *guid, char **gname) { char *pretty = NULL; @@ -232,6 +241,8 @@ print_var(efi_guid_t *guid, char *name) asciidump(data, datalen); else if (bflag) bindump(data, datalen); + else if (dflag) + devpath_dump(data, datalen); else hexdump(data, datalen); } else {