Refined the commands
This commit is contained in:
27
src/entry.c
27
src/entry.c
@@ -384,9 +384,19 @@ Status RemoveEntryDisk(const char* entry_identifier) {
|
||||
}
|
||||
|
||||
Status ResetEntryDisk(const char* entry_identifier, const char* backing_identifier) {
|
||||
// Check if the disk exists
|
||||
// Check that the entry exists
|
||||
bool exists;
|
||||
Status status = DoesEntryDiskExist(entry_identifier, &exists);
|
||||
Status status = DoesEntryExist(entry_identifier, &exists);
|
||||
if (status != SUCCESS)
|
||||
return status;
|
||||
|
||||
if (!exists) {
|
||||
Log(LOG_LEVEL_ERROR, "The entry '%s' does not exist.", entry_identifier);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
// Check if the disk exists
|
||||
status = DoesEntryDiskExist(entry_identifier, &exists);
|
||||
if (status != SUCCESS)
|
||||
return status;
|
||||
|
||||
@@ -438,7 +448,7 @@ Status ResetEntryDisk(const char* entry_identifier, const char* backing_identifi
|
||||
}
|
||||
|
||||
Status TrimEntryDisk(const char* entry_identifier) {
|
||||
// Check if the disk exists
|
||||
// Check if the entry exists
|
||||
bool exists;
|
||||
Status status = DoesEntryDiskExist(entry_identifier, &exists);
|
||||
if (status != SUCCESS)
|
||||
@@ -449,6 +459,16 @@ Status TrimEntryDisk(const char* entry_identifier) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
// Check if the disk exists
|
||||
status = DoesEntryDiskExist(entry_identifier, &exists);
|
||||
if (status != SUCCESS)
|
||||
return status;
|
||||
|
||||
if (!exists) {
|
||||
Log(LOG_LEVEL_ERROR, "The disk for the entry '%s' does not exist.", entry_identifier);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
// Get the disk path
|
||||
char* entry_disk_path = NULL;
|
||||
status = GetEntryDiskPath(entry_identifier, &entry_disk_path);
|
||||
@@ -461,3 +481,4 @@ Status TrimEntryDisk(const char* entry_identifier) {
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user