From a683e1878913969ccf8b0defdec4d955e15ed75a Mon Sep 17 00:00:00 2001 From: Sven Eden Date: Fri, 7 Jul 2017 11:33:14 +0200 Subject: [PATCH] Prep v232.2: Mask more unneeded functions --- cb/elogind.cbp | 4 ++++ src/basic/cgroup-util.h | 2 +- src/basic/fs-util.c | 2 +- src/basic/fs-util.h | 2 +- src/basic/mount-util.c | 2 ++ src/basic/mount-util.h | 2 ++ src/basic/socket-util.c | 2 ++ src/basic/socket-util.h | 2 ++ src/basic/string-util.c | 4 ++++ src/basic/string-util.h | 8 ++++++++ src/basic/time-util.h | 2 ++ src/basic/user-util.c | 2 ++ src/basic/user-util.h | 2 ++ src/basic/virt.c | 2 +- src/basic/virt.h | 2 +- src/libelogind/sd-id128/id128-util.c | 2 ++ src/libelogind/sd-id128/id128-util.h | 2 ++ src/shared/clean-ipc.c | 2 ++ src/shared/clean-ipc.h | 2 ++ src/shared/conf-parser.c | 2 ++ src/shared/conf-parser.h | 2 ++ 21 files changed, 47 insertions(+), 5 deletions(-) diff --git a/cb/elogind.cbp b/cb/elogind.cbp index 8524706f5..90317eda8 100644 --- a/cb/elogind.cbp +++ b/cb/elogind.cbp @@ -374,6 +374,10 @@ + + + diff --git a/src/basic/cgroup-util.h b/src/basic/cgroup-util.h index 3b6319245..73fce35a0 100644 --- a/src/basic/cgroup-util.h +++ b/src/basic/cgroup-util.h @@ -184,9 +184,9 @@ int cg_create_and_attach(const char *controller, const char *path, pid_t pid); int cg_set_attribute(const char *controller, const char *path, const char *attribute, const char *value); int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret); +#if 0 /// UNNEEDED by elogind int cg_get_keyed_attribute(const char *controller, const char *path, const char *attribute, const char **keys, char **values); -#if 0 /// UNNEEDED by elogind int cg_set_group_access(const char *controller, const char *path, mode_t mode, uid_t uid, gid_t gid); int cg_set_task_access(const char *controller, const char *path, mode_t mode, uid_t uid, gid_t gid); diff --git a/src/basic/fs-util.c b/src/basic/fs-util.c index 55f606ceb..59787552d 100644 --- a/src/basic/fs-util.c +++ b/src/basic/fs-util.c @@ -602,7 +602,6 @@ int inotify_add_watch_fd(int fd, int what, uint32_t mask) { return r; } -#endif // 0 int chase_symlinks(const char *path, const char *_root, char **ret) { _cleanup_free_ char *buffer = NULL, *done = NULL, *root = NULL; @@ -786,3 +785,4 @@ int chase_symlinks(const char *path, const char *_root, char **ret) { return 0; } +#endif // 0 diff --git a/src/basic/fs-util.h b/src/basic/fs-util.h index 08d24fd9b..871f7209f 100644 --- a/src/basic/fs-util.h +++ b/src/basic/fs-util.h @@ -89,6 +89,6 @@ union inotify_event_buffer { }; int inotify_add_watch_fd(int fd, int what, uint32_t mask); -#endif // 0 int chase_symlinks(const char *path, const char *_root, char **ret); +#endif // 0 diff --git a/src/basic/mount-util.c b/src/basic/mount-util.c index 32e42d6a3..e2bdfcd8a 100644 --- a/src/basic/mount-util.c +++ b/src/basic/mount-util.c @@ -584,6 +584,7 @@ const char* mode_to_inaccessible_node(mode_t mode) { return NULL; } +#if 0 /// UNNEEDED by elogind #define FLAG(name) (flags & name ? STRINGIFY(name) "|" : "") static char* mount_flags_to_string(long unsigned flags) { char *x; @@ -688,3 +689,4 @@ int umount_verbose(const char *what) { return log_error_errno(errno, "Failed to unmount %s: %m", what); return 0; } +#endif // 0 diff --git a/src/basic/mount-util.h b/src/basic/mount-util.h index 33453aa9f..d538ea953 100644 --- a/src/basic/mount-util.h +++ b/src/basic/mount-util.h @@ -57,6 +57,7 @@ const char* mode_to_inaccessible_node(mode_t mode); #define FILE_HANDLE_INIT { .handle.handle_bytes = MAX_HANDLE_SZ } +#if 0 /// UNNEEDED by elogind int mount_verbose( int error_log_level, const char *what, @@ -65,3 +66,4 @@ int mount_verbose( unsigned long flags, const char *options); int umount_verbose(const char *where); +#endif // 0 diff --git a/src/basic/socket-util.c b/src/basic/socket-util.c index a983c67a8..4c1869353 100644 --- a/src/basic/socket-util.c +++ b/src/basic/socket-util.c @@ -1067,6 +1067,7 @@ 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; @@ -1083,3 +1084,4 @@ int socket_ioctl_fd(void) { return fd; } +#endif // 0 diff --git a/src/basic/socket-util.h b/src/basic/socket-util.h index 93454f6ac..718de9ba3 100644 --- a/src/basic/socket-util.h +++ b/src/basic/socket-util.h @@ -163,4 +163,6 @@ struct cmsghdr* cmsg_find(struct msghdr *mh, int level, int type, socklen_t leng strnlen(_sa->sun_path, sizeof(_sa->sun_path))); \ }) +#if 0 /// UNNEEDED by elogind int socket_ioctl_fd(void); +#endif // 0 diff --git a/src/basic/string-util.c b/src/basic/string-util.c index 6b06e643c..ebe146b03 100644 --- a/src/basic/string-util.c +++ b/src/basic/string-util.c @@ -292,6 +292,7 @@ char *strstrip(char *s) { return s; } +#if 0 /// UNNEEDED by elogind char *delete_chars(char *s, const char *bad) { char *f, *t; @@ -308,6 +309,7 @@ char *delete_chars(char *s, const char *bad) { return s; } +#endif // 0 char *truncate_nl(char *s) { assert(s); @@ -316,6 +318,7 @@ char *truncate_nl(char *s) { return s; } +#if 0 /// UNNEEDED by elogind char ascii_tolower(char x) { if (x >= 'A' && x <= 'Z') @@ -406,6 +409,7 @@ bool chars_intersect(const char *a, const char *b) { return false; } +#endif // 0 bool string_has_cc(const char *p, const char *ok) { const char *t; diff --git a/src/basic/string-util.h b/src/basic/string-util.h index d029d538b..66e55cb2c 100644 --- a/src/basic/string-util.h +++ b/src/basic/string-util.h @@ -66,6 +66,7 @@ static inline bool isempty(const char *p) { return !p || !p[0]; } +#if 0 /// UNNEEDED by elogind static inline const char *empty_to_null(const char *p) { return isempty(p) ? NULL : p; } @@ -73,6 +74,7 @@ static inline const char *empty_to_null(const char *p) { static inline const char *strdash_if_empty(const char *str) { return isempty(str) ? "-" : str; } +#endif // 0 static inline char *startswith(const char *s, const char *prefix) { size_t l; @@ -84,6 +86,7 @@ static inline char *startswith(const char *s, const char *prefix) { return NULL; } +#if 0 /// UNNEEDED by elogind static inline char *startswith_no_case(const char *s, const char *prefix) { size_t l; @@ -93,6 +96,7 @@ static inline char *startswith_no_case(const char *s, const char *prefix) { return NULL; } +#endif // 0 char *endswith(const char *s, const char *postfix) _pure_; char *endswith_no_case(const char *s, const char *postfix) _pure_; @@ -134,9 +138,12 @@ char *strjoin(const char *x, ...) _sentinel_; }) char *strstrip(char *s); +#if 0 /// UNNEEDED by elogind char *delete_chars(char *s, const char *bad); +#endif // 0 char *truncate_nl(char *s); +#if 0 /// UNNEEDED by elogind char ascii_tolower(char x); char *ascii_strlower(char *s); char *ascii_strlower_n(char *s, size_t n); @@ -148,6 +155,7 @@ int ascii_strcasecmp_n(const char *a, const char *b, size_t n); int ascii_strcasecmp_nn(const char *a, size_t n, const char *b, size_t m); bool chars_intersect(const char *a, const char *b) _pure_; +#endif // 0 static inline bool _pure_ in_charset(const char *s, const char* charset) { assert(s); diff --git a/src/basic/time-util.h b/src/basic/time-util.h index 4421afc66..eab708c28 100644 --- a/src/basic/time-util.h +++ b/src/basic/time-util.h @@ -115,7 +115,9 @@ static inline bool triple_timestamp_is_set(triple_timestamp *ts) { usec_t triple_timestamp_by_clock(triple_timestamp *ts, clockid_t clock); usec_t timespec_load(const struct timespec *ts) _pure_; +#if 0 /// UNNEEDED by elogind nsec_t timespec_load_nsec(const struct timespec *ts) _pure_; +#endif // 0 struct timespec *timespec_store(struct timespec *ts, usec_t u); usec_t timeval_load(const struct timeval *tv) _pure_; diff --git a/src/basic/user-util.c b/src/basic/user-util.c index 2656d96c2..9ef19a1f6 100644 --- a/src/basic/user-util.c +++ b/src/basic/user-util.c @@ -179,6 +179,7 @@ int get_user_creds( return 0; } +#if 0 /// UNNEEDED by elogind int get_user_creds_clean( const char **username, uid_t *uid, gid_t *gid, @@ -249,6 +250,7 @@ int get_group_creds(const char **groupname, gid_t *gid) { return 0; } +#endif // 0 char* uid_to_name(uid_t uid) { char *ret; diff --git a/src/basic/user-util.h b/src/basic/user-util.h index 0d000b76c..4a1bc764a 100644 --- a/src/basic/user-util.h +++ b/src/basic/user-util.h @@ -42,8 +42,10 @@ 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); +#if 0 /// UNNEEDED by elogind int get_user_creds_clean(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); +#endif // 0 char* uid_to_name(uid_t uid); char* gid_to_name(gid_t gid); diff --git a/src/basic/virt.c b/src/basic/virt.c index 06fe509f7..35beebe7f 100644 --- a/src/basic/virt.c +++ b/src/basic/virt.c @@ -486,7 +486,6 @@ int detect_virtualization(void) { return r; } -#endif // 0 static int userns_has_mapping(const char *name) { _cleanup_fclose_ FILE *f = NULL; @@ -557,6 +556,7 @@ int running_in_userns(void) { log_debug("/proc/self/setgroups contains \"%s\", %s user namespace", line, r ? "in" : "not in"); return r; } +#endif // 0 int running_in_chroot(void) { int ret; diff --git a/src/basic/virt.h b/src/basic/virt.h index 8bcddb761..f448f4e8f 100644 --- a/src/basic/virt.h +++ b/src/basic/virt.h @@ -69,9 +69,9 @@ int detect_vm(void); int detect_container(void); #if 0 /// UNNEEDED by elogind int detect_virtualization(void); -#endif // 0 int running_in_userns(void); +#endif // 0 int running_in_chroot(void); const char *virtualization_to_string(int v) _const_; diff --git a/src/libelogind/sd-id128/id128-util.c b/src/libelogind/sd-id128/id128-util.c index 337eae24b..a6687b0c9 100644 --- a/src/libelogind/sd-id128/id128-util.c +++ b/src/libelogind/sd-id128/id128-util.c @@ -153,6 +153,7 @@ int id128_read(const char *p, Id128Format f, sd_id128_t *ret) { return id128_read_fd(fd, f, ret); } +#if 0 /// UNNEEDED by elogind int id128_write_fd(int fd, Id128Format f, sd_id128_t id, bool do_sync) { char buffer[36 + 2]; size_t sz; @@ -205,3 +206,4 @@ const struct hash_ops id128_hash_ops = { .hash = id128_hash_func, .compare = id128_compare_func, }; +#endif // 0 diff --git a/src/libelogind/sd-id128/id128-util.h b/src/libelogind/sd-id128/id128-util.h index 6b3855acb..e5262cdcd 100644 --- a/src/libelogind/sd-id128/id128-util.h +++ b/src/libelogind/sd-id128/id128-util.h @@ -43,9 +43,11 @@ typedef enum Id128Format { int id128_read_fd(int fd, Id128Format f, sd_id128_t *ret); int id128_read(const char *p, Id128Format f, sd_id128_t *ret); +#if 0 /// UNNEEDED by elogind int id128_write_fd(int fd, Id128Format f, sd_id128_t id, bool do_sync); int id128_write(const char *p, Id128Format f, sd_id128_t id, bool do_sync); void id128_hash_func(const void *p, struct siphash *state); int id128_compare_func(const void *a, const void *b) _pure_; extern const struct hash_ops id128_hash_ops; +#endif // 0 diff --git a/src/shared/clean-ipc.c b/src/shared/clean-ipc.c index 567dbbc99..8c60bdc1f 100644 --- a/src/shared/clean-ipc.c +++ b/src/shared/clean-ipc.c @@ -388,6 +388,8 @@ int clean_ipc_by_uid(uid_t uid) { return clean_ipc(uid, GID_INVALID); } +#if 0 /// UNNEEDED by elogind int clean_ipc_by_gid(gid_t gid) { return clean_ipc(UID_INVALID, gid); } +#endif // 0 diff --git a/src/shared/clean-ipc.h b/src/shared/clean-ipc.h index 6ca57f44f..7cd896df0 100644 --- a/src/shared/clean-ipc.h +++ b/src/shared/clean-ipc.h @@ -23,4 +23,6 @@ int clean_ipc(uid_t uid, gid_t gid); int clean_ipc_by_uid(uid_t uid); +#if 0 /// UNNEEDED by elogind int clean_ipc_by_gid(gid_t gid); +#endif // 0 diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c index 9190ec9b8..90f3167f5 100644 --- a/src/shared/conf-parser.c +++ b/src/shared/conf-parser.c @@ -507,8 +507,10 @@ int config_parse_many( DEFINE_PARSER(int, int, safe_atoi); DEFINE_PARSER(long, long, safe_atoli); +#if 0 /// UNNEEDED by elogind DEFINE_PARSER(uint16, uint16_t, safe_atou16); DEFINE_PARSER(uint32, uint32_t, safe_atou32); +#endif // 0 DEFINE_PARSER(uint64, uint64_t, safe_atou64); DEFINE_PARSER(unsigned, unsigned, safe_atou); DEFINE_PARSER(double, double, safe_atod); diff --git a/src/shared/conf-parser.h b/src/shared/conf-parser.h index fe93c3c1e..76d602322 100644 --- a/src/shared/conf-parser.h +++ b/src/shared/conf-parser.h @@ -121,8 +121,10 @@ int config_parse_many( int config_parse_int(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_unsigned(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_long(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); +#if 0 /// UNNEEDED by elogind int config_parse_uint16(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_uint32(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); +#endif // 0 int config_parse_uint64(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_double(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_iec_size(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