From f9e6aa16a3d3178ab1235705e4d95f2eec8828c4 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Wed, 1 Jun 2022 22:19:48 +0100 Subject: [PATCH] Remove some deprecated API --- libfwupdplugin/README.md | 1 + libfwupdplugin/fu-efivar.c | 21 +++---------------- libfwupdplugin/fu-efivar.h | 4 +--- libfwupdplugin/fwupdplugin.map | 3 +-- plugins/uefi-capsule/fu-plugin-uefi-capsule.c | 4 ++-- plugins/uefi-capsule/fu-uefi-bootmgr.c | 2 +- plugins/uefi-capsule/fu-uefi-common.c | 2 +- plugins/uefi-capsule/fu-uefi-device.c | 2 +- 8 files changed, 11 insertions(+), 28 deletions(-) diff --git a/libfwupdplugin/README.md b/libfwupdplugin/README.md index 93d458827..9780e4418 100644 --- a/libfwupdplugin/README.md +++ b/libfwupdplugin/README.md @@ -52,3 +52,4 @@ Remember: Plugins should be upstream! * `fu_usb_device_new_full()`: Use `fu_usb_device_new()` instead -- as the latter always specifies the context. * `fu_device_new_with_context()`: Use `fu_device_new()` instead -- as the latter always specifies the context. * `fu_plugin_has_custom_flag()`: Use `fu_plugin_has_private_flag()` instead. +* `fu_efivar_secure_boot_enabled_full()`: Use `fu_efivar_secure_boot_enabled()` instead -- as the latter always specifies the error. diff --git a/libfwupdplugin/fu-efivar.c b/libfwupdplugin/fu-efivar.c index bed2239ac..e41e0809b 100644 --- a/libfwupdplugin/fu-efivar.c +++ b/libfwupdplugin/fu-efivar.c @@ -265,17 +265,17 @@ fu_efivar_set_data_bytes(const gchar *guid, } /** - * fu_efivar_secure_boot_enabled_full: + * fu_efivar_secure_boot_enabled: * @error: (nullable): optional return location for an error * * Determines if secure boot was enabled * * Returns: %TRUE on success * - * Since: 1.5.0 + * Since: 1.8.2 **/ gboolean -fu_efivar_secure_boot_enabled_full(GError **error) +fu_efivar_secure_boot_enabled(GError **error) { gsize data_size = 0; g_autofree guint8 *data = NULL; @@ -301,18 +301,3 @@ fu_efivar_secure_boot_enabled_full(GError **error) g_set_error_literal(error, FWUPD_ERROR, FWUPD_ERROR_NOT_FOUND, "SecureBoot is not enabled"); return FALSE; } - -/** - * fu_efivar_secure_boot_enabled: - * - * Determines if secure boot was enabled - * - * Returns: %TRUE on success - * - * Since: 1.4.0 - **/ -gboolean -fu_efivar_secure_boot_enabled(void) -{ - return fu_efivar_secure_boot_enabled_full(NULL); -} diff --git a/libfwupdplugin/fu-efivar.h b/libfwupdplugin/fu-efivar.h index 998d2c86c..893a19a4f 100644 --- a/libfwupdplugin/fu-efivar.h +++ b/libfwupdplugin/fu-efivar.h @@ -64,6 +64,4 @@ fu_efivar_delete_with_glob(const gchar *guid, GPtrArray * fu_efivar_get_names(const gchar *guid, GError **error) G_GNUC_WARN_UNUSED_RESULT; gboolean -fu_efivar_secure_boot_enabled(void); -gboolean -fu_efivar_secure_boot_enabled_full(GError **error); +fu_efivar_secure_boot_enabled(GError **error); diff --git a/libfwupdplugin/fwupdplugin.map b/libfwupdplugin/fwupdplugin.map index 35b3ede56..a111bcca1 100644 --- a/libfwupdplugin/fwupdplugin.map +++ b/libfwupdplugin/fwupdplugin.map @@ -465,7 +465,6 @@ LIBFWUPDPLUGIN_1.4.0 { fu_efivar_delete_with_glob; fu_efivar_exists; fu_efivar_get_data; - fu_efivar_secure_boot_enabled; fu_efivar_set_data; fu_efivar_supported; fu_hid_device_get_interface; @@ -535,7 +534,6 @@ LIBFWUPDPLUGIN_1.5.0 { fu_device_report_metadata_pre; fu_device_unbind_driver; fu_efivar_get_data_bytes; - fu_efivar_secure_boot_enabled_full; fu_efivar_set_data_bytes; fu_firmware_add_flag; fu_firmware_build; @@ -1045,6 +1043,7 @@ LIBFWUPDPLUGIN_1.8.1 { LIBFWUPDPLUGIN_1.8.2 { global: fu_device_new; + fu_efivar_secure_boot_enabled; fu_progress_add_step_full; fu_progress_get_name; fu_progress_set_name; diff --git a/plugins/uefi-capsule/fu-plugin-uefi-capsule.c b/plugins/uefi-capsule/fu-plugin-uefi-capsule.c index a06e4e705..ec2b72bdb 100644 --- a/plugins/uefi-capsule/fu-plugin-uefi-capsule.c +++ b/plugins/uefi-capsule/fu-plugin-uefi-capsule.c @@ -173,7 +173,7 @@ fu_plugin_uefi_capsule_add_security_attrs(FuPlugin *plugin, FuSecurityAttrs *att fu_security_attrs_append(attrs, attr); /* SB not available or disabled */ - if (!fu_efivar_secure_boot_enabled_full(&error)) { + if (!fu_efivar_secure_boot_enabled(&error)) { if (g_error_matches(error, FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED)) { fwupd_security_attr_set_result(attr, FWUPD_SECURITY_ATTR_RESULT_NOT_FOUND); return; @@ -608,7 +608,7 @@ static void fu_plugin_uefi_capsule_test_secure_boot(FuPlugin *plugin) { const gchar *result_str = "Disabled"; - if (fu_efivar_secure_boot_enabled()) + if (fu_efivar_secure_boot_enabled(NULL)) result_str = "Enabled"; fu_plugin_add_report_metadata(plugin, "SecureBoot", result_str); } diff --git a/plugins/uefi-capsule/fu-uefi-bootmgr.c b/plugins/uefi-capsule/fu-uefi-bootmgr.c index c55d620ed..3cff51e9f 100644 --- a/plugins/uefi-capsule/fu-uefi-bootmgr.c +++ b/plugins/uefi-capsule/fu-uefi-bootmgr.c @@ -290,7 +290,7 @@ fu_uefi_bootmgr_bootnext(FuDevice *device, return FALSE; /* test if we should use shim */ - secure_boot = fu_efivar_secure_boot_enabled(); + secure_boot = fu_efivar_secure_boot_enabled(NULL); if (secure_boot) { /* test to make sure shim is there if we need it */ shim_app = fu_uefi_get_esp_app_path(device, esp_path, "shim", error); diff --git a/plugins/uefi-capsule/fu-uefi-common.c b/plugins/uefi-capsule/fu-uefi-common.c index 473471b54..aea4bdc25 100644 --- a/plugins/uefi-capsule/fu-uefi-common.c +++ b/plugins/uefi-capsule/fu-uefi-common.c @@ -106,7 +106,7 @@ fu_uefi_get_built_app_path(GError **error) source_path_exists = g_file_test(source_path, G_FILE_TEST_EXISTS); source_path_signed_exists = g_file_test(source_path_signed, G_FILE_TEST_EXISTS); - if (fu_efivar_secure_boot_enabled()) { + if (fu_efivar_secure_boot_enabled(NULL)) { if (!source_path_signed_exists) { g_set_error(error, G_IO_ERROR, diff --git a/plugins/uefi-capsule/fu-uefi-device.c b/plugins/uefi-capsule/fu-uefi-device.c index 0b0eb06e6..cc9ef0621 100644 --- a/plugins/uefi-capsule/fu-uefi-device.c +++ b/plugins/uefi-capsule/fu-uefi-device.c @@ -511,7 +511,7 @@ fu_uefi_check_asset(FuDevice *device, GError **error) { g_autofree gchar *source_app = fu_uefi_get_built_app_path(error); if (source_app == NULL) { - if (fu_efivar_secure_boot_enabled()) + if (fu_efivar_secure_boot_enabled(NULL)) g_prefix_error(error, "missing signed bootloader for secure boot: "); return FALSE; }