Started working on a refactored version

This commit is contained in:
2024-02-17 00:40:09 +01:00
parent 66caca4a7f
commit 85ad0ab103
11 changed files with 254 additions and 762 deletions

View File

@@ -1,39 +0,0 @@
#pragma once
#include <stdbool.h>
#include <stdint.h>
#define BACKING_POOL "/var/lib/sandbox/backings"
/// @brief Checks whether the backing pool exists and is a directory.
/// @return True if the backing pool exists and is a directory, false otherwise.
bool check_backing_pool(void);
/// @brief Checks whether the 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_backing_id_valid(const char* backing_id);
/// @brief Checks whether the backing disk exists.
/// @param backing_id The backing disk id to check.
/// @return True if the backing disk exists, false otherwise.
bool backing_exists(const char* backing_id);
/// @brief Adds a backing disk to the backing pool.
/// @param backing_id The backing disk id to add.
/// @param entry_id The entry from which the backing disk should be added.
/// @return True if the backing disk was added, false otherwise.
bool add_backing(const char* backing_id, const char* entry_id);
/// @brief Removes a backing disk from the backing pool, as well as any backing disks that depend on it.
/// @param backing_id The backing disk id to remove.
/// @return True if the backing disk was removed, false otherwise.
bool remove_backing(const char* backing_id);
/// @brief Lists all backing disks in the backing pool.
/// @return An array of backing disk ids or NULL if an error occurred. The result must be freed with free(), as well as each individual backing disk id.
char** list_backings(void);
/// @brief Clears all backing disks from the backing pool.
/// @return True if all backing disks were removed, false otherwise.
bool clear_backings(void);