Added backing signatures

This commit is contained in:
2024-02-17 14:21:14 +01:00
parent fd7b056457
commit 8821519a12
5 changed files with 105 additions and 10 deletions

View File

@@ -9,19 +9,49 @@
#define BACKING_POOL_DIR "/var/lib/sandbox/backings"
#define MAX_BACKING_LENGTH 256
/// @brief Checks whether the given backing id is valid.
/// @param backing_id The backing id to check.
/// @return True if the backing id is valid, false otherwise.
typedef struct {
DiskInfo disk_info;
} BackingInfo;
/// @brief Checks whether the given backing disk id is valid.
/// @param backing_id The backing disk id to check.
/// @return True if the backing disk id is valid, false otherwise.
bool is_valid_backing_id(const char* backing_id);
/// @brief Gets the path of the given backing.
/// @param backing_id The backing id.
/// @brief Gets the path of the given backing disk.
/// @param backing_id The backing disk id.
/// @param out_path The pointer to the output path string. The caller is responsible for freeing the memory.
/// @return The result of the operation.
Result get_backing_path(const char* backing_id, char** out_path);
/// @brief Checks whether the given backing exists in the pool.
/// @param backing_id The backing id.
/// @brief Checks whether the given backing disk exists in the pool.
/// @param backing_id The backing disk id.
/// @param out_exists The pointer to the output boolean.
/// @return The result of the operation.
Result backing_exists(const char* backing_id, bool* out_exists);
Result backing_exists(const char* backing_id, bool* out_exists);
/// @brief Adds a backing disk to the pool from an entry.
/// @param backing_id The backing disk id.
/// @param entry_id The entry id.
/// @return The result of the operation.
Result add_backing_from_entry(const char* backing_id, const char* entry_id);
/// @brief Removes a backing disk from the pool, and removes any backing disks that uses it.
/// @param backing_id The backing disk id.
/// @return The result of the operation.
Result remove_backing(const char* backing_id);
/// @brief Lists the backing disks in the pool.
/// @param out_backings The pointer to the null-terminated array of backing disk ids. The caller is responsible for freeing the memory of the array and its elements.
/// @return The result of the operation.
Result list_backings(char*** out_backings, size_t* out_count);
/// @brief Gathers information about a backing disk.
/// @param backing_id The backing disk id.
/// @param out_info The information about the backing disk.
/// @return The result of the operation.
Result get_backing_info(const char* backing_id, BackingInfo* out_info);
/// @brief Frees the resources used by the given backing disk information.
/// @param info The backing disk information to free.
void free_backing_info(BackingInfo* info);