]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
repart: when we copy in blocks, indicate we are doing from an offset
authorLennart Poettering <lennart@poettering.net>
Fri, 10 Nov 2023 21:45:02 +0000 (22:45 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 10 Nov 2023 21:53:49 +0000 (22:53 +0100)
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

index fc0ed48a542976019238a09a3c05208dd02cd922..d01fec63f5842f6a12e7b0129cab08996c7a83b3 100644 (file)
@@ -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)