From: Sven Eden Date: Tue, 11 Apr 2017 15:07:51 +0000 (+0200) Subject: Prep v228: Substitute declaration masks (3/4) X-Git-Tag: v228.1~1^2~12 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=20e696d0ded4e2f95ab20e95b148c806a3112949 Prep v228: Substitute declaration masks (3/4) --- diff --git a/src/basic/stat-util.h b/src/basic/stat-util.h index 7c93dd505..23e00885f 100644 --- a/src/basic/stat-util.h +++ b/src/basic/stat-util.h @@ -28,14 +28,17 @@ #include "macro.h" -// UNNEEDED int is_symlink(const char *path); +/// UNNEEDED by elogind +#if 0 +int is_symlink(const char *path); +#endif // 0 int is_dir(const char *path, bool follow); -// UNNEEDED int is_device_node(const char *path); - -// UNNEEDED int dir_is_empty(const char *path); - /// UNNEEDED by elogind #if 0 +int is_device_node(const char *path); + +int dir_is_empty(const char *path); + static inline int dir_is_populated(const char *path) { int r; r = dir_is_empty(path); @@ -47,10 +50,16 @@ static inline int dir_is_populated(const char *path) { bool null_or_empty(struct stat *st) _pure_; int null_or_empty_path(const char *fn); -// UNNEEDED int null_or_empty_fd(int fd); +/// UNNEEDED by elogind +#if 0 +int null_or_empty_fd(int fd); +#endif // 0 int path_is_read_only_fs(const char *path); -// UNNEEDED int path_is_os_tree(const char *path); +/// UNNEEDED by elogind +#if 0 +int path_is_os_tree(const char *path); +#endif // 0 int files_same(const char *filea, const char *fileb); @@ -60,8 +69,11 @@ int files_same(const char *filea, const char *fileb); typedef long statfs_f_type_t; bool is_fs_type(const struct statfs *s, statfs_f_type_t magic_value) _pure_; -// UNNEEDED int fd_check_fstype(int fd, statfs_f_type_t magic_value); -// UNNEEDED int path_check_fstype(const char *path, statfs_f_type_t magic_value); +/// UNNEEDED by elogind +#if 0 +int fd_check_fstype(int fd, statfs_f_type_t magic_value); +int path_check_fstype(const char *path, statfs_f_type_t magic_value); +#endif // 0 bool is_temporary_fs(const struct statfs *s) _pure_; int fd_is_temporary_fs(int fd); diff --git a/src/basic/strv.h b/src/basic/strv.h index e3d50ba1b..d90527c6f 100644 --- a/src/basic/strv.h +++ b/src/basic/strv.h @@ -46,21 +46,33 @@ char **strv_copy(char * const *l); unsigned strv_length(char * const *l) _pure_; int strv_extend_strv(char ***a, char **b, bool filter_duplicates); -// UNNEEDED int strv_extend_strv_concat(char ***a, char **b, const char *suffix); +/// UNNEEDED by elogind +#if 0 +int strv_extend_strv_concat(char ***a, char **b, const char *suffix); +#endif // 0 int strv_extend(char ***l, const char *value); -// UNNEEDED int strv_extendf(char ***l, const char *format, ...) _printf_(2,0); +/// UNNEEDED by elogind +#if 0 +int strv_extendf(char ***l, const char *format, ...) _printf_(2,0); +#endif // 0 int strv_push(char ***l, char *value); int strv_push_pair(char ***l, char *a, char *b); int strv_push_prepend(char ***l, char *value); int strv_consume(char ***l, char *value); -// UNNEEDED int strv_consume_pair(char ***l, char *a, char *b); +/// UNNEEDED by elogind +#if 0 +int strv_consume_pair(char ***l, char *a, char *b); +#endif // 0 int strv_consume_prepend(char ***l, char *value); char **strv_remove(char **l, const char *s); char **strv_uniq(char **l); -// UNNEEDED bool strv_is_uniq(char **l); +/// UNNEEDED by elogind +#if 0 +bool strv_is_uniq(char **l); -// UNNEEDED bool strv_equal(char **a, char **b); +bool strv_equal(char **a, char **b); +#endif // 0 #define strv_contains(l, s) (!!strv_find((l), (s))) @@ -76,19 +88,26 @@ static inline bool strv_isempty(char * const *l) { } char **strv_split(const char *s, const char *separator); -// UNNEEDED char **strv_split_newlines(const char *s); - -// UNNEEDED int strv_split_extract(char ***t, const char *s, const char *separators, ExtractFlags flags); +/// UNNEEDED by elogind +#if 0 +char **strv_split_newlines(const char *s); +int strv_split_extract(char ***t, const char *s, const char *separators, ExtractFlags flags); +#endif // 0 char *strv_join(char **l, const char *separator); -// UNNEEDED char *strv_join_quoted(char **l); +/// UNNEEDED by elogind +#if 0 +char *strv_join_quoted(char **l); +#endif // 0 char **strv_parse_nulstr(const char *s, size_t l); char **strv_split_nulstr(const char *s); -// UNNEEDED int strv_make_nulstr(char **l, char **p, size_t *n); - -// UNNEEDED bool strv_overlap(char **a, char **b) _pure_; +/// UNNEEDED by elogind +#if 0 +int strv_make_nulstr(char **l, char **p, size_t *n); +bool strv_overlap(char **a, char **b) _pure_; +#endif // 0 #define STRV_FOREACH(s, l) \ for ((s) = (l); (s) && *(s); (s)++) @@ -101,7 +120,10 @@ char **strv_split_nulstr(const char *s); for ((x) = (l), (y) = (x+1); (x) && *(x) && *(y); (x) += 2, (y) = (x + 1)) char **strv_sort(char **l); -// UNNEEDED void strv_print(char **l); +/// UNNEEDED by elogind +#if 0 +void strv_print(char **l); +#endif // 0 #define STRV_MAKE(...) ((char**) ((const char*[]) { __VA_ARGS__, NULL })) @@ -150,22 +172,22 @@ char **strv_sort(char **l); _l[0]; \ })) -// UNNEEDED char **strv_reverse(char **l); -// UNNEEDED char **strv_shell_escape(char **l, const char *bad); - -// UNNEEDED bool strv_fnmatch(char* const* patterns, const char *s, int flags); - /// UNNEEDED by elogind #if 0 +char **strv_reverse(char **l); +char **strv_shell_escape(char **l, const char *bad); + +bool strv_fnmatch(char* const* patterns, const char *s, int flags); + static inline bool strv_fnmatch_or_empty(char* const* patterns, const char *s, int flags) { assert(s); return strv_isempty(patterns) || strv_fnmatch(patterns, s, flags); } -#endif // 0 -// UNNEEDED char ***strv_free_free(char ***l); +char ***strv_free_free(char ***l); -// UNNEEDED char **strv_skip(char **l, size_t n); +char **strv_skip(char **l, size_t n); -// UNNEEDED int strv_extend_n(char ***l, const char *value, size_t n); +int strv_extend_n(char ***l, const char *value, size_t n); +#endif // 0 diff --git a/src/basic/syslog-util.h b/src/basic/syslog-util.h index 74912afca..15aa83ef1 100644 --- a/src/basic/syslog-util.h +++ b/src/basic/syslog-util.h @@ -25,10 +25,16 @@ int log_facility_unshifted_to_string_alloc(int i, char **s); int log_facility_unshifted_from_string(const char *s); -// UNNEEDED bool log_facility_unshifted_is_valid(int faciliy); +/// UNNEEDED by elogind +#if 0 +bool log_facility_unshifted_is_valid(int faciliy); +#endif // 0 int log_level_to_string_alloc(int i, char **s); int log_level_from_string(const char *s); -// UNNEEDED bool log_level_is_valid(int level); +/// UNNEEDED by elogind +#if 0 +bool log_level_is_valid(int level); -// UNNEEDED int syslog_parse_priority(const char **p, int *priority, bool with_facility); +int syslog_parse_priority(const char **p, int *priority, bool with_facility); +#endif // 0 diff --git a/src/basic/terminal-util.h b/src/basic/terminal-util.h index 36fc5d173..3464a053f 100644 --- a/src/basic/terminal-util.h +++ b/src/basic/terminal-util.h @@ -42,40 +42,61 @@ /* Set cursor to top left corner and clear screen */ #define ANSI_HOME_CLEAR "\x1B[H\x1B[2J" -// UNNEEDED int reset_terminal_fd(int fd, bool switch_to_text); -// UNNEEDED int reset_terminal(const char *name); +/// UNNEEDED by elogind +#if 0 +int reset_terminal_fd(int fd, bool switch_to_text); +int reset_terminal(const char *name); +#endif // 0 int open_terminal(const char *name, int mode); -// UNNEEDED int acquire_terminal(const char *name, bool fail, bool force, bool ignore_tiocstty_eperm, usec_t timeout); -// UNNEEDED int release_terminal(void); +/// UNNEEDED by elogind +#if 0 +int acquire_terminal(const char *name, bool fail, bool force, bool ignore_tiocstty_eperm, usec_t timeout); +int release_terminal(void); -// UNNEEDED int terminal_vhangup_fd(int fd); -// UNNEEDED int terminal_vhangup(const char *name); +int terminal_vhangup_fd(int fd); +int terminal_vhangup(const char *name); +#endif // 0 int chvt(int vt); -// UNNEEDED int read_one_char(FILE *f, char *ret, usec_t timeout, bool *need_nl); -// UNNEEDED int ask_char(char *ret, const char *replies, const char *text, ...) _printf_(3, 4); -// UNNEEDED int ask_string(char **ret, const char *text, ...) _printf_(2, 3); +/// UNNEEDED by elogind +#if 0 +int read_one_char(FILE *f, char *ret, usec_t timeout, bool *need_nl); +int ask_char(char *ret, const char *replies, const char *text, ...) _printf_(3, 4); +int ask_string(char **ret, const char *text, ...) _printf_(2, 3); -// UNNEEDED int vt_disallocate(const char *name); +int vt_disallocate(const char *name); -// UNNEEDED char *resolve_dev_console(char **active); +char *resolve_dev_console(char **active); +#endif // 0 bool tty_is_vc(const char *tty); -// UNNEEDED bool tty_is_vc_resolve(const char *tty); +/// UNNEEDED by elogind +#if 0 +bool tty_is_vc_resolve(const char *tty); +#endif // 0 bool tty_is_console(const char *tty) _pure_; int vtnr_from_tty(const char *tty); -// UNNEEDED const char *default_term_for_tty(const char *tty); +/// UNNEEDED by elogind +#if 0 +const char *default_term_for_tty(const char *tty); +#endif // 0 int make_stdio(int fd); int make_null_stdio(void); -// UNNEEDED int make_console_stdio(void); +/// UNNEEDED by elogind +#if 0 +int make_console_stdio(void); +#endif // 0 int fd_columns(int fd); unsigned columns(void); int fd_lines(int fd); unsigned lines(void); -// UNNEEDED void columns_lines_cache_reset(int _unused_ signum); +/// UNNEEDED by elogind +#if 0 +void columns_lines_cache_reset(int _unused_ signum); +#endif // 0 bool on_tty(void); @@ -114,11 +135,14 @@ static inline const char *ansi_normal(void) { int get_ctty_devnr(pid_t pid, dev_t *d); int get_ctty(pid_t, dev_t *_devnr, char **r); -// UNNEEDED int getttyname_malloc(int fd, char **r); -// UNNEEDED int getttyname_harder(int fd, char **r); +/// UNNEEDED by elogind +#if 0 +int getttyname_malloc(int fd, char **r); +int getttyname_harder(int fd, char **r); -// UNNEEDED int ptsname_malloc(int fd, char **ret); -// UNNEEDED int ptsname_namespace(int pty, char **ret); +int ptsname_malloc(int fd, char **ret); +int ptsname_namespace(int pty, char **ret); -// UNNEEDED int openpt_in_namespace(pid_t pid, int flags); -// UNNEEDED int open_terminal_in_namespace(pid_t pid, const char *name, int mode); +int openpt_in_namespace(pid_t pid, int flags); +int open_terminal_in_namespace(pid_t pid, const char *name, int mode); +#endif // 0 diff --git a/src/basic/time-util.h b/src/basic/time-util.h index d5c567eaf..1ef78519f 100644 --- a/src/basic/time-util.h +++ b/src/basic/time-util.h @@ -71,12 +71,18 @@ typedef struct dual_timestamp { #define DUAL_TIMESTAMP_NULL ((struct dual_timestamp) { 0ULL, 0ULL }) usec_t now(clockid_t clock); -// UNNEEDED nsec_t now_nsec(clockid_t clock); +/// UNNEEDED by elogind +#if 0 +nsec_t now_nsec(clockid_t clock); +#endif // 0 dual_timestamp* dual_timestamp_get(dual_timestamp *ts); dual_timestamp* dual_timestamp_from_realtime(dual_timestamp *ts, usec_t u); -// UNNEEDED dual_timestamp* dual_timestamp_from_monotonic(dual_timestamp *ts, usec_t u); -// UNNEEDED dual_timestamp* dual_timestamp_from_boottime_or_monotonic(dual_timestamp *ts, usec_t u); +/// UNNEEDED by elogind +#if 0 +dual_timestamp* dual_timestamp_from_monotonic(dual_timestamp *ts, usec_t u); +dual_timestamp* dual_timestamp_from_boottime_or_monotonic(dual_timestamp *ts, usec_t u); +#endif // 0 static inline bool dual_timestamp_is_set(dual_timestamp *ts) { return ((ts->realtime > 0 && ts->realtime != USEC_INFINITY) || @@ -92,35 +98,53 @@ struct timeval *timeval_store(struct timeval *tv, usec_t u); nsec_t timespec_load_nsec(const struct timespec *ts) _pure_; char *format_timestamp(char *buf, size_t l, usec_t t); -// UNNEEDED char *format_timestamp_utc(char *buf, size_t l, usec_t t); +/// UNNEEDED by elogind +#if 0 +char *format_timestamp_utc(char *buf, size_t l, usec_t t); +#endif // 0 char *format_timestamp_us(char *buf, size_t l, usec_t t); -// UNNEEDED char *format_timestamp_us_utc(char *buf, size_t l, usec_t t); +/// UNNEEDED by elogind +#if 0 +char *format_timestamp_us_utc(char *buf, size_t l, usec_t t); +#endif // 0 char *format_timestamp_relative(char *buf, size_t l, usec_t t); char *format_timespan(char *buf, size_t l, usec_t t, usec_t accuracy); -// UNNEEDED void dual_timestamp_serialize(FILE *f, const char *name, dual_timestamp *t); -// UNNEEDED int dual_timestamp_deserialize(const char *value, dual_timestamp *t); +/// UNNEEDED by elogind +#if 0 +void dual_timestamp_serialize(FILE *f, const char *name, dual_timestamp *t); +int dual_timestamp_deserialize(const char *value, dual_timestamp *t); -// UNNEEDED int parse_timestamp(const char *t, usec_t *usec); +int parse_timestamp(const char *t, usec_t *usec); +#endif // 0 int parse_sec(const char *t, usec_t *usec); int parse_time(const char *t, usec_t *usec, usec_t default_unit); -// UNNEEDED int parse_nsec(const char *t, nsec_t *nsec); +/// UNNEEDED by elogind +#if 0 +int parse_nsec(const char *t, nsec_t *nsec); -// UNNEEDED bool ntp_synced(void); +bool ntp_synced(void); -// UNNEEDED int get_timezones(char ***l); -// UNNEEDED bool timezone_is_valid(const char *name); +int get_timezones(char ***l); +bool timezone_is_valid(const char *name); -// UNNEEDED clockid_t clock_boottime_or_monotonic(void); +clockid_t clock_boottime_or_monotonic(void); +#endif // 0 #define xstrftime(buf, fmt, tm) \ assert_message_se(strftime(buf, ELEMENTSOF(buf), fmt, tm) > 0, \ "xstrftime: " #buf "[] must be big enough") -// UNNEEDED int get_timezone(char **timezone); +/// UNNEEDED by elogind +#if 0 +int get_timezone(char **timezone); -// UNNEEDED time_t mktime_or_timegm(struct tm *tm, bool utc); +time_t mktime_or_timegm(struct tm *tm, bool utc); +#endif // 0 struct tm *localtime_or_gmtime_r(const time_t *t, struct tm *tm, bool utc); -// UNNEEDED unsigned long usec_to_jiffies(usec_t usec); +/// UNNEEDED by elogind +#if 0 +unsigned long usec_to_jiffies(usec_t usec); +#endif // 0 diff --git a/src/basic/unit-name.h b/src/basic/unit-name.h index 21cf9e090..2c56d12a2 100644 --- a/src/basic/unit-name.h +++ b/src/basic/unit-name.h @@ -281,39 +281,39 @@ 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); +int unit_name_to_prefix(const char *n, char **prefix); +int unit_name_to_instance(const char *n, char **instance); +int unit_name_to_prefix_and_instance(const char *n, char **ret); -// UNNEEDED UnitType unit_name_to_type(const char *n) _pure_; +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_change_suffix(const char *n, const char *suffix, char **ret); +#endif // 0 int unit_name_build(const char *prefix, const char *instance, const char *suffix, 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 by elogind +#if 0 +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 int unit_name_replace_instance(const char *f, const char *i, char **ret); +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_template(const char *f, 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); +int unit_name_from_path(const char *path, const char *suffix, char **ret); +int unit_name_from_path_instance(const char *prefix, const char *path, const char *suffix, char **ret); +int unit_name_to_path(const char *name, char **ret); -// UNNEEDED char *unit_dbus_path_from_name(const char *name); -// UNNEEDED int unit_name_from_dbus_path(const char *path, char **name); +char *unit_dbus_path_from_name(const char *name); +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); +const char* unit_dbus_interface_from_type(UnitType t); +const char *unit_dbus_interface_from_name(const char *name); -/// UNNEEDED by elogind -#if 0 typedef enum UnitNameMangle { UNIT_NAME_NOGLOB, UNIT_NAME_GLOB, @@ -324,56 +324,59 @@ int unit_name_mangle_with_suffix(const char *name, UnitNameMangle allow_globs, c static inline int unit_name_mangle(const char *name, UnitNameMangle allow_globs, char **ret) { return unit_name_mangle_with_suffix(name, allow_globs, ".service", ret); } -#endif // 0 -// UNNEEDED int slice_build_parent_slice(const char *slice, char **ret); +int slice_build_parent_slice(const char *slice, char **ret); +#endif // 0 int slice_build_subslice(const char *slice, const char*name, char **subslice); bool slice_name_is_valid(const char *name); const char *unit_type_to_string(UnitType i) _const_; UnitType unit_type_from_string(const char *s) _pure_; -// UNNEEDED const char *unit_load_state_to_string(UnitLoadState i) _const_; -// UNNEEDED UnitLoadState unit_load_state_from_string(const char *s) _pure_; +/// UNNEEDED by elogind +#if 0 +const char *unit_load_state_to_string(UnitLoadState i) _const_; +UnitLoadState unit_load_state_from_string(const char *s) _pure_; -// UNNEEDED const char *unit_active_state_to_string(UnitActiveState i) _const_; -// UNNEEDED UnitActiveState unit_active_state_from_string(const char *s) _pure_; +const char *unit_active_state_to_string(UnitActiveState i) _const_; +UnitActiveState unit_active_state_from_string(const char *s) _pure_; -// UNNEEDED const char* automount_state_to_string(AutomountState i) _const_; -// UNNEEDED AutomountState automount_state_from_string(const char *s) _pure_; +const char* automount_state_to_string(AutomountState i) _const_; +AutomountState automount_state_from_string(const char *s) _pure_; -// UNNEEDED const char* busname_state_to_string(BusNameState i) _const_; -// UNNEEDED BusNameState busname_state_from_string(const char *s) _pure_; +const char* busname_state_to_string(BusNameState i) _const_; +BusNameState busname_state_from_string(const char *s) _pure_; -// UNNEEDED const char* device_state_to_string(DeviceState i) _const_; -// UNNEEDED DeviceState device_state_from_string(const char *s) _pure_; +const char* device_state_to_string(DeviceState i) _const_; +DeviceState device_state_from_string(const char *s) _pure_; -// UNNEEDED const char* mount_state_to_string(MountState i) _const_; -// UNNEEDED MountState mount_state_from_string(const char *s) _pure_; +const char* mount_state_to_string(MountState i) _const_; +MountState mount_state_from_string(const char *s) _pure_; -// UNNEEDED const char* path_state_to_string(PathState i) _const_; -// UNNEEDED PathState path_state_from_string(const char *s) _pure_; +const char* path_state_to_string(PathState i) _const_; +PathState path_state_from_string(const char *s) _pure_; -// UNNEEDED const char* scope_state_to_string(ScopeState i) _const_; -// UNNEEDED ScopeState scope_state_from_string(const char *s) _pure_; +const char* scope_state_to_string(ScopeState i) _const_; +ScopeState scope_state_from_string(const char *s) _pure_; -// UNNEEDED const char* service_state_to_string(ServiceState i) _const_; -// UNNEEDED ServiceState service_state_from_string(const char *s) _pure_; +const char* service_state_to_string(ServiceState i) _const_; +ServiceState service_state_from_string(const char *s) _pure_; -// UNNEEDED const char* slice_state_to_string(SliceState i) _const_; -// UNNEEDED SliceState slice_state_from_string(const char *s) _pure_; +const char* slice_state_to_string(SliceState i) _const_; +SliceState slice_state_from_string(const char *s) _pure_; -// UNNEEDED const char* socket_state_to_string(SocketState i) _const_; -// UNNEEDED SocketState socket_state_from_string(const char *s) _pure_; +const char* socket_state_to_string(SocketState i) _const_; +SocketState socket_state_from_string(const char *s) _pure_; -// UNNEEDED const char* swap_state_to_string(SwapState i) _const_; -// UNNEEDED SwapState swap_state_from_string(const char *s) _pure_; +const char* swap_state_to_string(SwapState i) _const_; +SwapState swap_state_from_string(const char *s) _pure_; -// UNNEEDED const char* target_state_to_string(TargetState i) _const_; -// UNNEEDED TargetState target_state_from_string(const char *s) _pure_; +const char* target_state_to_string(TargetState i) _const_; +TargetState target_state_from_string(const char *s) _pure_; -// UNNEEDED const char *timer_state_to_string(TimerState i) _const_; -// UNNEEDED TimerState timer_state_from_string(const char *s) _pure_; +const char *timer_state_to_string(TimerState i) _const_; +TimerState timer_state_from_string(const char *s) _pure_; -// UNNEEDED const char *unit_dependency_to_string(UnitDependency i) _const_; -// UNNEEDED UnitDependency unit_dependency_from_string(const char *s) _pure_; +const char *unit_dependency_to_string(UnitDependency i) _const_; +UnitDependency unit_dependency_from_string(const char *s) _pure_; +#endif // 0 diff --git a/src/basic/user-util.h b/src/basic/user-util.h index 87200a28c..235d0769a 100644 --- a/src/basic/user-util.h +++ b/src/basic/user-util.h @@ -36,8 +36,11 @@ static inline int parse_gid(const char *s, gid_t *ret_gid) { return parse_uid(s, (uid_t*) ret_gid); } -// UNNEEDED char* getlogname_malloc(void); -// UNNEEDED char* getusername_malloc(void); +/// UNNEEDED by elogind +#if 0 +char* getlogname_malloc(void); +char* getusername_malloc(void); +#endif // 0 int get_user_creds(const char **username, uid_t *uid, gid_t *gid, const char **home, const char **shell); int get_group_creds(const char **groupname, gid_t *gid); @@ -45,15 +48,21 @@ int get_group_creds(const char **groupname, gid_t *gid); char* uid_to_name(uid_t uid); char* gid_to_name(gid_t gid); -// UNNEEDED int in_gid(gid_t gid); -// UNNEEDED int in_group(const char *name); +/// UNNEEDED by elogind +#if 0 +int in_gid(gid_t gid); +int in_group(const char *name); -// UNNEEDED int get_home_dir(char **ret); -// UNNEEDED int get_shell(char **_ret); +int get_home_dir(char **ret); +int get_shell(char **_ret); +#endif // 0 int reset_uid_gid(void); -// UNNEEDED int take_etc_passwd_lock(const char *root); +/// UNNEEDED by elogind +#if 0 +int take_etc_passwd_lock(const char *root); +#endif // 0 #define UID_INVALID ((uid_t) -1) #define GID_INVALID ((gid_t) -1) diff --git a/src/basic/virt.h b/src/basic/virt.h index 622742dfe..17e7310ac 100644 --- a/src/basic/virt.h +++ b/src/basic/virt.h @@ -66,7 +66,10 @@ static inline bool VIRTUALIZATION_IS_CONTAINER(int x) { int detect_vm(void); int detect_container(void); -// UNNEEDED int detect_virtualization(void); +/// UNNEEDED by elogind +#if 0 +int detect_virtualization(void); +#endif // 0 int running_in_chroot(void); diff --git a/src/basic/xattr-util.h b/src/basic/xattr-util.h index e6833ef23..c535b4a0c 100644 --- a/src/basic/xattr-util.h +++ b/src/basic/xattr-util.h @@ -29,10 +29,13 @@ int getxattr_malloc(const char *path, const char *name, char **value, bool allow_symlink); int fgetxattr_malloc(int fd, const char *name, char **value); -// UNNEEDED ssize_t fgetxattrat_fake(int dirfd, const char *filename, const char *attribute, void *value, size_t size, int flags); +/// UNNEEDED by elogind +#if 0 +ssize_t fgetxattrat_fake(int dirfd, const char *filename, const char *attribute, void *value, size_t size, int flags); -// UNNEEDED int fd_setcrtime(int fd, usec_t usec); +int fd_setcrtime(int fd, usec_t usec); -// UNNEEDED int fd_getcrtime(int fd, usec_t *usec); -// UNNEEDED int path_getcrtime(const char *p, usec_t *usec); -// UNNEEDED int fd_getcrtime_at(int dirfd, const char *name, usec_t *usec, int flags); +int fd_getcrtime(int fd, usec_t *usec); +int path_getcrtime(const char *p, usec_t *usec); +int fd_getcrtime_at(int dirfd, const char *name, usec_t *usec, int flags); +#endif // 0 diff --git a/src/core/cgroup.c b/src/core/cgroup.c index b18940f82..b2d9d7f0a 100644 --- a/src/core/cgroup.c +++ b/src/core/cgroup.c @@ -37,7 +37,7 @@ #define CGROUP_CPU_QUOTA_PERIOD_USEC ((usec_t) 100 * USEC_PER_MSEC) -// UNNEEDED by elogind +/// UNNEEDED by elogind #if 0 void cgroup_context_init(CGroupContext *c) { assert(c); diff --git a/src/core/cgroup.h b/src/core/cgroup.h index 6bef26c48..008588b68 100644 --- a/src/core/cgroup.h +++ b/src/core/cgroup.h @@ -27,23 +27,23 @@ // #include "time-util.h" #include "logind.h" -// UNNEEDED typedef struct CGroupContext CGroupContext; -// UNNEEDED Stypedef struct CGroupDeviceAllow CGroupDeviceAllow; -// UNNEEDED typedef struct CGroupBlockIODeviceWeight CGroupBlockIODeviceWeight; -// UNNEEDED typedef struct CGroupBlockIODeviceBandwidth CGroupBlockIODeviceBandwidth; +/// UNNEEDED by elogind +#if 0 +typedef struct CGroupContext CGroupContext; +Stypedef struct CGroupDeviceAllow CGroupDeviceAllow; +typedef struct CGroupBlockIODeviceWeight CGroupBlockIODeviceWeight; +typedef struct CGroupBlockIODeviceBandwidth CGroupBlockIODeviceBandwidth; /* Maximum value for fixed (manual) net class ID assignment, * and also the value at which the range of automatic assignments starts */ -// UNNEEDED #define CGROUP_NETCLASS_FIXED_MAX UINT32_C(65535) +#define CGROUP_NETCLASS_FIXED_MAX UINT32_C(65535) -// UNNEEDED typedef struct CGroupContext CGroupContext; -// UNNEEDED typedef struct CGroupDeviceAllow CGroupDeviceAllow; -// UNNEEDED typedef struct CGroupBlockIODeviceWeight CGroupBlockIODeviceWeight; -// UNNEEDED typedef struct CGroupBlockIODeviceBandwidth CGroupBlockIODeviceBandwidth; +typedef struct CGroupContext CGroupContext; +typedef struct CGroupDeviceAllow CGroupDeviceAllow; +typedef struct CGroupBlockIODeviceWeight CGroupBlockIODeviceWeight; +typedef struct CGroupBlockIODeviceBandwidth CGroupBlockIODeviceBandwidth; -/// UNNEEDED by elogind -#if 0 typedef enum CGroupDevicePolicy { /* When devices listed, will allow those, plus built-in ones, @@ -119,70 +119,73 @@ struct CGroupContext { bool delegate; }; -#endif // 0 -// #include "unit.h" -// #include "cgroup-util.h" +#include "unit.h" +#include "cgroup-util.h" -// UNNNEEDE void cgroup_context_init(CGroupContext *c); -// UNNEEDED void cgroup_context_done(CGroupContext *c); -// UNNEEDED void cgroup_context_dump(CGroupContext *c, FILE* f, const char *prefix); -// UNNEEDED void cgroup_context_apply(CGroupContext *c, CGroupMask mask, const char *path, uint32_t netclass_id, ManagerState state); +void cgroup_context_init(CGroupContext *c); +void cgroup_context_done(CGroupContext *c); +void cgroup_context_dump(CGroupContext *c, FILE* f, const char *prefix); +void cgroup_context_apply(CGroupContext *c, CGroupMask mask, const char *path, uint32_t netclass_id, ManagerState state); -// UNNEEDED CGroupMask cgroup_context_get_mask(CGroupContext *c); +CGroupMask cgroup_context_get_mask(CGroupContext *c); -// UNNEEDED void cgroup_context_free_device_allow(CGroupContext *c, CGroupDeviceAllow *a); -// UNNEEDED void cgroup_context_free_blockio_device_weight(CGroupContext *c, CGroupBlockIODeviceWeight *w); -// UNNEEDED void cgroup_context_free_blockio_device_bandwidth(CGroupContext *c, CGroupBlockIODeviceBandwidth *b); +void cgroup_context_free_device_allow(CGroupContext *c, CGroupDeviceAllow *a); +void cgroup_context_free_blockio_device_weight(CGroupContext *c, CGroupBlockIODeviceWeight *w); +void cgroup_context_free_blockio_device_bandwidth(CGroupContext *c, CGroupBlockIODeviceBandwidth *b); -// UNNEEDED CGroupMask unit_get_own_mask(Unit *u); -// UNNEEDED CGroupMask unit_get_siblings_mask(Unit *u); -// UNNEEDED CGroupMask unit_get_members_mask(Unit *u); -// UNNEEDED CGroupMask unit_get_subtree_mask(Unit *u); +CGroupMask unit_get_own_mask(Unit *u); +CGroupMask unit_get_siblings_mask(Unit *u); +CGroupMask unit_get_members_mask(Unit *u); +CGroupMask unit_get_subtree_mask(Unit *u); -// UNNEEDED vCGroupMask unit_get_target_mask(Unit *u); -// UNNEEDED CGroupMask unit_get_enable_mask(Unit *u); +vCGroupMask unit_get_target_mask(Unit *u); +CGroupMask unit_get_enable_mask(Unit *u); -// UNNEEDED void unit_update_cgroup_members_masks(Unit *u); +void unit_update_cgroup_members_masks(Unit *u); -// UNNEEDED har *unit_default_cgroup_path(Unit *u); -// UNNEEDED int unit_set_cgroup_path(Unit *u, const char *path); +har *unit_default_cgroup_path(Unit *u); +int unit_set_cgroup_path(Unit *u, const char *path); -// UNNEEDED int unit_realize_cgroup(Unit *u); -// UNNEEDED void unit_release_cgroup(Unit *u); -// UNNEEDED void unit_prune_cgroup(Unit *u); -// UNNEEDED int unit_watch_cgroup(Unit *u); +int unit_realize_cgroup(Unit *u); +void unit_release_cgroup(Unit *u); +void unit_prune_cgroup(Unit *u); +int unit_watch_cgroup(Unit *u); -// UNNEEDED int unit_attach_pids_to_cgroup(Unit *u); +int unit_attach_pids_to_cgroup(Unit *u); -// UNNEEDED int unit_add_to_netclass_cgroup(Unit *u); -// UNNEEDED int unit_remove_from_netclass_cgroup(Unit *u); +int unit_add_to_netclass_cgroup(Unit *u); +int unit_remove_from_netclass_cgroup(Unit *u); +#endif // 0 int manager_setup_cgroup(Manager *m); void manager_shutdown_cgroup(Manager *m, bool delete); -// UNNEEDED unsigned manager_dispatch_cgroup_queue(Manager *m); +/// UNNEEDED by elogind +#if 0 +unsigned manager_dispatch_cgroup_queue(Manager *m); -// UNNEEDED Unit *manager_get_unit_by_cgroup(Manager *m, const char *cgroup); -// UNNEEDED Unit *manager_get_unit_by_pid_cgroup(Manager *m, pid_t pid); -// UNNEEDED Unit* manager_get_unit_by_pid(Manager *m, pid_t pid); +Unit *manager_get_unit_by_cgroup(Manager *m, const char *cgroup); +Unit *manager_get_unit_by_pid_cgroup(Manager *m, pid_t pid); +Unit* manager_get_unit_by_pid(Manager *m, pid_t pid); -// UNNEEDED int unit_search_main_pid(Unit *u, pid_t *ret); -// UNNEEDED int unit_watch_all_pids(Unit *u); +int unit_search_main_pid(Unit *u, pid_t *ret); +int unit_watch_all_pids(Unit *u); -// UNNEEDED int unit_get_memory_current(Unit *u, uint64_t *ret); -// UNNEEDED int unit_get_tasks_current(Unit *u, uint64_t *ret); -// UNNEEDED int unit_get_cpu_usage(Unit *u, nsec_t *ret); -// UNNEEDED int unit_reset_cpu_usage(Unit *u); +int unit_get_memory_current(Unit *u, uint64_t *ret); +int unit_get_tasks_current(Unit *u, uint64_t *ret); +int unit_get_cpu_usage(Unit *u, nsec_t *ret); +int unit_reset_cpu_usage(Unit *u); -// UNNEEDED bool unit_cgroup_delegate(Unit *u); +bool unit_cgroup_delegate(Unit *u); -// UNNEEDED int unit_notify_cgroup_empty(Unit *u); -// UNNEEDED int manager_notify_cgroup_empty(Manager *m, const char *group); +int unit_notify_cgroup_empty(Unit *u); +int manager_notify_cgroup_empty(Manager *m, const char *group); -// UNNEEDED void unit_invalidate_cgroup(Unit *u, CGroupMask m); +void unit_invalidate_cgroup(Unit *u, CGroupMask m); -// UNNEEDED void manager_invalidate_startup_units(Manager *m); +void manager_invalidate_startup_units(Manager *m); -// UNNEEDED const char* cgroup_device_policy_to_string(CGroupDevicePolicy i) _const_; -// UNNEEDED CGroupDevicePolicy cgroup_device_policy_from_string(const char *s) _pure_; +const char* cgroup_device_policy_to_string(CGroupDevicePolicy i) _const_; +CGroupDevicePolicy cgroup_device_policy_from_string(const char *s) _pure_; +#endif // 0 diff --git a/src/core/mount-setup.h b/src/core/mount-setup.h index 395a4923e..22b5a7823 100644 --- a/src/core/mount-setup.h +++ b/src/core/mount-setup.h @@ -23,10 +23,16 @@ #include -// UNNEEDED int mount_setup_early(void); +/// UNNEEDED by elogind +#if 0 +int mount_setup_early(void); +#endif // 0 int mount_setup(bool loaded_policy); -// UNNEEDED int mount_cgroup_controllers(char ***join_controllers); +/// UNNEEDED by elogind +#if 0 +int mount_cgroup_controllers(char ***join_controllers); -// UNNEEDED bool mount_point_is_api(const char *path); -// UNNEEDED bool mount_point_ignore(const char *path); +bool mount_point_is_api(const char *path); +bool mount_point_ignore(const char *path); +#endif // 0 diff --git a/src/libelogind/sd-bus/bus-internal.h b/src/libelogind/sd-bus/bus-internal.h index db344ac37..0a4d9b5c8 100644 --- a/src/libelogind/sd-bus/bus-internal.h +++ b/src/libelogind/sd-bus/bus-internal.h @@ -344,7 +344,10 @@ struct sd_bus { bool interface_name_is_valid(const char *p) _pure_; bool service_name_is_valid(const char *p) _pure_; -// UNNEEDED char* service_name_startswith(const char *a, const char *b); +/// UNNEEDED by elogind +#if 0 +char* service_name_startswith(const char *a, const char *b); +#endif // 0 bool member_name_is_valid(const char *p) _pure_; bool object_path_is_valid(const char *p) _pure_; char *object_path_startswith(const char *a, const char *b) _pure_; @@ -384,11 +387,17 @@ char *bus_address_escape(const char *v); _cleanup_bus_unref_ _unused_ sd_bus *_dont_destroy_##bus = sd_bus_ref(bus) int bus_set_address_system(sd_bus *bus); -// UNNEEDED int bus_set_address_user(sd_bus *bus); +/// UNNEEDED by elogind +#if 0 +int bus_set_address_user(sd_bus *bus); +#endif // 0 int bus_set_address_system_remote(sd_bus *b, const char *host); int bus_set_address_system_machine(sd_bus *b, const char *machine); -// UNNEEDED int bus_remove_match_by_string(sd_bus *bus, const char *match, sd_bus_message_handler_t callback, void *userdata); +/// UNNEEDED by elogind +#if 0 +int bus_remove_match_by_string(sd_bus *bus, const char *match, sd_bus_message_handler_t callback, void *userdata); +#endif // 0 int bus_get_root_path(sd_bus *bus); diff --git a/src/libelogind/sd-bus/bus-kernel.h b/src/libelogind/sd-bus/bus-kernel.h index 7086f9319..43f0febfc 100644 --- a/src/libelogind/sd-bus/bus-kernel.h +++ b/src/libelogind/sd-bus/bus-kernel.h @@ -71,8 +71,11 @@ int bus_kernel_read_message(sd_bus *bus, bool hint_priority, int64_t priority); int bus_kernel_open_bus_fd(const char *bus, char **path); -// UNNEEDED int bus_kernel_create_bus(const char *name, bool world, char **s); -// UNNEEDED int bus_kernel_create_endpoint(const char *bus_name, const char *ep_name, char **path); +/// UNNEEDED by elogind +#if 0 +int bus_kernel_create_bus(const char *name, bool world, char **s); +int bus_kernel_create_endpoint(const char *bus_name, const char *ep_name, char **path); +#endif // 0 int bus_kernel_pop_memfd(sd_bus *bus, void **address, size_t *mapped, size_t *allocated); void bus_kernel_push_memfd(sd_bus *bus, int fd, void *address, size_t mapped, size_t allocated); @@ -86,7 +89,10 @@ uint64_t attach_flags_to_kdbus(uint64_t sd_bus_flags); int bus_kernel_try_close(sd_bus *bus); -// UNNEEDED int bus_kernel_drop_one(int fd); +/// UNNEEDED by elogind +#if 0 +int bus_kernel_drop_one(int fd); +#endif // 0 int bus_kernel_realize_attach_flags(sd_bus *bus);