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,43 +0,0 @@
#pragma once
#include <stdbool.h>
#include <stdint.h>
typedef struct DiskInfo {
uint64_t virtual_size;
uint64_t actual_size;
char* backing_file;
} DiskInfo;
/// @brief Creates an empty disk at the given path with the given size.
/// @param path The path to the disk. Any existing file at this path will be overwritten.
/// @param size The size of the disk, in bytes.
/// @return True if the disk was created successfully, false otherwise.
bool create_empty_disk(const char* path, uint64_t size);
/// @brief Creates a disk at the given path with the given backing disk.
/// @param path The path to the disk.
/// @param backing_disk The path to the backing disk.
/// @return True if the disk was created successfully, false otherwise.
bool create_backed_disk(const char* path, const char* backing_disk);
/// @brief Trims the given disk to remove any unused space.
/// @param path The path to the disk.
/// @return True if the disk was trimmed successfully, false otherwise.
bool trim_disk(const char* path);
/// @brief Changes the backing disk of the given disk.
/// @param path The path to the disk.
/// @param backing_disk The path to the new backing disk.
/// @return True if the disk was rebased successfully, false otherwise.
bool rebase_disk(const char* path, const char* backing_disk);
/// @brief Gets information about the given disk.
/// @param path The path to the disk.
/// @param info The DiskInfo struct to fill with information about the disk.
/// @return True if the disk information was retrieved successfully, false otherwise.
bool get_disk_info(const char* path, DiskInfo* info);
/// @brief Frees the memory used by the given DiskInfo struct.
/// @param info The DiskInfo struct to free.
void free_disk_info(DiskInfo* info);