Added disk resetting
This commit is contained in:
27
src/entry.c
27
src/entry.c
@@ -230,6 +230,33 @@ Result remove_entry(const char* entry_id) {
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
Result reset_entry(const char* entry_id) {
|
||||
// Check that it exists
|
||||
bool exists;
|
||||
Result result = entry_exists(entry_id, &exists);
|
||||
if (result != SUCCESS)
|
||||
return result;
|
||||
|
||||
if (!exists) {
|
||||
log_message(LOG_LEVEL_ERROR, "The entry '%s' does not exist.", entry_id);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
// Get the path of the disk
|
||||
char* disk_path;
|
||||
result = get_entry_disk_path(entry_id, &disk_path);
|
||||
if (result != SUCCESS)
|
||||
return result;
|
||||
|
||||
// Reset the disk
|
||||
result = reset_disk(disk_path);
|
||||
|
||||
// Free the disk path
|
||||
free(disk_path);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Result get_entry_info(const char* entry_id, EntryInfo* out_info) {
|
||||
out_info->backing_id = NULL;
|
||||
out_info->type = ENTRY_TYPE_UNKNOWN;
|
||||
|
Reference in New Issue
Block a user