diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-02-19 16:51:18 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-02-22 20:10:55 +0100 |
commit | 6ef06723b1de8efc6cfe4bdaee8bc39220bdcb5a (patch) | |
tree | a081ab9b00748e696b3cf84c857b056cbcc92849 /src/basic/os-util.h | |
parent | fd03a6a92bc2c4eae2165cbfcbcd93d82cd28ccf (diff) | |
download | systemd-6ef06723b1de8efc6cfe4bdaee8bc39220bdcb5a.tar.gz |
Move os-util.[ch] to basic/
parse_os_release() will be used basic/hostname-util.c later on.
Diffstat (limited to 'src/basic/os-util.h')
-rw-r--r-- | src/basic/os-util.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/basic/os-util.h b/src/basic/os-util.h new file mode 100644 index 0000000000..f7789c0804 --- /dev/null +++ b/src/basic/os-util.h @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +#pragma once + +#include <stdio.h> + +/* The *_extension_release flavours will look for /usr/lib/extension-release/extension-release.NAME + * in accordance with the OS extension specification, rather than for /usr/lib/ or /etc/os-release. */ + +bool image_name_is_valid(const char *s) _pure_; + +int path_is_extension_tree(const char *path, const char *extension); +static inline int path_is_os_tree(const char *path) { + return path_is_extension_tree(path, NULL); +} + +int open_extension_release(const char *root, const char *extension, char **ret_path, int *ret_fd); +static inline int open_os_release(const char *root, char **ret_path, int *ret_fd) { + return open_extension_release(root, NULL, ret_path, ret_fd); +} + +int fopen_extension_release(const char *root, const char *extension, char **ret_path, FILE **ret_file); +static inline int fopen_os_release(const char *root, char **ret_path, FILE **ret_file) { + return fopen_extension_release(root, NULL, ret_path, ret_file); +} + +int parse_extension_release(const char *root, const char *extension, ...) _sentinel_; +int parse_os_release(const char *root, ...) _sentinel_; +int load_extension_release_pairs(const char *root, const char *extension, char ***ret); +int load_os_release_pairs(const char *root, char ***ret); +int load_os_release_pairs_with_prefix(const char *root, const char *prefix, char ***ret); |