Added helper for backing info
This commit is contained in:
@@ -419,3 +419,28 @@ result_t get_backing_parent(char** _parent, const char* backing) {
|
||||
*_parent = parent;
|
||||
return success();
|
||||
}
|
||||
|
||||
result_t get_backing_info(disk_info_t* _info, const char* backing) {
|
||||
// Initialize the output parameters
|
||||
_info->size = 0;
|
||||
_info->allocated = 0;
|
||||
_info->backing_path = NULL;
|
||||
|
||||
// Check that the backing exists
|
||||
result_t result = check_backing_exists(backing);
|
||||
if (result != success())
|
||||
return result;
|
||||
|
||||
// Get the backing path
|
||||
char* path;
|
||||
result = get_backing_path(&path, backing);
|
||||
if (result != success())
|
||||
return result;
|
||||
|
||||
// Get the disk information
|
||||
result = get_disk_info(_info, path);
|
||||
|
||||
free(path);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user