From owner-svn-src-head@freebsd.org Fri Nov 10 23:30:24 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 7F074E53A26; Fri, 10 Nov 2017 23:30:24 +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 58C006800F; Fri, 10 Nov 2017 23:30:24 +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 vAANUNY2062398; Fri, 10 Nov 2017 23:30:23 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAANUNM9062394; Fri, 10 Nov 2017 23:30:23 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201711102330.vAANUNM9062394@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 10 Nov 2017 23:30:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325684 - in head: lib/libefivar usr.sbin/efivar X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head: lib/libefivar usr.sbin/efivar X-SVN-Commit-Revision: 325684 X-SVN-Commit-Repository: base 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, 10 Nov 2017 23:30:24 -0000 Author: imp Date: Fri Nov 10 23:30:23 2017 New Revision: 325684 URL: https://svnweb.freebsd.org/changeset/base/325684 Log: Simplify the efivar interface a little. We started out having Linux compatible libefivar interfaces. This was in anticipation of porting the GPL'd efibootmgr to FreeBSD via a port. However, since we need that functionality in the base, that port isn't going to happened. It also appears that efivar is a private library that's not used much outside a command line util and efibootmgr. Reduce compatibility with the Linux version a little by removing the mode parameter to efi_set_variable (which was unused on FreeBSD, and not set to something useful in the code we'd written). Also remove some efi error routines that were never implemented and existed only to placate early GPL efibootmgr porting experiments. Suggested by: Matt Williams Sponsored by: Netflix Modified: head/lib/libefivar/efivar.c head/lib/libefivar/efivar.h head/usr.sbin/efivar/efivar.c Modified: head/lib/libefivar/efivar.c ============================================================================== --- head/lib/libefivar/efivar.c Fri Nov 10 22:17:30 2017 (r325683) +++ head/lib/libefivar/efivar.c Fri Nov 10 23:30:23 2017 (r325684) @@ -150,7 +150,7 @@ efi_append_variable(efi_guid_t guid, const char *name, { return efi_set_variable(guid, name, data, data_size, - attributes | EFI_VARIABLE_APPEND_WRITE, 0); + attributes | EFI_VARIABLE_APPEND_WRITE); } int @@ -158,7 +158,7 @@ efi_del_variable(efi_guid_t guid, const char *name) { /* data_size of 0 deletes the variable */ - return efi_set_variable(guid, name, NULL, 0, 0, 0); + return efi_set_variable(guid, name, NULL, 0, 0); } int @@ -358,7 +358,7 @@ efi_name_to_guid(const char *name, efi_guid_t *guid) int efi_set_variable(efi_guid_t guid, const char *name, - uint8_t *data, size_t data_size, uint32_t attributes, mode_t mode __unused) + uint8_t *data, size_t data_size, uint32_t attributes) { struct efi_var_ioc var; int rv; Modified: head/lib/libefivar/efivar.h ============================================================================== --- head/lib/libefivar/efivar.h Fri Nov 10 22:17:30 2017 (r325683) +++ head/lib/libefivar/efivar.h Fri Nov 10 23:30:23 2017 (r325684) @@ -83,7 +83,7 @@ int efi_guid_to_symbol(efi_guid_t *guid, char **symbol int efi_guid_to_str(const efi_guid_t *guid, char **sp); int efi_name_to_guid(const char *name, efi_guid_t *guid); int efi_set_variable(efi_guid_t guid, const char *name, - uint8_t *data, size_t data_size, uint32_t attributes, mode_t mode); + uint8_t *data, size_t data_size, uint32_t attributes); int efi_str_to_guid(const char *s, efi_guid_t *guid); int efi_variables_supported(void); @@ -98,38 +98,5 @@ struct uuid_table int efi_known_guid(struct uuid_table **); extern const efi_guid_t efi_guid_empty; - -/* Stubs that are expected, but aren't really used */ -static inline int -efi_error_get(unsigned int n __unused, char ** const fn __unused, - char ** const func __unused, int *line __unused, - char ** const msg __unused, int *err __unused) -{ - return 0; -} - -static inline int -efi_error_set(const char *fn __unused, const char *func __unused, - int line __unused, int err __unused, const char *fmt __unused, ...) -{ - return 0; -} - -static inline void -efi_error_clear(void) -{ -} - -static inline int -efi_error(const char *fmt __unused, ...) -{ - return 0; -} - -static inline int -efi_error_val(int val __unused, const char *fmt __unused, ...) -{ - return 0; -} #endif /* _EFIVAR_H_ */ Modified: head/usr.sbin/efivar/efivar.c ============================================================================== --- head/usr.sbin/efivar/efivar.c Fri Nov 10 22:17:30 2017 (r325683) +++ head/usr.sbin/efivar/efivar.c Fri Nov 10 23:30:23 2017 (r325684) @@ -147,7 +147,7 @@ write_variable(char *name, char *val) breakdown_name(name, &guid, &vname); data = get_value(val, &datalen); - if (efi_set_variable(guid, vname, data, datalen, attrib, 0) < 0) + if (efi_set_variable(guid, vname, data, datalen, attrib) < 0) err(1, "efi_set_variable"); }