1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3
4 #include <stdbool.h>
5
6 #include "macro.h"
7
8 typedef enum ImportVerify {
9 IMPORT_VERIFY_NO,
10 IMPORT_VERIFY_CHECKSUM,
11 IMPORT_VERIFY_SIGNATURE,
12 _IMPORT_VERIFY_MAX,
13 _IMPORT_VERIFY_INVALID = -EINVAL,
14 } ImportVerify;
15
16 int import_url_last_component(const char *url, char **ret);
17
18 int import_url_change_suffix(const char *url, size_t n_drop_components, const char *suffix, char **ret);
19
import_url_change_last_component(const char * url,const char * suffix,char ** ret)20 static inline int import_url_change_last_component(const char *url, const char *suffix, char **ret) {
21 return import_url_change_suffix(url, 1, suffix, ret);
22 }
23
import_url_append_component(const char * url,const char * suffix,char ** ret)24 static inline int import_url_append_component(const char *url, const char *suffix, char **ret) {
25 return import_url_change_suffix(url, 0, suffix, ret);
26 }
27
28 const char* import_verify_to_string(ImportVerify v) _const_;
29 ImportVerify import_verify_from_string(const char *s) _pure_;
30
31 int tar_strip_suffixes(const char *name, char **ret);
32 int raw_strip_suffixes(const char *name, char **ret);
33
34 int import_assign_pool_quota_and_warn(const char *path);
35
36 int import_set_nocow_and_log(int fd, const char *path);
37