1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #ifndef foosdpathhfoo
3 #define foosdpathhfoo
4 
5 /***
6   systemd is free software; you can redistribute it and/or modify it
7   under the terms of the GNU Lesser General Public License as published by
8   the Free Software Foundation; either version 2.1 of the License, or
9   (at your option) any later version.
10 
11   systemd is distributed in the hope that it will be useful, but
12   WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14   Lesser General Public License for more details.
15 
16   You should have received a copy of the GNU Lesser General Public License
17   along with systemd; If not, see <http://www.gnu.org/licenses/>.
18 ***/
19 
20 #include <inttypes.h>
21 
22 #include "_sd-common.h"
23 
24 _SD_BEGIN_DECLARATIONS;
25 
26 enum {
27         /* Temporary files */
28         SD_PATH_TEMPORARY,
29         SD_PATH_TEMPORARY_LARGE,
30 
31         /* Vendor supplied data */
32         SD_PATH_SYSTEM_BINARIES,
33         SD_PATH_SYSTEM_INCLUDE,
34         SD_PATH_SYSTEM_LIBRARY_PRIVATE,
35         SD_PATH_SYSTEM_LIBRARY_ARCH,
36         SD_PATH_SYSTEM_SHARED,
37         SD_PATH_SYSTEM_CONFIGURATION_FACTORY,
38         SD_PATH_SYSTEM_STATE_FACTORY,
39 
40         /* System configuration, runtime, state, ... */
41         SD_PATH_SYSTEM_CONFIGURATION,
42         SD_PATH_SYSTEM_RUNTIME,
43         SD_PATH_SYSTEM_RUNTIME_LOGS,
44         SD_PATH_SYSTEM_STATE_PRIVATE,
45         SD_PATH_SYSTEM_STATE_LOGS,
46         SD_PATH_SYSTEM_STATE_CACHE,
47         SD_PATH_SYSTEM_STATE_SPOOL,
48 
49         /* Vendor supplied data */
50         SD_PATH_USER_BINARIES,
51         SD_PATH_USER_LIBRARY_PRIVATE,
52         SD_PATH_USER_LIBRARY_ARCH,
53         SD_PATH_USER_SHARED,
54 
55         /* User configuration, state, runtime ... */
56         SD_PATH_USER_CONFIGURATION, /* takes both actual configuration (like /etc) and state (like /var/lib) */
57         SD_PATH_USER_RUNTIME,
58         SD_PATH_USER_STATE_CACHE,
59 
60         /* User resources */
61         SD_PATH_USER, /* $HOME itself */
62         SD_PATH_USER_DOCUMENTS,
63         SD_PATH_USER_MUSIC,
64         SD_PATH_USER_PICTURES,
65         SD_PATH_USER_VIDEOS,
66         SD_PATH_USER_DOWNLOAD,
67         SD_PATH_USER_PUBLIC,
68         SD_PATH_USER_TEMPLATES,
69         SD_PATH_USER_DESKTOP,
70 
71         /* Search paths */
72         SD_PATH_SEARCH_BINARIES,
73         SD_PATH_SEARCH_BINARIES_DEFAULT,
74         SD_PATH_SEARCH_LIBRARY_PRIVATE,
75         SD_PATH_SEARCH_LIBRARY_ARCH,
76         SD_PATH_SEARCH_SHARED,
77         SD_PATH_SEARCH_CONFIGURATION_FACTORY,
78         SD_PATH_SEARCH_STATE_FACTORY,
79         SD_PATH_SEARCH_CONFIGURATION,
80 
81         /* Various systemd paths, generally mirroring systemd.pc — Except we drop the "dir" suffix (and
82          * replaces "path" by "search"), since this API is about dirs/paths anyway, and contains "path"
83          * already in the prefix */
84         SD_PATH_SYSTEMD_UTIL,
85         SD_PATH_SYSTEMD_SYSTEM_UNIT,
86         SD_PATH_SYSTEMD_SYSTEM_PRESET,
87         SD_PATH_SYSTEMD_SYSTEM_CONF,
88         SD_PATH_SYSTEMD_USER_UNIT,
89         SD_PATH_SYSTEMD_USER_PRESET,
90         SD_PATH_SYSTEMD_USER_CONF,
91 
92         SD_PATH_SYSTEMD_SEARCH_SYSTEM_UNIT,
93         SD_PATH_SYSTEMD_SEARCH_USER_UNIT,
94 
95         SD_PATH_SYSTEMD_SYSTEM_GENERATOR,
96         SD_PATH_SYSTEMD_USER_GENERATOR,
97         SD_PATH_SYSTEMD_SEARCH_SYSTEM_GENERATOR,
98         SD_PATH_SYSTEMD_SEARCH_USER_GENERATOR,
99 
100         SD_PATH_SYSTEMD_SLEEP,
101         SD_PATH_SYSTEMD_SHUTDOWN,
102 
103         SD_PATH_TMPFILES,
104         SD_PATH_SYSUSERS,
105         SD_PATH_SYSCTL,
106         SD_PATH_BINFMT,
107         SD_PATH_MODULES_LOAD,
108         SD_PATH_CATALOG,
109 
110         /* systemd-networkd search paths */
111         SD_PATH_SYSTEMD_SEARCH_NETWORK,
112 
113         _SD_PATH_MAX,
114 };
115 
116 int sd_path_lookup(uint64_t type, const char *suffix, char **path);
117 int sd_path_lookup_strv(uint64_t type, const char *suffix, char ***paths);
118 
119 _SD_END_DECLARATIONS;
120 
121 #endif
122