diff options
author | Lennart Poettering <lennart@poettering.net> | 2022-09-01 12:10:30 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2022-09-01 15:59:54 +0200 |
commit | 91e1ce1a7c84953290ad6406fe92f972c7b6661b (patch) | |
tree | b27b35ad8ae4dea73bc8b52f69d33dc1d47b9ec8 /src/shared/loop-util.c | |
parent | cf0dc88da65eb65b630aa72f8db9df4ef3fc3b06 (diff) | |
download | systemd-91e1ce1a7c84953290ad6406fe92f972c7b6661b.tar.gz |
loop-util: move resize partition ioctl call to blockdev-util.[ch]
The other BLKPG calls have wrappers in blockdev-util.[ch], let's place
them all there.
No change in behaviour.
Diffstat (limited to 'src/shared/loop-util.c')
-rw-r--r-- | src/shared/loop-util.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/shared/loop-util.c b/src/shared/loop-util.c index ce9a982f02..fd68af4160 100644 --- a/src/shared/loop-util.c +++ b/src/shared/loop-util.c @@ -869,19 +869,11 @@ static int resize_partition(int partition_fd, uint64_t offset, uint64_t size) { if (r < 0) return r; - struct blkpg_partition bp = { - .pno = partno, - .start = offset == UINT64_MAX ? current_offset : offset, - .length = size == UINT64_MAX ? current_size : size, - }; - - struct blkpg_ioctl_arg ba = { - .op = BLKPG_RESIZE_PARTITION, - .data = &bp, - .datalen = sizeof(bp), - }; - - return RET_NERRNO(ioctl(whole_fd, BLKPG, &ba)); + return block_device_resize_partition( + whole_fd, + partno, + offset == UINT64_MAX ? current_offset : offset, + size == UINT64_MAX ? current_size : size); } int loop_device_refresh_size(LoopDevice *d, uint64_t offset, uint64_t size) { |