Debian Codegraph @

src/shared/import-util.h

raw
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3
4 #include "shared-forward.h"
5
6 typedef enum ImportType {
7 IMPORT_RAW,
8 IMPORT_TAR,
9 IMPORT_OCI,
10 _IMPORT_TYPE_MAX,
11 _IMPORT_TYPE_INVALID = -EINVAL,
12 } ImportType;
13
14 typedef enum ImportVerify {
15 IMPORT_VERIFY_NO,
16 IMPORT_VERIFY_CHECKSUM,
17 IMPORT_VERIFY_SIGNATURE,
18 _IMPORT_VERIFY_MAX,
19 _IMPORT_VERIFY_INVALID = -EINVAL,
20 } ImportVerify;
21
22 int import_url_last_component(const char *url, char **ret);
23
24 int import_url_change_suffix(const char *url, size_t n_drop_components, const char *suffix, char **ret);
25
26 static inline int import_url_change_last_component(const char *url, const char *suffix, char **ret) {
27 return import_url_change_suffix(url, 1, suffix, ret);
28 }
29
30 static inline int import_url_append_component(const char *url, const char *suffix, char **ret) {
31 return import_url_change_suffix(url, 0, suffix, ret);
32 }
33
34 DECLARE_STRING_TABLE_LOOKUP(import_type, ImportType);
35
36 DECLARE_STRING_TABLE_LOOKUP(import_verify, ImportVerify);
37
38 int tar_strip_suffixes(const char *name, char **ret);
39 int raw_strip_suffixes(const char *name, char **ret);
40
41 int import_assign_pool_quota_and_warn(const char *path);
42
43 int import_set_nocow_and_log(int fd, const char *path);