From: Sven Eden Date: Tue, 18 Jul 2017 06:04:37 +0000 (+0200) Subject: Prep v233.2: Mask unneeded functions and definitions in src/basic X-Git-Tag: v233.3~15 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=54225bd06a4e1486277639fd0c1518968f264b42 Prep v233.2: Mask unneeded functions and definitions in src/basic --- diff --git a/configure.ac b/configure.ac index a7e4ae3dc..2e63f609b 100644 --- a/configure.ac +++ b/configure.ac @@ -396,10 +396,9 @@ AC_CHECK_DECLS([ #include ]]) -AC_CHECK_TYPES([char16_t, char32_t, key_serial_t, struct ethtool_link_settings], +AC_CHECK_TYPES([char16_t, char32_t, key_serial_t], [], [], [[ #include -#include ]]) AC_CHECK_DECLS([IFLA_INET6_ADDR_GEN_MODE, diff --git a/src/basic/env-util.c b/src/basic/env-util.c index 1ec574e8a..c41d9dad8 100644 --- a/src/basic/env-util.c +++ b/src/basic/env-util.c @@ -122,6 +122,7 @@ bool env_assignment_is_valid(const char *e) { return true; } +#if 0 /// UNNEEDED by elogind bool strv_env_is_valid(char **e) { char **p, **q; @@ -247,7 +248,7 @@ fail: return NULL; } - +S static bool env_match(const char *t, const char *pattern) { assert(t); assert(pattern); @@ -804,3 +805,4 @@ int deserialize_environment(char ***environment, const char *line) { return strv_env_replace(environment, uce); } +#endif // 0 diff --git a/src/basic/env-util.h b/src/basic/env-util.h index e88fa6aac..d30b87410 100644 --- a/src/basic/env-util.h +++ b/src/basic/env-util.h @@ -35,13 +35,16 @@ enum { REPLACE_ENV_ALLOW_EXTENDED = 4u, }; +#if 0 /// UNNEEDED by elogind char *replace_env_n(const char *format, size_t n, char **env, unsigned flags); char **replace_env_argv(char **argv, char **env); static inline char *replace_env(const char *format, char **env, unsigned flags) { return replace_env_n(format, strlen(format), env, flags); } +#endif // 0 +#if 0 /// UNNEEDED by elogind 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); @@ -64,3 +67,4 @@ int getenv_bool(const char *p); int serialize_environment(FILE *f, char **environment); int deserialize_environment(char ***environment, const char *line); +#endif // 0 diff --git a/src/basic/exec-util.c b/src/basic/exec-util.c index aced9e8e3..e542d5c93 100644 --- a/src/basic/exec-util.c +++ b/src/basic/exec-util.c @@ -252,6 +252,7 @@ int execute_directories( return 0; } +#if 0 /// UNNEEDED by elogind static int gather_environment_generate(int fd, void *arg) { char ***env = arg, **x, **y; _cleanup_fclose_ FILE *f = NULL; @@ -358,3 +359,4 @@ const gather_stdout_callback_t gather_environment[] = { gather_environment_collect, gather_environment_consume, }; +#endif // 0 diff --git a/src/basic/exec-util.h b/src/basic/exec-util.h index 72009799b..0c47ccb2f 100644 --- a/src/basic/exec-util.h +++ b/src/basic/exec-util.h @@ -37,4 +37,7 @@ int execute_directories( void* const callback_args[_STDOUT_CONSUME_MAX], char *argv[]); +#if 0 /// UNNEEDED by elogind extern const gather_stdout_callback_t gather_environment[_STDOUT_CONSUME_MAX]; +#endif // 0 + diff --git a/src/basic/fileio.c b/src/basic/fileio.c index 822855c9d..13f610771 100644 --- a/src/basic/fileio.c +++ b/src/basic/fileio.c @@ -1439,7 +1439,6 @@ int link_tmpfile(int fd, const char *path, const char *target) { return 0; } -#endif // 0 int read_nul_string(FILE *f, char **ret) { _cleanup_free_ char *x = NULL; @@ -1500,3 +1499,4 @@ int mkdtemp_malloc(const char *template, char **ret) { *ret = p; return 0; } +#endif // 0 diff --git a/src/basic/fileio.h b/src/basic/fileio.h index c380ed9fd..a614d8998 100644 --- a/src/basic/fileio.h +++ b/src/basic/fileio.h @@ -100,8 +100,8 @@ int open_serialization_fd(const char *ident); #if 0 /// UNNEEDED by elogind int link_tmpfile(int fd, const char *path, const char *target); -#endif // 0 int read_nul_string(FILE *f, char **ret); int mkdtemp_malloc(const char *template, char **ret); +#endif // 0 diff --git a/src/basic/fs-util.h b/src/basic/fs-util.h index 65d577973..b13961991 100644 --- a/src/basic/fs-util.h +++ b/src/basic/fs-util.h @@ -98,6 +98,7 @@ enum { int chase_symlinks(const char *path_with_prefix, const char *root, unsigned flags, char **ret); +#if 0 /// UNNEEDED by elogind /* Useful for usage with _cleanup_(), removes a directory and frees the pointer */ static inline void rmdir_and_free(char *p) { (void) rmdir(p); @@ -110,3 +111,4 @@ static inline void unlink_and_free(char *p) { free(p); } DEFINE_TRIVIAL_CLEANUP_FUNC(char*, unlink_and_free); +#endif // 0 diff --git a/src/basic/log.c b/src/basic/log.c index 2c8e5738e..6827b97e6 100644 --- a/src/basic/log.c +++ b/src/basic/log.c @@ -1195,6 +1195,8 @@ int log_syntax_internal( NULL); } +#if 0 /// UNNEEDED by elogind void log_set_always_reopen_console(bool b) { always_reopen_console = b; } +#endif // 0 diff --git a/src/basic/log.h b/src/basic/log.h index 8619301e1..560d5f56b 100644 --- a/src/basic/log.h +++ b/src/basic/log.h @@ -228,8 +228,8 @@ LogTarget log_target_from_string(const char *s) _pure_; void log_received_signal(int level, const struct signalfd_siginfo *si); void log_set_upgrade_syslog_to_journal(bool b); -#endif // 0 void log_set_always_reopen_console(bool b); +#endif // 0 int log_syntax_internal( const char *unit, diff --git a/src/basic/missing.h b/src/basic/missing.h index 5c6d8a98c..b1a512eb4 100644 --- a/src/basic/missing.h +++ b/src/basic/missing.h @@ -54,6 +54,7 @@ #include #endif +#if 0 /// UNNEEDED by elogind #ifdef HAVE_LINUX_VM_SOCKETS_H #include #else @@ -70,6 +71,7 @@ struct sockaddr_vm { sizeof(unsigned int)]; }; #endif /* !HAVE_LINUX_VM_SOCKETS_H */ +#endif // 0 #include "macro.h" @@ -1155,6 +1157,7 @@ typedef int32_t key_serial_t; #define IFA_F_MCAUTOJOIN 0x400 #endif +#if 0 /// UNNEEDED by elogind #ifndef HAVE_STRUCT_ETHTOOL_LINK_SETTINGS #define ETHTOOL_GLINKSETTINGS 0x0000004c /* Get ethtool_link_settings */ @@ -1181,6 +1184,7 @@ struct ethtool_link_settings { }; #endif +#endif // 0 #endif diff --git a/src/basic/mount-util.c b/src/basic/mount-util.c index ae4a4979e..fef991207 100644 --- a/src/basic/mount-util.c +++ b/src/basic/mount-util.c @@ -695,7 +695,6 @@ int umount_verbose(const char *what) { return log_error_errno(errno, "Failed to unmount %s: %m", what); return 0; } -#endif // 0 const char *mount_propagation_flags_to_string(unsigned long flags) { @@ -728,3 +727,4 @@ int mount_propagation_flags_from_string(const char *name, unsigned long *ret) { return -EINVAL; return 0; } +#endif // 0 diff --git a/src/basic/mount-util.h b/src/basic/mount-util.h index deaa77950..32770d68c 100644 --- a/src/basic/mount-util.h +++ b/src/basic/mount-util.h @@ -66,7 +66,7 @@ int mount_verbose( unsigned long flags, const char *options); int umount_verbose(const char *where); -#endif // 0 const char *mount_propagation_flags_to_string(unsigned long flags); int mount_propagation_flags_from_string(const char *name, unsigned long *ret); +#endif // 0 diff --git a/src/basic/parse-util.c b/src/basic/parse-util.c index 2daa797a5..e294f25cf 100644 --- a/src/basic/parse-util.c +++ b/src/basic/parse-util.c @@ -581,7 +581,6 @@ int parse_nice(const char *p, int *ret) { *ret = n; return 0; } -#endif // 0 int parse_ip_port(const char *s, uint16_t *ret) { uint16_t l; @@ -598,3 +597,4 @@ int parse_ip_port(const char *s, uint16_t *ret) { return 0; } +#endif // 0 diff --git a/src/basic/parse-util.h b/src/basic/parse-util.h index 2f6cfdbc5..1c1ee4096 100644 --- a/src/basic/parse-util.h +++ b/src/basic/parse-util.h @@ -113,6 +113,6 @@ int parse_percent(const char *p); #if 0 /// UNNEEDED by elogind int parse_nice(const char *p, int *ret); -#endif // 0 int parse_ip_port(const char *s, uint16_t *ret); +#endif // 0 diff --git a/src/basic/socket-util.c b/src/basic/socket-util.c index 68773d54c..d392da2a4 100644 --- a/src/basic/socket-util.c +++ b/src/basic/socket-util.c @@ -480,7 +480,6 @@ const char* socket_address_get_path(const SocketAddress *a) { return a->sockaddr.un.sun_path; } -#endif // 0 bool socket_ipv6_is_supported(void) { if (access("/proc/net/if_inet6", F_OK) != 0) @@ -489,7 +488,6 @@ bool socket_ipv6_is_supported(void) { return true; } -#if 0 /// UNNEEDED by elogind bool socket_address_matches_fd(const SocketAddress *a, int fd) { SocketAddress b; socklen_t solen; @@ -866,7 +864,6 @@ static const char* const ip_tos_table[] = { }; DEFINE_STRING_TABLE_LOOKUP_WITH_FALLBACK(ip_tos, int, 0xff); -#endif // 0 bool ifname_valid(const char *p) { bool numeric = true; @@ -923,6 +920,7 @@ bool address_label_valid(const char *p) { return true; } +#endif // 0 int getpeercred(int fd, struct ucred *ucred) { socklen_t n = sizeof(struct ucred); @@ -1140,7 +1138,6 @@ int flush_accept(int fd) { close(cfd); } } -#endif // 0 struct cmsghdr* cmsg_find(struct msghdr *mh, int level, int type, socklen_t length) { struct cmsghdr *cmsg; @@ -1156,7 +1153,6 @@ struct cmsghdr* cmsg_find(struct msghdr *mh, int level, int type, socklen_t leng return NULL; } -#if 0 /// UNNEEDED by elogind int socket_ioctl_fd(void) { int fd; diff --git a/src/basic/socket-util.h b/src/basic/socket-util.h index 8e18eed8c..db3a73197 100644 --- a/src/basic/socket-util.h +++ b/src/basic/socket-util.h @@ -34,13 +34,17 @@ union sockaddr_union { struct sockaddr sa; +#if 0 /// UNNEEDED by elogind, only 'sa' and 'un' are used in all of elogind. struct sockaddr_in in; struct sockaddr_in6 in6; +#endif // 0 struct sockaddr_un un; +#if 0 /// UNNEEDED by elogind, only 'sa' and 'un' are used in all of elogind. struct sockaddr_nl nl; struct sockaddr_storage storage; struct sockaddr_ll ll; struct sockaddr_vm vm; +#endif // 0 }; #if 0 /// UNNEEDED by elogind @@ -99,11 +103,9 @@ bool socket_address_matches_fd(const SocketAddress *a, int fd); bool socket_address_equal(const SocketAddress *a, const SocketAddress *b) _pure_; const char* socket_address_get_path(const SocketAddress *a); -#endif // 0 bool socket_ipv6_is_supported(void); -#if 0 /// UNNEEDED by elogind int sockaddr_port(const struct sockaddr *_sa, unsigned *port); int sockaddr_pretty(const struct sockaddr *_sa, socklen_t salen, bool translate_ipv6, bool include_port, char **ret); @@ -128,10 +130,10 @@ int fd_inc_rcvbuf(int fd, size_t n); int ip_tos_to_string_alloc(int i, char **s); int ip_tos_from_string(const char *s); -#endif // 0 bool ifname_valid(const char *p); bool address_label_valid(const char *p); +#endif // 0 int getpeercred(int fd, struct ucred *ucred); int getpeersec(int fd, char **ret); @@ -152,7 +154,9 @@ int flush_accept(int fd); #define CMSG_FOREACH(cmsg, mh) \ for ((cmsg) = CMSG_FIRSTHDR(mh); (cmsg); (cmsg) = CMSG_NXTHDR((mh), (cmsg))) +#if 0 /// UNNEEDED by elogind struct cmsghdr* cmsg_find(struct msghdr *mh, int level, int type, socklen_t length); +#endif // 0 /* Covers only file system and abstract AF_UNIX socket addresses, but not unnamed socket addresses. */ #define SOCKADDR_UN_LEN(sa) \ diff --git a/src/basic/stat-util.c b/src/basic/stat-util.c index 9dbdae0a0..d262fe16a 100644 --- a/src/basic/stat-util.c +++ b/src/basic/stat-util.c @@ -225,6 +225,7 @@ bool is_temporary_fs(const struct statfs *s) { is_fs_type(s, RAMFS_MAGIC); } +#if 0 /// UNNEEDED by elogind int fd_is_temporary_fs(int fd) { struct statfs s; @@ -243,3 +244,4 @@ int path_is_temporary_fs(const char *path) { return fd_is_temporary_fs(fd); } +#endif // 0 diff --git a/src/basic/stat-util.h b/src/basic/stat-util.h index 168cb3cb5..32d09d014 100644 --- a/src/basic/stat-util.h +++ b/src/basic/stat-util.h @@ -70,8 +70,10 @@ int path_check_fstype(const char *path, statfs_f_type_t magic_value); #endif // 0 bool is_temporary_fs(const struct statfs *s) _pure_; +#if 0 /// UNNEEDED by elogind int fd_is_temporary_fs(int fd); int path_is_temporary_fs(const char *path); +#endif // 0 /* Because statfs.t_type can be int on some architectures, we have to cast * the const magic to the type, otherwise the compiler warns about