From a053f801f85190fb7dd608f7aa57df55cb6d9161 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 10 Nov 2023 22:45:02 +0100 Subject: [PATCH] repart: when we copy in blocks, indicate we are doing from an offset At first I thought when using --copy-from= that it was copying in my whole disk into a partition instead of just a partition into a partition. Let's make the log message clearer and say that we copy starting from an offset. --- src/partition/repart.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/partition/repart.c b/src/partition/repart.c index fc0ed48a542..d01fec63f58 100644 --- a/src/partition/repart.c +++ b/src/partition/repart.c @@ -4291,11 +4291,16 @@ static int context_copy_blocks(Context *context) { return r; } - log_info("Copying in '%s' (%s) on block level into future partition %" PRIu64 ".", - p->copy_blocks_path, FORMAT_BYTES(p->copy_blocks_size), p->partno); + if (p->copy_blocks_offset == UINT64_MAX) + log_info("Copying in '%s' (%s) on block level into future partition %" PRIu64 ".", + p->copy_blocks_path, FORMAT_BYTES(p->copy_blocks_size), p->partno); + else { + log_info("Copying in '%s' @ %" PRIu64 " (%s) on block level into future partition %" PRIu64 ".", + p->copy_blocks_path, p->copy_blocks_offset, FORMAT_BYTES(p->copy_blocks_size), p->partno); - if (p->copy_blocks_offset != UINT64_MAX && lseek(p->copy_blocks_fd, p->copy_blocks_offset, SEEK_SET) < 0) - return log_error_errno(errno, "Failed to seek to copy blocks offset in %s: %m", p->copy_blocks_path); + if (lseek(p->copy_blocks_fd, p->copy_blocks_offset, SEEK_SET) < 0) + return log_error_errno(errno, "Failed to seek to copy blocks offset in %s: %m", p->copy_blocks_path); + } r = copy_bytes(p->copy_blocks_fd, partition_target_fd(t), p->copy_blocks_size, COPY_REFLINK); if (r < 0) -- 2.47.3