forked from pantavisor/pantavisor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
paths.h
175 lines (143 loc) · 7.11 KB
/
paths.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
/*
* Copyright (c) 2022 Pantacor Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef PV_PATHS_H
#define PV_PATHS_H
#include <stddef.h>
#define ONLINE_FNAME "online"
#define DEVICE_ID_FNAME "device-id"
#define CHALLENGE_FNAME "challenge"
#define PHHOST_FNAME "pantahub-host"
#define PVCTRL_FNAME "pv-ctrl"
#define LOGCTRL_FNAME "pv-ctrl-log"
#define LOGFD_FNAME "pv-fd-log"
void pv_paths_pv_file(char *buf, size_t size, const char *name);
#define USRMETA_DNAME "user-meta"
#define SSH_KEY_FNAME "pvr-sdk.authorized_keys"
void pv_paths_pv_usrmeta_key(char *buf, size_t size, const char *key);
void pv_paths_pv_usrmeta_plat_key(char *buf, size_t size, const char *plat,
const char *key);
#define DEVMETA_DNAME "device-meta"
void pv_paths_pv_devmeta_key(char *buf, size_t size, const char *key);
void pv_paths_pv_devmeta_plat_key(char *buf, size_t size, const char *plat,
const char *key);
#define LOGS_DNAME "logs"
#define LOGS_ERROR_DNAME "error"
#define LXC_LOG_SUBDIR "lxc"
#define LOGS_PV_DNAME "pantavisor"
#define LOGS_PV_FNAME "pantavisor.log"
void pv_paths_pv_log(char *buf, size_t size, const char *rev);
void pv_paths_pv_log_plat(char *buf, size_t size, const char *rev,
const char *plat);
void pv_paths_pv_log_file(char *buf, size_t size, const char *rev,
const char *plat, const char *name);
void pv_paths_storage(char *buf, size_t size);
void pv_paths_storage_log(char *buf, size_t size);
void pv_paths_storage_usrmeta(char *buf, size_t size);
void pv_paths_storage_devmeta(char *buf, size_t size);
void pv_paths_storage_dropbear(char *buf, size_t size);
#define COREPV_FNAME "corepv"
#define PVMOUNTED_FNAME ".pvmounted"
void pv_paths_storage_file(char *buf, size_t size, const char *name);
void pv_paths_storage_object(char *buf, size_t size, const char *sha);
#define DONE_FNAME "done"
#define PROGRESS_FNAME "progress"
#define COMMITMSG_FNAME "commitmsg"
#define JSON_FNAME "json"
#define CONFIG_FNAME "config"
#define LOGS_FNAME "logs"
#define LOGS_TMP_FNAME "logs.tmp"
void pv_paths_storage_trail(char *buf, size_t size, const char *rev);
void pv_paths_storage_trail_file(char *buf, size_t size, const char *rev,
const char *name);
void pv_paths_storage_trail_plat_file(char *buf, size_t size, const char *rev,
const char *plat, const char *name);
void pv_paths_storage_trail_config_file(char *buf, size_t size, const char *rev,
const char *name);
void pv_paths_storage_trail_pv_file(char *buf, size_t size, const char *rev,
const char *name);
void pv_paths_storage_trail_pvr_file(char *buf, size_t size, const char *rev,
const char *name);
#define UNCLAIMED_FNAME "unclaimed.config"
#define PANTAHUB_FNAME "pantahub.config"
void pv_paths_storage_config_file(char *buf, size_t size, const char *name);
#define GRUBENV_FNAME "grubenv"
#define UBOOTTXT_FNAME "uboot.txt"
#define RPIABTXT_FNAME "rpiab.txt"
void pv_paths_storage_boot_file(char *buf, size_t size, const char *name);
void pv_paths_storage_factory_meta_key(char *buf, size_t size, const char *key);
void pv_paths_storage_disks(char *buf, size_t size);
void pv_paths_storage_disks_rev(char *buf, size_t size, const char *rev);
void pv_paths_storage_disks_rev_file(char *buf, size_t size, const char *rev,
const char *plat, const char *name);
void pv_paths_storage_disks_perm_file(char *buf, size_t size, const char *plat,
const char *name);
void pv_paths_storage_mounted_disk_path(char *buf, size_t size,
const char *type, const char *name);
void pv_paths_crypt_disks_rev_file(char *buf, size_t size, const char *type,
const char *dname, const char *rev,
const char *plat, const char *name);
void pv_paths_crypt_disks_perm_file(char *buf, size_t size, const char *type,
const char *dname, const char *plat,
const char *name);
void pv_paths_crypt_disks_boot_file(char *buf, size_t size, const char *type,
const char *dname, const char *plat,
const char *name);
void pv_paths_lib_plugin(char *buf, size_t size, const char *name);
void pv_paths_lib_modules(char *buf, size_t size, const char *release);
void pv_paths_lib_crypt(char *buf, size_t size, const char *name);
void pv_paths_lib_volmount(char *buf, size_t size, const char *type,
const char *name);
void pv_paths_lib_hook(char *buf, size_t size, const char *name);
void pv_paths_lib_hooks_early_spawn(char *buf, size_t size, const char *name);
void pv_paths_lib_lxc_rootfs_mount(char *buf, size_t size);
void pv_paths_lib_lxc_lxcpath(char *buf, size_t size);
#define BSP_DNAME "bsp"
#define USRMETAVOL_DNAME "pv--usrmeta"
#define DEVMETAVOL_DNAME "pv--devmeta"
void pv_paths_root_file(char *buf, size_t size, const char *path);
void pv_paths_volumes_file(char *buf, size_t size, const char *name);
void pv_paths_volumes_plat_file(char *buf, size_t size, const char *plat,
const char *name);
void pv_paths_exports(char *buf, size_t size);
void pv_paths_writable(char *buf, size_t size);
#define PV_PANTAVISOR_CONFIG_PATH "/etc/pantavisor.config"
#define DROPBEAR_DNAME "dropbear"
#define PV_DNAME "pantavisor"
#define PV_DEFAULTS_GROUPS PV_DNAME "/defaults/groups.json"
#define PVS_TRUST_DNAME PV_DNAME "/pvs/trust"
#define PVS_PK_FNAME PVS_TRUST_DNAME "/pub.pem"
#define PVS_CERT_DEFAULT_OEM_STORE "ca-oem-certificates"
#define PVS_CERT_DEFAULT_STORE "ca-certificates"
void pv_paths_etc_file(char *buf, size_t size, const char *name);
void pv_paths_etc_policy_file(char *buf, size_t size, const char *name);
void pv_paths_etc_ssh_file(char *buf, size_t size, const char *name);
void pv_paths_configs_file(char *buf, size_t size, const char *name);
void pv_paths_cert(char *buf, size_t size, const char *name);
void pv_paths_secureboot_trust_crts(char *buf, size_t size, const char *name);
void pv_paths_tmp(char *buf, size_t size, const char *path);
#define PLATFORM_PV_PATH "/pantavisor"
#define PLATFORM_LOGS_PATH PLATFORM_PV_PATH "/" LOGS_DNAME
#define PLATFORM_PVCTRL_SOCKET_PATH PLATFORM_PV_PATH "/" PVCTRL_FNAME
#define PLATFORM_LOG_CTRL_PATH PLATFORM_PV_PATH "/" LOGCTRL_FNAME
#define PLATFORM_USER_META_PATH PLATFORM_PV_PATH "/" USRMETA_DNAME
#define PLATFORM_DEVICE_META_PATH PLATFORM_PV_PATH "/" DEVMETA_DNAME
#endif /* PATHS_H */