diff --git a/libfwupdplugin/fu-volume.c b/libfwupdplugin/fu-volume.c index 54af3cd77..126fb91ba 100644 --- a/libfwupdplugin/fu-volume.c +++ b/libfwupdplugin/fu-volume.c @@ -643,88 +643,6 @@ fu_volume_new_by_devnum(guint32 devnum, GError **error) return NULL; } -/** - * fu_volume_new_esp_default: - * @error: (nullable): optional return location for an error - * - * Gets the platform default ESP. - * - * NOTE: This has been deprecated, please use fu_context_get_esp_volumes() instead. - * - * Returns: (transfer full): a volume, or %NULL if the ESP was not found - * - * Since: 1.8.2 - **/ -FuVolume * -fu_volume_new_esp_default(GError **error) -{ - const gchar *path_tmp; - gboolean has_internal = FALSE; - g_autoptr(GPtrArray) volumes_fstab = g_ptr_array_new(); - g_autoptr(GPtrArray) volumes_mtab = g_ptr_array_new(); - g_autoptr(GPtrArray) volumes_vfat = g_ptr_array_new(); - g_autoptr(GPtrArray) volumes = NULL; - g_autoptr(GError) error_local = NULL; - - g_return_val_if_fail(error == NULL || *error == NULL, NULL); - - /* for the test suite use local directory for ESP */ - path_tmp = g_getenv("FWUPD_UEFI_ESP_PATH"); - if (path_tmp != NULL) - return fu_volume_new_from_mount_path(path_tmp); - - volumes = fu_volume_new_by_kind(FU_VOLUME_KIND_ESP, &error_local); - if (volumes == NULL) { - g_debug("%s, falling back to %s", error_local->message, FU_VOLUME_KIND_BDP); - volumes = fu_volume_new_by_kind(FU_VOLUME_KIND_BDP, error); - if (volumes == NULL) { - g_prefix_error(error, "%s: ", error_local->message); - return NULL; - } - } - - /* are there _any_ internal vfat partitions? - * remember HintSystem is just that -- a hint! */ - for (guint i = 0; i < volumes->len; i++) { - FuVolume *vol = g_ptr_array_index(volumes, i); - g_autofree gchar *type = fu_volume_get_id_type(vol); - if (g_strcmp0(type, "vfat") == 0 && fu_volume_is_internal(vol)) { - has_internal = TRUE; - break; - } - } - - /* filter to vfat partitions */ - for (guint i = 0; i < volumes->len; i++) { - FuVolume *vol = g_ptr_array_index(volumes, i); - g_autofree gchar *type = fu_volume_get_id_type(vol); - if (type == NULL) - continue; - if (has_internal && !fu_volume_is_internal(vol)) - continue; - if (g_strcmp0(type, "vfat") == 0) - g_ptr_array_add(volumes_vfat, vol); - } - if (volumes_vfat->len == 0) { - g_set_error(error, G_IO_ERROR, G_IO_ERROR_INVALID_FILENAME, "No ESP found"); - return NULL; - } - for (guint i = 0; i < volumes_vfat->len; i++) { - FuVolume *vol = g_ptr_array_index(volumes_vfat, i); - g_ptr_array_add(fu_volume_is_mounted(vol) ? volumes_mtab : volumes_fstab, vol); - } - if (volumes_mtab->len == 1) { - FuVolume *vol = g_ptr_array_index(volumes_mtab, 0); - return g_object_ref(vol); - } - if (volumes_mtab->len == 0 && volumes_fstab->len == 1) { - FuVolume *vol = g_ptr_array_index(volumes_fstab, 0); - return g_object_ref(vol); - } - g_set_error(error, G_IO_ERROR, G_IO_ERROR_INVALID_FILENAME, "More than one available ESP"); - return NULL; -} - /** * fu_volume_new_esp_for_path: * @esp_path: a path to the ESP diff --git a/libfwupdplugin/fu-volume.h b/libfwupdplugin/fu-volume.h index 7984ba1cf..ecd9e4b15 100644 --- a/libfwupdplugin/fu-volume.h +++ b/libfwupdplugin/fu-volume.h @@ -60,7 +60,3 @@ FuVolume * fu_volume_new_by_devnum(guint32 devnum, GError **error) G_GNUC_WARN_UNUSED_RESULT; FuVolume * fu_volume_new_esp_for_path(const gchar *esp_path, GError **error) G_GNUC_WARN_UNUSED_RESULT; - -G_DEPRECATED_FOR(fu_context_get_esp_volumes) -FuVolume * -fu_volume_new_esp_default(GError **error) G_GNUC_WARN_UNUSED_RESULT; diff --git a/libfwupdplugin/fwupdplugin.map b/libfwupdplugin/fwupdplugin.map index 9186e948b..d34519764 100644 --- a/libfwupdplugin/fwupdplugin.map +++ b/libfwupdplugin/fwupdplugin.map @@ -1055,7 +1055,6 @@ LIBFWUPDPLUGIN_1.8.2 { fu_volume_new_by_device; fu_volume_new_by_devnum; fu_volume_new_by_kind; - fu_volume_new_esp_default; fu_volume_new_esp_for_path; local: *; } LIBFWUPDPLUGIN_1.8.1;