42 lines
1.7 KiB
C
42 lines
1.7 KiB
C
|
#pragma once
|
||
|
|
||
|
#include "sandbox.h"
|
||
|
|
||
|
#include <stdbool.h>
|
||
|
#include <stdint.h>
|
||
|
#include <time.h>
|
||
|
|
||
|
/// @brief Returns whether the given name is a valid backing name. Backing names are valid if they start with a number (used as the ctime).
|
||
|
/// @param name The name to check.
|
||
|
/// @return Whether the name is valid or not.
|
||
|
bool is_valid_backing_name(const char* name);
|
||
|
|
||
|
/// @brief Returns the backing path for the given name.
|
||
|
/// @param name The name of the backing. Note: This function does not check if the name is valid.
|
||
|
/// @return The backing path.
|
||
|
char* get_backing_path(const char* name);
|
||
|
|
||
|
/// @brief Returns the backing path for the given name.
|
||
|
/// @param name The name of the backing. Note: This function does not check if the name is valid.
|
||
|
/// @return The backing path.
|
||
|
bool backing_exists(const char* name);
|
||
|
|
||
|
/// @brief Returns an array of all the backing names, terminated by a NULL pointer.
|
||
|
/// @return An array of all the backing names. Note: The array must be freed by the caller, including every string in the array.
|
||
|
char** list_backings(void);
|
||
|
|
||
|
/// @brief Returns the ctime of the backing with the given name.
|
||
|
/// @param name The name of the backing.
|
||
|
/// @return The ctime of the backing.
|
||
|
time_t get_backing_ctime(const char* name);
|
||
|
|
||
|
/// @brief Returns the latest backing's name.
|
||
|
/// @return The latest backing's name.
|
||
|
char* get_latest_backing(void);
|
||
|
|
||
|
/// @brief Creates a new backing with the given name from the given source disk.
|
||
|
/// @param name The name of the new backing.
|
||
|
/// @param source_disk The source disk to create the backing from. Note: If the source disk has a backing file, it must be a existing sandbox backing disk.
|
||
|
/// @return Whether the backing was created successfully or not.
|
||
|
bool create_backing(const char* name, const char* source_disk);
|