loop-util: move device_has_block_children() to blockdev-util.c
As the function is not only for loopback block device. No actual code changes, just refactoring.
This commit is contained in:
@@ -621,3 +621,18 @@ int block_device_remove_all_partitions(sd_device *dev, int fd) {
|
||||
|
||||
return k;
|
||||
}
|
||||
|
||||
int block_device_has_partitions(sd_device *dev) {
|
||||
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
|
||||
int r;
|
||||
|
||||
assert(dev);
|
||||
|
||||
/* Checks if the specified device currently has partitions. */
|
||||
|
||||
r = partition_enumerator_new(dev, &e);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
return !!sd_device_enumerator_get_device_first(e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user