diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-10-24 22:58:24 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-10-24 23:05:02 +0200 |
commit | 07630cea1f3a845c09309f197ac7c4f11edd3b62 (patch) | |
tree | af80c7221d1466fac79a7f3a57e0d63a96f464d4 /src/journal | |
parent | 4f5dd3943bef8a04be7e3b838b822bb9a7ad6cb3 (diff) |
util-lib: split our string related calls from util.[ch] into its own file string-util.[ch]
There are more than enough calls doing string manipulations to deserve
its own files, hence do something about it.
This patch also sorts the #include blocks of all files that needed to be
updated, according to the sorting suggestions from CODING_STYLE. Since
pretty much every file needs our string manipulation functions this
effectively means that most files have sorted #include blocks now.
Also touches a few unrelated include files.
Diffstat (limited to 'src/journal')
26 files changed, 122 insertions, 90 deletions
diff --git a/src/journal/cat.c b/src/journal/cat.c index f9b279d7de..7074552a15 100644 --- a/src/journal/cat.c +++ b/src/journal/cat.c @@ -28,6 +28,7 @@ #include "sd-journal.h" +#include "string-util.h" #include "util.h" static char *arg_identifier = NULL; diff --git a/src/journal/catalog.c b/src/journal/catalog.c index 4c43500ef5..32b851aea3 100644 --- a/src/journal/catalog.c +++ b/src/journal/catalog.c @@ -19,25 +19,27 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ +#include <errno.h> #include <fcntl.h> +#include <locale.h> #include <stdio.h> -#include <unistd.h> -#include <errno.h> #include <string.h> #include <sys/mman.h> -#include <locale.h> +#include <unistd.h> -#include "util.h" -#include "log.h" -#include "sparse-endian.h" #include "sd-id128.h" -#include "hashmap.h" -#include "strv.h" -#include "strbuf.h" + +#include "catalog.h" #include "conf-files.h" +#include "hashmap.h" +#include "log.h" #include "mkdir.h" -#include "catalog.h" #include "siphash24.h" +#include "sparse-endian.h" +#include "strbuf.h" +#include "string-util.h" +#include "strv.h" +#include "util.h" const char * const catalog_file_dirs[] = { "/usr/local/lib/systemd/catalog/", diff --git a/src/journal/compress.c b/src/journal/compress.c index 8c92e26edd..46a5410482 100644 --- a/src/journal/compress.c +++ b/src/journal/compress.c @@ -21,8 +21,8 @@ #include <stdlib.h> #include <string.h> -#include <unistd.h> #include <sys/mman.h> +#include <unistd.h> #ifdef HAVE_XZ # include <lzma.h> @@ -33,11 +33,12 @@ # include <lz4frame.h> #endif -#include "compress.h" +#include "journal-def.h" #include "macro.h" -#include "util.h" #include "sparse-endian.h" -#include "journal-def.h" +#include "string-util.h" +#include "util.h" +#include "compress.h" #ifdef HAVE_LZ4 DEFINE_TRIVIAL_CLEANUP_FUNC(LZ4F_compressionContext_t, LZ4F_freeCompressionContext); diff --git a/src/journal/coredump-vacuum.c b/src/journal/coredump-vacuum.c index efe418615a..ba9994ac47 100644 --- a/src/journal/coredump-vacuum.c +++ b/src/journal/coredump-vacuum.c @@ -21,11 +21,11 @@ #include <sys/statvfs.h> -#include "util.h" -#include "time-util.h" #include "hashmap.h" #include "macro.h" - +#include "string-util.h" +#include "time-util.h" +#include "util.h" #include "coredump-vacuum.h" #define DEFAULT_MAX_USE_LOWER (uint64_t) (1ULL*1024ULL*1024ULL) /* 1 MiB */ diff --git a/src/journal/coredump.c b/src/journal/coredump.c index e20a73c159..5c1badd66d 100644 --- a/src/journal/coredump.c +++ b/src/journal/coredump.c @@ -49,6 +49,7 @@ #include "process-util.h" #include "special.h" #include "stacktrace.h" +#include "string-util.h" #include "strv.h" #include "util.h" diff --git a/src/journal/coredumpctl.c b/src/journal/coredumpctl.c index 97a721c114..80f692e044 100644 --- a/src/journal/coredumpctl.c +++ b/src/journal/coredumpctl.c @@ -38,6 +38,7 @@ #include "set.h" #include "sigbus.h" #include "signal-util.h" +#include "string-util.h" #include "terminal-util.h" #include "util.h" diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c index 1071c6d6d7..f0962faeb5 100644 --- a/src/journal/journal-file.c +++ b/src/journal/journal-file.c @@ -19,22 +19,23 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include <sys/mman.h> #include <errno.h> -#include <sys/uio.h> -#include <unistd.h> -#include <sys/statvfs.h> #include <fcntl.h> -#include <stddef.h> #include <linux/fs.h> +#include <stddef.h> +#include <sys/mman.h> +#include <sys/statvfs.h> +#include <sys/uio.h> +#include <unistd.h> #include "btrfs-util.h" -#include "journal-def.h" -#include "journal-file.h" +#include "compress.h" #include "journal-authenticate.h" +#include "journal-def.h" #include "lookup3.h" -#include "compress.h" #include "random-util.h" +#include "string-util.h" +#include "journal-file.h" #define DEFAULT_DATA_HASH_TABLE_SIZE (2047ULL*sizeof(HashItem)) #define DEFAULT_FIELD_HASH_TABLE_SIZE (333ULL*sizeof(HashItem)) diff --git a/src/journal/journal-internal.h b/src/journal/journal-internal.h index b51ecdb600..1221799c1d 100644 --- a/src/journal/journal-internal.h +++ b/src/journal/journal-internal.h @@ -25,14 +25,14 @@ #include <inttypes.h> #include <stdbool.h> -#include "systemd/sd-id128.h" +#include "sd-id128.h" +#include "sd-journal.h" +#include "hashmap.h" #include "journal-def.h" +#include "journal-file.h" #include "list.h" -#include "hashmap.h" #include "set.h" -#include "journal-file.h" -#include "sd-journal.h" typedef struct Match Match; typedef struct Location Location; diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c index dc1b2105dd..79ef5b13d2 100644 --- a/src/journal/journal-send.c +++ b/src/journal/journal-send.c @@ -19,20 +19,22 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include <sys/socket.h> -#include <sys/un.h> #include <errno.h> -#include <stddef.h> -#include <unistd.h> #include <fcntl.h> #include <printf.h> +#include <stddef.h> +#include <sys/socket.h> +#include <sys/un.h> +#include <unistd.h> #define SD_JOURNAL_SUPPRESS_LOCATION #include "sd-journal.h" -#include "util.h" -#include "socket-util.h" + #include "memfd-util.h" +#include "socket-util.h" +#include "string-util.h" +#include "util.h" #define SNDBUF_SIZE (8*1024*1024) diff --git a/src/journal/journal-vacuum.c b/src/journal/journal-vacuum.c index c7ecd360b9..692b875fae 100644 --- a/src/journal/journal-vacuum.c +++ b/src/journal/journal-vacuum.c @@ -23,12 +23,15 @@ #include <sys/stat.h> #include <unistd.h> +#include "sd-id128.h" + #include "journal-def.h" #include "journal-file.h" -#include "journal-vacuum.h" -#include "sd-id128.h" +#include "string-util.h" #include "util.h" +#include "journal-vacuum.h" + struct vacuum_info { uint64_t usage; char *filename; diff --git a/src/journal/journald-audit.c b/src/journal/journald-audit.c index fe8ae194c9..58778a697a 100644 --- a/src/journal/journald-audit.c +++ b/src/journal/journald-audit.c @@ -19,9 +19,10 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ +#include "audit-type.h" #include "missing.h" +#include "string-util.h" #include "journald-audit.h" -#include "audit-type.h" typedef struct MapField { const char *audit_field; diff --git a/src/journal/journald-kmsg.c b/src/journal/journald-kmsg.c index 9ed368b586..a8be704716 100644 --- a/src/journal/journald-kmsg.c +++ b/src/journal/journald-kmsg.c @@ -33,6 +33,7 @@ #include "journald-server.h" #include "journald-syslog.h" #include "process-util.h" +#include "string-util.h" #include "journald-kmsg.h" void server_forward_kmsg( diff --git a/src/journal/journald-native.c b/src/journal/journald-native.c index 3e8a7a05f6..7a514b2848 100644 --- a/src/journal/journald-native.c +++ b/src/journal/journald-native.c @@ -19,21 +19,22 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include <unistd.h> #include <stddef.h> #include <sys/epoll.h> #include <sys/mman.h> +#include <unistd.h> -#include "socket-util.h" -#include "path-util.h" -#include "selinux-util.h" -#include "journald-server.h" -#include "journald-native.h" -#include "journald-kmsg.h" #include "journald-console.h" +#include "journald-kmsg.h" +#include "journald-server.h" #include "journald-syslog.h" #include "journald-wall.h" #include "memfd-util.h" +#include "path-util.h" +#include "selinux-util.h" +#include "socket-util.h" +#include "string-util.h" +#include "journald-native.h" bool valid_user_field(const char *p, size_t l, bool allow_protected) { const char *a; diff --git a/src/journal/journald-rate-limit.c b/src/journal/journald-rate-limit.c index 8afd493b50..6e9557c06e 100644 --- a/src/journal/journald-rate-limit.c +++ b/src/journal/journald-rate-limit.c @@ -19,14 +19,15 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include <string.h> #include <errno.h> +#include <string.h> -#include "journald-rate-limit.h" -#include "list.h" -#include "util.h" #include "hashmap.h" +#include "list.h" #include "random-util.h" +#include "string-util.h" +#include "util.h" +#include "journald-rate-limit.h" #define POOLS_MAX 5 #define BUCKETS_MAX 127 diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c index 140d40667e..2dfd309310 100644 --- a/src/journal/journald-server.c +++ b/src/journal/journald-server.c @@ -19,7 +19,6 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include <linux/sockios.h> #ifdef HAVE_SELINUX #include <selinux/selinux.h> #endif @@ -27,6 +26,7 @@ #include <sys/mman.h> #include <sys/signalfd.h> #include <sys/statvfs.h> +#include <linux/sockios.h> #include "libudev.h" #include "sd-daemon.h" @@ -39,13 +39,6 @@ #include "formats-util.h" #include "hashmap.h" #include "hostname-util.h" -#include "missing.h" -#include "mkdir.h" -#include "process-util.h" -#include "rm-rf.h" -#include "selinux-util.h" -#include "signal-util.h" -#include "socket-util.h" #include "journal-authenticate.h" #include "journal-file.h" #include "journal-internal.h" @@ -54,9 +47,17 @@ #include "journald-kmsg.h" #include "journald-native.h" #include "journald-rate-limit.h" -#include "journald-server.h" #include "journald-stream.h" #include "journald-syslog.h" +#include "missing.h" +#include "mkdir.h" +#include "process-util.h" +#include "rm-rf.h" +#include "selinux-util.h" +#include "signal-util.h" +#include "socket-util.h" +#include "string-util.h" +#include "journald-server.h" #define USER_JOURNALS_MAX 1024 diff --git a/src/journal/journald-stream.c b/src/journal/journald-stream.c index 0c4b82f80d..e06be6267f 100644 --- a/src/journal/journald-stream.c +++ b/src/journal/journald-stream.c @@ -19,8 +19,8 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include <unistd.h> #include <stddef.h> +#include <unistd.h> #ifdef HAVE_SELINUX #include <selinux/selinux.h> @@ -39,6 +39,7 @@ #include "mkdir.h" #include "selinux-util.h" #include "socket-util.h" +#include "string-util.h" #include "journald-stream.h" #define STDOUT_STREAMS_MAX 4096 diff --git a/src/journal/journald-syslog.c b/src/journal/journald-syslog.c index ffba451955..fc69cd7d9e 100644 --- a/src/journal/journald-syslog.c +++ b/src/journal/journald-syslog.c @@ -19,20 +19,22 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include <unistd.h> #include <stddef.h> #include <sys/epoll.h> +#include <unistd.h> -#include "systemd/sd-messages.h" -#include "socket-util.h" -#include "selinux-util.h" -#include "journald-server.h" -#include "journald-syslog.h" -#include "journald-kmsg.h" +#include "sd-messages.h" + +#include "formats-util.h" #include "journald-console.h" +#include "journald-kmsg.h" +#include "journald-server.h" #include "journald-wall.h" -#include "formats-util.h" #include "process-util.h" +#include "selinux-util.h" +#include "socket-util.h" +#include "string-util.h" +#include "journald-syslog.h" /* Warn once every 30s if we missed syslog message */ #define WARN_FORWARD_SYSLOG_MISSED_USEC (30 * USEC_PER_SEC) diff --git a/src/journal/journald-wall.c b/src/journal/journald-wall.c index 7863766ae7..5284914941 100644 --- a/src/journal/journald-wall.c +++ b/src/journal/journald-wall.c @@ -19,11 +19,12 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include "utmp-wtmp.h" -#include "journald-server.h" -#include "journald-wall.h" #include "formats-util.h" +#include "journald-server.h" #include "process-util.h" +#include "string-util.h" +#include "utmp-wtmp.h" +#include "journald-wall.h" void server_forward_wall( Server *s, diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c index 13fa9b52fc..442e352ae2 100644 --- a/src/journal/sd-journal.c +++ b/src/journal/sd-journal.c @@ -21,29 +21,31 @@ #include <errno.h> #include <fcntl.h> +#include <linux/magic.h> +#include <poll.h> #include <stddef.h> -#include <unistd.h> #include <sys/inotify.h> -#include <poll.h> #include <sys/vfs.h> -#include <linux/magic.h> +#include <unistd.h> #include "sd-journal.h" + +#include "catalog.h" +#include "compress.h" +#include "fileio.h" +#include "formats-util.h" +#include "hashmap.h" +#include "hostname-util.h" #include "journal-def.h" #include "journal-file.h" -#include "hashmap.h" +#include "journal-internal.h" #include "list.h" -#include "strv.h" -#include "path-util.h" #include "lookup3.h" -#include "compress.h" -#include "journal-internal.h" #include "missing.h" -#include "catalog.h" +#include "path-util.h" #include "replace-var.h" -#include "fileio.h" -#include "formats-util.h" -#include "hostname-util.h" +#include "string-util.h" +#include "strv.h" #define JOURNAL_FILES_MAX 7168 diff --git a/src/journal/stacktrace.c b/src/journal/stacktrace.c index 98a54ff269..c4ba9e3890 100644 --- a/src/journal/stacktrace.c +++ b/src/journal/stacktrace.c @@ -22,10 +22,11 @@ #include <dwarf.h> #include <elfutils/libdwfl.h> -#include "util.h" +#include "formats-util.h" #include "macro.h" +#include "string-util.h" +#include "util.h" #include "stacktrace.h" -#include "formats-util.h" #define FRAMES_MAX 64 #define THREADS_MAX 64 diff --git a/src/journal/test-catalog.c b/src/journal/test-catalog.c index dbfdea609d..222d6cc72a 100644 --- a/src/journal/test-catalog.c +++ b/src/journal/test-catalog.c @@ -25,11 +25,13 @@ #include <errno.h> #include <fcntl.h> +#include "sd-messages.h" + #include "util.h" #include "log.h" #include "macro.h" -#include "sd-messages.h" #include "catalog.h" +#include "string-util.h" static const char *catalog_dirs[] = { CATALOG_DIR, diff --git a/src/journal/test-compress-benchmark.c b/src/journal/test-compress-benchmark.c index 782b85db26..0a9ab7f52c 100644 --- a/src/journal/test-compress-benchmark.c +++ b/src/journal/test-compress-benchmark.c @@ -20,9 +20,10 @@ ***/ #include "compress.h" -#include "util.h" #include "macro.h" #include "random-util.h" +#include "string-util.h" +#include "util.h" typedef int (compress_t)(const void *src, uint64_t src_size, void *dst, size_t *dst_size); typedef int (decompress_t)(const void *src, uint64_t src_size, diff --git a/src/journal/test-journal-enum.c b/src/journal/test-journal-enum.c index cde2025ae9..040c7d58fb 100644 --- a/src/journal/test-journal-enum.c +++ b/src/journal/test-journal-enum.c @@ -21,8 +21,9 @@ #include <stdio.h> -#include "log.h" #include "sd-journal.h" + +#include "log.h" #include "macro.h" #include "journal-internal.h" diff --git a/src/journal/test-journal-flush.c b/src/journal/test-journal-flush.c index 2d4f531e9b..6061623ae7 100644 --- a/src/journal/test-journal-flush.c +++ b/src/journal/test-journal-flush.c @@ -22,9 +22,11 @@ #include <fcntl.h> #include "sd-journal.h" -#include "macro.h" + #include "journal-file.h" #include "journal-internal.h" +#include "macro.h" +#include "string-util.h" int main(int argc, char *argv[]) { _cleanup_free_ char *fn = NULL; diff --git a/src/journal/test-journal-match.c b/src/journal/test-journal-match.c index a3187053c9..476477055a 100644 --- a/src/journal/test-journal-match.c +++ b/src/journal/test-journal-match.c @@ -21,11 +21,12 @@ #include <stdio.h> -#include "systemd/sd-journal.h" +#include "sd-journal.h" #include "journal-internal.h" -#include "util.h" #include "log.h" +#include "string-util.h" +#include "util.h" int main(int argc, char *argv[]) { _cleanup_journal_close_ sd_journal*j; diff --git a/src/journal/test-journal-syslog.c b/src/journal/test-journal-syslog.c index c99ca0654b..de942c50cc 100644 --- a/src/journal/test-journal-syslog.c +++ b/src/journal/test-journal-syslog.c @@ -21,6 +21,7 @@ #include "journald-syslog.h" #include "macro.h" +#include "string-util.h" static void test_syslog_parse_identifier(const char* str, const char *ident, const char*pid, int ret) { |