Added helper for backing info
This commit is contained in:
parent
6eaa10e3d3
commit
091c9fa692
@ -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;
|
||||
}
|
||||
|
@ -75,3 +75,9 @@ result_t set_default_backing(const char* backing);
|
||||
/// @param backing The backing to get the parent of.
|
||||
/// @return The result of the operation.
|
||||
result_t get_backing_parent(char** _parent, const char* backing);
|
||||
|
||||
/// @brief Gets information about the given backing. If the backing does not exist, the call will return a failure result with an error message.
|
||||
/// @param _info The string pointer to store the resulting disk information in. The caller is responsible for freeing the string.
|
||||
/// @param backing The backing to get information about.
|
||||
/// @return The result of the operation.
|
||||
result_t get_backing_info(disk_info_t* _info, const char* backing);
|
||||
|
Loading…
Reference in New Issue
Block a user