Split out of #37344.
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <errno.h>
-#include <fcntl.h>
+#include "sd-event.h"
#include "alloc-util.h"
#include "curl-util.h"
#include "fd-util.h"
-#include "locale-util.h"
+#include "hashmap.h"
#include "log.h"
#include "string-util.h"
+#include "time-util.h"
#include "version.h"
static void curl_glue_check_finished(CurlGlue *g) {
#pragma once
#include <curl/curl.h>
-#include <sys/types.h>
-#include "sd-event.h"
-
-#include "hashmap.h"
-#include "time-util.h"
+#include "forward.h"
typedef struct CurlGlue CurlGlue;
-struct CurlGlue {
+typedef struct CurlGlue {
sd_event *event;
CURLM *curl;
sd_event_source *timer;
void (*on_finished)(CurlGlue *g, CURL *curl, CURLcode code);
void *userdata;
-};
+} CurlGlue;
int curl_glue_new(CurlGlue **glue, sd_event *event);
CurlGlue* curl_glue_unref(CurlGlue *glue);
#include <sys/sendfile.h>
#include "sd-daemon.h"
+#include "sd-event.h"
#include "alloc-util.h"
-#include "btrfs-util.h"
#include "copy.h"
#include "export-raw.h"
#include "fd-util.h"
#include "format-util.h"
#include "fs-util.h"
-#include "import-common.h"
#include "log.h"
-#include "missing_fcntl.h"
#include "pretty-print.h"
#include "ratelimit.h"
#include "stat-util.h"
#include "string-util.h"
+#include "terminal-util.h"
+#include "time-util.h"
#include "tmpfile-util.h"
#define COPY_BUFFER_SIZE (16*1024)
-struct RawExport {
+typedef struct RawExport {
sd_event *event;
RawExportFinished on_finished;
bool eof;
bool tried_reflink;
bool tried_sendfile;
-};
+} RawExport;
RawExport *raw_export_unref(RawExport *e) {
if (!e)
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-event.h"
-
+#include "forward.h"
#include "import-compress.h"
-#include "memory-util.h"
typedef struct RawExport RawExport;
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include <sys/stat.h>
+
#include "sd-daemon.h"
+#include "sd-event.h"
#include "alloc-util.h"
#include "btrfs-util.h"
#include "export-tar.h"
#include "fd-util.h"
+#include "format-util.h"
#include "import-common.h"
#include "log.h"
#include "pretty-print.h"
#include "process-util.h"
#include "ratelimit.h"
#include "string-util.h"
+#include "terminal-util.h"
+#include "time-util.h"
#include "tmpfile-util.h"
#define COPY_BUFFER_SIZE (16*1024)
-struct TarExport {
+typedef struct TarExport {
sd_event *event;
TarExportFinished on_finished;
bool eof;
bool tried_splice;
-};
+} TarExport;
TarExport *tar_export_unref(TarExport *e) {
if (!e)
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-event.h"
-
+#include "forward.h"
#include "import-compress.h"
-#include "memory-util.h"
typedef struct TarExport TarExport;
#include <locale.h>
#include "sd-event.h"
-#include "sd-id128.h"
#include "alloc-util.h"
#include "ansi-color.h"
#include "export-raw.h"
#include "export-tar.h"
#include "fd-util.h"
-#include "fs-util.h"
-#include "hostname-util.h"
#include "import-common.h"
-#include "import-util.h"
+#include "log.h"
#include "main-func.h"
+#include "runtime-scope.h"
#include "signal-util.h"
#include "string-util.h"
-#include "terminal-util.h"
#include "verbs.h"
static ImportCompressType arg_compress = IMPORT_COMPRESS_UNKNOWN;
if (error == 0)
log_info("Operation completed successfully.");
- sd_event_exit(event, abs(error));
+ sd_event_exit(event, ABS(error));
}
static int export_tar(int argc, char *argv[], void *userdata) {
if (error == 0)
log_info("Operation completed successfully.");
- sd_event_exit(event, abs(error));
+ sd_event_exit(event, ABS(error));
}
static int export_raw(int argc, char *argv[], void *userdata) {
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <sched.h>
-#include <sys/prctl.h>
#include <sys/stat.h>
#include <unistd.h>
+#include "sd-event.h"
+
#include "alloc-util.h"
-#include "btrfs-util.h"
#include "capability-util.h"
-#include "chattr-util.h"
#include "dirent-util.h"
#include "fd-util.h"
#include "fileio.h"
#include "fs-util.h"
-#include "hostname-util.h"
#include "import-common.h"
#include "log.h"
#include "os-util.h"
#include "process-util.h"
#include "selinux-util.h"
-#include "signal-util.h"
#include "stat-util.h"
#include "tmpfile-util.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <errno.h>
-#include <stdbool.h>
-#include <sys/types.h>
-
-#include "sd-event.h"
+#include "forward.h"
typedef enum ImportFlags {
/* Public Flags (i.e. accessible via D-Bus, must stay stable! */
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include "assert-util.h"
+#include <stdlib.h>
+#include <string.h>
+
#include "import-compress.h"
-#include "log.h"
#include "string-table.h"
void import_compress_free(ImportCompress *c) {
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <errno.h>
-
#if HAVE_BZIP2
#include <bzlib.h>
#endif
#include <lzma.h>
-#include <sys/types.h>
#include <zlib.h>
#if HAVE_ZSTD
#include <zstd.h>
-#include <zstd_errors.h>
#endif
-#include "macro.h"
+#include "forward.h"
typedef enum ImportCompressType {
IMPORT_COMPRESS_UNKNOWN,
#include "discover-image.h"
#include "fd-util.h"
#include "format-util.h"
-#include "fs-util.h"
-#include "hostname-util.h"
#include "import-common.h"
#include "import-util.h"
#include "install-file.h"
+#include "log.h"
#include "main-func.h"
#include "mkdir-label.h"
#include "parse-argument.h"
+#include "path-util.h"
#include "ratelimit.h"
#include "rm-rf.h"
+#include "runtime-scope.h"
#include "signal-util.h"
#include "string-util.h"
-#include "terminal-util.h"
+#include "time-util.h"
#include "tmpfile-util.h"
#include "verbs.h"
#include "creds-util.h"
#include "discover-image.h"
#include "efivars.h"
+#include "errno-util.h"
#include "extract-word.h"
#include "fd-util.h"
#include "fileio.h"
#include "initrd-util.h"
#include "json-util.h"
#include "parse-util.h"
+#include "path-util.h"
#include "proc-cmdline.h"
-#include "special.h"
#include "specifier.h"
+#include "string-util.h"
#include "unit-name.h"
#include "web-util.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include <sys/stat.h>
+
#include "sd-daemon.h"
#include "sd-event.h"
#include "alloc-util.h"
-#include "btrfs-util.h"
#include "copy.h"
#include "fd-util.h"
#include "format-util.h"
#include "fs-util.h"
-#include "hostname-util.h"
#include "import-common.h"
#include "import-compress.h"
#include "import-raw.h"
#include "install-file.h"
#include "io-util.h"
#include "log.h"
-#include "machine-pool.h"
-#include "missing_fs.h"
#include "mkdir-label.h"
-#include "path-util.h"
#include "pretty-print.h"
#include "qcow2-util.h"
#include "ratelimit.h"
-#include "rm-rf.h"
#include "string-util.h"
+#include "terminal-util.h"
+#include "time-util.h"
#include "tmpfile-util.h"
-struct RawImport {
+typedef struct RawImport {
sd_event *event;
char *image_root;
uint64_t offset;
uint64_t size_max;
-};
+} RawImport;
RawImport* raw_import_unref(RawImport *i) {
if (!i)
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-event.h"
-
+#include "forward.h"
#include "import-common.h"
-#include "memory-util.h"
typedef struct RawImport RawImport;
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include <sys/stat.h>
+
#include "sd-daemon.h"
#include "sd-event.h"
#include "alloc-util.h"
#include "btrfs-util.h"
-#include "copy.h"
#include "errno-util.h"
#include "fd-util.h"
-#include "fileio.h"
-#include "fs-util.h"
-#include "hostname-util.h"
+#include "format-util.h"
#include "import-common.h"
#include "import-compress.h"
#include "import-tar.h"
#include "install-file.h"
#include "io-util.h"
#include "log.h"
-#include "machine-pool.h"
-#include "missing_fs.h"
#include "mkdir-label.h"
#include "path-util.h"
#include "pretty-print.h"
#include "process-util.h"
-#include "qcow2-util.h"
#include "ratelimit.h"
#include "rm-rf.h"
#include "string-util.h"
+#include "terminal-util.h"
+#include "time-util.h"
#include "tmpfile-util.h"
-struct TarImport {
+typedef struct TarImport {
sd_event *event;
char *image_root;
unsigned last_percent;
RateLimit progress_ratelimit;
-};
+} TarImport;
TarImport* tar_import_unref(TarImport *i) {
if (!i)
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-event.h"
-
+#include "forward.h"
#include "import-common.h"
-#include "memory-util.h"
typedef struct TarImport TarImport;
#include <locale.h>
#include "sd-event.h"
-#include "sd-id128.h"
#include "alloc-util.h"
#include "ansi-color.h"
#include "discover-image.h"
#include "env-util.h"
#include "fd-util.h"
-#include "fs-util.h"
-#include "hostname-util.h"
#include "import-raw.h"
#include "import-tar.h"
#include "import-util.h"
#include "io-util.h"
+#include "log.h"
#include "main-func.h"
#include "parse-argument.h"
#include "parse-util.h"
+#include "path-util.h"
+#include "runtime-scope.h"
#include "signal-util.h"
#include "string-util.h"
-#include "terminal-util.h"
#include "verbs.h"
static const char *arg_image_root = NULL;
if (error == 0)
log_info("Operation completed successfully.");
- sd_event_exit(event, abs(error));
+ sd_event_exit(event, ABS(error));
}
static int import_tar(int argc, char *argv[], void *userdata) {
if (error == 0)
log_info("Operation completed successfully.");
- sd_event_exit(event, abs(error));
+ sd_event_exit(event, ABS(error));
}
static int import_raw(int argc, char *argv[], void *userdata) {
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <getopt.h>
+#include <locale.h>
#include "sd-bus.h"
+#include "sd-event.h"
#include "alloc-util.h"
#include "build.h"
#include "discover-image.h"
#include "fd-util.h"
#include "format-table.h"
-#include "hostname-util.h"
#include "import-common.h"
#include "import-util.h"
-#include "locale-util.h"
#include "log.h"
-#include "macro.h"
#include "main-func.h"
#include "os-util.h"
#include "pager.h"
#include "path-util.h"
#include "polkit-agent.h"
#include "pretty-print.h"
-#include "signal-util.h"
-#include "sort-util.h"
+#include "runtime-scope.h"
#include "string-table.h"
+#include "string-util.h"
+#include "strv.h"
#include "verbs.h"
#include "web-util.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <sys/prctl.h>
-#include <sys/wait.h>
+#include <stdlib.h>
#include "sd-bus.h"
#include "sd-varlink.h"
#include "bus-common-errors.h"
#include "bus-get-properties.h"
#include "bus-log-control-api.h"
+#include "bus-object.h"
#include "bus-polkit.h"
#include "bus-util.h"
#include "common-signal.h"
#include "event-util.h"
#include "fd-util.h"
#include "float.h"
-#include "hostname-util.h"
+#include "hashmap.h"
#include "import-common.h"
#include "import-util.h"
#include "json-util.h"
#include "machine-pool.h"
#include "main-func.h"
-#include "mkdir-label.h"
#include "notify-recv.h"
#include "os-util.h"
#include "parse-util.h"
-#include "path-util.h"
#include "percent-util.h"
+#include "pidref.h"
#include "process-util.h"
+#include "runtime-scope.h"
#include "service-util.h"
+#include "set.h"
#include "signal-util.h"
-#include "socket-util.h"
#include "stat-util.h"
#include "string-table.h"
#include "strv.h"
#include "syslog-util.h"
-#include "user-util.h"
#include "varlink-io.systemd.Import.h"
#include "varlink-io.systemd.service.h"
#include "varlink-util.h"
#include "web-util.h"
-typedef struct Transfer Transfer;
typedef struct Manager Manager;
typedef enum TransferType {
_TRANSFER_TYPE_INVALID = -EINVAL,
} TransferType;
-struct Transfer {
+typedef struct Transfer {
Manager *manager;
uint32_t id;
int stdout_fd;
Set *varlink_subscribed;
-};
+} Transfer;
-struct Manager {
+typedef struct Manager {
sd_event *event;
sd_bus *bus;
sd_varlink_server *varlink_server;
bool use_btrfs_quota;
RuntimeScope runtime_scope; /* for now: always RUNTIME_SCOPE_SYSTEM */
-};
+} Manager;
#define TRANSFERS_MAX 64
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <sys/prctl.h>
+#include "sd-id128.h"
#include "alloc-util.h"
-#include "btrfs-util.h"
-#include "capability-util.h"
-#include "copy.h"
#include "dirent-util.h"
-#include "discover-image.h"
#include "escape.h"
#include "fd-util.h"
-#include "hostname-util.h"
#include "io-util.h"
+#include "log.h"
#include "memory-util.h"
+#include "os-util.h"
#include "path-util.h"
#include "process-util.h"
#include "pull-common.h"
#include "pull-job.h"
#include "rm-rf.h"
-#include "signal-util.h"
#include "siphash24.h"
#include "string-util.h"
#include "strv.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <stdbool.h>
-
+#include "forward.h"
#include "import-common.h"
#include "import-util.h"
#include "pull-job.h"
+typedef struct CurlGlue CurlGlue;
+typedef struct PullJob PullJob;
+
int pull_find_old_etags(const char *url, const char *root, int dt, const char *prefix, const char *suffix, char ***etags);
int pull_make_path(const char *url, const char *etag, const char *image_root, const char *prefix, const char *suffix, char **ret);
#include "fd-util.h"
#include "format-util.h"
#include "hexdecoct.h"
-#include "import-util.h"
#include "io-util.h"
#include "log.h"
-#include "machine-pool.h"
#include "parse-util.h"
#include "pull-common.h"
#include "pull-job.h"
+#include "curl-util.h"
#include "string-util.h"
#include "strv.h"
#include "sync-util.h"
+#include "time-util.h"
#include "xattr-util.h"
void pull_job_close_disk_fd(PullJob *j) {
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
+#include <curl/curl.h>
#include <sys/stat.h>
-#include "curl-util.h"
+#include "forward.h"
#include "import-compress.h"
#include "openssl-util.h"
+typedef struct CurlGlue CurlGlue;
typedef struct PullJob PullJob;
typedef void (*PullJobFinished)(PullJob *job);
#define PULL_JOB_IS_COMPLETE(j) (IN_SET((j)->state, PULL_JOB_DONE, PULL_JOB_FAILED))
-struct PullJob {
+typedef struct PullJob {
PullJobState state;
int error;
char *checksum;
bool sync;
bool force_memory;
-};
+} PullJob;
int pull_job_new(PullJob **job, const char *url, CurlGlue *glue, void *userdata);
PullJob* pull_job_unref(PullJob *job);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <curl/curl.h>
-#include <sys/xattr.h>
-
#include "sd-daemon.h"
+#include "sd-event.h"
#include "alloc-util.h"
-#include "btrfs-util.h"
#include "copy.h"
#include "curl-util.h"
#include "fd-util.h"
#include "fs-util.h"
-#include "hostname-util.h"
#include "import-common.h"
#include "import-util.h"
#include "install-file.h"
#include "log.h"
-#include "macro.h"
-#include "missing_fs.h"
#include "mkdir-label.h"
-#include "path-util.h"
#include "pull-common.h"
#include "pull-job.h"
#include "pull-raw.h"
#include "qcow2-util.h"
-#include "rm-rf.h"
#include "string-util.h"
-#include "strv.h"
#include "tmpfile-util.h"
-#include "utf8.h"
#include "web-util.h"
typedef enum RawProgress {
RAW_COPYING,
} RawProgress;
-struct RawPull {
+typedef struct RawPull {
sd_event *event;
CurlGlue *glue;
char *verity_temp_path;
char *checksum;
-};
+} RawPull;
RawPull* raw_pull_unref(RawPull *i) {
if (!i)
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-event.h"
-
+#include "forward.h"
+#include "import-common.h"
#include "import-util.h"
-#include "macro.h"
-#include "pull-common.h"
typedef struct RawPull RawPull;
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <curl/curl.h>
-#include <sys/prctl.h>
+#include <dirent.h>
#include "sd-daemon.h"
+#include "sd-event.h"
#include "alloc-util.h"
#include "btrfs-util.h"
#include "copy.h"
#include "curl-util.h"
#include "errno-util.h"
-#include "fd-util.h"
#include "fs-util.h"
-#include "hostname-util.h"
#include "import-common.h"
#include "import-util.h"
#include "install-file.h"
#include "log.h"
-#include "macro.h"
#include "mkdir-label.h"
#include "path-util.h"
#include "process-util.h"
#include "pull-tar.h"
#include "rm-rf.h"
#include "string-util.h"
-#include "strv.h"
#include "tmpfile-util.h"
-#include "user-util.h"
-#include "utf8.h"
#include "web-util.h"
typedef enum TarProgress {
TAR_COPYING,
} TarProgress;
-struct TarPull {
+typedef struct TarPull {
sd_event *event;
CurlGlue *glue;
char *settings_temp_path;
char *checksum;
-};
+} TarPull;
TarPull* tar_pull_unref(TarPull *i) {
if (!i)
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-event.h"
-
+#include "forward.h"
+#include "import-common.h"
#include "import-util.h"
-#include "macro.h"
-#include "pull-common.h"
typedef struct TarPull TarPull;
#include <getopt.h>
#include <locale.h>
+#include <stdio.h>
#include "sd-event.h"
-#include "sd-id128.h"
#include "alloc-util.h"
#include "ansi-color.h"
#include "discover-image.h"
#include "env-util.h"
#include "hexdecoct.h"
-#include "hostname-util.h"
#include "import-common.h"
#include "import-util.h"
#include "io-util.h"
+#include "log.h"
#include "main-func.h"
#include "parse-argument.h"
#include "parse-util.h"
+#include "path-util.h"
#include "pull-raw.h"
#include "pull-tar.h"
+#include "runtime-scope.h"
#include "signal-util.h"
#include "string-util.h"
-#include "terminal-util.h"
#include "verbs.h"
#include "web-util.h"
if (error == 0)
log_info("Operation completed successfully.");
- sd_event_exit(event, abs(error));
+ sd_event_exit(event, ABS(error));
}
static int pull_tar(int argc, char *argv[], void *userdata) {
if (error == 0)
log_info("Operation completed successfully.");
- sd_event_exit(event, abs(error));
+ sd_event_exit(event, ABS(error));
}
static int pull_raw(int argc, char *argv[], void *userdata) {
#include <zlib.h>
#include "alloc-util.h"
-#include "assert-util.h"
-#include "btrfs-util.h"
+#include "copy.h"
#include "qcow2-util.h"
#include "sparse-endian.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
#include "fd-util.h"
#include "log.h"