mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-13 17:23:20 +00:00
Remove the 'common' prefix from the volume creation methods
This commit is contained in:
parent
4105768a01
commit
377bcb718f
@ -121,6 +121,11 @@ if __name__ == "__main__":
|
|||||||
"fu_common_version_guess_format": "fu_version_guess_format",
|
"fu_common_version_guess_format": "fu_version_guess_format",
|
||||||
"fu_common_version_parse_from_format": "fu_version_parse_from_format",
|
"fu_common_version_parse_from_format": "fu_version_parse_from_format",
|
||||||
"fu_common_version_verify_format": "fu_version_verify_format",
|
"fu_common_version_verify_format": "fu_version_verify_format",
|
||||||
|
"fu_common_get_volumes_by_kind": "fu_volume_new_by_kind",
|
||||||
|
"fu_common_get_volume_by_device": "fu_volume_new_by_device",
|
||||||
|
"fu_common_get_volume_by_devnum": "fu_volume_new_by_devnum",
|
||||||
|
"fu_common_get_esp_for_path": "fu_volume_new_esp_for_path",
|
||||||
|
"fu_common_get_esp_default": "fu_volume_new_esp_default",
|
||||||
}.items():
|
}.items():
|
||||||
if buf.find(old) == -1:
|
if buf.find(old) == -1:
|
||||||
continue
|
continue
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
#include "fu-common-private.h"
|
#include "fu-common-private.h"
|
||||||
#include "fu-firmware.h"
|
#include "fu-firmware.h"
|
||||||
#include "fu-string.h"
|
#include "fu-string.h"
|
||||||
#include "fu-volume-private.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fu_cpuid:
|
* fu_cpuid:
|
||||||
@ -202,319 +201,6 @@ fu_common_check_full_disk_encryption(GError **error)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* fu_common_get_volumes_by_kind:
|
|
||||||
* @kind: a volume kind, typically a GUID
|
|
||||||
* @error: (nullable): optional return location for an error
|
|
||||||
*
|
|
||||||
* Finds all volumes of a specific partition type
|
|
||||||
*
|
|
||||||
* Returns: (transfer container) (element-type FuVolume): a #GPtrArray, or %NULL if the kind was not
|
|
||||||
*found
|
|
||||||
*
|
|
||||||
* Since: 1.4.6
|
|
||||||
**/
|
|
||||||
GPtrArray *
|
|
||||||
fu_common_get_volumes_by_kind(const gchar *kind, GError **error)
|
|
||||||
{
|
|
||||||
g_autoptr(GPtrArray) devices = NULL;
|
|
||||||
g_autoptr(GPtrArray) volumes = NULL;
|
|
||||||
|
|
||||||
g_return_val_if_fail(kind != NULL, NULL);
|
|
||||||
g_return_val_if_fail(error == NULL || *error == NULL, NULL);
|
|
||||||
|
|
||||||
devices = fu_common_get_block_devices(error);
|
|
||||||
if (devices == NULL)
|
|
||||||
return NULL;
|
|
||||||
volumes = g_ptr_array_new_with_free_func((GDestroyNotify)g_object_unref);
|
|
||||||
for (guint i = 0; i < devices->len; i++) {
|
|
||||||
GDBusProxy *proxy_blk = g_ptr_array_index(devices, i);
|
|
||||||
const gchar *type_str;
|
|
||||||
g_autoptr(FuVolume) vol = NULL;
|
|
||||||
g_autoptr(GDBusProxy) proxy_part = NULL;
|
|
||||||
g_autoptr(GDBusProxy) proxy_fs = NULL;
|
|
||||||
g_autoptr(GVariant) val = NULL;
|
|
||||||
|
|
||||||
proxy_part = g_dbus_proxy_new_sync(g_dbus_proxy_get_connection(proxy_blk),
|
|
||||||
G_DBUS_PROXY_FLAGS_NONE,
|
|
||||||
NULL,
|
|
||||||
UDISKS_DBUS_SERVICE,
|
|
||||||
g_dbus_proxy_get_object_path(proxy_blk),
|
|
||||||
UDISKS_DBUS_INTERFACE_PARTITION,
|
|
||||||
NULL,
|
|
||||||
error);
|
|
||||||
if (proxy_part == NULL) {
|
|
||||||
g_prefix_error(error,
|
|
||||||
"failed to initialize d-bus proxy %s: ",
|
|
||||||
g_dbus_proxy_get_object_path(proxy_blk));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
val = g_dbus_proxy_get_cached_property(proxy_part, "Type");
|
|
||||||
if (val == NULL)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
g_variant_get(val, "&s", &type_str);
|
|
||||||
proxy_fs = g_dbus_proxy_new_sync(g_dbus_proxy_get_connection(proxy_blk),
|
|
||||||
G_DBUS_PROXY_FLAGS_NONE,
|
|
||||||
NULL,
|
|
||||||
UDISKS_DBUS_SERVICE,
|
|
||||||
g_dbus_proxy_get_object_path(proxy_blk),
|
|
||||||
UDISKS_DBUS_INTERFACE_FILESYSTEM,
|
|
||||||
NULL,
|
|
||||||
error);
|
|
||||||
if (proxy_fs == NULL) {
|
|
||||||
g_prefix_error(error,
|
|
||||||
"failed to initialize d-bus proxy %s: ",
|
|
||||||
g_dbus_proxy_get_object_path(proxy_blk));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
vol = g_object_new(FU_TYPE_VOLUME,
|
|
||||||
"proxy-block",
|
|
||||||
proxy_blk,
|
|
||||||
"proxy-filesystem",
|
|
||||||
proxy_fs,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
/* convert reported type to GPT type */
|
|
||||||
type_str = fu_common_convert_to_gpt_type(type_str);
|
|
||||||
if (g_getenv("FWUPD_VERBOSE") != NULL) {
|
|
||||||
g_autofree gchar *id_type = fu_volume_get_id_type(vol);
|
|
||||||
g_debug("device %s, type: %s, internal: %d, fs: %s",
|
|
||||||
g_dbus_proxy_get_object_path(proxy_blk),
|
|
||||||
type_str,
|
|
||||||
fu_volume_is_internal(vol),
|
|
||||||
id_type);
|
|
||||||
}
|
|
||||||
if (g_strcmp0(type_str, kind) != 0)
|
|
||||||
continue;
|
|
||||||
g_ptr_array_add(volumes, g_steal_pointer(&vol));
|
|
||||||
}
|
|
||||||
if (volumes->len == 0) {
|
|
||||||
g_set_error(error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND, "no volumes of type %s", kind);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return g_steal_pointer(&volumes);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* fu_common_get_volume_by_device:
|
|
||||||
* @device: a device string, typically starting with `/dev/`
|
|
||||||
* @error: (nullable): optional return location for an error
|
|
||||||
*
|
|
||||||
* Finds the first volume from the specified device.
|
|
||||||
*
|
|
||||||
* Returns: (transfer full): a volume, or %NULL if the device was not found
|
|
||||||
*
|
|
||||||
* Since: 1.5.1
|
|
||||||
**/
|
|
||||||
FuVolume *
|
|
||||||
fu_common_get_volume_by_device(const gchar *device, GError **error)
|
|
||||||
{
|
|
||||||
g_autoptr(GPtrArray) devices = NULL;
|
|
||||||
|
|
||||||
g_return_val_if_fail(device != NULL, NULL);
|
|
||||||
g_return_val_if_fail(error == NULL || *error == NULL, NULL);
|
|
||||||
|
|
||||||
/* find matching block device */
|
|
||||||
devices = fu_common_get_block_devices(error);
|
|
||||||
if (devices == NULL)
|
|
||||||
return NULL;
|
|
||||||
for (guint i = 0; i < devices->len; i++) {
|
|
||||||
GDBusProxy *proxy_blk = g_ptr_array_index(devices, i);
|
|
||||||
g_autoptr(GVariant) val = NULL;
|
|
||||||
val = g_dbus_proxy_get_cached_property(proxy_blk, "Device");
|
|
||||||
if (val == NULL)
|
|
||||||
continue;
|
|
||||||
if (g_strcmp0(g_variant_get_bytestring(val), device) == 0) {
|
|
||||||
g_autoptr(GDBusProxy) proxy_fs = NULL;
|
|
||||||
g_autoptr(GError) error_local = NULL;
|
|
||||||
proxy_fs = g_dbus_proxy_new_sync(g_dbus_proxy_get_connection(proxy_blk),
|
|
||||||
G_DBUS_PROXY_FLAGS_NONE,
|
|
||||||
NULL,
|
|
||||||
UDISKS_DBUS_SERVICE,
|
|
||||||
g_dbus_proxy_get_object_path(proxy_blk),
|
|
||||||
UDISKS_DBUS_INTERFACE_FILESYSTEM,
|
|
||||||
NULL,
|
|
||||||
&error_local);
|
|
||||||
if (proxy_fs == NULL)
|
|
||||||
g_debug("ignoring: %s", error_local->message);
|
|
||||||
return g_object_new(FU_TYPE_VOLUME,
|
|
||||||
"proxy-block",
|
|
||||||
proxy_blk,
|
|
||||||
"proxy-filesystem",
|
|
||||||
proxy_fs,
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* failed */
|
|
||||||
g_set_error(error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND, "no volumes for device %s", device);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* fu_common_get_volume_by_devnum:
|
|
||||||
* @devnum: a device number
|
|
||||||
* @error: (nullable): optional return location for an error
|
|
||||||
*
|
|
||||||
* Finds the first volume from the specified device.
|
|
||||||
*
|
|
||||||
* Returns: (transfer full): a volume, or %NULL if the device was not found
|
|
||||||
*
|
|
||||||
* Since: 1.5.1
|
|
||||||
**/
|
|
||||||
FuVolume *
|
|
||||||
fu_common_get_volume_by_devnum(guint32 devnum, GError **error)
|
|
||||||
{
|
|
||||||
g_autoptr(GPtrArray) devices = NULL;
|
|
||||||
|
|
||||||
g_return_val_if_fail(error == NULL || *error == NULL, NULL);
|
|
||||||
|
|
||||||
/* find matching block device */
|
|
||||||
devices = fu_common_get_block_devices(error);
|
|
||||||
if (devices == NULL)
|
|
||||||
return NULL;
|
|
||||||
for (guint i = 0; i < devices->len; i++) {
|
|
||||||
GDBusProxy *proxy_blk = g_ptr_array_index(devices, i);
|
|
||||||
g_autoptr(GVariant) val = NULL;
|
|
||||||
val = g_dbus_proxy_get_cached_property(proxy_blk, "DeviceNumber");
|
|
||||||
if (val == NULL)
|
|
||||||
continue;
|
|
||||||
if (devnum == g_variant_get_uint64(val)) {
|
|
||||||
return g_object_new(FU_TYPE_VOLUME, "proxy-block", proxy_blk, NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* failed */
|
|
||||||
g_set_error(error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND, "no volumes for devnum %u", devnum);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* fu_common_get_esp_default:
|
|
||||||
* @error: (nullable): optional return location for an error
|
|
||||||
*
|
|
||||||
* Gets the platform default ESP
|
|
||||||
*
|
|
||||||
* Returns: (transfer full): a volume, or %NULL if the ESP was not found
|
|
||||||
*
|
|
||||||
* Since: 1.4.6
|
|
||||||
**/
|
|
||||||
FuVolume *
|
|
||||||
fu_common_get_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_common_get_volumes_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_common_get_volumes_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_common_get_esp_for_path:
|
|
||||||
* @esp_path: a path to the ESP
|
|
||||||
* @error: (nullable): optional return location for an error
|
|
||||||
*
|
|
||||||
* Gets the platform ESP using a UNIX or UDisks path
|
|
||||||
*
|
|
||||||
* Returns: (transfer full): a #volume, or %NULL if the ESP was not found
|
|
||||||
*
|
|
||||||
* Since: 1.4.6
|
|
||||||
**/
|
|
||||||
FuVolume *
|
|
||||||
fu_common_get_esp_for_path(const gchar *esp_path, GError **error)
|
|
||||||
{
|
|
||||||
g_autofree gchar *basename = NULL;
|
|
||||||
g_autoptr(GPtrArray) volumes = NULL;
|
|
||||||
g_autoptr(GError) error_local = NULL;
|
|
||||||
|
|
||||||
g_return_val_if_fail(esp_path != NULL, NULL);
|
|
||||||
g_return_val_if_fail(error == NULL || *error == NULL, NULL);
|
|
||||||
|
|
||||||
volumes = fu_common_get_volumes_by_kind(FU_VOLUME_KIND_ESP, &error_local);
|
|
||||||
if (volumes == NULL) {
|
|
||||||
/* check if it's a valid directory already */
|
|
||||||
if (g_file_test(esp_path, G_FILE_TEST_IS_DIR))
|
|
||||||
return fu_volume_new_from_mount_path(esp_path);
|
|
||||||
g_propagate_error(error, g_steal_pointer(&error_local));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
basename = g_path_get_basename(esp_path);
|
|
||||||
for (guint i = 0; i < volumes->len; i++) {
|
|
||||||
FuVolume *vol = g_ptr_array_index(volumes, i);
|
|
||||||
g_autofree gchar *vol_basename =
|
|
||||||
g_path_get_basename(fu_volume_get_mount_point(vol));
|
|
||||||
if (g_strcmp0(basename, vol_basename) == 0)
|
|
||||||
return g_object_ref(vol);
|
|
||||||
}
|
|
||||||
g_set_error(error,
|
|
||||||
G_IO_ERROR,
|
|
||||||
G_IO_ERROR_INVALID_FILENAME,
|
|
||||||
"No ESP with path %s",
|
|
||||||
esp_path);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fu_common_align_up:
|
* fu_common_align_up:
|
||||||
* @value: value to align
|
* @value: value to align
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
|
|
||||||
#include <xmlb.h>
|
#include <xmlb.h>
|
||||||
|
|
||||||
#include "fu-volume.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FuEndianType:
|
* FuEndianType:
|
||||||
*
|
*
|
||||||
@ -78,16 +76,6 @@ gboolean
|
|||||||
fu_common_is_live_media(void);
|
fu_common_is_live_media(void);
|
||||||
guint64
|
guint64
|
||||||
fu_common_get_memory_size(void);
|
fu_common_get_memory_size(void);
|
||||||
GPtrArray *
|
|
||||||
fu_common_get_volumes_by_kind(const gchar *kind, GError **error) G_GNUC_WARN_UNUSED_RESULT;
|
|
||||||
FuVolume *
|
|
||||||
fu_common_get_volume_by_device(const gchar *device, GError **error) G_GNUC_WARN_UNUSED_RESULT;
|
|
||||||
FuVolume *
|
|
||||||
fu_common_get_volume_by_devnum(guint32 devnum, GError **error) G_GNUC_WARN_UNUSED_RESULT;
|
|
||||||
FuVolume *
|
|
||||||
fu_common_get_esp_for_path(const gchar *esp_path, GError **error) G_GNUC_WARN_UNUSED_RESULT;
|
|
||||||
FuVolume *
|
|
||||||
fu_common_get_esp_default(GError **error) G_GNUC_WARN_UNUSED_RESULT;
|
|
||||||
gboolean
|
gboolean
|
||||||
fu_common_check_full_disk_encryption(GError **error);
|
fu_common_check_full_disk_encryption(GError **error);
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include <fwupd.h>
|
#include <fwupd.h>
|
||||||
|
|
||||||
#include "fu-context.h"
|
#include "fu-context.h"
|
||||||
|
#include "fu-device-locker.h"
|
||||||
#include "fu-firmware.h"
|
#include "fu-firmware.h"
|
||||||
#include "fu-progress.h"
|
#include "fu-progress.h"
|
||||||
#include "fu-security-attrs.h"
|
#include "fu-security-attrs.h"
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include "fwupd-error.h"
|
#include "fwupd-error.h"
|
||||||
|
|
||||||
|
#include "fu-common-private.h"
|
||||||
#include "fu-volume-private.h"
|
#include "fu-volume-private.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -453,3 +454,316 @@ fu_volume_new_from_mount_path(const gchar *mount_path)
|
|||||||
self->mount_path = g_strdup(mount_path);
|
self->mount_path = g_strdup(mount_path);
|
||||||
return g_steal_pointer(&self);
|
return g_steal_pointer(&self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fu_volume_new_by_kind:
|
||||||
|
* @kind: a volume kind, typically a GUID
|
||||||
|
* @error: (nullable): optional return location for an error
|
||||||
|
*
|
||||||
|
* Finds all volumes of a specific partition type
|
||||||
|
*
|
||||||
|
* Returns: (transfer container) (element-type FuVolume): a #GPtrArray, or %NULL if the kind was not
|
||||||
|
*found
|
||||||
|
*
|
||||||
|
* Since: 1.8.2
|
||||||
|
**/
|
||||||
|
GPtrArray *
|
||||||
|
fu_volume_new_by_kind(const gchar *kind, GError **error)
|
||||||
|
{
|
||||||
|
g_autoptr(GPtrArray) devices = NULL;
|
||||||
|
g_autoptr(GPtrArray) volumes = NULL;
|
||||||
|
|
||||||
|
g_return_val_if_fail(kind != NULL, NULL);
|
||||||
|
g_return_val_if_fail(error == NULL || *error == NULL, NULL);
|
||||||
|
|
||||||
|
devices = fu_common_get_block_devices(error);
|
||||||
|
if (devices == NULL)
|
||||||
|
return NULL;
|
||||||
|
volumes = g_ptr_array_new_with_free_func((GDestroyNotify)g_object_unref);
|
||||||
|
for (guint i = 0; i < devices->len; i++) {
|
||||||
|
GDBusProxy *proxy_blk = g_ptr_array_index(devices, i);
|
||||||
|
const gchar *type_str;
|
||||||
|
g_autoptr(FuVolume) vol = NULL;
|
||||||
|
g_autoptr(GDBusProxy) proxy_part = NULL;
|
||||||
|
g_autoptr(GDBusProxy) proxy_fs = NULL;
|
||||||
|
g_autoptr(GVariant) val = NULL;
|
||||||
|
|
||||||
|
proxy_part = g_dbus_proxy_new_sync(g_dbus_proxy_get_connection(proxy_blk),
|
||||||
|
G_DBUS_PROXY_FLAGS_NONE,
|
||||||
|
NULL,
|
||||||
|
UDISKS_DBUS_SERVICE,
|
||||||
|
g_dbus_proxy_get_object_path(proxy_blk),
|
||||||
|
UDISKS_DBUS_INTERFACE_PARTITION,
|
||||||
|
NULL,
|
||||||
|
error);
|
||||||
|
if (proxy_part == NULL) {
|
||||||
|
g_prefix_error(error,
|
||||||
|
"failed to initialize d-bus proxy %s: ",
|
||||||
|
g_dbus_proxy_get_object_path(proxy_blk));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
val = g_dbus_proxy_get_cached_property(proxy_part, "Type");
|
||||||
|
if (val == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
g_variant_get(val, "&s", &type_str);
|
||||||
|
proxy_fs = g_dbus_proxy_new_sync(g_dbus_proxy_get_connection(proxy_blk),
|
||||||
|
G_DBUS_PROXY_FLAGS_NONE,
|
||||||
|
NULL,
|
||||||
|
UDISKS_DBUS_SERVICE,
|
||||||
|
g_dbus_proxy_get_object_path(proxy_blk),
|
||||||
|
UDISKS_DBUS_INTERFACE_FILESYSTEM,
|
||||||
|
NULL,
|
||||||
|
error);
|
||||||
|
if (proxy_fs == NULL) {
|
||||||
|
g_prefix_error(error,
|
||||||
|
"failed to initialize d-bus proxy %s: ",
|
||||||
|
g_dbus_proxy_get_object_path(proxy_blk));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
vol = g_object_new(FU_TYPE_VOLUME,
|
||||||
|
"proxy-block",
|
||||||
|
proxy_blk,
|
||||||
|
"proxy-filesystem",
|
||||||
|
proxy_fs,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
/* convert reported type to GPT type */
|
||||||
|
type_str = fu_common_convert_to_gpt_type(type_str);
|
||||||
|
if (g_getenv("FWUPD_VERBOSE") != NULL) {
|
||||||
|
g_autofree gchar *id_type = fu_volume_get_id_type(vol);
|
||||||
|
g_debug("device %s, type: %s, internal: %d, fs: %s",
|
||||||
|
g_dbus_proxy_get_object_path(proxy_blk),
|
||||||
|
type_str,
|
||||||
|
fu_volume_is_internal(vol),
|
||||||
|
id_type);
|
||||||
|
}
|
||||||
|
if (g_strcmp0(type_str, kind) != 0)
|
||||||
|
continue;
|
||||||
|
g_ptr_array_add(volumes, g_steal_pointer(&vol));
|
||||||
|
}
|
||||||
|
if (volumes->len == 0) {
|
||||||
|
g_set_error(error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND, "no volumes of type %s", kind);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return g_steal_pointer(&volumes);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fu_volume_new_by_device:
|
||||||
|
* @device: a device string, typically starting with `/dev/`
|
||||||
|
* @error: (nullable): optional return location for an error
|
||||||
|
*
|
||||||
|
* Finds the first volume from the specified device.
|
||||||
|
*
|
||||||
|
* Returns: (transfer full): a volume, or %NULL if the device was not found
|
||||||
|
*
|
||||||
|
* Since: 1.8.2
|
||||||
|
**/
|
||||||
|
FuVolume *
|
||||||
|
fu_volume_new_by_device(const gchar *device, GError **error)
|
||||||
|
{
|
||||||
|
g_autoptr(GPtrArray) devices = NULL;
|
||||||
|
|
||||||
|
g_return_val_if_fail(device != NULL, NULL);
|
||||||
|
g_return_val_if_fail(error == NULL || *error == NULL, NULL);
|
||||||
|
|
||||||
|
/* find matching block device */
|
||||||
|
devices = fu_common_get_block_devices(error);
|
||||||
|
if (devices == NULL)
|
||||||
|
return NULL;
|
||||||
|
for (guint i = 0; i < devices->len; i++) {
|
||||||
|
GDBusProxy *proxy_blk = g_ptr_array_index(devices, i);
|
||||||
|
g_autoptr(GVariant) val = NULL;
|
||||||
|
val = g_dbus_proxy_get_cached_property(proxy_blk, "Device");
|
||||||
|
if (val == NULL)
|
||||||
|
continue;
|
||||||
|
if (g_strcmp0(g_variant_get_bytestring(val), device) == 0) {
|
||||||
|
g_autoptr(GDBusProxy) proxy_fs = NULL;
|
||||||
|
g_autoptr(GError) error_local = NULL;
|
||||||
|
proxy_fs = g_dbus_proxy_new_sync(g_dbus_proxy_get_connection(proxy_blk),
|
||||||
|
G_DBUS_PROXY_FLAGS_NONE,
|
||||||
|
NULL,
|
||||||
|
UDISKS_DBUS_SERVICE,
|
||||||
|
g_dbus_proxy_get_object_path(proxy_blk),
|
||||||
|
UDISKS_DBUS_INTERFACE_FILESYSTEM,
|
||||||
|
NULL,
|
||||||
|
&error_local);
|
||||||
|
if (proxy_fs == NULL)
|
||||||
|
g_debug("ignoring: %s", error_local->message);
|
||||||
|
return g_object_new(FU_TYPE_VOLUME,
|
||||||
|
"proxy-block",
|
||||||
|
proxy_blk,
|
||||||
|
"proxy-filesystem",
|
||||||
|
proxy_fs,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* failed */
|
||||||
|
g_set_error(error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND, "no volumes for device %s", device);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fu_volume_new_by_devnum:
|
||||||
|
* @devnum: a device number
|
||||||
|
* @error: (nullable): optional return location for an error
|
||||||
|
*
|
||||||
|
* Finds the first volume from the specified device.
|
||||||
|
*
|
||||||
|
* Returns: (transfer full): a volume, or %NULL if the device was not found
|
||||||
|
*
|
||||||
|
* Since: 1.8.2
|
||||||
|
**/
|
||||||
|
FuVolume *
|
||||||
|
fu_volume_new_by_devnum(guint32 devnum, GError **error)
|
||||||
|
{
|
||||||
|
g_autoptr(GPtrArray) devices = NULL;
|
||||||
|
|
||||||
|
g_return_val_if_fail(error == NULL || *error == NULL, NULL);
|
||||||
|
|
||||||
|
/* find matching block device */
|
||||||
|
devices = fu_common_get_block_devices(error);
|
||||||
|
if (devices == NULL)
|
||||||
|
return NULL;
|
||||||
|
for (guint i = 0; i < devices->len; i++) {
|
||||||
|
GDBusProxy *proxy_blk = g_ptr_array_index(devices, i);
|
||||||
|
g_autoptr(GVariant) val = NULL;
|
||||||
|
val = g_dbus_proxy_get_cached_property(proxy_blk, "DeviceNumber");
|
||||||
|
if (val == NULL)
|
||||||
|
continue;
|
||||||
|
if (devnum == g_variant_get_uint64(val)) {
|
||||||
|
return g_object_new(FU_TYPE_VOLUME, "proxy-block", proxy_blk, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* failed */
|
||||||
|
g_set_error(error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND, "no volumes for devnum %u", devnum);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fu_volume_new_esp_default:
|
||||||
|
* @error: (nullable): optional return location for an error
|
||||||
|
*
|
||||||
|
* Gets the platform default ESP
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* @error: (nullable): optional return location for an error
|
||||||
|
*
|
||||||
|
* Gets the platform ESP using a UNIX or UDisks path
|
||||||
|
*
|
||||||
|
* Returns: (transfer full): a #volume, or %NULL if the ESP was not found
|
||||||
|
*
|
||||||
|
* Since: 1.8.2
|
||||||
|
**/
|
||||||
|
FuVolume *
|
||||||
|
fu_volume_new_esp_for_path(const gchar *esp_path, GError **error)
|
||||||
|
{
|
||||||
|
g_autofree gchar *basename = NULL;
|
||||||
|
g_autoptr(GPtrArray) volumes = NULL;
|
||||||
|
g_autoptr(GError) error_local = NULL;
|
||||||
|
|
||||||
|
g_return_val_if_fail(esp_path != NULL, NULL);
|
||||||
|
g_return_val_if_fail(error == NULL || *error == NULL, NULL);
|
||||||
|
|
||||||
|
volumes = fu_volume_new_by_kind(FU_VOLUME_KIND_ESP, &error_local);
|
||||||
|
if (volumes == NULL) {
|
||||||
|
/* check if it's a valid directory already */
|
||||||
|
if (g_file_test(esp_path, G_FILE_TEST_IS_DIR))
|
||||||
|
return fu_volume_new_from_mount_path(esp_path);
|
||||||
|
g_propagate_error(error, g_steal_pointer(&error_local));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
basename = g_path_get_basename(esp_path);
|
||||||
|
for (guint i = 0; i < volumes->len; i++) {
|
||||||
|
FuVolume *vol = g_ptr_array_index(volumes, i);
|
||||||
|
g_autofree gchar *vol_basename =
|
||||||
|
g_path_get_basename(fu_volume_get_mount_point(vol));
|
||||||
|
if (g_strcmp0(basename, vol_basename) == 0)
|
||||||
|
return g_object_ref(vol);
|
||||||
|
}
|
||||||
|
g_set_error(error,
|
||||||
|
G_IO_ERROR,
|
||||||
|
G_IO_ERROR_INVALID_FILENAME,
|
||||||
|
"No ESP with path %s",
|
||||||
|
esp_path);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
@ -52,3 +52,13 @@ gboolean
|
|||||||
fu_volume_is_internal(FuVolume *self);
|
fu_volume_is_internal(FuVolume *self);
|
||||||
gchar *
|
gchar *
|
||||||
fu_volume_get_id_type(FuVolume *self);
|
fu_volume_get_id_type(FuVolume *self);
|
||||||
|
GPtrArray *
|
||||||
|
fu_volume_new_by_kind(const gchar *kind, GError **error) G_GNUC_WARN_UNUSED_RESULT;
|
||||||
|
FuVolume *
|
||||||
|
fu_volume_new_by_device(const gchar *device, GError **error) G_GNUC_WARN_UNUSED_RESULT;
|
||||||
|
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;
|
||||||
|
FuVolume *
|
||||||
|
fu_volume_new_esp_default(GError **error) G_GNUC_WARN_UNUSED_RESULT;
|
||||||
|
@ -435,9 +435,6 @@ LIBFWUPDPLUGIN_1.4.5 {
|
|||||||
|
|
||||||
LIBFWUPDPLUGIN_1.4.6 {
|
LIBFWUPDPLUGIN_1.4.6 {
|
||||||
global:
|
global:
|
||||||
fu_common_get_esp_default;
|
|
||||||
fu_common_get_esp_for_path;
|
|
||||||
fu_common_get_volumes_by_kind;
|
|
||||||
fu_common_is_live_media;
|
fu_common_is_live_media;
|
||||||
fu_volume_check_free_space;
|
fu_volume_check_free_space;
|
||||||
fu_volume_get_id;
|
fu_volume_get_id;
|
||||||
@ -494,8 +491,6 @@ LIBFWUPDPLUGIN_1.5.0 {
|
|||||||
|
|
||||||
LIBFWUPDPLUGIN_1.5.1 {
|
LIBFWUPDPLUGIN_1.5.1 {
|
||||||
global:
|
global:
|
||||||
fu_common_get_volume_by_device;
|
|
||||||
fu_common_get_volume_by_devnum;
|
|
||||||
fu_device_add_possible_plugin;
|
fu_device_add_possible_plugin;
|
||||||
fu_efivar_space_used;
|
fu_efivar_space_used;
|
||||||
fu_volume_is_encrypted;
|
fu_volume_is_encrypted;
|
||||||
@ -1021,5 +1016,10 @@ LIBFWUPDPLUGIN_1.8.2 {
|
|||||||
fu_version_guess_format;
|
fu_version_guess_format;
|
||||||
fu_version_parse_from_format;
|
fu_version_parse_from_format;
|
||||||
fu_version_verify_format;
|
fu_version_verify_format;
|
||||||
|
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: *;
|
local: *;
|
||||||
} LIBFWUPDPLUGIN_1.8.1;
|
} LIBFWUPDPLUGIN_1.8.1;
|
||||||
|
@ -35,7 +35,7 @@ fu_linux_swap_verify_partition(FuLinuxSwap *self, const gchar *fn, GError **erro
|
|||||||
g_autoptr(FuVolume) volume = NULL;
|
g_autoptr(FuVolume) volume = NULL;
|
||||||
|
|
||||||
/* find the device */
|
/* find the device */
|
||||||
volume = fu_common_get_volume_by_device(fn, error);
|
volume = fu_volume_new_by_device(fn, error);
|
||||||
if (volume == NULL)
|
if (volume == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ fu_linux_swap_verify_file(FuLinuxSwap *self, const gchar *fn, GError **error)
|
|||||||
devnum = g_file_info_get_attribute_uint32(info, G_FILE_ATTRIBUTE_UNIX_DEVICE);
|
devnum = g_file_info_get_attribute_uint32(info, G_FILE_ATTRIBUTE_UNIX_DEVICE);
|
||||||
|
|
||||||
/* find the device */
|
/* find the device */
|
||||||
volume = fu_common_get_volume_by_devnum(devnum, error);
|
volume = fu_volume_new_by_devnum(devnum, error);
|
||||||
if (volume == NULL)
|
if (volume == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -493,7 +493,7 @@ fu_plugin_uefi_capsule_register_proxy_device(FuPlugin *plugin, FuDevice *device)
|
|||||||
dev = fu_uefi_backend_device_new_from_dev(FU_UEFI_BACKEND(data->backend), device);
|
dev = fu_uefi_backend_device_new_from_dev(FU_UEFI_BACKEND(data->backend), device);
|
||||||
fu_plugin_uefi_capsule_load_config(plugin, FU_DEVICE(dev));
|
fu_plugin_uefi_capsule_load_config(plugin, FU_DEVICE(dev));
|
||||||
if (data->esp == NULL)
|
if (data->esp == NULL)
|
||||||
data->esp = fu_common_get_esp_default(&error_local);
|
data->esp = fu_volume_new_esp_default(&error_local);
|
||||||
if (data->esp == NULL) {
|
if (data->esp == NULL) {
|
||||||
fu_device_inhibit(device, "no-esp", error_local->message);
|
fu_device_inhibit(device, "no-esp", error_local->message);
|
||||||
} else {
|
} else {
|
||||||
@ -664,7 +664,7 @@ fu_plugin_uefi_capsule_startup(FuPlugin *plugin, FuProgress *progress, GError **
|
|||||||
/* override the default ESP path */
|
/* override the default ESP path */
|
||||||
esp_path = fu_plugin_get_config_value(plugin, "OverrideESPMountPoint");
|
esp_path = fu_plugin_get_config_value(plugin, "OverrideESPMountPoint");
|
||||||
if (esp_path != NULL) {
|
if (esp_path != NULL) {
|
||||||
data->esp = fu_common_get_esp_for_path(esp_path, error);
|
data->esp = fu_volume_new_esp_for_path(esp_path, error);
|
||||||
if (data->esp == NULL) {
|
if (data->esp == NULL) {
|
||||||
g_prefix_error(error,
|
g_prefix_error(error,
|
||||||
"invalid OverrideESPMountPoint=%s "
|
"invalid OverrideESPMountPoint=%s "
|
||||||
@ -826,7 +826,7 @@ fu_plugin_uefi_capsule_coldplug(FuPlugin *plugin, FuProgress *progress, GError *
|
|||||||
fu_progress_add_step(progress, FWUPD_STATUS_LOADING, 1, "setup-bgrt");
|
fu_progress_add_step(progress, FWUPD_STATUS_LOADING, 1, "setup-bgrt");
|
||||||
|
|
||||||
if (data->esp == NULL) {
|
if (data->esp == NULL) {
|
||||||
data->esp = fu_common_get_esp_default(&error_udisks2);
|
data->esp = fu_volume_new_esp_default(&error_udisks2);
|
||||||
if (data->esp == NULL) {
|
if (data->esp == NULL) {
|
||||||
fu_plugin_add_flag(plugin, FWUPD_PLUGIN_FLAG_ESP_NOT_FOUND);
|
fu_plugin_add_flag(plugin, FWUPD_PLUGIN_FLAG_ESP_NOT_FOUND);
|
||||||
fu_plugin_add_flag(plugin, FWUPD_PLUGIN_FLAG_CLEAR_UPDATABLE);
|
fu_plugin_add_flag(plugin, FWUPD_PLUGIN_FLAG_CLEAR_UPDATABLE);
|
||||||
|
@ -234,14 +234,14 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
/* override the default ESP path */
|
/* override the default ESP path */
|
||||||
if (esp_path != NULL) {
|
if (esp_path != NULL) {
|
||||||
esp = fu_common_get_esp_for_path(esp_path, &error);
|
esp = fu_volume_new_esp_for_path(esp_path, &error);
|
||||||
if (esp == NULL) {
|
if (esp == NULL) {
|
||||||
/* TRANSLATORS: ESP is EFI System Partition */
|
/* TRANSLATORS: ESP is EFI System Partition */
|
||||||
g_print("%s: %s\n", _("ESP specified was not valid"), error->message);
|
g_print("%s: %s\n", _("ESP specified was not valid"), error->message);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
esp = fu_common_get_esp_default(&error);
|
esp = fu_volume_new_esp_default(&error);
|
||||||
if (esp == NULL) {
|
if (esp == NULL) {
|
||||||
g_printerr("failed: %s\n", error->message);
|
g_printerr("failed: %s\n", error->message);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
@ -83,7 +83,7 @@ gboolean
|
|||||||
fu_uefi_dbx_signature_list_validate(FuEfiSignatureList *siglist, GError **error)
|
fu_uefi_dbx_signature_list_validate(FuEfiSignatureList *siglist, GError **error)
|
||||||
{
|
{
|
||||||
g_autoptr(GPtrArray) volumes = NULL;
|
g_autoptr(GPtrArray) volumes = NULL;
|
||||||
volumes = fu_common_get_volumes_by_kind(FU_VOLUME_KIND_ESP, error);
|
volumes = fu_volume_new_by_kind(FU_VOLUME_KIND_ESP, error);
|
||||||
if (volumes == NULL)
|
if (volumes == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
for (guint i = 0; i < volumes->len; i++) {
|
for (guint i = 0; i < volumes->len; i++) {
|
||||||
|
@ -96,7 +96,7 @@ fu_block_device_get_full_path(FuUf2Device *self, const gchar *filename, GError *
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* find volume */
|
/* find volume */
|
||||||
volume = fu_common_get_volume_by_device(devfile, error);
|
volume = fu_volume_new_by_device(devfile, error);
|
||||||
if (volume == NULL)
|
if (volume == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -196,7 +196,7 @@ fu_uf2_device_volume_mount(FuUf2Device *self, GError **error)
|
|||||||
const gchar *devfile = fu_udev_device_get_device_file(FU_UDEV_DEVICE(self));
|
const gchar *devfile = fu_udev_device_get_device_file(FU_UDEV_DEVICE(self));
|
||||||
|
|
||||||
/* mount volume if required */
|
/* mount volume if required */
|
||||||
self->volume = fu_common_get_volume_by_device(devfile, error);
|
self->volume = fu_volume_new_by_device(devfile, error);
|
||||||
if (self->volume == NULL)
|
if (self->volume == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
return fu_volume_mount(self->volume, error);
|
return fu_volume_mount(self->volume, error);
|
||||||
@ -209,7 +209,7 @@ fu_uf2_device_check_volume_mounted_cb(FuDevice *self, gpointer user_data, GError
|
|||||||
g_autoptr(FuVolume) volume = NULL;
|
g_autoptr(FuVolume) volume = NULL;
|
||||||
|
|
||||||
/* mount volume if required */
|
/* mount volume if required */
|
||||||
volume = fu_common_get_volume_by_device(devfile, error);
|
volume = fu_volume_new_by_device(devfile, error);
|
||||||
if (volume == NULL)
|
if (volume == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!fu_volume_is_mounted(volume)) {
|
if (!fu_volume_is_mounted(volume)) {
|
||||||
|
@ -3056,11 +3056,11 @@ fu_util_prompt_for_volume(GError **error)
|
|||||||
g_autoptr(GError) error_local = NULL;
|
g_autoptr(GError) error_local = NULL;
|
||||||
|
|
||||||
/* exactly one */
|
/* exactly one */
|
||||||
volumes = fu_common_get_volumes_by_kind(FU_VOLUME_KIND_ESP, &error_local);
|
volumes = fu_volume_new_by_kind(FU_VOLUME_KIND_ESP, &error_local);
|
||||||
if (volumes == NULL) {
|
if (volumes == NULL) {
|
||||||
is_fallback = TRUE;
|
is_fallback = TRUE;
|
||||||
g_debug("%s, falling back to %s", error_local->message, FU_VOLUME_KIND_BDP);
|
g_debug("%s, falling back to %s", error_local->message, FU_VOLUME_KIND_BDP);
|
||||||
volumes = fu_common_get_volumes_by_kind(FU_VOLUME_KIND_BDP, error);
|
volumes = fu_volume_new_by_kind(FU_VOLUME_KIND_BDP, error);
|
||||||
if (volumes == NULL) {
|
if (volumes == NULL) {
|
||||||
g_prefix_error(error, "%s: ", error_local->message);
|
g_prefix_error(error, "%s: ", error_local->message);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user