diff options
author | Anthony G. Basile <blueness@gentoo.org> | 2013-06-05 19:20:52 -0400 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2013-06-05 19:20:52 -0400 |
commit | c36cba5bc1c783f87b0ada8a8b42303bfadeaf0a (patch) | |
tree | a8027ec35d6c7bbc5f6a168ab3bfae569f66ed1c /src/libudev/log.c | |
parent | 58daf39a6c4002a9dd89690d88ce2ec41b2a7ea3 (diff) |
Remove unused functions from src/libudev/{conf-files,exit-status,hashmap,log,path-util,set,strv}.c
A lot of upstream commits cross many boundaries between systemd code
and udev code. The point of intersection is upstreams src/shared
folder. The best way we find to track them is to apply their commits
to udev and libudev and then just pick remove functions from the
shared folder. Its timely but it gives us the best control over what
gets in and what doesnt.
In this commit we removed the following functions:
conf_files_list_nulstr
exit_status_to_string
is_clean_exit_lsb
uint64_hash_func
uint64_compare_func
hashmap_free_free_free
hashmap_update
hashmap_get2
hashmap_remove_and_replace
hashmap_remove_value
hashmap_steal_first_key
hashmap_next
log_forget_fds
log_set_facility
log_meta_object
log_struct_internal
log_set_target_from_string
log_set_max_level_from_string
log_get_target
log_get_max_level
log_show_color_from_string
log_show_location_from_string
log_on_console
is_path
path_split_and_make_absolute
set_ensure_allocated
set_replace
set_remove_and_put
set_size
set_isempty
set_iterate_skip
set_steal_first
set_first
set_last
set_merge
set_move_one
set_copy
set_clear_free
set_get_strv
strv_find_prefix
strv_merge_concat
strv_split_newlines
strv_join
strv_remove_prefix
strv_parse_nulstr
strv_overlap
strv_sort
strv_print
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/libudev/log.c')
-rw-r--r-- | src/libudev/log.c | 203 |
1 files changed, 0 insertions, 203 deletions
diff --git a/src/libudev/log.c b/src/libudev/log.c index 778c0e2ea9..64baa9a3b3 100644 --- a/src/libudev/log.c +++ b/src/libudev/log.c @@ -287,20 +287,12 @@ void log_close(void) { log_close_console(); } -void log_forget_fds(void) { - console_fd = kmsg_fd = syslog_fd = journal_fd = -1; -} - void log_set_max_level(int level) { assert((level & LOG_PRIMASK) == level); log_max_level = level; } -void log_set_facility(int facility) { - log_facility = facility; -} - static int write_to_console( int level, const char*file, @@ -661,26 +653,6 @@ int log_metav_object( object_name, object, buffer); } -int log_meta_object( - int level, - const char*file, - int line, - const char *func, - const char *object_name, - const char *object, - const char *format, ...) { - - int r; - va_list ap; - - va_start(ap, format); - r = log_metav_object(level, file, line, func, - object_name, object, format, ap); - va_end(ap); - - return r; -} - #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-nonliteral" _noreturn_ static void log_assert(const char *text, const char *file, int line, const char *func, const char *format) { @@ -709,152 +681,6 @@ int log_oom_internal(const char *file, int line, const char *func) { return -ENOMEM; } -int log_struct_internal( - int level, - const char *file, - int line, - const char *func, - const char *format, ...) { - - PROTECT_ERRNO; - va_list ap; - int r; - - if (_likely_(LOG_PRI(level) > log_max_level)) - return 0; - - if (log_target == LOG_TARGET_NULL) - return 0; - - if ((level & LOG_FACMASK) == 0) - level = log_facility | LOG_PRI(level); - - if ((log_target == LOG_TARGET_AUTO || - log_target == LOG_TARGET_JOURNAL_OR_KMSG || - log_target == LOG_TARGET_JOURNAL) && - journal_fd >= 0) { - - char header[LINE_MAX]; - struct iovec iovec[17] = {}; - unsigned n = 0, i; - struct msghdr mh = { - .msg_iov = iovec, - }; - static const char nl = '\n'; - - /* If the journal is available do structured logging */ - log_do_header(header, sizeof(header), level, - file, line, func, NULL, NULL); - IOVEC_SET_STRING(iovec[n++], header); - - va_start(ap, format); - while (format && n + 1 < ELEMENTSOF(iovec)) { - char *buf; - va_list aq; - - /* We need to copy the va_list structure, - * since vasprintf() leaves it afterwards at - * an undefined location */ - - va_copy(aq, ap); - if (vasprintf(&buf, format, aq) < 0) { - va_end(aq); - r = -ENOMEM; - goto finish; - } - va_end(aq); - - /* Now, jump enough ahead, so that we point to - * the next format string */ - VA_FORMAT_ADVANCE(format, ap); - - IOVEC_SET_STRING(iovec[n++], buf); - - iovec[n].iov_base = (char*) &nl; - iovec[n].iov_len = 1; - n++; - - format = va_arg(ap, char *); - } - - mh.msg_iovlen = n; - - if (sendmsg(journal_fd, &mh, MSG_NOSIGNAL) < 0) - r = -errno; - else - r = 1; - - finish: - va_end(ap); - for (i = 1; i < n; i += 2) - free(iovec[i].iov_base); - - } else { - char buf[LINE_MAX]; - bool found = false; - - /* Fallback if journal logging is not available */ - - va_start(ap, format); - while (format) { - va_list aq; - - va_copy(aq, ap); - vsnprintf(buf, sizeof(buf), format, aq); - va_end(aq); - char_array_0(buf); - - if (startswith(buf, "MESSAGE=")) { - found = true; - break; - } - - VA_FORMAT_ADVANCE(format, ap); - - format = va_arg(ap, char *); - } - va_end(ap); - - if (found) - r = log_dispatch(level, file, line, func, - NULL, NULL, buf + 8); - else - r = -EINVAL; - } - - return r; -} - -int log_set_target_from_string(const char *e) { - LogTarget t; - - t = log_target_from_string(e); - if (t < 0) - return -EINVAL; - - log_set_target(t); - return 0; -} - -int log_set_max_level_from_string(const char *e) { - int t; - - t = log_level_from_string(e); - if (t < 0) - return t; - - log_set_max_level(t); - return 0; -} - -LogTarget log_get_target(void) { - return log_target; -} - -int log_get_max_level(void) { - return log_max_level; -} - void log_show_color(bool b) { show_color = b; } @@ -863,35 +689,6 @@ void log_show_location(bool b) { show_location = b; } -int log_show_color_from_string(const char *e) { - int t; - - t = parse_boolean(e); - if (t < 0) - return t; - - log_show_color(t); - return 0; -} - -int log_show_location_from_string(const char *e) { - int t; - - t = parse_boolean(e); - if (t < 0) - return t; - - log_show_location(t); - return 0; -} - -bool log_on_console(void) { - if (log_target == LOG_TARGET_CONSOLE) - return true; - - return syslog_fd < 0 && kmsg_fd < 0 && journal_fd < 0; -} - static const char *const log_target_table[] = { [LOG_TARGET_CONSOLE] = "console", [LOG_TARGET_KMSG] = "kmsg", |