Started writing the management program.

This commit is contained in:
2024-02-15 00:17:20 +01:00
commit 827b62fbcd
12 changed files with 700 additions and 0 deletions

26
src/disk.h Normal file
View File

@@ -0,0 +1,26 @@
#pragma once
#include <stdbool.h>
#include <stdint.h>
/// @brief Creates an empty disk.
/// @param disk The path to the disk to create. Warning: the disk must not exist, otherwise it will be overwritten.
/// @param size The size of the disk to create in bytes.
/// @return true if the disk is created, otherwise false.
bool create_empty_disk(const char* disk, uint64_t size);
/// @brief Creates a backed disk.
/// @param disk The path to the disk to create. Warning: the disk must not exist, otherwise it will be overwritten.
/// @param backing The path to the backing file, which exists.
/// @return true if the disk is created, otherwise false.
bool create_backed_disk(const char* disk, const char* backing);
/// @brief Packs the disk to reduce its size.
/// @param disk The path to the disk to pack, which exists.
/// @return true if the disk is packed, otherwise false.
bool pack_disk(const char* disk);
/// @brief Gets the backing file of a disk.
/// @param disk The path to the disk, which exists.
/// @return The backing file of the disk. The caller is responsible for freeing the returned string. This function can return NULL.
char* get_backing_file(const char* disk);