From: Lennart Poettering Date: Fri, 10 Nov 2023 21:45:02 +0000 (+0100) Subject: repart: when we copy in blocks, indicate we are doing from an offset X-Git-Tag: v255-rc2~48^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a053f801f85190fb7dd608f7aa57df55cb6d9161;p=thirdparty%2Fsystemd.git 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. --- 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)