Perfected the disk utilities

This commit is contained in:
2024-02-15 19:42:22 +01:00
parent e6bc757343
commit 01ea511b2d
10 changed files with 581 additions and 1183 deletions

View File

@@ -1,42 +0,0 @@
#pragma once
#include <stdbool.h>
#include <stdint.h>
/// @brief Returns the directory path where the backing disks are stored.
/// @return The directory path where the backing disks are stored. The caller is responsible for freeing the returned string. This function can return NULL.
char* get_backings_path(void);
/// @brief Checks if the specified backing disk name is valid.
/// @param name The backing disk name to check.
/// @return true if the backing disk name is valid, otherwise false.
bool is_valid_backing_name(const char* name);
/// @brief Returns the path to the specified backing disk.
/// @param backing The valid backing disk name.
/// @return The path to the specified backing disk. The caller is responsible for freeing the returned string. This function can return NULL.
char* get_backing_path(const char* backing);
/// @brief Checks if the specified backing disk exists.
/// @param backing The valid backing disk name.
/// @return true if the backing disk exists, otherwise false.
bool backing_exists(const char* backing);
/// @brief Lists the backing disks.
/// @return The list of backing disks. The caller is responsible for freeing the returned array and strings. This function can return NULL.
char** list_backings(void);
/// @brief Get the creation time of the specified backing disk.
/// @param backing The valid backing disk name.
/// @return The creation time of the specified backing disk. If the backing disk does not exist, this function returns 0.
uint64_t get_backing_creation_time(const char* backing);
/// @brief Finds the latest backing disk.
/// @return The latest backing disk. The caller is responsible for freeing the returned string. This function can return NULL.
char* find_latest_backing(void);
/// @brief Creates a new backing disk.
/// @param disk The disk to use as the backing disk. Warning: the disk must be part of the backing disks.
/// @param description The description of the backing disk.
/// @return true if the backing disk was created, otherwise false.
bool create_backing(const char* disk, const char* description);