Files
linuxinstall/src/disk.h

33 lines
1.3 KiB
C
Raw Normal View History

2024-02-17 00:57:30 +01:00
#pragma once
#include "utils.h"
#include <stdbool.h>
#include <stdint.h>
#include <sys/types.h>
/// @brief Creates an empty disk at the given path, with the given size and with the given permissions.
/// @param path The path to the disk to create.
/// @param size The size of the disk to create.
/// @param permissions The permissions to set on the disk.
/// @return The result of the operation.
Result create_empty_disk(const char* path, uint64_t size, mode_t permissions);
/// @brief Creates a backed disk at the given path, with the given backing disk and with the given permissions.
/// @param path The path to the disk to create.
/// @param backing_disk The disk to back the new disk with.
/// @param permissions The permissions to set on the disk.
/// @return The result of the operation.
Result create_backed_disk(const char* path, const char* backing_disk, mode_t permissions);
/// @brief Trims a disk to remove any unused space.
/// @param path The path to the disk to trim.
/// @return The result of the operation.
Result trim_disk(const char* path);
/// @brief Moves a disk's backing file to the given path.
/// @param path The path to the disk to move.
/// @param backing_disk The new path to the backing disk.
/// @return The result of the operation.
Result rebase_disk(const char* path, const char* backing_disk);