From: Lennart Poettering Date: Mon, 26 Feb 2024 14:53:35 +0000 (+0100) Subject: import: mention explicitly which image directory we operate on X-Git-Tag: v256-rc1~671^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ed459ec0c0c997734447985532c5683b50fc46bd;p=thirdparty%2Fsystemd.git import: mention explicitly which image directory we operate on Also, let's move the similar message about sync() mode to more common code. --- diff --git a/src/import/import-fs.c b/src/import/import-fs.c index b1619ef9eac..44fc5be8a5c 100644 --- a/src/import/import-fs.c +++ b/src/import/import-fs.c @@ -171,6 +171,8 @@ static int import_fs(int argc, char *argv[], void *userdata) { log_info("Importing '%s', saving as '%s'.", strempty(pretty), local); } + log_info("Operating on image directory '%s'.", arg_image_root); + if (!arg_sync) log_info("File system synchronization on completion is off."); diff --git a/src/import/import.c b/src/import/import.c index 37dd0b2078f..889cd63ff0d 100644 --- a/src/import/import.c +++ b/src/import/import.c @@ -114,6 +114,12 @@ static int open_source(const char *path, const char *local, int *ret_open_fd) { log_info("Importing '%s', saving as '%s'.", strempty(pretty), local); } + if (!FLAGS_SET(arg_import_flags, IMPORT_DIRECT)) + log_info("Operating on image directory '%s'.", arg_image_root); + + if (!FLAGS_SET(arg_import_flags, IMPORT_SYNC)) + log_info("File system synchronization on completion is off."); + *ret_open_fd = TAKE_FD(open_fd); return retval; } @@ -167,9 +173,6 @@ static int import_tar(int argc, char *argv[], void *userdata) { if (r < 0) return r; - if (!FLAGS_SET(arg_import_flags, IMPORT_SYNC)) - log_info("File system synchronization on completion is off."); - r = tar_import_new(&import, event, arg_image_root, on_tar_finished, event); if (r < 0) return log_error_errno(r, "Failed to allocate importer: %m"); @@ -239,9 +242,6 @@ static int import_raw(int argc, char *argv[], void *userdata) { if (r < 0) return r; - if (!FLAGS_SET(arg_import_flags, IMPORT_SYNC)) - log_info("File system synchronization on completion is off."); - r = raw_import_new(&import, event, arg_image_root, on_raw_finished, event); if (r < 0) return log_error_errno(r, "Failed to allocate importer: %m"); diff --git a/src/import/pull.c b/src/import/pull.c index d4ad0b2ea37..7c838a5307b 100644 --- a/src/import/pull.c +++ b/src/import/pull.c @@ -90,6 +90,12 @@ static int normalize_local(const char *local, const char *url, char **ret) { } else log_info("Pulling '%s'.", url); + if (!FLAGS_SET(arg_import_flags, IMPORT_DIRECT)) + log_info("Operating on image directory '%s'.", arg_image_root); + + if (!FLAGS_SET(arg_import_flags, IMPORT_SYNC)) + log_info("File system synchronization on completion is off."); + *ret = TAKE_PTR(ll); return 0; } @@ -142,9 +148,6 @@ static int pull_tar(int argc, char *argv[], void *userdata) { if (r < 0) return r; - if (!FLAGS_SET(arg_import_flags, IMPORT_SYNC)) - log_info("File system synchronization on completion is off."); - r = tar_pull_new(&pull, event, arg_image_root, on_tar_finished, event); if (r < 0) return log_error_errno(r, "Failed to allocate puller: %m"); @@ -212,9 +215,6 @@ static int pull_raw(int argc, char *argv[], void *userdata) { if (r < 0) return r; - if (!FLAGS_SET(arg_import_flags, IMPORT_SYNC)) - log_info("File system synchronization on completion is off."); - r = raw_pull_new(&pull, event, arg_image_root, on_raw_finished, event); if (r < 0) return log_error_errno(r, "Failed to allocate puller: %m");