#pragma once #include "utils.h" #include "disk.h" #include #include #define BACKING_POOL_DIR "/var/lib/sandbox/backings" #define MAX_BACKING_LENGTH 256 /// @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 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 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); /// @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);