]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
import: Make naming consistent
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 25 Nov 2025 12:33:25 +0000 (13:33 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 26 Nov 2025 07:23:13 +0000 (16:23 +0900)
Always abbreviate import/pull/export structs with their first letter
instead of only doing it in some places and using the wrong letter in
other places.

src/import/export-raw.h
src/import/export-tar.h
src/import/import-raw.h
src/import/import-tar.h
src/import/pull-job.h
src/import/pull-raw.c
src/import/pull-raw.h
src/import/pull-tar.c
src/import/pull-tar.h

index 7af90919291f257c073f91114238511b66c8081b..664bdfc8e7e50b29d0cf22ac7565089e3b0d8c64 100644 (file)
@@ -6,11 +6,11 @@
 
 typedef struct RawExport RawExport;
 
-typedef void (*RawExportFinished)(RawExport *export, int error, void *userdata);
+typedef void (*RawExportFinished)(RawExport *e, int error, void *userdata);
 
-int raw_export_new(RawExport **export, sd_event *event, RawExportFinished on_finished, void *userdata);
-RawExport* raw_export_unref(RawExport *export);
+int raw_export_new(RawExport **ret, sd_event *event, RawExportFinished on_finished, void *userdata);
+RawExport* raw_export_unref(RawExport *e);
 
 DEFINE_TRIVIAL_CLEANUP_FUNC(RawExport*, raw_export_unref);
 
-int raw_export_start(RawExport *export, const char *path, int fd, ImportCompressType compress);
+int raw_export_start(RawExport *e, const char *path, int fd, ImportCompressType compress);
index 382b5f58c0fac5d9572f4b9ad5184e4012c7c8b5..c5006d42319b16c1831c09ecb2c429b0671c006a 100644 (file)
@@ -7,11 +7,11 @@
 
 typedef struct TarExport TarExport;
 
-typedef void (*TarExportFinished)(TarExport *export, int error, void *userdata);
+typedef void (*TarExportFinished)(TarExport *e, int error, void *userdata);
 
-int tar_export_new(TarExport **export, sd_event *event, TarExportFinished on_finished, void *userdata);
-TarExport* tar_export_unref(TarExport *export);
+int tar_export_new(TarExport **ret, sd_event *event, TarExportFinished on_finished, void *userdata);
+TarExport* tar_export_unref(TarExport *e);
 
 DEFINE_TRIVIAL_CLEANUP_FUNC(TarExport*, tar_export_unref);
 
-int tar_export_start(TarExport *export, const char *path, int fd, ImportCompressType compress, ImportFlags flags);
+int tar_export_start(TarExport *e, const char *path, int fd, ImportCompressType compress, ImportFlags flags);
index 7c38a1f819172ca3cb653ca5f4c1f435b0d9a530..7fdafdf2f431250096064fc3bc390f885a7dec78 100644 (file)
@@ -6,10 +6,10 @@
 
 typedef struct RawImport RawImport;
 
-typedef void (*RawImportFinished)(RawImport *import, int error, void *userdata);
+typedef void (*RawImportFinished)(RawImport *i, int error, void *userdata);
 
-int raw_import_new(RawImport **import, sd_event *event, const char *image_root, RawImportFinished on_finished, void *userdata);
-RawImport* raw_import_unref(RawImport *import);
+int raw_import_new(RawImport **ret, sd_event *event, const char *image_root, RawImportFinished on_finished, void *userdata);
+RawImport* raw_import_unref(RawImport *i);
 
 DEFINE_TRIVIAL_CLEANUP_FUNC(RawImport*, raw_import_unref);
 
index 3586ba0d57d62cdf84d6e14d4f89045e27a197aa..116c3269bd7ed23dd07f2e82b7f6183f19f4633f 100644 (file)
@@ -6,11 +6,11 @@
 
 typedef struct TarImport TarImport;
 
-typedef void (*TarImportFinished)(TarImport *import, int error, void *userdata);
+typedef void (*TarImportFinished)(TarImport *i, int error, void *userdata);
 
-int tar_import_new(TarImport **import, sd_event *event, const char *image_root, TarImportFinished on_finished, void *userdata);
-TarImport* tar_import_unref(TarImport *import);
+int tar_import_new(TarImport **ret, sd_event *event, const char *image_root, TarImportFinished on_finished, void *userdata);
+TarImport* tar_import_unref(TarImport *i);
 
 DEFINE_TRIVIAL_CLEANUP_FUNC(TarImport*, tar_import_unref);
 
-int tar_import_start(TarImport *import, int fd, const char *local, ImportFlags flags);
+int tar_import_start(TarImport *i, int fd, const char *local, ImportFlags flags);
index b07423817407a353bc0953689e5f829bd77f93f6..c4cda83a47ed5a92f5cca918545fead2c7f2f2af 100644 (file)
@@ -84,7 +84,7 @@ typedef struct PullJob {
         bool force_memory;
 } PullJob;
 
-int pull_job_new(PullJob **job, const char *url, CurlGlue *glue, void *userdata);
+int pull_job_new(PullJob **ret, const char *url, CurlGlue *glue, void *userdata);
 PullJob* pull_job_unref(PullJob *job);
 
 int pull_job_begin(PullJob *j);
index 01a810a9b8c80c911b1107e02117bba919b9311b..fc681fbb59dccc4d208992888dff7eff08e19592 100644 (file)
@@ -69,36 +69,36 @@ typedef struct RawPull {
         char *verity_temp_path;
 } RawPull;
 
-RawPull* raw_pull_unref(RawPull *i) {
-        if (!i)
+RawPull* raw_pull_unref(RawPull *p) {
+        if (!p)
                 return NULL;
 
-        pull_job_unref(i->raw_job);
-        pull_job_unref(i->checksum_job);
-        pull_job_unref(i->signature_job);
-        pull_job_unref(i->settings_job);
-        pull_job_unref(i->roothash_job);
-        pull_job_unref(i->roothash_signature_job);
-        pull_job_unref(i->verity_job);
-
-        curl_glue_unref(i->glue);
-        sd_event_unref(i->event);
-
-        unlink_and_free(i->temp_path);
-        unlink_and_free(i->settings_temp_path);
-        unlink_and_free(i->roothash_temp_path);
-        unlink_and_free(i->roothash_signature_temp_path);
-        unlink_and_free(i->verity_temp_path);
-
-        free(i->final_path);
-        free(i->settings_path);
-        free(i->roothash_path);
-        free(i->roothash_signature_path);
-        free(i->verity_path);
-        free(i->image_root);
-        free(i->local);
-
-        return mfree(i);
+        pull_job_unref(p->raw_job);
+        pull_job_unref(p->checksum_job);
+        pull_job_unref(p->signature_job);
+        pull_job_unref(p->settings_job);
+        pull_job_unref(p->roothash_job);
+        pull_job_unref(p->roothash_signature_job);
+        pull_job_unref(p->verity_job);
+
+        curl_glue_unref(p->glue);
+        sd_event_unref(p->event);
+
+        unlink_and_free(p->temp_path);
+        unlink_and_free(p->settings_temp_path);
+        unlink_and_free(p->roothash_temp_path);
+        unlink_and_free(p->roothash_signature_temp_path);
+        unlink_and_free(p->verity_temp_path);
+
+        free(p->final_path);
+        free(p->settings_path);
+        free(p->roothash_path);
+        free(p->roothash_signature_path);
+        free(p->verity_path);
+        free(p->image_root);
+        free(p->local);
+
+        return mfree(p);
 }
 
 int raw_pull_new(
@@ -110,7 +110,7 @@ int raw_pull_new(
 
         _cleanup_(curl_glue_unrefp) CurlGlue *g = NULL;
         _cleanup_(sd_event_unrefp) sd_event *e = NULL;
-        _cleanup_(raw_pull_unrefp) RawPull *i = NULL;
+        _cleanup_(raw_pull_unrefp) RawPull *p = NULL;
         _cleanup_free_ char *root = NULL;
         int r;
 
@@ -133,11 +133,11 @@ int raw_pull_new(
         if (r < 0)
                 return r;
 
-        i = new(RawPull, 1);
-        if (!i)
+        p = new(RawPull, 1);
+        if (!p)
                 return -ENOMEM;
 
-        *i = (RawPull) {
+        *p = (RawPull) {
                 .on_finished = on_finished,
                 .userdata = userdata,
                 .image_root = TAKE_PTR(root),
@@ -146,58 +146,58 @@ int raw_pull_new(
                 .offset = UINT64_MAX,
         };
 
-        i->glue->on_finished = pull_job_curl_on_finished;
-        i->glue->userdata = i;
+        p->glue->on_finished = pull_job_curl_on_finished;
+        p->glue->userdata = p;
 
-        *ret = TAKE_PTR(i);
+        *ret = TAKE_PTR(p);
 
         return 0;
 }
 
-static void raw_pull_report_progress(RawPull *i, RawProgress p) {
+static void raw_pull_report_progress(RawPull *p, RawProgress progress) {
         unsigned percent;
 
-        assert(i);
+        assert(p);
 
-        switch (p) {
+        switch (progress) {
 
         case RAW_DOWNLOADING: {
                 unsigned remain = 80;
 
                 percent = 0;
 
-                if (i->checksum_job) {
-                        percent += i->checksum_job->progress_percent * 5 / 100;
+                if (p->checksum_job) {
+                        percent += p->checksum_job->progress_percent * 5 / 100;
                         remain -= 5;
                 }
 
-                if (i->signature_job) {
-                        percent += i->signature_job->progress_percent * 5 / 100;
+                if (p->signature_job) {
+                        percent += p->signature_job->progress_percent * 5 / 100;
                         remain -= 5;
                 }
 
-                if (i->settings_job) {
-                        percent += i->settings_job->progress_percent * 5 / 100;
+                if (p->settings_job) {
+                        percent += p->settings_job->progress_percent * 5 / 100;
                         remain -= 5;
                 }
 
-                if (i->roothash_job) {
-                        percent += i->roothash_job->progress_percent * 5 / 100;
+                if (p->roothash_job) {
+                        percent += p->roothash_job->progress_percent * 5 / 100;
                         remain -= 5;
                 }
 
-                if (i->roothash_signature_job) {
-                        percent += i->roothash_signature_job->progress_percent * 5 / 100;
+                if (p->roothash_signature_job) {
+                        percent += p->roothash_signature_job->progress_percent * 5 / 100;
                         remain -= 5;
                 }
 
-                if (i->verity_job) {
-                        percent += i->verity_job->progress_percent * 10 / 100;
+                if (p->verity_job) {
+                        percent += p->verity_job->progress_percent * 10 / 100;
                         remain -= 10;
                 }
 
-                if (i->raw_job)
-                        percent += i->raw_job->progress_percent * remain / 100;
+                if (p->raw_job)
+                        percent += p->raw_job->progress_percent * remain / 100;
                 break;
         }
 
@@ -225,30 +225,30 @@ static void raw_pull_report_progress(RawPull *i, RawProgress p) {
         log_debug("Combined progress %u%%", percent);
 }
 
-static int raw_pull_maybe_convert_qcow2(RawPull *i) {
+static int raw_pull_maybe_convert_qcow2(RawPull *p) {
         _cleanup_(unlink_and_freep) char *t = NULL;
         _cleanup_close_ int converted_fd = -EBADF;
         _cleanup_free_ char *f = NULL;
         int r;
 
-        assert(i);
-        assert(i->raw_job);
-        assert(!FLAGS_SET(i->flags, IMPORT_DIRECT));
+        assert(p);
+        assert(p->raw_job);
+        assert(!FLAGS_SET(p->flags, IMPORT_DIRECT));
 
-        if (!FLAGS_SET(i->flags, IMPORT_CONVERT_QCOW2))
+        if (!FLAGS_SET(p->flags, IMPORT_CONVERT_QCOW2))
                 return 0;
 
-        assert(i->final_path);
-        assert(i->raw_job->close_disk_fd);
+        assert(p->final_path);
+        assert(p->raw_job->close_disk_fd);
 
-        r = qcow2_detect(i->raw_job->disk_fd);
+        r = qcow2_detect(p->raw_job->disk_fd);
         if (r < 0)
                 return log_error_errno(r, "Failed to detect whether this is a QCOW2 image: %m");
         if (r == 0)
                 return 0;
 
         /* This is a QCOW2 image, let's convert it */
-        r = tempfn_random(i->final_path, NULL, &f);
+        r = tempfn_random(p->final_path, NULL, &f);
         if (r < 0)
                 return log_oom();
 
@@ -262,32 +262,32 @@ static int raw_pull_maybe_convert_qcow2(RawPull *i) {
 
         log_info("Unpacking QCOW2 file.");
 
-        r = qcow2_convert(i->raw_job->disk_fd, converted_fd);
+        r = qcow2_convert(p->raw_job->disk_fd, converted_fd);
         if (r < 0)
                 return log_error_errno(r, "Failed to convert qcow2 image: %m");
 
-        unlink_and_free(i->temp_path);
-        i->temp_path = TAKE_PTR(t);
-        close_and_replace(i->raw_job->disk_fd, converted_fd);
+        unlink_and_free(p->temp_path);
+        p->temp_path = TAKE_PTR(t);
+        close_and_replace(p->raw_job->disk_fd, converted_fd);
 
         return 1;
 }
 
 static int raw_pull_determine_path(
-                RawPull *i,
+                RawPull *p,
                 const char *suffix,
                 char **field /* input + output (!) */) {
         int r;
 
-        assert(i);
+        assert(p);
         assert(field);
 
         if (*field)
                 return 0;
 
-        assert(i->raw_job);
+        assert(p->raw_job);
 
-        r = pull_make_path(i->raw_job->url, i->raw_job->etag, i->image_root, ".raw-", suffix, field);
+        r = pull_make_path(p->raw_job->url, p->raw_job->etag, p->image_root, ".raw-", suffix, field);
         if (r < 0)
                 return log_oom();
 
@@ -295,38 +295,38 @@ static int raw_pull_determine_path(
 }
 
 static int raw_pull_copy_auxiliary_file(
-                RawPull *i,
+                RawPull *p,
                 const char *suffix,
                 char **path /* input + output (!) */) {
 
         _cleanup_free_ char *local = NULL;
         int r;
 
-        assert(i);
+        assert(p);
         assert(suffix);
         assert(path);
 
-        r = raw_pull_determine_path(i, suffix, path);
+        r = raw_pull_determine_path(p, suffix, path);
         if (r < 0)
                 return r;
 
-        local = strjoin(i->image_root, "/", i->local, suffix);
+        local = strjoin(p->image_root, "/", p->local, suffix);
         if (!local)
                 return log_oom();
 
-        if (FLAGS_SET(i->flags, IMPORT_PULL_KEEP_DOWNLOAD))
+        if (FLAGS_SET(p->flags, IMPORT_PULL_KEEP_DOWNLOAD))
                 r = copy_file_atomic(
                                 *path,
                                 local,
                                 0644,
                                 COPY_REFLINK |
-                                (FLAGS_SET(i->flags, IMPORT_FORCE) ? COPY_REPLACE : 0) |
-                                (FLAGS_SET(i->flags, IMPORT_SYNC) ? COPY_FSYNC_FULL : 0));
+                                (FLAGS_SET(p->flags, IMPORT_FORCE) ? COPY_REPLACE : 0) |
+                                (FLAGS_SET(p->flags, IMPORT_SYNC) ? COPY_FSYNC_FULL : 0));
         else
                 r = install_file(AT_FDCWD, *path,
                                  AT_FDCWD, local,
-                                 (i->flags & IMPORT_FORCE ? INSTALL_REPLACE : 0) |
-                                 (i->flags & IMPORT_SYNC ? INSTALL_SYNCFS : 0));
+                                 (p->flags & IMPORT_FORCE ? INSTALL_REPLACE : 0) |
+                                 (p->flags & IMPORT_SYNC ? INSTALL_SYNCFS : 0));
         if (r == -EEXIST)
                 log_warning_errno(r, "File %s already exists, not replacing.", local);
         else if (r == -ENOENT)
@@ -339,46 +339,46 @@ static int raw_pull_copy_auxiliary_file(
         return 0;
 }
 
-static int raw_pull_make_local_copy(RawPull *i) {
+static int raw_pull_make_local_copy(RawPull *p) {
         _cleanup_(unlink_and_freep) char *tp = NULL;
-        _cleanup_free_ char *p = NULL;
+        _cleanup_free_ char *path = NULL;
         int r;
 
-        assert(i);
-        assert(i->raw_job);
-        assert(!FLAGS_SET(i->flags, IMPORT_DIRECT));
+        assert(p);
+        assert(p->raw_job);
+        assert(!FLAGS_SET(p->flags, IMPORT_DIRECT));
 
-        if (!i->local)
+        if (!p->local)
                 return 0;
 
-        if (i->raw_job->etag_exists) {
+        if (p->raw_job->etag_exists) {
                 /* We have downloaded this one previously, reopen it */
 
-                assert(i->raw_job->disk_fd < 0);
+                assert(p->raw_job->disk_fd < 0);
 
-                i->raw_job->disk_fd = open(i->final_path, O_RDONLY|O_NOCTTY|O_CLOEXEC);
-                if (i->raw_job->disk_fd < 0)
+                p->raw_job->disk_fd = open(p->final_path, O_RDONLY|O_NOCTTY|O_CLOEXEC);
+                if (p->raw_job->disk_fd < 0)
                         return log_error_errno(errno, "Failed to open vendor image: %m");
         } else {
                 /* We freshly downloaded the image, use it */
 
-                assert(i->raw_job->disk_fd >= 0);
-                assert(i->offset == UINT64_MAX);
+                assert(p->raw_job->disk_fd >= 0);
+                assert(p->offset == UINT64_MAX);
 
-                if (lseek(i->raw_job->disk_fd, 0, SEEK_SET) < 0)
+                if (lseek(p->raw_job->disk_fd, 0, SEEK_SET) < 0)
                         return log_error_errno(errno, "Failed to seek to beginning of vendor image: %m");
         }
 
-        p = strjoin(i->image_root, "/", i->local, ".raw");
-        if (!p)
+        path = strjoin(p->image_root, "/", p->local, ".raw");
+        if (!path)
                 return log_oom();
 
         const char *source;
-        if (FLAGS_SET(i->flags, IMPORT_PULL_KEEP_DOWNLOAD)) {
+        if (FLAGS_SET(p->flags, IMPORT_PULL_KEEP_DOWNLOAD)) {
                 _cleanup_close_ int dfd = -EBADF;
                 _cleanup_free_ char *f = NULL;
 
-                r = tempfn_random(p, NULL, &f);
+                r = tempfn_random(path, NULL, &f);
                 if (r < 0)
                         return log_oom();
 
@@ -392,51 +392,51 @@ static int raw_pull_make_local_copy(RawPull *i) {
                  * since it reduces fragmentation caused by not allowing in-place writes. */
                 (void) import_set_nocow_and_log(dfd, tp);
 
-                r = copy_bytes(i->raw_job->disk_fd, dfd, UINT64_MAX, COPY_REFLINK);
+                r = copy_bytes(p->raw_job->disk_fd, dfd, UINT64_MAX, COPY_REFLINK);
                 if (r < 0)
                         return log_error_errno(r, "Failed to make writable copy of image: %m");
 
-                (void) copy_times(i->raw_job->disk_fd, dfd, COPY_CRTIME);
-                (void) copy_xattr(i->raw_job->disk_fd, NULL, dfd, NULL, 0);
+                (void) copy_times(p->raw_job->disk_fd, dfd, COPY_CRTIME);
+                (void) copy_xattr(p->raw_job->disk_fd, NULL, dfd, NULL, 0);
 
                 dfd = safe_close(dfd);
 
                 source = tp;
         } else
-                source = i->final_path;
+                source = p->final_path;
 
         r = install_file(AT_FDCWD, source,
-                         AT_FDCWD, p,
-                         (i->flags & IMPORT_FORCE ? INSTALL_REPLACE : 0) |
-                         (i->flags & IMPORT_READ_ONLY ? INSTALL_READ_ONLY : 0) |
-                         (i->flags & IMPORT_SYNC ? INSTALL_FSYNC_FULL : 0));
+                         AT_FDCWD, path,
+                         (p->flags & IMPORT_FORCE ? INSTALL_REPLACE : 0) |
+                         (p->flags & IMPORT_READ_ONLY ? INSTALL_READ_ONLY : 0) |
+                         (p->flags & IMPORT_SYNC ? INSTALL_FSYNC_FULL : 0));
         if (r < 0)
-                return log_error_errno(r, "Failed to move local image into place '%s': %m", p);
+                return log_error_errno(r, "Failed to move local image into place '%s': %m", path);
 
         tp = mfree(tp);
 
-        log_info("Created new local image '%s'.", i->local);
+        log_info("Created new local image '%s'.", p->local);
 
-        if (FLAGS_SET(i->flags, IMPORT_PULL_SETTINGS)) {
-                r = raw_pull_copy_auxiliary_file(i, ".nspawn", &i->settings_path);
+        if (FLAGS_SET(p->flags, IMPORT_PULL_SETTINGS)) {
+                r = raw_pull_copy_auxiliary_file(p, ".nspawn", &p->settings_path);
                 if (r < 0)
                         return r;
         }
 
-        if (FLAGS_SET(i->flags, IMPORT_PULL_ROOTHASH)) {
-                r = raw_pull_copy_auxiliary_file(i, ".roothash", &i->roothash_path);
+        if (FLAGS_SET(p->flags, IMPORT_PULL_ROOTHASH)) {
+                r = raw_pull_copy_auxiliary_file(p, ".roothash", &p->roothash_path);
                 if (r < 0)
                         return r;
         }
 
-        if (FLAGS_SET(i->flags, IMPORT_PULL_ROOTHASH_SIGNATURE)) {
-                r = raw_pull_copy_auxiliary_file(i, ".roothash.p7s", &i->roothash_signature_path);
+        if (FLAGS_SET(p->flags, IMPORT_PULL_ROOTHASH_SIGNATURE)) {
+                r = raw_pull_copy_auxiliary_file(p, ".roothash.p7s", &p->roothash_signature_path);
                 if (r < 0)
                         return r;
         }
 
-        if (FLAGS_SET(i->flags, IMPORT_PULL_VERITY)) {
-                r = raw_pull_copy_auxiliary_file(i, ".verity", &i->verity_path);
+        if (FLAGS_SET(p->flags, IMPORT_PULL_VERITY)) {
+                r = raw_pull_copy_auxiliary_file(p, ".verity", &p->verity_path);
                 if (r < 0)
                         return r;
         }
@@ -444,37 +444,37 @@ static int raw_pull_make_local_copy(RawPull *i) {
         return 0;
 }
 
-static bool raw_pull_is_done(RawPull *i) {
-        assert(i);
-        assert(i->raw_job);
+static bool raw_pull_is_done(RawPull *p) {
+        assert(p);
+        assert(p->raw_job);
 
-        if (!PULL_JOB_IS_COMPLETE(i->raw_job))
+        if (!PULL_JOB_IS_COMPLETE(p->raw_job))
                 return false;
-        if (i->checksum_job && !PULL_JOB_IS_COMPLETE(i->checksum_job))
+        if (p->checksum_job && !PULL_JOB_IS_COMPLETE(p->checksum_job))
                 return false;
-        if (i->signature_job && !PULL_JOB_IS_COMPLETE(i->signature_job))
+        if (p->signature_job && !PULL_JOB_IS_COMPLETE(p->signature_job))
                 return false;
-        if (i->settings_job && !PULL_JOB_IS_COMPLETE(i->settings_job))
+        if (p->settings_job && !PULL_JOB_IS_COMPLETE(p->settings_job))
                 return false;
-        if (i->roothash_job && !PULL_JOB_IS_COMPLETE(i->roothash_job))
+        if (p->roothash_job && !PULL_JOB_IS_COMPLETE(p->roothash_job))
                 return false;
-        if (i->roothash_signature_job && !PULL_JOB_IS_COMPLETE(i->roothash_signature_job))
+        if (p->roothash_signature_job && !PULL_JOB_IS_COMPLETE(p->roothash_signature_job))
                 return false;
-        if (i->verity_job && !PULL_JOB_IS_COMPLETE(i->verity_job))
+        if (p->verity_job && !PULL_JOB_IS_COMPLETE(p->verity_job))
                 return false;
 
         return true;
 }
 
 static int raw_pull_rename_auxiliary_file(
-                RawPull *i,
+                RawPull *p,
                 const char *suffix,
                 char **temp_path,
                 char **path) {
 
         int r;
 
-        assert(i);
+        assert(p);
         assert(path);
         assert(temp_path);
         assert(*temp_path);
@@ -483,7 +483,7 @@ static int raw_pull_rename_auxiliary_file(
         /* Regenerate final name for this auxiliary file, we might know the etag of the file now, and we should
          * incorporate it in the file name if we can */
         *path = mfree(*path);
-        r = raw_pull_determine_path(i, suffix, path);
+        r = raw_pull_determine_path(p, suffix, path);
         if (r < 0)
                 return r;
 
@@ -491,7 +491,7 @@ static int raw_pull_rename_auxiliary_file(
                         AT_FDCWD, *temp_path,
                         AT_FDCWD, *path,
                         INSTALL_READ_ONLY|
-                        (i->flags & IMPORT_SYNC ? INSTALL_FSYNC_FULL : 0));
+                        (p->flags & IMPORT_SYNC ? INSTALL_FSYNC_FULL : 0));
         if (r < 0)
                 return log_error_errno(r, "Failed to move '%s' into place: %m", *path);
 
@@ -503,7 +503,7 @@ static void raw_pull_job_on_finished(PullJob *j) {
         int r;
 
         assert(j);
-        RawPull *i = ASSERT_PTR(j->userdata);
+        RawPull *p = ASSERT_PTR(j->userdata);
 
         if (j->error != 0) {
                 /* Only the main job and the checksum job are fatal if they fail. The other fails are just
@@ -511,24 +511,24 @@ static void raw_pull_job_on_finished(PullJob *j) {
                  * might not actually need it in case Suse style signatures are used, that are inline in the
                  * checksum file. */
 
-                if (j == i->raw_job) {
+                if (j == p->raw_job) {
                         if (j->error == ENOMEDIUM) /* HTTP 404 */
                                 r = log_error_errno(j->error, "Failed to retrieve image file. (Wrong URL?)");
                         else
                                 r = log_error_errno(j->error, "Failed to retrieve image file.");
                         goto finish;
-                } else if (j == i->checksum_job) {
+                } else if (j == p->checksum_job) {
                         r = log_error_errno(j->error, "Failed to retrieve SHA256 checksum, cannot verify. (Try --verify=no?)");
                         goto finish;
-                } else if (j == i->signature_job)
+                } else if (j == p->signature_job)
                         log_debug_errno(j->error, "Signature job for %s failed, proceeding for now.", j->url);
-                else if (j == i->settings_job)
+                else if (j == p->settings_job)
                         log_info_errno(j->error, "Settings file could not be retrieved, proceeding without.");
-                else if (j == i->roothash_job)
+                else if (j == p->roothash_job)
                         log_info_errno(j->error, "Root hash file could not be retrieved, proceeding without.");
-                else if (j == i->roothash_signature_job)
+                else if (j == p->roothash_signature_job)
                         log_info_errno(j->error, "Root hash signature file could not be retrieved, proceeding without.");
-                else if (j == i->verity_job)
+                else if (j == p->verity_job)
                         log_info_errno(j->error, "Verity integrity file could not be retrieved, proceeding without.");
                 else
                         assert_not_reached();
@@ -539,16 +539,16 @@ static void raw_pull_job_on_finished(PullJob *j) {
          *
          * We only do something when we got all files */
 
-        if (!raw_pull_is_done(i))
+        if (!raw_pull_is_done(p))
                 return;
 
-        if (i->signature_job && i->signature_job->error != 0) {
+        if (p->signature_job && p->signature_job->error != 0) {
                 VerificationStyle style;
                 PullJob *verify_job;
 
                 /* The signature job failed. Let's see if we actually need it */
 
-                verify_job = i->checksum_job ?: i->raw_job; /* if the checksum job doesn't exist this must be
+                verify_job = p->checksum_job ?: p->raw_job; /* if the checksum job doesn't exist this must be
                                                              * because the main job is the checksum file
                                                              * itself */
 
@@ -564,7 +564,7 @@ static void raw_pull_job_on_finished(PullJob *j) {
                                                             * in per-directory verification mode, since only
                                                             * then the signature is detached, and thus a file
                                                             * of its own. */
-                        r = log_error_errno(i->signature_job->error,
+                        r = log_error_errno(p->signature_job->error,
                                             "Failed to retrieve signature file, cannot verify. (Try --verify=no?)");
                         goto finish;
                 }
@@ -572,104 +572,104 @@ static void raw_pull_job_on_finished(PullJob *j) {
 
         PullJob *jj;
         /* Let's close these auxiliary files now, we don't need access to them anymore. */
-        FOREACH_ARGUMENT(jj, i->settings_job, i->roothash_job, i->roothash_signature_job, i->verity_job)
+        FOREACH_ARGUMENT(jj, p->settings_job, p->roothash_job, p->roothash_signature_job, p->verity_job)
                 pull_job_close_disk_fd(jj);
 
-        if (!i->raw_job->etag_exists) {
-                raw_pull_report_progress(i, RAW_VERIFYING);
-
-                r = pull_verify(i->verify,
-                                i->raw_job,
-                                i->checksum_job,
-                                i->signature_job,
-                                i->settings_job,
-                                i->roothash_job,
-                                i->roothash_signature_job,
-                                i->verity_job);
+        if (!p->raw_job->etag_exists) {
+                raw_pull_report_progress(p, RAW_VERIFYING);
+
+                r = pull_verify(p->verify,
+                                p->raw_job,
+                                p->checksum_job,
+                                p->signature_job,
+                                p->settings_job,
+                                p->roothash_job,
+                                p->roothash_signature_job,
+                                p->verity_job);
                 if (r < 0)
                         goto finish;
         }
 
-        if (i->flags & IMPORT_DIRECT) {
-                assert(!i->settings_job);
-                assert(!i->roothash_job);
-                assert(!i->roothash_signature_job);
-                assert(!i->verity_job);
+        if (p->flags & IMPORT_DIRECT) {
+                assert(!p->settings_job);
+                assert(!p->roothash_job);
+                assert(!p->roothash_signature_job);
+                assert(!p->verity_job);
 
-                raw_pull_report_progress(i, RAW_FINALIZING);
+                raw_pull_report_progress(p, RAW_FINALIZING);
 
-                if (i->local) {
-                        r = install_file(AT_FDCWD, i->local,
+                if (p->local) {
+                        r = install_file(AT_FDCWD, p->local,
                                          AT_FDCWD, NULL,
-                                         ((i->flags & IMPORT_READ_ONLY) && i->offset == UINT64_MAX ? INSTALL_READ_ONLY : 0) |
-                                         (i->flags & IMPORT_SYNC ? INSTALL_FSYNC_FULL : 0));
+                                         ((p->flags & IMPORT_READ_ONLY) && p->offset == UINT64_MAX ? INSTALL_READ_ONLY : 0) |
+                                         (p->flags & IMPORT_SYNC ? INSTALL_FSYNC_FULL : 0));
                         if (r < 0) {
-                                log_error_errno(r, "Failed to finalize raw file to '%s': %m", i->local);
+                                log_error_errno(r, "Failed to finalize raw file to '%s': %m", p->local);
                                 goto finish;
                         }
                 }
         } else {
-                r = raw_pull_determine_path(i, ".raw", &i->final_path);
+                r = raw_pull_determine_path(p, ".raw", &p->final_path);
                 if (r < 0)
                         goto finish;
 
-                if (!i->raw_job->etag_exists) {
+                if (!p->raw_job->etag_exists) {
                         /* This is a new download, verify it, and move it into place */
 
-                        assert(i->temp_path);
-                        assert(i->final_path);
+                        assert(p->temp_path);
+                        assert(p->final_path);
 
-                        raw_pull_report_progress(i, RAW_UNPACKING);
+                        raw_pull_report_progress(p, RAW_UNPACKING);
 
-                        r = raw_pull_maybe_convert_qcow2(i);
+                        r = raw_pull_maybe_convert_qcow2(p);
                         if (r < 0)
                                 goto finish;
 
-                        raw_pull_report_progress(i, RAW_FINALIZING);
+                        raw_pull_report_progress(p, RAW_FINALIZING);
 
-                        r = install_file(AT_FDCWD, i->temp_path,
-                                         AT_FDCWD, i->final_path,
-                                         (i->flags & IMPORT_PULL_KEEP_DOWNLOAD ? INSTALL_READ_ONLY : 0) |
-                                         (i->flags & IMPORT_SYNC ? INSTALL_FSYNC_FULL : 0));
+                        r = install_file(AT_FDCWD, p->temp_path,
+                                         AT_FDCWD, p->final_path,
+                                         (p->flags & IMPORT_PULL_KEEP_DOWNLOAD ? INSTALL_READ_ONLY : 0) |
+                                         (p->flags & IMPORT_SYNC ? INSTALL_FSYNC_FULL : 0));
                         if (r < 0) {
-                                log_error_errno(r, "Failed to move raw file to '%s': %m", i->final_path);
+                                log_error_errno(r, "Failed to move raw file to '%s': %m", p->final_path);
                                 goto finish;
                         }
 
-                        i->temp_path = mfree(i->temp_path);
+                        p->temp_path = mfree(p->temp_path);
 
-                        if (i->settings_job &&
-                            i->settings_job->error == 0) {
-                                r = raw_pull_rename_auxiliary_file(i, ".nspawn", &i->settings_temp_path, &i->settings_path);
+                        if (p->settings_job &&
+                            p->settings_job->error == 0) {
+                                r = raw_pull_rename_auxiliary_file(p, ".nspawn", &p->settings_temp_path, &p->settings_path);
                                 if (r < 0)
                                         goto finish;
                         }
 
-                        if (i->roothash_job &&
-                            i->roothash_job->error == 0) {
-                                r = raw_pull_rename_auxiliary_file(i, ".roothash", &i->roothash_temp_path, &i->roothash_path);
+                        if (p->roothash_job &&
+                            p->roothash_job->error == 0) {
+                                r = raw_pull_rename_auxiliary_file(p, ".roothash", &p->roothash_temp_path, &p->roothash_path);
                                 if (r < 0)
                                         goto finish;
                         }
 
-                        if (i->roothash_signature_job &&
-                            i->roothash_signature_job->error == 0) {
-                                r = raw_pull_rename_auxiliary_file(i, ".roothash.p7s", &i->roothash_signature_temp_path, &i->roothash_signature_path);
+                        if (p->roothash_signature_job &&
+                            p->roothash_signature_job->error == 0) {
+                                r = raw_pull_rename_auxiliary_file(p, ".roothash.p7s", &p->roothash_signature_temp_path, &p->roothash_signature_path);
                                 if (r < 0)
                                         goto finish;
                         }
 
-                        if (i->verity_job &&
-                            i->verity_job->error == 0) {
-                                r = raw_pull_rename_auxiliary_file(i, ".verity", &i->verity_temp_path, &i->verity_path);
+                        if (p->verity_job &&
+                            p->verity_job->error == 0) {
+                                r = raw_pull_rename_auxiliary_file(p, ".verity", &p->verity_temp_path, &p->verity_path);
                                 if (r < 0)
                                         goto finish;
                         }
                 }
 
-                raw_pull_report_progress(i, RAW_COPYING);
+                raw_pull_report_progress(p, RAW_COPYING);
 
-                r = raw_pull_make_local_copy(i);
+                r = raw_pull_make_local_copy(p);
                 if (r < 0)
                         goto finish;
         }
@@ -677,29 +677,29 @@ static void raw_pull_job_on_finished(PullJob *j) {
         r = 0;
 
 finish:
-        if (i->on_finished)
-                i->on_finished(i, r, i->userdata);
+        if (p->on_finished)
+                p->on_finished(p, r, p->userdata);
         else
-                sd_event_exit(i->event, r);
+                sd_event_exit(p->event, r);
 }
 
 static int raw_pull_job_on_open_disk_generic(
-                RawPull *i,
+                RawPull *p,
                 PullJob *j,
                 const char *extra,
                 char **temp_path /* input + output */) {
 
         int r;
 
-        assert(i);
+        assert(p);
         assert(j);
         assert(extra);
         assert(temp_path);
 
-        assert(!FLAGS_SET(i->flags, IMPORT_DIRECT));
+        assert(!FLAGS_SET(p->flags, IMPORT_DIRECT));
 
         if (!*temp_path) {
-                r = tempfn_random_child(i->image_root, extra, temp_path);
+                r = tempfn_random_child(p->image_root, extra, temp_path);
                 if (r < 0)
                         return log_oom();
         }
@@ -714,106 +714,106 @@ static int raw_pull_job_on_open_disk_generic(
 }
 
 static int raw_pull_job_on_open_disk_raw(PullJob *j) {
-        RawPull *i;
+        RawPull *p;
         int r;
 
         assert(j);
         assert(j->userdata);
 
-        i = j->userdata;
-        assert(i->raw_job == j);
+        p = j->userdata;
+        assert(p->raw_job == j);
         assert(j->disk_fd < 0);
 
-        if (i->flags & IMPORT_DIRECT) {
+        if (p->flags & IMPORT_DIRECT) {
 
-                if (!i->local) { /* If no local name specified, the pull job will write its data to stdout */
+                if (!p->local) { /* If no local name specified, the pull job will write its data to stdout */
                         j->disk_fd = STDOUT_FILENO;
                         j->close_disk_fd = false;
                         return 0;
                 }
 
-                (void) mkdir_parents_label(i->local, 0700);
+                (void) mkdir_parents_label(p->local, 0700);
 
-                j->disk_fd = open(i->local, O_RDWR|O_NOCTTY|O_CLOEXEC|(i->offset == UINT64_MAX ? O_TRUNC|O_CREAT : 0), 0664);
+                j->disk_fd = open(p->local, O_RDWR|O_NOCTTY|O_CLOEXEC|(p->offset == UINT64_MAX ? O_TRUNC|O_CREAT : 0), 0664);
                 if (j->disk_fd < 0)
-                        return log_error_errno(errno, "Failed to open destination '%s': %m", i->local);
+                        return log_error_errno(errno, "Failed to open destination '%s': %m", p->local);
 
-                if (i->offset == UINT64_MAX)
-                        (void) import_set_nocow_and_log(j->disk_fd, i->local);
+                if (p->offset == UINT64_MAX)
+                        (void) import_set_nocow_and_log(j->disk_fd, p->local);
 
         } else {
-                r = raw_pull_job_on_open_disk_generic(i, j, "raw", &i->temp_path);
+                r = raw_pull_job_on_open_disk_generic(p, j, "raw", &p->temp_path);
                 if (r < 0)
                         return r;
 
-                assert(i->offset == UINT64_MAX);
-                (void) import_set_nocow_and_log(j->disk_fd, i->temp_path);
+                assert(p->offset == UINT64_MAX);
+                (void) import_set_nocow_and_log(j->disk_fd, p->temp_path);
         }
 
         return 0;
 }
 
 static int raw_pull_job_on_open_disk_settings(PullJob *j) {
-        RawPull *i;
+        RawPull *p;
 
         assert(j);
         assert(j->userdata);
 
-        i = j->userdata;
-        assert(i->settings_job == j);
+        p = j->userdata;
+        assert(p->settings_job == j);
 
-        return raw_pull_job_on_open_disk_generic(i, j, "settings", &i->settings_temp_path);
+        return raw_pull_job_on_open_disk_generic(p, j, "settings", &p->settings_temp_path);
 }
 
 static int raw_pull_job_on_open_disk_roothash(PullJob *j) {
-        RawPull *i;
+        RawPull *p;
 
         assert(j);
         assert(j->userdata);
 
-        i = j->userdata;
-        assert(i->roothash_job == j);
+        p = j->userdata;
+        assert(p->roothash_job == j);
 
-        return raw_pull_job_on_open_disk_generic(i, j, "roothash", &i->roothash_temp_path);
+        return raw_pull_job_on_open_disk_generic(p, j, "roothash", &p->roothash_temp_path);
 }
 
 static int raw_pull_job_on_open_disk_roothash_signature(PullJob *j) {
-        RawPull *i;
+        RawPull *p;
 
         assert(j);
         assert(j->userdata);
 
-        i = j->userdata;
-        assert(i->roothash_signature_job == j);
+        p = j->userdata;
+        assert(p->roothash_signature_job == j);
 
-        return raw_pull_job_on_open_disk_generic(i, j, "roothash.p7s", &i->roothash_signature_temp_path);
+        return raw_pull_job_on_open_disk_generic(p, j, "roothash.p7s", &p->roothash_signature_temp_path);
 }
 
 static int raw_pull_job_on_open_disk_verity(PullJob *j) {
-        RawPull *i;
+        RawPull *p;
 
         assert(j);
         assert(j->userdata);
 
-        i = j->userdata;
-        assert(i->verity_job == j);
+        p = j->userdata;
+        assert(p->verity_job == j);
 
-        return raw_pull_job_on_open_disk_generic(i, j, "verity", &i->verity_temp_path);
+        return raw_pull_job_on_open_disk_generic(p, j, "verity", &p->verity_temp_path);
 }
 
 static void raw_pull_job_on_progress(PullJob *j) {
-        RawPull *i;
+        RawPull *p;
 
         assert(j);
         assert(j->userdata);
 
-        i = j->userdata;
+        p = j->userdata;
 
-        raw_pull_report_progress(i, RAW_DOWNLOADING);
+        raw_pull_report_progress(p, RAW_DOWNLOADING);
 }
 
 int raw_pull_start(
-                RawPull *i,
+                RawPull *p,
                 const char *url,
                 const char *local,
                 uint64_t offset,
@@ -824,7 +824,7 @@ int raw_pull_start(
 
         int r;
 
-        assert(i);
+        assert(p);
         assert(url);
         assert(verify == _IMPORT_VERIFY_INVALID || verify < _IMPORT_VERIFY_MAX);
         assert(verify == _IMPORT_VERIFY_INVALID || verify >= 0);
@@ -840,29 +840,29 @@ int raw_pull_start(
         if (local && !pull_validate_local(local, flags))
                 return -EINVAL;
 
-        if (i->raw_job)
+        if (p->raw_job)
                 return -EBUSY;
 
-        r = free_and_strdup(&i->local, local);
+        r = free_and_strdup(&p->local, local);
         if (r < 0)
                 return r;
 
-        i->flags = flags;
-        i->verify = verify;
+        p->flags = flags;
+        p->verify = verify;
 
         /* Queue job for the image itself */
-        r = pull_job_new(&i->raw_job, url, i->glue, i);
+        r = pull_job_new(&p->raw_job, url, p->glue, p);
         if (r < 0)
                 return r;
 
-        i->raw_job->on_finished = raw_pull_job_on_finished;
-        i->raw_job->on_open_disk = raw_pull_job_on_open_disk_raw;
+        p->raw_job->on_finished = raw_pull_job_on_finished;
+        p->raw_job->on_open_disk = raw_pull_job_on_open_disk_raw;
 
         if (iovec_is_set(checksum)) {
-                if (!iovec_memdup(checksum, &i->raw_job->expected_checksum))
+                if (!iovec_memdup(checksum, &p->raw_job->expected_checksum))
                         return -ENOMEM;
 
-                i->raw_job->calc_checksum = true;
+                p->raw_job->calc_checksum = true;
         } else if (verify != IMPORT_VERIFY_NO) {
                 /* Calculate checksum of the main download unless the users asks for a SHA256SUM file or its
                  * signature, which we let gpg verify instead. */
@@ -871,102 +871,102 @@ int raw_pull_start(
                 if (r < 0)
                         return r;
 
-                i->raw_job->calc_checksum = r;
-                i->raw_job->force_memory = !r; /* make sure this is both written to disk if that's
+                p->raw_job->calc_checksum = r;
+                p->raw_job->force_memory = !r; /* make sure this is both written to disk if that's
                                                 * requested and into memory, since we need to verify it */
         }
 
         if (size_max != UINT64_MAX)
-                i->raw_job->uncompressed_max = size_max;
+                p->raw_job->uncompressed_max = size_max;
         if (offset != UINT64_MAX)
-                i->raw_job->offset = i->offset = offset;
+                p->raw_job->offset = p->offset = offset;
 
         if (!FLAGS_SET(flags, IMPORT_DIRECT)) {
-                r = pull_find_old_etags(url, i->image_root, DT_REG, ".raw-", ".raw", &i->raw_job->old_etags);
+                r = pull_find_old_etags(url, p->image_root, DT_REG, ".raw-", ".raw", &p->raw_job->old_etags);
                 if (r < 0)
                         return r;
         }
 
         r = pull_make_verification_jobs(
-                        &i->checksum_job,
-                        &i->signature_job,
+                        &p->checksum_job,
+                        &p->signature_job,
                         verify,
                         url,
-                        i->glue,
+                        p->glue,
                         raw_pull_job_on_finished,
-                        i);
+                        p);
         if (r < 0)
                 return r;
 
         if (FLAGS_SET(flags, IMPORT_PULL_SETTINGS)) {
                 r = pull_make_auxiliary_job(
-                                &i->settings_job,
+                                &p->settings_job,
                                 url,
                                 raw_strip_suffixes,
                                 ".nspawn",
                                 verify,
-                                i->glue,
+                                p->glue,
                                 raw_pull_job_on_open_disk_settings,
                                 raw_pull_job_on_finished,
-                                i);
+                                p);
                 if (r < 0)
                         return r;
         }
 
         if (FLAGS_SET(flags, IMPORT_PULL_ROOTHASH)) {
                 r = pull_make_auxiliary_job(
-                                &i->roothash_job,
+                                &p->roothash_job,
                                 url,
                                 raw_strip_suffixes,
                                 ".roothash",
                                 verify,
-                                i->glue,
+                                p->glue,
                                 raw_pull_job_on_open_disk_roothash,
                                 raw_pull_job_on_finished,
-                                i);
+                                p);
                 if (r < 0)
                         return r;
         }
 
         if (FLAGS_SET(flags, IMPORT_PULL_ROOTHASH_SIGNATURE)) {
                 r = pull_make_auxiliary_job(
-                                &i->roothash_signature_job,
+                                &p->roothash_signature_job,
                                 url,
                                 raw_strip_suffixes,
                                 ".roothash.p7s",
                                 verify,
-                                i->glue,
+                                p->glue,
                                 raw_pull_job_on_open_disk_roothash_signature,
                                 raw_pull_job_on_finished,
-                                i);
+                                p);
                 if (r < 0)
                         return r;
         }
 
         if (FLAGS_SET(flags, IMPORT_PULL_VERITY)) {
                 r = pull_make_auxiliary_job(
-                                &i->verity_job,
+                                &p->verity_job,
                                 url,
                                 raw_strip_suffixes,
                                 ".verity",
                                 verify,
-                                i->glue,
+                                p->glue,
                                 raw_pull_job_on_open_disk_verity,
                                 raw_pull_job_on_finished,
-                                i);
+                                p);
                 if (r < 0)
                         return r;
         }
 
         PullJob *j;
         FOREACH_ARGUMENT(j,
-                         i->raw_job,
-                         i->checksum_job,
-                         i->signature_job,
-                         i->settings_job,
-                         i->roothash_job,
-                         i->roothash_signature_job,
-                         i->verity_job) {
+                         p->raw_job,
+                         p->checksum_job,
+                         p->signature_job,
+                         p->settings_job,
+                         p->roothash_job,
+                         p->roothash_signature_job,
+                         p->verity_job) {
 
                 if (!j)
                         continue;
index 0dbd4dcd20c73f9cee6b9737fb3764639bf93bd5..d927d927f89aaf3521ba68cf98d48c16c919eca7 100644 (file)
@@ -7,11 +7,11 @@
 
 typedef struct RawPull RawPull;
 
-typedef void (*RawPullFinished)(RawPull *pull, int error, void *userdata);
+typedef void (*RawPullFinished)(RawPull *p, int error, void *userdata);
 
-int raw_pull_new(RawPull **pull, sd_event *event, const char *image_root, RawPullFinished on_finished, void *userdata);
-RawPull* raw_pull_unref(RawPull *pull);
+int raw_pull_new(RawPull **ret, sd_event *event, const char *image_root, RawPullFinished on_finished, void *userdata);
+RawPull* raw_pull_unref(RawPull *p);
 
 DEFINE_TRIVIAL_CLEANUP_FUNC(RawPull*, raw_pull_unref);
 
-int raw_pull_start(RawPull *pull, const char *url, const char *local, uint64_t offset, uint64_t size_max, ImportFlags flags, ImportVerify verify, const struct iovec *checksum);
+int raw_pull_start(RawPull *p, const char *url, const char *local, uint64_t offset, uint64_t size_max, ImportFlags flags, ImportVerify verify, const struct iovec *checksum);
index 956fe7b993f8a0f34e9c0b81207241ccb43974be..d54c88a63939530cab3eb904411f7d7a482854f2 100644 (file)
@@ -70,35 +70,35 @@ typedef struct TarPull {
         RateLimit progress_ratelimit;
 } TarPull;
 
-TarPull* tar_pull_unref(TarPull *i) {
-        if (!i)
+TarPull* tar_pull_unref(TarPull *p) {
+        if (!p)
                 return NULL;
 
-        pidref_done_sigkill_wait(&i->tar_pid);
+        pidref_done_sigkill_wait(&p->tar_pid);
 
-        pull_job_unref(i->tar_job);
-        pull_job_unref(i->checksum_job);
-        pull_job_unref(i->signature_job);
-        pull_job_unref(i->settings_job);
+        pull_job_unref(p->tar_job);
+        pull_job_unref(p->checksum_job);
+        pull_job_unref(p->signature_job);
+        pull_job_unref(p->settings_job);
 
-        curl_glue_unref(i->glue);
-        sd_event_unref(i->event);
+        curl_glue_unref(p->glue);
+        sd_event_unref(p->event);
 
-        if (i->temp_path) {
-                import_remove_tree(i->temp_path, &i->userns_fd, i->flags);
-                free(i->temp_path);
+        if (p->temp_path) {
+                import_remove_tree(p->temp_path, &p->userns_fd, p->flags);
+                free(p->temp_path);
         }
-        unlink_and_free(i->settings_temp_path);
+        unlink_and_free(p->settings_temp_path);
 
-        free(i->final_path);
-        free(i->settings_path);
-        free(i->image_root);
-        free(i->local);
+        free(p->final_path);
+        free(p->settings_path);
+        free(p->image_root);
+        free(p->local);
 
-        safe_close(i->tree_fd);
-        safe_close(i->userns_fd);
+        safe_close(p->tree_fd);
+        safe_close(p->userns_fd);
 
-        return mfree(i);
+        return mfree(p);
 }
 
 int tar_pull_new(
@@ -110,7 +110,7 @@ int tar_pull_new(
 
         _cleanup_(curl_glue_unrefp) CurlGlue *g = NULL;
         _cleanup_(sd_event_unrefp) sd_event *e = NULL;
-        _cleanup_(tar_pull_unrefp) TarPull *i = NULL;
+        _cleanup_(tar_pull_unrefp) TarPull *p = NULL;
         _cleanup_free_ char *root = NULL;
         int r;
 
@@ -133,11 +133,11 @@ int tar_pull_new(
         if (r < 0)
                 return r;
 
-        i = new(TarPull, 1);
-        if (!i)
+        p = new(TarPull, 1);
+        if (!p)
                 return -ENOMEM;
 
-        *i = (TarPull) {
+        *p = (TarPull) {
                 .on_finished = on_finished,
                 .userdata = userdata,
                 .image_root = TAKE_PTR(root),
@@ -150,43 +150,43 @@ int tar_pull_new(
                 .progress_ratelimit = { 100 * USEC_PER_MSEC, 1 },
         };
 
-        i->glue->on_finished = pull_job_curl_on_finished;
-        i->glue->userdata = i;
+        p->glue->on_finished = pull_job_curl_on_finished;
+        p->glue->userdata = p;
 
-        *ret = TAKE_PTR(i);
+        *ret = TAKE_PTR(p);
 
         return 0;
 }
 
-static void tar_pull_report_progress(TarPull *i, TarProgress p) {
+static void tar_pull_report_progress(TarPull *p, TarProgress progress) {
         unsigned percent;
 
-        assert(i);
+        assert(p);
 
-        switch (p) {
+        switch (progress) {
 
         case TAR_DOWNLOADING: {
                 unsigned remain = 85;
 
                 percent = 0;
 
-                if (i->checksum_job) {
-                        percent += i->checksum_job->progress_percent * 5 / 100;
+                if (p->checksum_job) {
+                        percent += p->checksum_job->progress_percent * 5 / 100;
                         remain -= 5;
                 }
 
-                if (i->signature_job) {
-                        percent += i->signature_job->progress_percent * 5 / 100;
+                if (p->signature_job) {
+                        percent += p->signature_job->progress_percent * 5 / 100;
                         remain -= 5;
                 }
 
-                if (i->settings_job) {
-                        percent += i->settings_job->progress_percent * 5 / 100;
+                if (p->settings_job) {
+                        percent += p->settings_job->progress_percent * 5 / 100;
                         remain -= 5;
                 }
 
-                if (i->tar_job)
-                        percent += i->tar_job->progress_percent * remain / 100;
+                if (p->tar_job)
+                        percent += p->tar_job->progress_percent * remain / 100;
                 break;
         }
 
@@ -206,10 +206,10 @@ static void tar_pull_report_progress(TarPull *i, TarProgress p) {
                 assert_not_reached();
         }
 
-        if (percent == i->last_percent)
+        if (percent == p->last_percent)
                 return;
 
-        if (!ratelimit_below(&i->progress_ratelimit))
+        if (!ratelimit_below(&p->progress_ratelimit))
                 return;
 
         sd_notifyf(false, "X_IMPORT_PROGRESS=%u%%", percent);
@@ -219,81 +219,81 @@ static void tar_pull_report_progress(TarPull *i, TarProgress p) {
 
         log_debug("Combined progress %u%%", percent);
 
-        i->last_percent = percent;
+        p->last_percent = percent;
 }
 
 static int tar_pull_determine_path(
-                TarPull *i,
+                TarPull *p,
                 const char *suffix,
                 char **field /* input + output (!) */) {
         int r;
 
-        assert(i);
+        assert(p);
         assert(field);
 
         if (*field)
                 return 0;
 
-        assert(i->tar_job);
+        assert(p->tar_job);
 
-        r = pull_make_path(i->tar_job->url, i->tar_job->etag, i->image_root, ".tar-", suffix, field);
+        r = pull_make_path(p->tar_job->url, p->tar_job->etag, p->image_root, ".tar-", suffix, field);
         if (r < 0)
                 return log_oom();
 
         return 1;
 }
 
-static int tar_pull_make_local_copy(TarPull *i) {
+static int tar_pull_make_local_copy(TarPull *p) {
         _cleanup_(rm_rf_subvolume_and_freep) char *t = NULL;
-        _cleanup_free_ char *p = NULL;
+        _cleanup_free_ char *path = NULL;
         const char *source;
         int r;
 
-        assert(i);
-        assert(i->tar_job);
+        assert(p);
+        assert(p->tar_job);
 
-        if (!i->local)
+        if (!p->local)
                 return 0;
 
         /* Creates a copy/clone of the original downloaded version (which is supposed to remain untouched)
          * under a local image name (which may then be modified) */
 
-        assert(i->final_path);
+        assert(p->final_path);
 
-        p = path_join(i->image_root, i->local);
-        if (!p)
+        path = path_join(p->image_root, p->local);
+        if (!path)
                 return log_oom();
 
-        if (FLAGS_SET(i->flags, IMPORT_PULL_KEEP_DOWNLOAD)) {
-                r = tempfn_random(p, NULL, &t);
+        if (FLAGS_SET(p->flags, IMPORT_PULL_KEEP_DOWNLOAD)) {
+                r = tempfn_random(path, NULL, &t);
                 if (r < 0)
-                        return log_error_errno(r, "Failed to generate temporary filename for %s: %m", p);
+                        return log_error_errno(r, "Failed to generate temporary filename for %s: %m", path);
 
-                if (FLAGS_SET(i->flags, IMPORT_FOREIGN_UID)) {
+                if (FLAGS_SET(p->flags, IMPORT_FOREIGN_UID)) {
                         /* Copy in userns */
 
-                        r = import_make_foreign_userns(&i->userns_fd);
+                        r = import_make_foreign_userns(&p->userns_fd);
                         if (r < 0)
                                 return r;
 
                         /* Usually, tar_pull_job_on_open_disk_tar() would allocate ->tree_fd for us, but if
                          * already downloaded the image before, and are just making a copy of the original
                          * download, we need to open ->tree_fd now */
-                        if (i->tree_fd < 0) {
-                                _cleanup_close_ int directory_fd = open(i->final_path, O_DIRECTORY|O_CLOEXEC);
+                        if (p->tree_fd < 0) {
+                                _cleanup_close_ int directory_fd = open(p->final_path, O_DIRECTORY|O_CLOEXEC);
                                 if (directory_fd < 0)
-                                        return log_error_errno(errno, "Failed to open '%s': %m", i->final_path);
+                                        return log_error_errno(errno, "Failed to open '%s': %m", p->final_path);
 
                                 struct stat st;
                                 if (fstat(directory_fd, &st) < 0)
-                                        return log_error_errno(errno, "Failed to stat '%s': %m", i->final_path);
+                                        return log_error_errno(errno, "Failed to stat '%s': %m", p->final_path);
 
                                 if (uid_is_foreign(st.st_uid)) {
-                                        r = mountfsd_mount_directory_fd(directory_fd, i->userns_fd, DISSECT_IMAGE_FOREIGN_UID, &i->tree_fd);
+                                        r = mountfsd_mount_directory_fd(directory_fd, p->userns_fd, DISSECT_IMAGE_FOREIGN_UID, &p->tree_fd);
                                         if (r < 0)
                                                 return r;
                                 } else
-                                        i->tree_fd = TAKE_FD(directory_fd);
+                                        p->tree_fd = TAKE_FD(directory_fd);
                         }
 
                         _cleanup_close_ int directory_fd = -EBADF;
@@ -302,71 +302,71 @@ static int tar_pull_make_local_copy(TarPull *i) {
                                 return r;
 
                         _cleanup_close_ int copy_fd = -EBADF;
-                        r = mountfsd_mount_directory_fd(directory_fd, i->userns_fd, DISSECT_IMAGE_FOREIGN_UID, &copy_fd);
+                        r = mountfsd_mount_directory_fd(directory_fd, p->userns_fd, DISSECT_IMAGE_FOREIGN_UID, &copy_fd);
                         if (r < 0)
                                 return r;
 
-                        r = import_copy_foreign(i->tree_fd, copy_fd, &i->userns_fd);
+                        r = import_copy_foreign(p->tree_fd, copy_fd, &p->userns_fd);
                         if (r < 0)
                                 return r;
                 } else {
                         /* Copy locally */
-                        if (i->flags & IMPORT_BTRFS_SUBVOL)
+                        if (p->flags & IMPORT_BTRFS_SUBVOL)
                                 r = btrfs_subvol_snapshot_at(
-                                                AT_FDCWD, i->final_path,
+                                                AT_FDCWD, p->final_path,
                                                 AT_FDCWD, t,
-                                                (i->flags & IMPORT_BTRFS_QUOTA ? BTRFS_SNAPSHOT_QUOTA : 0)|
+                                                (p->flags & IMPORT_BTRFS_QUOTA ? BTRFS_SNAPSHOT_QUOTA : 0)|
                                                 BTRFS_SNAPSHOT_FALLBACK_COPY|
                                                 BTRFS_SNAPSHOT_FALLBACK_DIRECTORY|
                                                 BTRFS_SNAPSHOT_RECURSIVE);
                         else
-                                r = copy_tree(i->final_path, t, UID_INVALID, GID_INVALID, COPY_REFLINK|COPY_HARDLINKS, NULL, NULL);
+                                r = copy_tree(p->final_path, t, UID_INVALID, GID_INVALID, COPY_REFLINK|COPY_HARDLINKS, NULL, NULL);
                         if (r < 0)
                                 return log_error_errno(r, "Failed to create original download image: %m");
                 }
 
                 source = t;
         } else
-                source = i->final_path;
+                source = p->final_path;
 
         r = install_file(AT_FDCWD, source,
-                         AT_FDCWD, p,
-                         (i->flags & IMPORT_FORCE ? INSTALL_REPLACE : 0) |
-                         (i->flags & IMPORT_READ_ONLY ? INSTALL_READ_ONLY|INSTALL_GRACEFUL : 0) |
-                         (i->flags & IMPORT_SYNC ? INSTALL_SYNCFS|INSTALL_GRACEFUL : 0));
+                         AT_FDCWD, path,
+                         (p->flags & IMPORT_FORCE ? INSTALL_REPLACE : 0) |
+                         (p->flags & IMPORT_READ_ONLY ? INSTALL_READ_ONLY|INSTALL_GRACEFUL : 0) |
+                         (p->flags & IMPORT_SYNC ? INSTALL_SYNCFS|INSTALL_GRACEFUL : 0));
         if (r < 0)
-                return log_error_errno(r, "Failed to install local image '%s': %m", p);
+                return log_error_errno(r, "Failed to install local image '%s': %m", path);
 
         t = mfree(t);
 
         clear_progress_bar(/* prefix= */ NULL);
-        log_info("Created new local image '%s'.", i->local);
+        log_info("Created new local image '%s'.", p->local);
 
-        if (FLAGS_SET(i->flags, IMPORT_PULL_SETTINGS)) {
+        if (FLAGS_SET(p->flags, IMPORT_PULL_SETTINGS)) {
                 _cleanup_free_ char *local_settings = NULL;
-                assert(i->settings_job);
+                assert(p->settings_job);
 
-                r = tar_pull_determine_path(i, ".nspawn", &i->settings_path);
+                r = tar_pull_determine_path(p, ".nspawn", &p->settings_path);
                 if (r < 0)
                         return r;
 
-                local_settings = strjoin(i->image_root, "/", i->local, ".nspawn");
+                local_settings = strjoin(p->image_root, "/", p->local, ".nspawn");
                 if (!local_settings)
                         return log_oom();
 
-                if (FLAGS_SET(i->flags, IMPORT_PULL_KEEP_DOWNLOAD))
+                if (FLAGS_SET(p->flags, IMPORT_PULL_KEEP_DOWNLOAD))
                         r = copy_file_atomic(
-                                        i->settings_path,
+                                        p->settings_path,
                                         local_settings,
                                         0664,
                                         COPY_REFLINK |
-                                        (FLAGS_SET(i->flags, IMPORT_FORCE) ? COPY_REPLACE : 0) |
-                                        (FLAGS_SET(i->flags, IMPORT_SYNC) ? COPY_FSYNC_FULL : 0));
+                                        (FLAGS_SET(p->flags, IMPORT_FORCE) ? COPY_REPLACE : 0) |
+                                        (FLAGS_SET(p->flags, IMPORT_SYNC) ? COPY_FSYNC_FULL : 0));
                 else
-                        r = install_file(AT_FDCWD, i->settings_path,
+                        r = install_file(AT_FDCWD, p->settings_path,
                                          AT_FDCWD, local_settings,
-                                         (i->flags & IMPORT_FORCE ? INSTALL_REPLACE : 0) |
-                                         (i->flags & IMPORT_SYNC ? INSTALL_SYNCFS : 0));
+                                         (p->flags & IMPORT_FORCE ? INSTALL_REPLACE : 0) |
+                                         (p->flags & IMPORT_SYNC ? INSTALL_SYNCFS : 0));
                 if (r == -EEXIST)
                         log_warning_errno(r, "Settings file %s already exists, not replacing.", local_settings);
                 else if (r == -ENOENT)
@@ -380,17 +380,17 @@ static int tar_pull_make_local_copy(TarPull *i) {
         return 0;
 }
 
-static bool tar_pull_is_done(TarPull *i) {
-        assert(i);
-        assert(i->tar_job);
+static bool tar_pull_is_done(TarPull *p) {
+        assert(p);
+        assert(p->tar_job);
 
-        if (!PULL_JOB_IS_COMPLETE(i->tar_job))
+        if (!PULL_JOB_IS_COMPLETE(p->tar_job))
                 return false;
-        if (i->checksum_job && !PULL_JOB_IS_COMPLETE(i->checksum_job))
+        if (p->checksum_job && !PULL_JOB_IS_COMPLETE(p->checksum_job))
                 return false;
-        if (i->signature_job && !PULL_JOB_IS_COMPLETE(i->signature_job))
+        if (p->signature_job && !PULL_JOB_IS_COMPLETE(p->signature_job))
                 return false;
-        if (i->settings_job && !PULL_JOB_IS_COMPLETE(i->settings_job))
+        if (p->settings_job && !PULL_JOB_IS_COMPLETE(p->settings_job))
                 return false;
 
         return true;
@@ -400,23 +400,23 @@ static void tar_pull_job_on_finished(PullJob *j) {
         int r;
 
         assert(j);
-        TarPull *i = ASSERT_PTR(j->userdata);
+        TarPull *p = ASSERT_PTR(j->userdata);
 
         if (j->error != 0) {
                 clear_progress_bar(/* prefix= */ NULL);
 
-                if (j == i->tar_job) {
+                if (j == p->tar_job) {
                         if (j->error == ENOMEDIUM) /* HTTP 404 */
                                 r = log_error_errno(j->error, "Failed to retrieve image file. (Wrong URL?)");
                         else
                                 r = log_error_errno(j->error, "Failed to retrieve image file.");
                         goto finish;
-                } else if (j == i->checksum_job) {
+                } else if (j == p->checksum_job) {
                         r = log_error_errno(j->error, "Failed to retrieve SHA256 checksum, cannot verify. (Try --verify=no?)");
                         goto finish;
-                } else if (j == i->signature_job)
+                } else if (j == p->signature_job)
                         log_debug_errno(j->error, "Signature job for %s failed, proceeding for now.", j->url);
-                else if (j == i->settings_job)
+                else if (j == p->settings_job)
                         log_info_errno(j->error, "Settings file could not be retrieved, proceeding without.");
                 else
                         assert("unexpected job");
@@ -425,15 +425,15 @@ static void tar_pull_job_on_finished(PullJob *j) {
         /* This is invoked if either the download completed successfully, or the download was skipped because
          * we already have the etag. */
 
-        if (!tar_pull_is_done(i))
+        if (!tar_pull_is_done(p))
                 return;
 
-        if (i->signature_job && i->signature_job->error != 0) {
+        if (p->signature_job && p->signature_job->error != 0) {
                 VerificationStyle style;
 
-                assert(i->checksum_job);
+                assert(p->checksum_job);
 
-                r = verification_style_from_url(i->checksum_job->url, &style);
+                r = verification_style_from_url(p->checksum_job->url, &style);
                 if (r < 0) {
                         log_error_errno(r, "Failed to determine verification style from checksum URL: %m");
                         goto finish;
@@ -443,37 +443,37 @@ static void tar_pull_job_on_finished(PullJob *j) {
                                                             * in per-directory verification mode, since only
                                                             * then the signature is detached, and thus a file
                                                             * of its own. */
-                        r = log_error_errno(i->signature_job->error,
+                        r = log_error_errno(p->signature_job->error,
                                             "Failed to retrieve signature file, cannot verify. (Try --verify=no?)");
                         goto finish;
                 }
         }
 
-        pull_job_close_disk_fd(i->tar_job);
-        pull_job_close_disk_fd(i->settings_job);
+        pull_job_close_disk_fd(p->tar_job);
+        pull_job_close_disk_fd(p->settings_job);
 
-        if (pidref_is_set(&i->tar_pid)) {
-                r = pidref_wait_for_terminate_and_check("tar", &i->tar_pid, WAIT_LOG);
+        if (pidref_is_set(&p->tar_pid)) {
+                r = pidref_wait_for_terminate_and_check("tar", &p->tar_pid, WAIT_LOG);
                 if (r < 0)
                         goto finish;
-                pidref_done(&i->tar_pid);
+                pidref_done(&p->tar_pid);
                 if (r != EXIT_SUCCESS) {
                         r = -EIO;
                         goto finish;
                 }
         }
 
-        if (!i->tar_job->etag_exists) {
+        if (!p->tar_job->etag_exists) {
                 /* This is a new download, verify it, and move it into place */
 
-                tar_pull_report_progress(i, TAR_VERIFYING);
+                tar_pull_report_progress(p, TAR_VERIFYING);
 
                 clear_progress_bar(/* prefix= */ NULL);
-                r = pull_verify(i->verify,
-                                i->tar_job,
-                                i->checksum_job,
-                                i->signature_job,
-                                i->settings_job,
+                r = pull_verify(p->verify,
+                                p->tar_job,
+                                p->checksum_job,
+                                p->signature_job,
+                                p->settings_job,
                                 /* roothash_job = */ NULL,
                                 /* roothash_signature_job = */ NULL,
                                 /* verity_job = */ NULL);
@@ -481,87 +481,87 @@ static void tar_pull_job_on_finished(PullJob *j) {
                         goto finish;
         }
 
-        if (i->flags & IMPORT_DIRECT) {
-                assert(!i->settings_job);
-                assert(i->local);
-                assert(!i->temp_path);
+        if (p->flags & IMPORT_DIRECT) {
+                assert(!p->settings_job);
+                assert(p->local);
+                assert(!p->temp_path);
 
-                tar_pull_report_progress(i, TAR_FINALIZING);
+                tar_pull_report_progress(p, TAR_FINALIZING);
 
-                r = import_mangle_os_tree_fd(i->tree_fd, i->userns_fd, i->flags);
+                r = import_mangle_os_tree_fd(p->tree_fd, p->userns_fd, p->flags);
                 if (r < 0)
                         goto finish;
 
                 r = install_file(
-                                AT_FDCWD, i->local,
+                                AT_FDCWD, p->local,
                                 AT_FDCWD, NULL,
-                                (i->flags & IMPORT_READ_ONLY ? INSTALL_READ_ONLY|INSTALL_GRACEFUL : 0) |
-                                (i->flags & IMPORT_SYNC ? INSTALL_SYNCFS|INSTALL_GRACEFUL : 0));
+                                (p->flags & IMPORT_READ_ONLY ? INSTALL_READ_ONLY|INSTALL_GRACEFUL : 0) |
+                                (p->flags & IMPORT_SYNC ? INSTALL_SYNCFS|INSTALL_GRACEFUL : 0));
                 if (r < 0) {
-                        log_error_errno(r, "Failed to finalize '%s': %m", i->local);
+                        log_error_errno(r, "Failed to finalize '%s': %m", p->local);
                         goto finish;
                 }
         } else {
-                r = tar_pull_determine_path(i, NULL, &i->final_path);
+                r = tar_pull_determine_path(p, NULL, &p->final_path);
                 if (r < 0)
                         goto finish;
 
-                if (!i->tar_job->etag_exists) {
+                if (!p->tar_job->etag_exists) {
                         /* This is a new download, verify it, and move it into place */
 
-                        assert(i->temp_path);
-                        assert(i->final_path);
+                        assert(p->temp_path);
+                        assert(p->final_path);
 
-                        tar_pull_report_progress(i, TAR_FINALIZING);
+                        tar_pull_report_progress(p, TAR_FINALIZING);
 
-                        r = import_mangle_os_tree_fd(i->tree_fd, i->userns_fd, i->flags);
+                        r = import_mangle_os_tree_fd(p->tree_fd, p->userns_fd, p->flags);
                         if (r < 0)
                                 goto finish;
 
                         r = install_file(
-                                        AT_FDCWD, i->temp_path,
-                                        AT_FDCWD, i->final_path,
-                                        (i->flags & IMPORT_PULL_KEEP_DOWNLOAD ? INSTALL_READ_ONLY|INSTALL_GRACEFUL : 0) |
-                                        (i->flags & IMPORT_SYNC ? INSTALL_SYNCFS|INSTALL_GRACEFUL : 0));
+                                        AT_FDCWD, p->temp_path,
+                                        AT_FDCWD, p->final_path,
+                                        (p->flags & IMPORT_PULL_KEEP_DOWNLOAD ? INSTALL_READ_ONLY|INSTALL_GRACEFUL : 0) |
+                                        (p->flags & IMPORT_SYNC ? INSTALL_SYNCFS|INSTALL_GRACEFUL : 0));
                         if (r < 0) {
-                                log_error_errno(r, "Failed to rename to final image name to %s: %m", i->final_path);
+                                log_error_errno(r, "Failed to rename to final image name to %s: %m", p->final_path);
                                 goto finish;
                         }
 
-                        i->temp_path = mfree(i->temp_path);
+                        p->temp_path = mfree(p->temp_path);
 
-                        if (i->settings_job &&
-                            i->settings_job->error == 0) {
+                        if (p->settings_job &&
+                            p->settings_job->error == 0) {
 
                                 /* Also move the settings file into place, if it exists. Note that we do so only if we also
                                  * moved the tar file in place, to keep things strictly in sync. */
-                                assert(i->settings_temp_path);
+                                assert(p->settings_temp_path);
 
                                 /* Regenerate final name for this auxiliary file, we might know the etag of the file now, and
                                  * we should incorporate it in the file name if we can */
-                                i->settings_path = mfree(i->settings_path);
+                                p->settings_path = mfree(p->settings_path);
 
-                                r = tar_pull_determine_path(i, ".nspawn", &i->settings_path);
+                                r = tar_pull_determine_path(p, ".nspawn", &p->settings_path);
                                 if (r < 0)
                                         goto finish;
 
                                 r = install_file(
-                                                AT_FDCWD, i->settings_temp_path,
-                                                AT_FDCWD, i->settings_path,
+                                                AT_FDCWD, p->settings_temp_path,
+                                                AT_FDCWD, p->settings_path,
                                                 INSTALL_READ_ONLY|INSTALL_GRACEFUL|
-                                                (i->flags & IMPORT_SYNC ? INSTALL_FSYNC_FULL : 0));
+                                                (p->flags & IMPORT_SYNC ? INSTALL_FSYNC_FULL : 0));
                                 if (r < 0) {
-                                        log_error_errno(r, "Failed to rename settings file to %s: %m", i->settings_path);
+                                        log_error_errno(r, "Failed to rename settings file to %s: %m", p->settings_path);
                                         goto finish;
                                 }
 
-                                i->settings_temp_path = mfree(i->settings_temp_path);
+                                p->settings_temp_path = mfree(p->settings_temp_path);
                         }
                 }
 
-                tar_pull_report_progress(i, TAR_COPYING);
+                tar_pull_report_progress(p, TAR_COPYING);
 
-                r = tar_pull_make_local_copy(i);
+                r = tar_pull_make_local_copy(p);
                 if (r < 0)
                         goto finish;
         }
@@ -569,10 +569,10 @@ static void tar_pull_job_on_finished(PullJob *j) {
         r = 0;
 
 finish:
-        if (i->on_finished)
-                i->on_finished(i, r, i->userdata);
+        if (p->on_finished)
+                p->on_finished(p, r, p->userdata);
         else
-                sd_event_exit(i->event, r);
+                sd_event_exit(p->event, r);
 }
 
 static int tar_pull_job_on_open_disk_tar(PullJob *j) {
@@ -581,30 +581,30 @@ static int tar_pull_job_on_open_disk_tar(PullJob *j) {
 
         assert(j);
 
-        TarPull *i = ASSERT_PTR(j->userdata);
-        assert(i->tar_job == j);
-        assert(!pidref_is_set(&i->tar_pid));
-        assert(i->tree_fd < 0);
+        TarPull *p = ASSERT_PTR(j->userdata);
+        assert(p->tar_job == j);
+        assert(!pidref_is_set(&p->tar_pid));
+        assert(p->tree_fd < 0);
 
-        if (i->flags & IMPORT_DIRECT)
-                where = i->local;
+        if (p->flags & IMPORT_DIRECT)
+                where = p->local;
         else {
-                if (!i->temp_path) {
-                        r = tempfn_random_child(i->image_root, "tar", &i->temp_path);
+                if (!p->temp_path) {
+                        r = tempfn_random_child(p->image_root, "tar", &p->temp_path);
                         if (r < 0)
                                 return log_oom();
                 }
 
-                where = i->temp_path;
+                where = p->temp_path;
         }
 
         (void) mkdir_parents_label(where, 0700);
 
-        if (FLAGS_SET(i->flags, IMPORT_DIRECT|IMPORT_FORCE))
+        if (FLAGS_SET(p->flags, IMPORT_DIRECT|IMPORT_FORCE))
                 (void) rm_rf(where, REMOVE_ROOT|REMOVE_PHYSICAL|REMOVE_SUBVOLUME);
 
-        if (FLAGS_SET(i->flags, IMPORT_FOREIGN_UID)) {
-                r = import_make_foreign_userns(&i->userns_fd);
+        if (FLAGS_SET(p->flags, IMPORT_FOREIGN_UID)) {
+                r = import_make_foreign_userns(&p->userns_fd);
                 if (r < 0)
                         return r;
 
@@ -613,32 +613,32 @@ static int tar_pull_job_on_open_disk_tar(PullJob *j) {
                 if (r < 0)
                         return r;
 
-                r = mountfsd_mount_directory_fd(directory_fd, i->userns_fd, DISSECT_IMAGE_FOREIGN_UID, &i->tree_fd);
+                r = mountfsd_mount_directory_fd(directory_fd, p->userns_fd, DISSECT_IMAGE_FOREIGN_UID, &p->tree_fd);
                 if (r < 0)
                         return r;
         } else {
-                if (i->flags & IMPORT_BTRFS_SUBVOL)
+                if (p->flags & IMPORT_BTRFS_SUBVOL)
                         r = btrfs_subvol_make_fallback(AT_FDCWD, where, 0755);
                 else
                         r = RET_NERRNO(mkdir(where, 0755));
-                if (r == -EEXIST && (i->flags & IMPORT_DIRECT)) /* EEXIST is OK if in direct mode, but not otherwise,
+                if (r == -EEXIST && (p->flags & IMPORT_DIRECT)) /* EEXIST is OK if in direct mode, but not otherwise,
                                                                  * because in that case our temporary path collided */
                         r = 0;
                 if (r < 0)
                         return log_error_errno(r, "Failed to create directory/subvolume %s: %m", where);
 
-                if (r > 0 && (i->flags & IMPORT_BTRFS_QUOTA)) { /* actually btrfs subvol */
-                        if (!(i->flags & IMPORT_DIRECT))
-                                (void) import_assign_pool_quota_and_warn(i->image_root);
+                if (r > 0 && (p->flags & IMPORT_BTRFS_QUOTA)) { /* actually btrfs subvol */
+                        if (!(p->flags & IMPORT_DIRECT))
+                                (void) import_assign_pool_quota_and_warn(p->image_root);
                         (void) import_assign_pool_quota_and_warn(where);
                 }
 
-                i->tree_fd = open(where, O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW);
-                if (i->tree_fd < 0)
+                p->tree_fd = open(where, O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW);
+                if (p->tree_fd < 0)
                         return log_error_errno(errno, "Failed to open '%s': %m", where);
         }
 
-        j->disk_fd = import_fork_tar_x(i->tree_fd, i->userns_fd, &i->tar_pid);
+        j->disk_fd = import_fork_tar_x(p->tree_fd, p->userns_fd, &p->tar_pid);
         if (j->disk_fd < 0)
                 return j->disk_fd;
 
@@ -646,43 +646,43 @@ static int tar_pull_job_on_open_disk_tar(PullJob *j) {
 }
 
 static int tar_pull_job_on_open_disk_settings(PullJob *j) {
-        TarPull *i;
+        TarPull *p;
         int r;
 
         assert(j);
         assert(j->userdata);
 
-        i = j->userdata;
-        assert(i->settings_job == j);
+        p = j->userdata;
+        assert(p->settings_job == j);
 
-        if (!i->settings_temp_path) {
-                r = tempfn_random_child(i->image_root, "settings", &i->settings_temp_path);
+        if (!p->settings_temp_path) {
+                r = tempfn_random_child(p->image_root, "settings", &p->settings_temp_path);
                 if (r < 0)
                         return log_oom();
         }
 
-        (void) mkdir_parents_label(i->settings_temp_path, 0700);
+        (void) mkdir_parents_label(p->settings_temp_path, 0700);
 
-        j->disk_fd = open(i->settings_temp_path, O_RDWR|O_CREAT|O_EXCL|O_NOCTTY|O_CLOEXEC, 0664);
+        j->disk_fd = open(p->settings_temp_path, O_RDWR|O_CREAT|O_EXCL|O_NOCTTY|O_CLOEXEC, 0664);
         if (j->disk_fd < 0)
-                return log_error_errno(errno, "Failed to create %s: %m", i->settings_temp_path);
+                return log_error_errno(errno, "Failed to create %s: %m", p->settings_temp_path);
 
         return 0;
 }
 
 static void tar_pull_job_on_progress(PullJob *j) {
-        TarPull *i;
+        TarPull *p;
 
         assert(j);
         assert(j->userdata);
 
-        i = j->userdata;
+        p = j->userdata;
 
-        tar_pull_report_progress(i, TAR_DOWNLOADING);
+        tar_pull_report_progress(p, TAR_DOWNLOADING);
 }
 
 int tar_pull_start(
-                TarPull *i,
+                TarPull *p,
                 const char *url,
                 const char *local,
                 ImportFlags flags,
@@ -691,7 +691,7 @@ int tar_pull_start(
 
         int r;
 
-        assert(i);
+        assert(p);
         assert(verify == _IMPORT_VERIFY_INVALID || verify < _IMPORT_VERIFY_MAX);
         assert(verify == _IMPORT_VERIFY_INVALID || verify >= 0);
         assert((verify < 0) || !iovec_is_set(checksum));
@@ -705,72 +705,72 @@ int tar_pull_start(
         if (local && !pull_validate_local(local, flags))
                 return -EINVAL;
 
-        if (i->tar_job)
+        if (p->tar_job)
                 return -EBUSY;
 
-        r = free_and_strdup(&i->local, local);
+        r = free_and_strdup(&p->local, local);
         if (r < 0)
                 return r;
 
-        i->flags = flags;
-        i->verify = verify;
+        p->flags = flags;
+        p->verify = verify;
 
         /* Set up download job for TAR file */
-        r = pull_job_new(&i->tar_job, url, i->glue, i);
+        r = pull_job_new(&p->tar_job, url, p->glue, p);
         if (r < 0)
                 return r;
 
-        i->tar_job->on_finished = tar_pull_job_on_finished;
-        i->tar_job->on_open_disk = tar_pull_job_on_open_disk_tar;
+        p->tar_job->on_finished = tar_pull_job_on_finished;
+        p->tar_job->on_open_disk = tar_pull_job_on_open_disk_tar;
 
         if (iovec_is_set(checksum)) {
-                if (!iovec_memdup(checksum, &i->tar_job->expected_checksum))
+                if (!iovec_memdup(checksum, &p->tar_job->expected_checksum))
                         return -ENOMEM;
 
-                i->tar_job->calc_checksum = true;
+                p->tar_job->calc_checksum = true;
         } else
-                i->tar_job->calc_checksum = verify != IMPORT_VERIFY_NO;
+                p->tar_job->calc_checksum = verify != IMPORT_VERIFY_NO;
 
         if (!FLAGS_SET(flags, IMPORT_DIRECT)) {
-                r = pull_find_old_etags(url, i->image_root, DT_DIR, ".tar-", NULL, &i->tar_job->old_etags);
+                r = pull_find_old_etags(url, p->image_root, DT_DIR, ".tar-", NULL, &p->tar_job->old_etags);
                 if (r < 0)
                         return r;
         }
 
         /* Set up download of checksum/signature files */
         r = pull_make_verification_jobs(
-                        &i->checksum_job,
-                        &i->signature_job,
+                        &p->checksum_job,
+                        &p->signature_job,
                         verify,
                         url,
-                        i->glue,
+                        p->glue,
                         tar_pull_job_on_finished,
-                        i);
+                        p);
         if (r < 0)
                 return r;
 
         /* Set up download job for the settings file (.nspawn) */
         if (FLAGS_SET(flags, IMPORT_PULL_SETTINGS)) {
                 r = pull_make_auxiliary_job(
-                                &i->settings_job,
+                                &p->settings_job,
                                 url,
                                 tar_strip_suffixes,
                                 ".nspawn",
                                 verify,
-                                i->glue,
+                                p->glue,
                                 tar_pull_job_on_open_disk_settings,
                                 tar_pull_job_on_finished,
-                                i);
+                                p);
                 if (r < 0)
                         return r;
         }
 
         PullJob *j;
         FOREACH_ARGUMENT(j,
-                         i->tar_job,
-                         i->checksum_job,
-                         i->signature_job,
-                         i->settings_job) {
+                         p->tar_job,
+                         p->checksum_job,
+                         p->signature_job,
+                         p->settings_job) {
 
                 if (!j)
                         continue;
index d2118272ff16e28b131031556367ac5986bcd04e..39a9eacb35295a6864e78d54803ad4321cc03505 100644 (file)
@@ -7,11 +7,11 @@
 
 typedef struct TarPull TarPull;
 
-typedef void (*TarPullFinished)(TarPull *pull, int error, void *userdata);
+typedef void (*TarPullFinished)(TarPull *p, int error, void *userdata);
 
-int tar_pull_new(TarPull **pull, sd_event *event, const char *image_root, TarPullFinished on_finished, void *userdata);
-TarPull* tar_pull_unref(TarPull *pull);
+int tar_pull_new(TarPull **ret, sd_event *event, const char *image_root, TarPullFinished on_finished, void *userdata);
+TarPull* tar_pull_unref(TarPull *p);
 
 DEFINE_TRIVIAL_CLEANUP_FUNC(TarPull*, tar_pull_unref);
 
-int tar_pull_start(TarPull *pull, const char *url, const char *local, ImportFlags flags, ImportVerify verify, const struct iovec *checksum);
+int tar_pull_start(TarPull *p, const char *url, const char *local, ImportFlags flags, ImportVerify verify, const struct iovec *checksum);