mirror of
https://github.com/clearlinux/clr-boot-manager.git
synced 2026-10-04 07:48:31 +00:00
lib: Remove unused get_part_uuid API
With the move to CbmDeviceProbe API, this functionality is no longer necessary within clr-boot-manager. Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
This commit is contained in:
committed by
William Douglas
parent
26bfa686ee
commit
555be2a89b
@@ -79,60 +79,6 @@ bool cbm_files_match(const char *p1, const char *p2)
|
||||
return false;
|
||||
}
|
||||
|
||||
char *get_part_uuid(const char *path)
|
||||
{
|
||||
struct stat st = { 0 };
|
||||
autofree(char) *node = NULL;
|
||||
blkid_probe probe = NULL;
|
||||
const char *value = NULL;
|
||||
char *ret = NULL;
|
||||
|
||||
if (stat(path, &st) != 0) {
|
||||
LOG_ERROR("Path does not exist: %s", path);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (major(st.st_dev) == 0) {
|
||||
LOG_ERROR("Invalid block device: %s", path);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (asprintf(&node, "/dev/block/%u:%u", major(st.st_dev), minor(st.st_dev)) < 0) {
|
||||
DECLARE_OOM();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
probe = blkid_new_probe_from_filename(node);
|
||||
if (!probe) {
|
||||
LOG_ERROR("Unable to probe %u:%u", major(st.st_dev), minor(st.st_dev));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
blkid_probe_enable_superblocks(probe, 1);
|
||||
blkid_probe_set_superblocks_flags(probe, BLKID_SUBLKS_TYPE);
|
||||
blkid_probe_enable_partitions(probe, 1);
|
||||
blkid_probe_set_partitions_flags(probe, BLKID_PARTS_ENTRY_DETAILS);
|
||||
|
||||
if (blkid_do_safeprobe(probe) != 0) {
|
||||
LOG_ERROR("Error probing filesystem: %s", strerror(errno));
|
||||
goto clean;
|
||||
}
|
||||
|
||||
if (blkid_probe_lookup_value(probe, "PART_ENTRY_UUID", &value, NULL) != 0) {
|
||||
LOG_ERROR("Unable to find UUID for %s: %s", node, strerror(errno));
|
||||
value = NULL;
|
||||
goto clean;
|
||||
}
|
||||
|
||||
LOG_DEBUG("UUID for %s is %s", node, value);
|
||||
|
||||
ret = strdup(value);
|
||||
clean:
|
||||
blkid_free_probe(probe);
|
||||
errno = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
char *get_boot_device()
|
||||
{
|
||||
glob_t glo = { 0 };
|
||||
|
||||
@@ -38,14 +38,6 @@ typedef struct CbmMappedFile {
|
||||
size_t length; /**< Length of the mmap()'d file (see fstat) */
|
||||
} CbmMappedFile;
|
||||
|
||||
/**
|
||||
* Get the PartUUID for a given path
|
||||
*
|
||||
* @param path Path to get the PartUUID for
|
||||
* @return a newly allocated string, or NULL on error
|
||||
*/
|
||||
char *get_part_uuid(const char *path);
|
||||
|
||||
/**
|
||||
* Return the UEFI device that is used for booting (/boot)
|
||||
*
|
||||
|
||||
@@ -56,22 +56,6 @@ START_TEST(bootman_match_test)
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(bootman_uuid_test)
|
||||
{
|
||||
if (geteuid() != 0) {
|
||||
LOG_INFO("Skipping UUID test as root privileges are required");
|
||||
return;
|
||||
}
|
||||
const char *path = TOP_DIR "/tests/data/hashfile";
|
||||
autofree(char) *puuid = NULL;
|
||||
|
||||
puuid = get_part_uuid(path);
|
||||
fail_if(!puuid, "Failed to get filesystem UUID");
|
||||
|
||||
LOG_INFO("PUUID: %s", puuid);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(bootman_find_boot)
|
||||
{
|
||||
if (!nc_file_exists("/sys/firmware/efi")) {
|
||||
@@ -105,7 +89,6 @@ static Suite *core_suite(void)
|
||||
s = suite_create("bootman_files");
|
||||
tc = tcase_create("bootman_files");
|
||||
tcase_add_test(tc, bootman_match_test);
|
||||
tcase_add_test(tc, bootman_uuid_test);
|
||||
tcase_add_test(tc, bootman_mount_test);
|
||||
tcase_add_test(tc, bootman_find_boot);
|
||||
suite_add_tcase(s, tc);
|
||||
|
||||
Reference in New Issue
Block a user