From c286398e07a7a16aa88a3437318cb2edf8c082c1 Mon Sep 17 00:00:00 2001 From: Sven Eden Date: Tue, 21 Feb 2017 19:16:19 +0100 Subject: [PATCH] Cleaned up more unneeded functions and types in: - src/basic/ioprio.h - removed - src/basic/ring.h - removed - src/basic/capability.[hc] - cleaned - src/basic/cgroup-util.[hc] - cleaned - src/basic/hostname-util.[hc] - cleaned - src/basic/path-util.[hc] - cleaned - src/basic/socket-util.h - cleaned - src/basic/strv.[hc] - cleaned - src/basic/time-util.[hc] - cleaned - src/basic/unit-name.[hc] - cleaned - src/basic/util.[hc] - cleaned - src/libelogind/sd-bus/bus-introspect.c - cleaned - src/login/loginctl.c - cleaned - src/login/logind-dbus.c - cleaned - src/login/logind.h - cleaned - src/shared/conf-parser.[hc] - cleaned --- src/basic/capability.c | 4 +- src/basic/capability.h | 2 +- src/basic/cgroup-util.c | 6 --- src/basic/cgroup-util.h | 4 +- src/basic/hostname-util.c | 3 ++ src/basic/hostname-util.h | 2 +- src/basic/ioprio.h | 55 -------------------------- src/basic/path-util.c | 5 +-- src/basic/path-util.h | 4 +- src/basic/ring.h | 55 -------------------------- src/basic/socket-util.h | 11 ++++-- src/basic/strv.c | 7 +--- src/basic/strv.h | 6 +-- src/basic/time-util.c | 6 +-- src/basic/time-util.h | 8 ++-- src/basic/unit-name.c | 13 +----- src/basic/unit-name.h | 19 +++++---- src/basic/util.c | 6 +-- src/basic/util.h | 4 +- src/libelogind/sd-bus/bus-introspect.c | 4 +- src/login/loginctl.c | 10 ++++- src/login/logind-dbus.c | 2 +- src/login/logind.h | 10 ++--- src/shared/conf-parser.c | 2 +- src/shared/conf-parser.h | 2 +- 25 files changed, 67 insertions(+), 183 deletions(-) delete mode 100644 src/basic/ioprio.h delete mode 100644 src/basic/ring.h diff --git a/src/basic/capability.c b/src/basic/capability.c index 91ccb2779..360c12816 100644 --- a/src/basic/capability.c +++ b/src/basic/capability.c @@ -96,6 +96,8 @@ unsigned long cap_last_cap(void) { return p; } +/// UNNEEDED by elogind +#if 0 int capability_bounding_set_drop(uint64_t drop, bool right_now) { _cleanup_cap_free_ cap_t after_cap = NULL; cap_flag_value_t fv; @@ -176,8 +178,6 @@ finish: return r; } -/// UNNEEDED by elogind -#if 0 static int drop_from_file(const char *fn, uint64_t drop) { int r, k; uint32_t hi, lo; diff --git a/src/basic/capability.h b/src/basic/capability.h index 0d6b33b8b..137f606f0 100644 --- a/src/basic/capability.h +++ b/src/basic/capability.h @@ -28,7 +28,7 @@ unsigned long cap_last_cap(void); // UNNEEDED int have_effective_cap(int value); -int capability_bounding_set_drop(uint64_t drop, bool right_now); +// UNNEEDED int capability_bounding_set_drop(uint64_t drop, bool right_now); // UNNEEDED int capability_bounding_set_drop_usermode(uint64_t drop); // UNNEEDED int drop_privileges(uid_t uid, gid_t gid, uint64_t keep_capabilities); diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c index f7a892380..bd17b5ee5 100644 --- a/src/basic/cgroup-util.c +++ b/src/basic/cgroup-util.c @@ -1907,7 +1907,6 @@ int cg_create_everywhere(CGroupMask supported, CGroupMask mask, const char *path return 0; } -#endif // 0 int cg_attach_everywhere(CGroupMask supported, const char *path, pid_t pid, cg_migrate_callback_t path_callback, void *userdata) { CGroupController c; @@ -1942,8 +1941,6 @@ int cg_attach_everywhere(CGroupMask supported, const char *path, pid_t pid, cg_m return 0; } -/// UNNEEDED by elogind -#if 0 int cg_attach_many_everywhere(CGroupMask supported, const char *path, Set* pids, cg_migrate_callback_t path_callback, void *userdata) { Iterator i; void *pidp; @@ -2237,7 +2234,6 @@ int cg_enable_everywhere(CGroupMask supported, CGroupMask mask, const char *p) { return 0; } -#endif // 0 bool cg_is_unified_wanted(void) { static thread_local int wanted = -1; @@ -2271,8 +2267,6 @@ bool cg_is_unified_wanted(void) { } } -/// UNNEEDED by elogind -#if 0 bool cg_is_legacy_wanted(void) { return !cg_is_unified_wanted(); } diff --git a/src/basic/cgroup-util.h b/src/basic/cgroup-util.h index 90a68be34..f14fc3705 100644 --- a/src/basic/cgroup-util.h +++ b/src/basic/cgroup-util.h @@ -141,7 +141,7 @@ bool cg_controller_is_valid(const char *p); typedef const char* (*cg_migrate_callback_t)(CGroupMask mask, void *userdata); // UNNEEDED int cg_create_everywhere(CGroupMask supported, CGroupMask mask, const char *path); -int cg_attach_everywhere(CGroupMask supported, const char *path, pid_t pid, cg_migrate_callback_t callback, void *userdata); +// UNNEEDED int cg_attach_everywhere(CGroupMask supported, const char *path, pid_t pid, cg_migrate_callback_t callback, void *userdata); // UNNEEDED int cg_attach_many_everywhere(CGroupMask supported, const char *path, Set* pids, cg_migrate_callback_t callback, void *userdata); // UNNEEDED int cg_migrate_everywhere(CGroupMask supported, const char *from, const char *to, cg_migrate_callback_t callback, void *userdata); // UNNEEDED int cg_trim_everywhere(CGroupMask supported, const char *path, bool delete_root); @@ -154,7 +154,7 @@ int cg_mask_supported(CGroupMask *ret); int cg_unified(void); // UNNEEDED void cg_unified_flush(void); -bool cg_is_unified_wanted(void); +// UNNEEDED bool cg_is_unified_wanted(void); // UNNEEDED bool cg_is_legacy_wanted(void); const char* cgroup_controller_to_string(CGroupController c) _const_; diff --git a/src/basic/hostname-util.c b/src/basic/hostname-util.c index a55b4149d..c0048409b 100644 --- a/src/basic/hostname-util.c +++ b/src/basic/hostname-util.c @@ -113,6 +113,8 @@ bool hostname_is_valid(const char *s, bool allow_trailing_dot) { return true; } +/// UNNEEDED by elogind +#if 0 char* hostname_cleanup(char *s) { char *p, *d; bool dot; @@ -142,6 +144,7 @@ char* hostname_cleanup(char *s) { return s; } +#endif // 0 bool is_localhost(const char *hostname) { assert(hostname); diff --git a/src/basic/hostname-util.h b/src/basic/hostname-util.h index e96cd5f87..dd0960e37 100644 --- a/src/basic/hostname-util.h +++ b/src/basic/hostname-util.h @@ -30,7 +30,7 @@ // UNNEEDED char* gethostname_malloc(void); bool hostname_is_valid(const char *s, bool allow_trailing_dot) _pure_; -char* hostname_cleanup(char *s); +// UNNEEDED char* hostname_cleanup(char *s); #define machine_name_is_valid(s) hostname_is_valid(s, false) diff --git a/src/basic/ioprio.h b/src/basic/ioprio.h deleted file mode 100644 index e5c71d004..000000000 --- a/src/basic/ioprio.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef IOPRIO_H -#define IOPRIO_H - -/* This is minimal version of Linux' linux/ioprio.h header file, which - * is licensed GPL2 */ - -#include -#include - -/* - * Gives us 8 prio classes with 13-bits of data for each class - */ -#define IOPRIO_BITS (16) -#define IOPRIO_CLASS_SHIFT (13) -#define IOPRIO_PRIO_MASK ((1UL << IOPRIO_CLASS_SHIFT) - 1) - -#define IOPRIO_PRIO_CLASS(mask) ((mask) >> IOPRIO_CLASS_SHIFT) -#define IOPRIO_PRIO_DATA(mask) ((mask) & IOPRIO_PRIO_MASK) -#define IOPRIO_PRIO_VALUE(class, data) (((class) << IOPRIO_CLASS_SHIFT) | data) - -#define ioprio_valid(mask) (IOPRIO_PRIO_CLASS((mask)) != IOPRIO_CLASS_NONE) - -/* - * These are the io priority groups as implemented by CFQ. RT is the realtime - * class, it always gets premium service. BE is the best-effort scheduling - * class, the default for any process. IDLE is the idle scheduling class, it - * is only served when no one else is using the disk. - */ -enum { - IOPRIO_CLASS_NONE, - IOPRIO_CLASS_RT, - IOPRIO_CLASS_BE, - IOPRIO_CLASS_IDLE, -}; - -/* - * 8 best effort priority levels are supported - */ -#define IOPRIO_BE_NR (8) - -enum { - IOPRIO_WHO_PROCESS = 1, - IOPRIO_WHO_PGRP, - IOPRIO_WHO_USER, -}; - -static inline int ioprio_set(int which, int who, int ioprio) { - return syscall(__NR_ioprio_set, which, who, ioprio); -} - -static inline int ioprio_get(int which, int who) { - return syscall(__NR_ioprio_get, which, who); -} - -#endif diff --git a/src/basic/path-util.c b/src/basic/path-util.c index 6bdc8342e..238252eeb 100644 --- a/src/basic/path-util.c +++ b/src/basic/path-util.c @@ -719,7 +719,6 @@ int path_is_os_tree(const char *path) { return r >= 0; } -#endif // 0 int find_binary(const char *name, bool local, char **filename) { assert(name); @@ -773,8 +772,6 @@ int find_binary(const char *name, bool local, char **filename) { } } -/// UNNEEDED by elogind -#if 0 bool paths_check_timestamp(const char* const* paths, usec_t *timestamp, bool update) { bool changed = false; const char* const* i; @@ -833,7 +830,6 @@ int fsck_exists(const char *fstype) { return 0; } -#endif // 0 char *prefix_root(const char *root, const char *path) { char *n, *p; @@ -868,3 +864,4 @@ char *prefix_root(const char *root, const char *path) { strcpy(p, path); return n; } +#endif // 0 diff --git a/src/basic/path-util.h b/src/basic/path-util.h index b692f17ab..90b405dc8 100644 --- a/src/basic/path-util.h +++ b/src/basic/path-util.h @@ -58,7 +58,7 @@ int path_is_mount_point(const char *path, int flags); int path_is_read_only_fs(const char *path); // UNNEEDED int path_is_os_tree(const char *path); -int find_binary(const char *name, bool local, char **filename); +// UNNEEDED int find_binary(const char *name, bool local, char **filename); // UNNEEDED bool paths_check_timestamp(const char* const* paths, usec_t *paths_ts_usec, bool update); @@ -74,7 +74,7 @@ int find_binary(const char *name, bool local, char **filename); #define PATH_FOREACH_PREFIX_MORE(prefix, path) \ for (char *_slash = ({ path_kill_slashes(strcpy(prefix, path)); if (streq(prefix, "/")) prefix[0] = 0; strrchr(prefix, 0); }); _slash && ((*_slash = 0), true); _slash = strrchr((prefix), '/')) -char *prefix_root(const char *root, const char *path); +// UNNEEDED char *prefix_root(const char *root, const char *path); /* Similar to prefix_root(), but returns an alloca() buffer, or * possibly a const pointer into the path parameter */ diff --git a/src/basic/ring.h b/src/basic/ring.h deleted file mode 100644 index dcd0a3e8b..000000000 --- a/src/basic/ring.h +++ /dev/null @@ -1,55 +0,0 @@ -/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ - -#pragma once - -/*** - This file is part of systemd. - - Copyright 2014 David Herrmann - - 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 . -***/ - - -typedef struct Ring Ring; - -struct Ring { - uint8_t *buf; /* buffer or NULL */ - size_t size; /* actual size of @buf */ - size_t start; /* start position of ring */ - size_t used; /* number of actually used bytes */ -}; - -/* flush buffer so it is empty again */ -// UNNEEDED void ring_flush(Ring *r); - -/* flush buffer, free allocated data and reset to initial state */ -void ring_clear(Ring *r); - -/* get pointers to buffer data and their length */ -size_t ring_peek(Ring *r, struct iovec *vec); - -/* copy data into external linear buffer */ -// UNNEEDED size_t ring_copy(Ring *r, void *buf, size_t size); - -/* push data to the end of the buffer */ -int ring_push(Ring *r, const void *u8, size_t size); - -/* pull data from the front of the buffer */ -void ring_pull(Ring *r, size_t size); - -/* return size of occupied buffer in bytes */ -static inline size_t ring_get_size(Ring *r) { - return r->used; -} diff --git a/src/basic/socket-util.h b/src/basic/socket-util.h index cccc6a654..c039f4869 100644 --- a/src/basic/socket-util.h +++ b/src/basic/socket-util.h @@ -41,6 +41,8 @@ union sockaddr_union { struct sockaddr_ll ll; }; +/// UNNEEDED by elogind +#if 0 typedef struct SocketAddress { union sockaddr_union sockaddr; @@ -86,7 +88,7 @@ int socket_address_listen( mode_t directory_mode, mode_t socket_mode, const char *label); -// UNNEEDED int make_socket_fd(int log_level, const char* address, int flags); +int make_socket_fd(int log_level, const char* address, int flags); bool socket_address_is(const SocketAddress *a, const char *s, int type); bool socket_address_is_netlink(const SocketAddress *a, const char *s); @@ -103,10 +105,10 @@ int sockaddr_port(const struct sockaddr *_sa) _pure_; int sockaddr_pretty(const struct sockaddr *_sa, socklen_t salen, bool translate_ipv6, bool include_port, char **ret); int getpeername_pretty(int fd, char **ret); -// UNNEEDED int getsockname_pretty(int fd, char **ret); +int getsockname_pretty(int fd, char **ret); int socknameinfo_pretty(union sockaddr_union *sa, socklen_t salen, char **_ret); -// UNNEEDED int getnameinfo_pretty(int fd, char **ret); +int getnameinfo_pretty(int fd, char **ret); const char* socket_address_bind_ipv6_only_to_string(SocketAddressBindIPv6Only b) _const_; SocketAddressBindIPv6Only socket_address_bind_ipv6_only_from_string(const char *s) _pure_; @@ -114,8 +116,9 @@ SocketAddressBindIPv6Only socket_address_bind_ipv6_only_from_string(const char * int netlink_family_to_string_alloc(int b, char **s); int netlink_family_from_string(const char *s) _pure_; -// UNNEEDED bool sockaddr_equal(const union sockaddr_union *a, const union sockaddr_union *b); +bool sockaddr_equal(const union sockaddr_union *a, const union sockaddr_union *b); #define ETHER_ADDR_TO_STRING_MAX (3*6) char* ether_addr_to_string(const struct ether_addr *addr, char buffer[ETHER_ADDR_TO_STRING_MAX]); +#endif // 0 diff --git a/src/basic/strv.c b/src/basic/strv.c index ea5e57acd..9decbb419 100644 --- a/src/basic/strv.c +++ b/src/basic/strv.c @@ -633,6 +633,8 @@ char **strv_split_nulstr(const char *s) { return r; } +/// UNNEEDED by elogind +#if 0 bool strv_overlap(char **a, char **b) { char **i; @@ -658,8 +660,6 @@ char **strv_sort(char **l) { return l; } -/// UNNEEDED by elogind -#if 0 bool strv_equal(char **a, char **b) { if (!a || !b) return a == b; @@ -670,7 +670,6 @@ bool strv_equal(char **a, char **b) { return true; } -#endif // 0 void strv_print(char **l) { char **s; @@ -679,8 +678,6 @@ void strv_print(char **l) { puts(*s); } -/// UNNEEDED by elogind -#if 0 int strv_extendf(char ***l, const char *format, ...) { va_list ap; char *x; diff --git a/src/basic/strv.h b/src/basic/strv.h index d1dbe83d3..682bb3f75 100644 --- a/src/basic/strv.h +++ b/src/basic/strv.h @@ -81,7 +81,7 @@ char *strv_join(char **l, const char *separator); char **strv_parse_nulstr(const char *s, size_t l); char **strv_split_nulstr(const char *s); -bool strv_overlap(char **a, char **b) _pure_; +// UNNEEDED bool strv_overlap(char **a, char **b) _pure_; #define STRV_FOREACH(s, l) \ for ((s) = (l); (s) && *(s); (s)++) @@ -94,8 +94,8 @@ bool strv_overlap(char **a, char **b) _pure_; #define STRV_FOREACH_PAIR(x, y, l) \ for ((x) = (l), (y) = (x+1); (x) && *(x) && *(y); (x) += 2, (y) = (x + 1)) -char **strv_sort(char **l); -void strv_print(char **l); +// UNNEEDED char **strv_sort(char **l); +// UNNEEDED void strv_print(char **l); #define STRV_MAKE(...) ((char**) ((const char*[]) { __VA_ARGS__, NULL })) diff --git a/src/basic/time-util.c b/src/basic/time-util.c index 52a0382c7..17d3da6fa 100644 --- a/src/basic/time-util.c +++ b/src/basic/time-util.c @@ -800,6 +800,8 @@ int parse_sec(const char *t, usec_t *usec) { return 0; } +/// UNNEEDED by elogind +#if 0 int parse_nsec(const char *t, nsec_t *nsec) { static const struct { const char *suffix; @@ -925,8 +927,6 @@ int parse_nsec(const char *t, nsec_t *nsec) { return 0; } -/// UNNEEDED by elogind -#if 0 bool ntp_synced(void) { struct timex txc = {}; @@ -1002,7 +1002,6 @@ int get_timezones(char ***ret) { return 0; } -#endif // 0 bool timezone_is_valid(const char *name) { bool slash = false; @@ -1089,3 +1088,4 @@ int get_timezone(char **tz) { *tz = z; return 0; } +#endif // 0 diff --git a/src/basic/time-util.h b/src/basic/time-util.h index 08b2bfb82..a0c850b08 100644 --- a/src/basic/time-util.h +++ b/src/basic/time-util.h @@ -103,15 +103,15 @@ char *format_timespan(char *buf, size_t l, usec_t t, usec_t accuracy); // UNNEEDED int parse_timestamp(const char *t, usec_t *usec); int parse_sec(const char *t, usec_t *usec); -int parse_nsec(const char *t, nsec_t *nsec); +// UNNEEDED int parse_nsec(const char *t, nsec_t *nsec); // UNNEEDED bool ntp_synced(void); // UNNEEDED int get_timezones(char ***l); -bool timezone_is_valid(const char *name); +// UNNEEDED bool timezone_is_valid(const char *name); -clockid_t clock_boottime_or_monotonic(void); +// UNNEEDED clockid_t clock_boottime_or_monotonic(void); #define xstrftime(buf, fmt, tm) assert_se(strftime(buf, ELEMENTSOF(buf), fmt, tm) > 0) -int get_timezone(char **timezone); +// UNNEEDED int get_timezone(char **timezone); diff --git a/src/basic/unit-name.c b/src/basic/unit-name.c index 6c74661c5..de1683536 100644 --- a/src/basic/unit-name.c +++ b/src/basic/unit-name.c @@ -196,7 +196,6 @@ int unit_name_to_prefix_and_instance(const char *n, char **ret) { *ret = s; return 0; } -#endif // 0 UnitType unit_name_to_type(const char *n) { const char *e; @@ -211,8 +210,6 @@ UnitType unit_name_to_type(const char *n) { return unit_type_from_string(e + 1); } -/// UNNEEDED by elogind -#if 0 int unit_name_change_suffix(const char *n, const char *suffix, char **ret) { char *e, *s; size_t a, b; @@ -270,6 +267,8 @@ int unit_name_build(const char *prefix, const char *instance, const char *suffix return 0; } +/// UNNEEDED by elogind +#if 0 static char *do_escape_char(char c, char *t) { assert(t); @@ -443,8 +442,6 @@ int unit_name_path_unescape(const char *f, char **ret) { return 0; } -/// UNNEEDED by elogind -#if 0 int unit_name_replace_instance(const char *f, const char *i, char **ret) { const char *p, *e; char *s; @@ -500,7 +497,6 @@ int unit_name_template(const char *f, char **ret) { *ret = s; return 0; } -#endif // 0 int unit_name_from_path(const char *path, const char *suffix, char **ret) { _cleanup_free_ char *p = NULL; @@ -526,8 +522,6 @@ int unit_name_from_path(const char *path, const char *suffix, char **ret) { return 0; } -/// UNNEEDED by elogind -#if 0 int unit_name_from_path_instance(const char *prefix, const char *path, const char *suffix, char **ret) { _cleanup_free_ char *p = NULL; char *s; @@ -568,7 +562,6 @@ int unit_name_to_path(const char *name, char **ret) { return unit_name_path_unescape(prefix, ret); } -#endif // 0 char *unit_dbus_path_from_name(const char *name) { _cleanup_free_ char *e = NULL; @@ -598,8 +591,6 @@ int unit_name_from_dbus_path(const char *path, char **name) { return 0; } -/// UNNEEDED by elogind -#if 0 const char* unit_dbus_interface_from_type(UnitType t) { static const char *const table[_UNIT_TYPE_MAX] = { diff --git a/src/basic/unit-name.h b/src/basic/unit-name.h index 8ed77ae8e..e07f7917b 100644 --- a/src/basic/unit-name.h +++ b/src/basic/unit-name.h @@ -124,36 +124,39 @@ bool unit_prefix_is_valid(const char *p) _pure_; bool unit_instance_is_valid(const char *i) _pure_; bool unit_suffix_is_valid(const char *s) _pure_; +/// UNNEEDED by elogind +#if 0 static inline int unit_prefix_and_instance_is_valid(const char *p) { /* For prefix+instance and instance the same rules apply */ return unit_instance_is_valid(p); } +#endif // 0 // UNNEEDED int unit_name_to_prefix(const char *n, char **prefix); // UNNEEDED int unit_name_to_instance(const char *n, char **instance); // UNNEEDED int unit_name_to_prefix_and_instance(const char *n, char **ret); -UnitType unit_name_to_type(const char *n) _pure_; +// UNNEEDED UnitType unit_name_to_type(const char *n) _pure_; // UNNEEDED int unit_name_change_suffix(const char *n, const char *suffix, char **ret); int unit_name_build(const char *prefix, const char *instance, const char *suffix, char **ret); -char *unit_name_escape(const char *f); -int unit_name_unescape(const char *f, char **ret); -int unit_name_path_escape(const char *f, char **ret); -int unit_name_path_unescape(const char *f, char **ret); +// UNNEEDED char *unit_name_escape(const char *f); +// UNNEEDED int unit_name_unescape(const char *f, char **ret); +// UNNEEDED int unit_name_path_escape(const char *f, char **ret); +// UNNEEDED int unit_name_path_unescape(const char *f, char **ret); // UNNEEDED int unit_name_replace_instance(const char *f, const char *i, char **ret); // UNNEEDED int unit_name_template(const char *f, char **ret); -int unit_name_from_path(const char *path, const char *suffix, char **ret); +// UNNEEDED int unit_name_from_path(const char *path, const char *suffix, char **ret); // UNNEEDED int unit_name_from_path_instance(const char *prefix, const char *path, const char *suffix, char **ret); // UNNEEDED int unit_name_to_path(const char *name, char **ret); -char *unit_dbus_path_from_name(const char *name); -int unit_name_from_dbus_path(const char *path, char **name); +// UNNEEDED char *unit_dbus_path_from_name(const char *name); +// UNNEEDED int unit_name_from_dbus_path(const char *path, char **name); // UNNEEDED const char* unit_dbus_interface_from_type(UnitType t); // UNNEEDED const char *unit_dbus_interface_from_name(const char *name); diff --git a/src/basic/util.c b/src/basic/util.c index fcea9cead..7e0a913f5 100644 --- a/src/basic/util.c +++ b/src/basic/util.c @@ -72,7 +72,7 @@ #include "config.h" #include "macro.h" #include "util.h" -#include "ioprio.h" +// #include "ioprio.h" // #include "missing.h" // #include "log.h" #include "strv.h" @@ -3677,7 +3677,6 @@ 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", @@ -3687,6 +3686,7 @@ static const char *const ioprio_class_table[] = { }; DEFINE_STRING_TABLE_LOOKUP_WITH_FALLBACK(ioprio_class, int, INT_MAX); +#endif // 0 static const char *const sigchld_code_table[] = { [CLD_EXITED] = "exited", @@ -6671,7 +6671,6 @@ int rename_noreplace(int olddirfd, const char *oldpath, int newdirfd, const char return 0; } -#endif // 0 static char *strcpy_backslash_escaped(char *t, const char *s, const char *bad) { assert(bad); @@ -6732,6 +6731,7 @@ char *shell_maybe_quote(const char *s) { return r; } +#endif // 0 int parse_mode(const char *s, mode_t *ret) { char *x; diff --git a/src/basic/util.h b/src/basic/util.h index 3cb40a83b..3b956b856 100644 --- a/src/basic/util.h +++ b/src/basic/util.h @@ -924,8 +924,8 @@ void sigkill_wait(pid_t *pid); // UNNEEDED int rename_noreplace(int olddirfd, const char *oldpath, int newdirfd, const char *newpath); -char *shell_escape(const char *s, const char *bad); -char *shell_maybe_quote(const char *s); +// UNNEEDED char *shell_escape(const char *s, const char *bad); +// UNNEEDED char *shell_maybe_quote(const char *s); int parse_mode(const char *s, mode_t *ret); diff --git a/src/libelogind/sd-bus/bus-introspect.c b/src/libelogind/sd-bus/bus-introspect.c index 24aa21dfd..fe7fcb5c5 100644 --- a/src/libelogind/sd-bus/bus-introspect.c +++ b/src/libelogind/sd-bus/bus-introspect.c @@ -82,7 +82,7 @@ static void introspect_write_flags(struct introspect *i, int type, int flags) { if (type == _SD_BUS_VTABLE_PROPERTY || type == _SD_BUS_VTABLE_WRITABLE_PROPERTY) { if (flags & SD_BUS_VTABLE_PROPERTY_EXPLICIT) - fputs(" \n", i->f); + fputs(" \n", i->f); if (flags & SD_BUS_VTABLE_PROPERTY_CONST) fputs(" \n", i->f); @@ -95,7 +95,7 @@ static void introspect_write_flags(struct introspect *i, int type, int flags) { if (!i->trusted && (type == _SD_BUS_VTABLE_METHOD || type == _SD_BUS_VTABLE_WRITABLE_PROPERTY) && !(flags & SD_BUS_VTABLE_UNPRIVILEGED)) - fputs(" \n", i->f); + fputs(" \n", i->f); } static int introspect_write_arguments(struct introspect *i, const char *signature, const char *direction) { diff --git a/src/login/loginctl.c b/src/login/loginctl.c index 543f14063..7b259ce21 100644 --- a/src/login/loginctl.c +++ b/src/login/loginctl.c @@ -95,6 +95,8 @@ static void polkit_agent_open_if_enabled(void) { polkit_agent_open(); } +/// UNNEEDED by elogind +#if 0 static OutputFlags get_output_flags(void) { return @@ -103,6 +105,7 @@ static OutputFlags get_output_flags(void) { (!on_tty() || pager_have()) * OUTPUT_FULL_WIDTH | on_tty() * OUTPUT_COLOR; } +#endif // 0 static int list_sessions(int argc, char *argv[], void *userdata) { _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; @@ -244,6 +247,8 @@ static int list_seats(int argc, char *argv[], void *userdata) { return 0; } +/// UNNEEDED by elogind +#if 0 static int show_unit_cgroup(sd_bus *bus, const char *interface, const char *unit, pid_t leader) { _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; _cleanup_bus_message_unref_ sd_bus_message *reply = NULL; @@ -291,6 +296,7 @@ static int show_unit_cgroup(sd_bus *bus, const char *interface, const char *unit show_cgroup_and_extra(ELOGIND_CGROUP_CONTROLLER, cgroup, "\t\t ", c, false, &leader, leader > 0, get_output_flags()); return 0; } +#endif // 0 typedef struct SessionStatusInfo { char *id; @@ -547,8 +553,8 @@ static int print_session_status_info(sd_bus *bus, const char *path, bool *new_li if (i.scope) { printf("\t Unit: %s\n", i.scope); - show_unit_cgroup(bus, "org.freedesktop.systemd1.Scope", i.scope, i.leader); #if 0 + show_unit_cgroup(bus, "org.freedesktop.systemd1.Scope", i.scope, i.leader); if (arg_transport == BUS_TRANSPORT_LOCAL) { show_journal_by_unit( @@ -631,8 +637,8 @@ static int print_user_status_info(sd_bus *bus, const char *path, bool *new_line) if (i.slice) { printf("\t Unit: %s\n", i.slice); - show_unit_cgroup(bus, "org.freedesktop.systemd1.Slice", i.slice, 0); #if 0 + show_unit_cgroup(bus, "org.freedesktop.systemd1.Slice", i.slice, 0); show_journal_by_unit( stdout, i.slice, diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index bf00b137a..5dedbfc90 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -2621,7 +2621,6 @@ int match_job_removed(sd_bus_message *message, void *userdata, sd_bus_error *err return 0; } -#endif // 0 int match_unit_removed(sd_bus_message *message, void *userdata, sd_bus_error *error) { const char *path, *unit; @@ -2710,6 +2709,7 @@ int match_reloading(sd_bus_message *message, void *userdata, sd_bus_error *error return 0; } +#endif // 0 int manager_send_changed(Manager *manager, const char *property, ...) { char **l; diff --git a/src/login/logind.h b/src/login/logind.h index 0b6422fc1..29432823e 100644 --- a/src/login/logind.h +++ b/src/login/logind.h @@ -191,11 +191,11 @@ bool manager_is_docked_or_multiple_displays(Manager *m); extern const sd_bus_vtable manager_vtable[]; -int match_job_removed(sd_bus_message *message, void *userdata, sd_bus_error *error); -int match_unit_removed(sd_bus_message *message, void *userdata, sd_bus_error *error); -int match_properties_changed(sd_bus_message *message, void *userdata, sd_bus_error *error); -int match_reloading(sd_bus_message *message, void *userdata, sd_bus_error *error); -int match_name_owner_changed(sd_bus_message *message, void *userdata, sd_bus_error *error); +// UNNEEDED int match_job_removed(sd_bus_message *message, void *userdata, sd_bus_error *error); +// UNNEEDED int match_unit_removed(sd_bus_message *message, void *userdata, sd_bus_error *error); +// UNNEEDED int match_properties_changed(sd_bus_message *message, void *userdata, sd_bus_error *error); +// UNNEEDED int match_reloading(sd_bus_message *message, void *userdata, sd_bus_error *error); +// UNNEEDED int match_name_owner_changed(sd_bus_message *message, void *userdata, sd_bus_error *error); /// eloginds own version does the action itself #if 0 diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c index 588532fae..b803c57e7 100644 --- a/src/shared/conf-parser.c +++ b/src/shared/conf-parser.c @@ -455,7 +455,7 @@ DEFINE_PARSER(uint32, uint32_t, safe_atou32) DEFINE_PARSER(uint64, uint64_t, safe_atou64) DEFINE_PARSER(unsigned, unsigned, safe_atou) DEFINE_PARSER(double, double, safe_atod) -DEFINE_PARSER(nsec, nsec_t, parse_nsec) +// UNNEEDED DEFINE_PARSER(nsec, nsec_t, parse_nsec) DEFINE_PARSER(sec, usec_t, parse_sec) int config_parse_iec_size(const char* unit, diff --git a/src/shared/conf-parser.h b/src/shared/conf-parser.h index 08ea1f76d..9e594c86e 100644 --- a/src/shared/conf-parser.h +++ b/src/shared/conf-parser.h @@ -116,7 +116,7 @@ int config_parse_string(const char *unit, const char *filename, unsigned line, c int config_parse_path(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); int config_parse_strv(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); int config_parse_sec(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); -int config_parse_nsec(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); +// UNNEEDED int config_parse_nsec(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); int config_parse_mode(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); int config_parse_log_facility(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); int config_parse_log_level(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); -- 2.30.2