From 390fb58fd380304b6a3c185ee076a8dbc87a07fe Mon Sep 17 00:00:00 2001 From: Sven Eden Date: Tue, 3 Jan 2017 11:20:52 +0100 Subject: [PATCH] Prep v224: Cleaned up src/basic/util.[ch] This lead to the deletion of src/basic/device-nodes.h and src/basic/env-util.h. Both are not needed by elogind. Further removed the superfluous src/boot/efi/disk.[ch] --- src/basic/device-nodes.h | 25 ----- src/basic/env-util.h | 49 --------- src/basic/util.c | 221 ++++++++++++++++++++++++--------------- src/basic/util.h | 74 ++++++------- src/boot/efi/disk.c | 51 --------- src/boot/efi/disk.h | 21 ---- 6 files changed, 172 insertions(+), 269 deletions(-) delete mode 100644 src/basic/device-nodes.h delete mode 100644 src/basic/env-util.h delete mode 100644 src/boot/efi/disk.c delete mode 100644 src/boot/efi/disk.h diff --git a/src/basic/device-nodes.h b/src/basic/device-nodes.h deleted file mode 100644 index 04ba4897e..000000000 --- a/src/basic/device-nodes.h +++ /dev/null @@ -1,25 +0,0 @@ -/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ - -#pragma once - -/*** - This file is part of systemd. - - Copyright 2012 Lennart Poettering - - systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 of the License, or - (at your option) any later version. - - systemd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with systemd; If not, see . -***/ - -int encode_devnode_name(const char *str, char *str_enc, size_t len); -int whitelisted_char_for_devnode(char c, const char *additional); diff --git a/src/basic/env-util.h b/src/basic/env-util.h deleted file mode 100644 index 803aa61ca..000000000 --- a/src/basic/env-util.h +++ /dev/null @@ -1,49 +0,0 @@ -/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ - -#pragma once - -/*** - This file is part of systemd. - - Copyright 2013 Lennart Poettering - - systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 of the License, or - (at your option) any later version. - - systemd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with systemd; If not, see . -***/ - -#include - -#include "macro.h" - -bool env_name_is_valid(const char *e); -bool env_value_is_valid(const char *e); -bool env_assignment_is_valid(const char *e); - -char *replace_env(const char *format, char **env); -char **replace_env_argv(char **argv, char **env); - -bool strv_env_is_valid(char **e); -#define strv_env_clean(l) strv_env_clean_with_callback(l, NULL, NULL) -char **strv_env_clean_with_callback(char **l, void (*invalid_callback)(const char *p, void *userdata), void *userdata); - -bool strv_env_name_or_assignment_is_valid(char **l); - -char **strv_env_merge(unsigned n_lists, ...); -char **strv_env_delete(char **x, unsigned n_lists, ...); /* New copy */ - -char **strv_env_set(char **x, const char *p); /* New copy ... */ -char **strv_env_unset(char **l, const char *p); /* In place ... */ -char **strv_env_unset_many(char **l, ...) _sentinel_; - -char *strv_env_get_n(char **l, const char *name, size_t k) _pure_; -char *strv_env_get(char **x, const char *n) _pure_; diff --git a/src/basic/util.c b/src/basic/util.c index f17a473d6..328010209 100644 --- a/src/basic/util.c +++ b/src/basic/util.c @@ -19,81 +19,81 @@ along with systemd; If not, see . ***/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +// #include +// #include +#include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +#include +// #include +#include +// #include +#include +#include +// #include +// #include +// #include +#include +// #include +// #include +// #include +#include +// #include +#include +// #include +// #include +#include +// #include +// #include +#include /* When we include libgen.h because we need dirname() we immediately * undefine basename() since libgen.h defines it as a macro to the POSIX * version which is really broken. We prefer GNU basename(). */ -#include -#undef basename +// #include +// #undef basename #ifdef HAVE_SYS_AUXV_H #include #endif -#include "config.h" -#include "macro.h" -#include "util.h" -#include "ioprio.h" -#include "missing.h" -#include "log.h" -#include "strv.h" -#include "mkdir.h" -#include "path-util.h" -#include "exit-status.h" -#include "hashmap.h" -#include "env-util.h" -#include "fileio.h" -#include "device-nodes.h" -#include "utf8.h" -#include "gunicode.h" -#include "virt.h" -#include "def.h" -#include "sparse-endian.h" -#include "formats-util.h" -#include "process-util.h" -#include "random-util.h" -#include "terminal-util.h" -#include "hostname-util.h" -#include "signal-util.h" +#include "config.h" +#include "macro.h" +#include "util.h" +#include "ioprio.h" +// #include "missing.h" +// #include "log.h" +#include "strv.h" +#include "mkdir.h" +#include "path-util.h" +// #include "exit-status.h" +// #include "hashmap.h" +// #include "env-util.h" +#include "fileio.h" +// #include "device-nodes.h" +#include "utf8.h" +#include "gunicode.h" +#include "virt.h" +// #include "def.h" +#include "sparse-endian.h" +// #include "formats-util.h" +#include "process-util.h" +#include "random-util.h" +// #include "terminal-util.h" +#include "hostname-util.h" +#include "signal-util.h" /* Put this test here for a lack of better place */ assert_cc(EAGAIN == EWOULDBLOCK); @@ -707,6 +707,8 @@ int readlink_malloc(const char *p, char **ret) { return readlinkat_malloc(AT_FDCWD, p, ret); } +/// UNNEEDED by elogind +#if 0 int readlink_value(const char *p, char **ret) { _cleanup_free_ char *link = NULL; char *value; @@ -728,6 +730,7 @@ int readlink_value(const char *p, char **ret) { return 0; } +#endif // 0 int readlink_and_make_absolute(const char *p, char **r) { _cleanup_free_ char *target = NULL; @@ -749,6 +752,8 @@ int readlink_and_make_absolute(const char *p, char **r) { return 0; } +/// UNNEEDED by elogind +#if 0 int readlink_and_canonicalize(const char *p, char **r) { char *t, *s; int j; @@ -771,6 +776,7 @@ int readlink_and_canonicalize(const char *p, char **r) { return 0; } +#endif // 0 char *strstrip(char *s) { char *e; @@ -836,6 +842,8 @@ char *file_in_same_dir(const char *path, const char *filename) { return ret; } +/// UNNEEDED by elogind +#if 0 int rmdir_parents(const char *path, const char *stop) { size_t l; int r = 0; @@ -881,6 +889,7 @@ int rmdir_parents(const char *path, const char *stop) { return 0; } +#endif // 0 char hexchar(int x) { static const char table[16] = "0123456789abcdef"; @@ -1301,6 +1310,8 @@ char *xescape(const char *s, const char *bad) { return r; } +/// UNNEEDED by elogind +#if 0 char *ascii_strlower(char *t) { char *p; @@ -1312,6 +1323,7 @@ char *ascii_strlower(char *t) { return t; } +#endif // 0 _pure_ static bool hidden_file_allow_backup(const char *filename) { assert(filename); @@ -1471,6 +1483,8 @@ bool chars_intersect(const char *a, const char *b) { return false; } +/// UNNEEDED by elogind +#if 0 bool fstype_is_network(const char *fstype) { static const char table[] = "afs\0" @@ -1493,6 +1507,7 @@ bool fstype_is_network(const char *fstype) { return nulstr_contains(table, fstype); } +#endif // 0 int flush_fd(int fd) { struct pollfd pollfd = { @@ -1771,6 +1786,8 @@ bool is_device_path(const char *path) { path_startswith(path, "/sys/"); } +/// UNNEEDED by elogind +#if 0 int dir_is_empty(const char *path) { _cleanup_closedir_ DIR *d; @@ -1842,6 +1859,7 @@ void rename_process(const char name[8]) { } } } +#endif // 0 char *lookup_uid(uid_t uid) { long bufsize; @@ -1870,6 +1888,8 @@ char *lookup_uid(uid_t uid) { return name; } +/// UNNEEDED by elogind +#if 0 char* getlogname_malloc(void) { uid_t uid; struct stat st; @@ -1891,6 +1911,7 @@ char *getusername_malloc(void) { return lookup_uid(getuid()); } +#endif // 0 bool is_temporary_fs(const struct statfs *s) { assert(s); @@ -1945,7 +1966,6 @@ int fchmod_and_fchown(int fd, mode_t mode, uid_t uid, gid_t gid) { return 0; } -#endif // 0 cpu_set_t* cpu_set_malloc(unsigned *ncpus) { cpu_set_t *r; @@ -1974,6 +1994,7 @@ cpu_set_t* cpu_set_malloc(unsigned *ncpus) { n *= 2; } } +#endif // 0 int files_same(const char *filea, const char *fileb) { struct stat a, b; @@ -1988,6 +2009,8 @@ int files_same(const char *filea, const char *fileb) { a.st_ino == b.st_ino; } +/// UNNEEDED by elogind +#if 0 int running_in_chroot(void) { int ret; @@ -1997,6 +2020,7 @@ int running_in_chroot(void) { return ret == 0; } +#endif // 0 static char *ascii_ellipsize_mem(const char *s, size_t old_length, size_t new_length, unsigned percent) { size_t x; @@ -2565,6 +2589,8 @@ int fopen_temporary(const char *path, FILE **_f, char **_temp_path) { return 0; } +/// UNNEEDED by elogind +#if 0 int symlink_atomic(const char *from, const char *to) { _cleanup_free_ char *t = NULL; int r; @@ -2587,8 +2613,6 @@ int symlink_atomic(const char *from, const char *to) { return 0; } -/// UNNEEDED by elogind -#if 0 int symlink_idempotent(const char *from, const char *to) { _cleanup_free_ char *p = NULL; int r; @@ -2865,7 +2889,6 @@ int in_group(const char *name) { return in_gid(gid); } -#endif // 0 int glob_exists(const char *path) { _cleanup_globfree_ glob_t g = {}; @@ -2886,8 +2909,6 @@ int glob_exists(const char *path) { return errno ? -errno : -EIO; } -/// UNNEEDED by elogind -#if 0 int glob_extend(char ***strv, const char *path) { _cleanup_globfree_ glob_t g = {}; int k; @@ -3056,6 +3077,8 @@ bool is_main_thread(void) { return cached > 0; } +/// UNNEEDED by elogind +#if 0 int block_get_whole_disk(dev_t d, dev_t *ret) { char *p, *s; int r; @@ -3115,6 +3138,7 @@ int block_get_whole_disk(dev_t d, dev_t *ret) { return -ENOENT; } +#endif // 0 static const char *const ioprio_class_table[] = { [IOPRIO_CLASS_NONE] = "none", @@ -3245,7 +3269,7 @@ int prot_from_flags(int flags) { return -EINVAL; } } -#endif // 0 + char *format_bytes(char *buf, size_t l, off_t t) { unsigned i; @@ -3284,6 +3308,7 @@ finish: return buf; } +#endif // 0 void* memdup(const void *p, size_t l) { void *r; @@ -3435,6 +3460,8 @@ int fork_agent(pid_t *pid, const int except[], unsigned n_except, const char *pa _exit(EXIT_FAILURE); } +/// UNNEEDED by elogind +#if 0 int setrlimit_closest(int resource, const struct rlimit *rlim) { struct rlimit highest, fixed; @@ -3459,8 +3486,6 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) { return 0; } -/// UNNEEDED by elogind -#if 0 bool http_etag_is_valid(const char *etag) { if (isempty(etag)) return false; @@ -3585,6 +3610,8 @@ int get_home_dir(char **_h) { return 0; } +/// UNNEEDED by elogind +#if 0 int get_shell(char **_s) { struct passwd *p; const char *e; @@ -3631,6 +3658,7 @@ int get_shell(char **_s) { *_s = s; return 0; } +#endif // 0 bool filename_is_valid(const char *p) { @@ -3816,6 +3844,8 @@ const char *draw_special_char(DrawSpecialChar ch) { return draw_table[!is_locale_utf8()][ch]; } +/// UNNEEDED by elogind +#if 0 char *strreplace(const char *text, const char *old_string, const char *new_string) { const char *f; char *t, *r; @@ -4024,6 +4054,7 @@ int on_ac_power(void) { return found_online || !found_offline; } +#endif // 0 static int search_and_fopen_internal(const char *path, const char *mode, const char *root, char **search, FILE **_f) { char **i; @@ -4415,6 +4446,8 @@ int get_proc_cmdline_key(const char *key, char **value) { } +/// UNNEEDED by elogind +#if 0 int container_get_leader(const char *machine, pid_t *pid) { _cleanup_free_ char *s = NULL, *class = NULL; const char *p; @@ -4445,6 +4478,7 @@ int container_get_leader(const char *machine, pid_t *pid) { *pid = leader; return 0; } +#endif // 0 int namespace_open(pid_t pid, int *pidns_fd, int *mntns_fd, int *netns_fd, int *root_fd) { _cleanup_close_ int pidnsfd = -1, mntnsfd = -1, netnsfd = -1; @@ -4613,6 +4647,8 @@ int mkostemp_safe(char *pattern, int flags) { return fd; } +/// UNNEEDED by elogind +#if 0 int open_tmpfile(const char *path, int flags) { char *p; int fd; @@ -4636,6 +4672,7 @@ int open_tmpfile(const char *path, int flags) { unlink(p); return fd; } +#endif // 0 int fd_warn_permissions(const char *path, int fd) { struct stat st; @@ -4684,6 +4721,8 @@ unsigned long personality_from_string(const char *p) { } #endif // 0 +/// UNNEEDED by elogind +#if 0 const char* personality_to_string(unsigned long p) { #if defined(__x86_64__) @@ -4702,6 +4741,7 @@ const char* personality_to_string(unsigned long p) { return NULL; } +#endif // 0 uint64_t physical_memory(void) { long mem; @@ -4759,7 +4799,6 @@ void hexdump(FILE *f, const void *p, size_t s) { s -= 16; } } -#endif // 0 int update_reboot_param_file(const char *param) { int r = 0; @@ -5006,6 +5045,7 @@ int bind_remount_recursive(const char *prefix, bool ro) { } } } +#endif // 0 int fflush_and_check(FILE *f) { assert(f); @@ -5169,7 +5209,6 @@ int take_password_lock(const char *root) { return fd; } -#endif // 0 int is_symlink(const char *path) { struct stat info; @@ -5179,6 +5218,7 @@ int is_symlink(const char *path) { return !!S_ISLNK(info.st_mode); } +#endif // 0 int is_dir(const char* path, bool follow) { struct stat st; @@ -5376,6 +5416,8 @@ finish: return 1; } +/// UNNEEDED by elogind +#if 0 int unquote_first_word_and_warn( const char **p, char **ret, @@ -5406,8 +5448,6 @@ int unquote_first_word_and_warn( return r; } -/// UNNEEDED by elogind -#if 0 int unquote_many_words(const char **p, UnquoteFlags flags, ...) { va_list ap; char **l; @@ -5489,6 +5529,8 @@ int free_and_strdup(char **p, const char *s) { return 1; } +/// UNNEEDED by elogind +#if 0 int ptsname_malloc(int fd, char **ret) { size_t l = 100; @@ -5516,8 +5558,6 @@ int ptsname_malloc(int fd, char **ret) { } } -/// UNNEEDED by elogind -#if 0 int openpt_in_namespace(pid_t pid, int flags) { _cleanup_close_ int pidnsfd = -1, mntnsfd = -1, rootfd = -1; _cleanup_close_pair_ int pair[2] = { -1, -1 }; @@ -5654,6 +5694,8 @@ int fd_getcrtime(int fd, usec_t *usec) { return parse_crtime(le, usec); } +/// UNNEEDED by elogind +#if 0 int fd_getcrtime_at(int dirfd, const char *name, usec_t *usec, int flags) { le64_t le; ssize_t n; @@ -5667,8 +5709,6 @@ int fd_getcrtime_at(int dirfd, const char *name, usec_t *usec, int flags) { return parse_crtime(le, usec); } -/// UNNEEDED by elogind -#if 0 int path_getcrtime(const char *p, usec_t *usec) { le64_t le; ssize_t n; @@ -5684,7 +5724,6 @@ int path_getcrtime(const char *p, usec_t *usec) { return parse_crtime(le, usec); } -#endif // 0 int fd_setcrtime(int fd, usec_t usec) { le64_t le; @@ -5765,6 +5804,7 @@ int same_fd(int a, int b) { return fa == fb; } +#endif // 0 int chattr_fd(int fd, unsigned value, unsigned mask) { unsigned old_attr, new_attr; @@ -5800,6 +5840,8 @@ int chattr_fd(int fd, unsigned value, unsigned mask) { return 1; } +/// UNNEEDED by elogind +#if 0 int chattr_path(const char *p, unsigned value, unsigned mask) { _cleanup_close_ int fd = -1; @@ -5814,6 +5856,7 @@ int chattr_path(const char *p, unsigned value, unsigned mask) { return chattr_fd(fd, value, mask); } +#endif // 0 int read_attr_fd(int fd, unsigned *ret) { struct stat st; @@ -5832,6 +5875,8 @@ int read_attr_fd(int fd, unsigned *ret) { return 0; } +/// UNNEEDED by elogind +#if 0 int read_attr_path(const char *p, unsigned *ret) { _cleanup_close_ int fd = -1; @@ -5845,8 +5890,6 @@ int read_attr_path(const char *p, unsigned *ret) { return read_attr_fd(fd, ret); } -/// UNNEEDED by elogind -#if 0 static size_t nul_length(const uint8_t *p, size_t sz) { size_t n = 0; @@ -5978,6 +6021,8 @@ ssize_t string_table_lookup(const char * const *table, size_t len, const char *k return -1; } +/// UNNEEDED by elogind +#if 0 void cmsg_close_all(struct msghdr *mh) { struct cmsghdr *cmsg; @@ -6028,6 +6073,7 @@ int rename_noreplace(int olddirfd, const char *oldpath, int newdirfd, const char return 0; } +#endif // 0 char *shell_maybe_quote(const char *s) { const char *p; @@ -6090,6 +6136,8 @@ int parse_mode(const char *s, mode_t *ret) { return 0; } +/// UNNEEDED by elogind +#if 0 int mount_move_root(const char *path) { assert(path); @@ -6107,6 +6155,7 @@ int mount_move_root(const char *path) { return 0; } +#endif // 0 int reset_uid_gid(void) { diff --git a/src/basic/util.h b/src/basic/util.h index 4e30fe128..0d0b881b9 100644 --- a/src/basic/util.h +++ b/src/basic/util.h @@ -222,9 +222,9 @@ char *strnappend(const char *s, const char *suffix, size_t length); int readlinkat_malloc(int fd, const char *p, char **ret); int readlink_malloc(const char *p, char **r); -int readlink_value(const char *p, char **ret); +// UNNEEDED int readlink_value(const char *p, char **ret); int readlink_and_make_absolute(const char *p, char **r); -int readlink_and_canonicalize(const char *p, char **r); +// UNNEEDED int readlink_and_canonicalize(const char *p, char **r); char *strstrip(char *s); // UNNEEDED char *delete_chars(char *s, const char *bad); @@ -232,7 +232,7 @@ char *truncate_nl(char *s); char *file_in_same_dir(const char *path, const char *filename); -int rmdir_parents(const char *path, const char *stop); +// UNNEEDED int rmdir_parents(const char *path, const char *stop); char hexchar(int x) _const_; int unhexchar(char c) _const_; @@ -254,7 +254,7 @@ int cunescape_length_with_prefix(const char *s, size_t length, const char *prefi char *xescape(const char *s, const char *bad); -char *ascii_strlower(char *path); +// UNNEEDED char *ascii_strlower(char *path); bool dirent_is_file(const struct dirent *de) _pure_; bool dirent_is_file_with_suffix(const struct dirent *de, const char *suffix) _pure_; @@ -326,7 +326,7 @@ int fd_cloexec(int fd, bool cloexec); int close_all_fds(const int except[], unsigned n_except); -bool fstype_is_network(const char *fstype); +// UNNEEDED bool fstype_is_network(const char *fstype); int flush_fd(int fd); @@ -338,12 +338,12 @@ int loop_write(int fd, const void *buf, size_t nbytes, bool do_poll); bool is_device_path(const char *path); -int dir_is_empty(const char *path); -char* dirname_malloc(const char *path); +// UNNEEDED int dir_is_empty(const char *path); +// UNNEEDED char* dirname_malloc(const char *path); char* lookup_uid(uid_t uid); -char* getlogname_malloc(void); -char* getusername_malloc(void); +// UNNEEDED char* getlogname_malloc(void); +// UNNEEDED char* getusername_malloc(void); int chmod_and_chown(const char *path, mode_t mode, uid_t uid, gid_t gid); // UNNEEDED int fchmod_and_fchown(int fd, mode_t mode, uid_t uid, gid_t gid); @@ -353,13 +353,13 @@ int fd_is_temporary_fs(int fd); int pipe_eof(int fd); -cpu_set_t* cpu_set_malloc(unsigned *ncpus); +// UNNEEDED cpu_set_t* cpu_set_malloc(unsigned *ncpus); #define xsprintf(buf, fmt, ...) assert_se((size_t) snprintf(buf, ELEMENTSOF(buf), fmt, __VA_ARGS__) < ELEMENTSOF(buf)) int files_same(const char *filea, const char *fileb); -int running_in_chroot(void); +// UNNEEDED int running_in_chroot(void); char *ellipsize(const char *s, size_t length, unsigned percent); /* bytes columns */ @@ -390,7 +390,7 @@ char* strshorten(char *s, size_t l); // UNNEEDED int symlink_idempotent(const char *from, const char *to); -int symlink_atomic(const char *from, const char *to); +// UNNEEDED int symlink_atomic(const char *from, const char *to); // UNNEEDED int mknod_atomic(const char *path, mode_t mode, dev_t dev); // UNNEEDED int mkfifo_atomic(const char *path, mode_t mode); @@ -408,7 +408,7 @@ int in_gid(gid_t gid); char* uid_to_name(uid_t uid); char* gid_to_name(gid_t gid); -int glob_exists(const char *path); +// UNNEEDED int glob_exists(const char *path); // UNNEEDED int glob_extend(char ***strv, const char *path); int dirent_ensure_type(DIR *d, struct dirent *de); @@ -425,7 +425,7 @@ static inline bool _pure_ in_charset(const char *s, const char* charset) { return s[strspn(s, charset)] == '\0'; } -int block_get_whole_disk(dev_t d, dev_t *ret); +// UNNEEDED int block_get_whole_disk(dev_t d, dev_t *ret); #define NULSTR_FOREACH(i, l) \ for ((i) = (l); (i) && *(i); (i) = strchr((i), 0)+1) @@ -461,7 +461,7 @@ bool kexec_loaded(void); // UNNEEDED int prot_from_flags(int flags) _const_; -char *format_bytes(char *buf, size_t l, off_t t); +// UNNEEDED char *format_bytes(char *buf, size_t l, off_t t); int fd_wait_for_event(int fd, int event, usec_t timeout); @@ -472,7 +472,7 @@ int fd_inc_rcvbuf(int fd, size_t n); int fork_agent(pid_t *pid, const int except[], unsigned n_except, const char *path, ...); -int setrlimit_closest(int resource, const struct rlimit *rlim); +// UNNEEDED int setrlimit_closest(int resource, const struct rlimit *rlim); bool http_url_is_valid(const char *url) _pure_; bool documentation_url_is_valid(const char *url) _pure_; @@ -482,7 +482,7 @@ bool documentation_url_is_valid(const char *url) _pure_; bool in_initrd(void); int get_home_dir(char **ret); -int get_shell(char **_ret); +// UNNEEDED int get_shell(char **_ret); static inline void freep(void *p) { free(*(void**) p); @@ -570,11 +570,11 @@ typedef enum DrawSpecialChar { const char *draw_special_char(DrawSpecialChar ch); -char *strreplace(const char *text, const char *old_string, const char *new_string); +// UNNEEDED char *strreplace(const char *text, const char *old_string, const char *new_string); -char *strip_tab_ansi(char **p, size_t *l); +// UNNEEDED char *strip_tab_ansi(char **p, size_t *l); -int on_ac_power(void); +// UNNEEDED int on_ac_power(void); int search_and_fopen(const char *path, const char *mode, const char *root, const char **search, FILE **_f); // UNNEEDED int search_and_fopen_nulstr(const char *path, const char *mode, const char *root, const char *search, FILE **_f); @@ -785,7 +785,7 @@ int proc_cmdline(char **ret); int parse_proc_cmdline(int (*parse_word)(const char *key, const char *value)); int get_proc_cmdline_key(const char *parameter, char **value); -int container_get_leader(const char *machine, pid_t *pid); +// UNNEEDED int container_get_leader(const char *machine, pid_t *pid); int namespace_open(pid_t pid, int *pidns_fd, int *mntns_fd, int *netns_fd, int *root_fd); int namespace_enter(int pidns_fd, int mntns_fd, int netns_fd, int root_fd); @@ -796,7 +796,7 @@ int getpeersec(int fd, char **ret); int writev_safe(int fd, const struct iovec *w, int j); int mkostemp_safe(char *pattern, int flags); -int open_tmpfile(const char *path, int flags); +// UNNEEDED int open_tmpfile(const char *path, int flags); int fd_warn_permissions(const char *path, int fd); @@ -808,7 +808,7 @@ int fd_warn_permissions(const char *path, int fd); #endif // UNNEEDED unsigned long personality_from_string(const char *p); -const char *personality_to_string(unsigned long); +// UNNEEDED const char *personality_to_string(unsigned long); uint64_t physical_memory(void); @@ -820,11 +820,11 @@ union file_handle_union { }; #define FILE_HANDLE_INIT { .handle.handle_bytes = MAX_HANDLE_SZ } -int update_reboot_param_file(const char *param); +// UNNEEDED int update_reboot_param_file(const char *param); -int umount_recursive(const char *target, int flags); +// UNNEEDED int umount_recursive(const char *target, int flags); -int bind_remount_recursive(const char *prefix, bool ro); +// UNNEEDED int bind_remount_recursive(const char *prefix, bool ro); int fflush_and_check(FILE *f); @@ -834,7 +834,7 @@ int tempfn_random(const char *p, const char *extra, char **ret); // UNNEEDED int take_password_lock(const char *root); -int is_symlink(const char *path); +// UNNEEDED int is_symlink(const char *path); int is_dir(const char *path, bool follow); // UNNEEDED int is_device_node(const char *path); @@ -845,7 +845,7 @@ typedef enum UnquoteFlags { } UnquoteFlags; int unquote_first_word(const char **p, char **ret, UnquoteFlags flags); -int unquote_first_word_and_warn(const char **p, char **ret, UnquoteFlags flags, const char *unit, const char *filename, unsigned line, const char *rvalue); +// UNNEEDED int unquote_first_word_and_warn(const char **p, char **ret, UnquoteFlags flags, const char *unit, const char *filename, unsigned line, const char *rvalue); // UNNEEDED int unquote_many_words(const char **p, UnquoteFlags flags, ...) _sentinel_; int free_and_strdup(char **p, const char *s); @@ -864,24 +864,24 @@ union inotify_event_buffer { #define laccess(path, mode) faccessat(AT_FDCWD, (path), (mode), AT_SYMLINK_NOFOLLOW) -int ptsname_malloc(int fd, char **ret); +// UNNEEDED int ptsname_malloc(int fd, char **ret); // UNNEEDED int openpt_in_namespace(pid_t pid, int flags); ssize_t fgetxattrat_fake(int dirfd, const char *filename, const char *attribute, void *value, size_t size, int flags); -int fd_setcrtime(int fd, usec_t usec); +// UNNEEDED int fd_setcrtime(int fd, usec_t usec); int fd_getcrtime(int fd, usec_t *usec); // UNNEEDED int path_getcrtime(const char *p, usec_t *usec); -int fd_getcrtime_at(int dirfd, const char *name, usec_t *usec, int flags); +// UNNEEDED int fd_getcrtime_at(int dirfd, const char *name, usec_t *usec, int flags); -int same_fd(int a, int b); +// UNNEEDED int same_fd(int a, int b); int chattr_fd(int fd, unsigned value, unsigned mask); -int chattr_path(const char *p, unsigned value, unsigned mask); +// UNNEEDED int chattr_path(const char *p, unsigned value, unsigned mask); int read_attr_fd(int fd, unsigned *ret); -int read_attr_path(const char *p, unsigned *ret); +// UNNEEDED int read_attr_path(const char *p, unsigned *ret); #define RLIMIT_MAKE_CONST(lim) ((struct rlimit) { lim, lim }) @@ -892,14 +892,14 @@ void sigkill_wait(pid_t *pid); // UNNEEDED int syslog_parse_priority(const char **p, int *priority, bool with_facility); -void cmsg_close_all(struct msghdr *mh); +// UNNEEDED void cmsg_close_all(struct msghdr *mh); -int rename_noreplace(int olddirfd, const char *oldpath, int newdirfd, const char *newpath); +// UNNEEDED int rename_noreplace(int olddirfd, const char *oldpath, int newdirfd, const char *newpath); char *shell_maybe_quote(const char *s); int parse_mode(const char *s, mode_t *ret); -int mount_move_root(const char *path); +// UNNEEDED int mount_move_root(const char *path); int reset_uid_gid(void); diff --git a/src/boot/efi/disk.c b/src/boot/efi/disk.c deleted file mode 100644 index 96063fbc2..000000000 --- a/src/boot/efi/disk.c +++ /dev/null @@ -1,51 +0,0 @@ -/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ - -/* - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * Copyright (C) 2015 Kay Sievers - */ - -#include -#include - -#include "util.h" - -EFI_STATUS disk_get_part_uuid(EFI_HANDLE *handle, CHAR16 uuid[37]) { - EFI_DEVICE_PATH *device_path; - EFI_STATUS r = EFI_NOT_FOUND; - - /* export the device path this image is started from */ - device_path = DevicePathFromHandle(handle); - if (device_path) { - EFI_DEVICE_PATH *path, *paths; - - paths = UnpackDevicePath(device_path); - for (path = paths; !IsDevicePathEnd(path); path = NextDevicePathNode(path)) { - HARDDRIVE_DEVICE_PATH *drive; - - if (DevicePathType(path) != MEDIA_DEVICE_PATH) - continue; - if (DevicePathSubType(path) != MEDIA_HARDDRIVE_DP) - continue; - drive = (HARDDRIVE_DEVICE_PATH *)path; - if (drive->SignatureType != SIGNATURE_TYPE_GUID) - continue; - - GuidToString(uuid, (EFI_GUID *)&drive->Signature); - r = EFI_SUCCESS; - break; - } - FreePool(paths); - } - - return r; -} diff --git a/src/boot/efi/disk.h b/src/boot/efi/disk.h deleted file mode 100644 index 1b25343a0..000000000 --- a/src/boot/efi/disk.h +++ /dev/null @@ -1,21 +0,0 @@ -/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ - -/* - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * Copyright (C) 2015 Kay Sievers - */ - -#ifndef __SDBOOT_DISK_H -#define __SDBOOT_DISK_H - -EFI_STATUS disk_get_part_uuid(EFI_HANDLE *handle, CHAR16 uuid[37]); -#endif -- 2.30.2