1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-22 13:33:56 +03:00

headers: remove unneeded includes from util.h

This means we need to include many more headers in various files that simply
included util.h before, but it seems cleaner to do it this way.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2019-03-27 11:32:41 +01:00
parent b45556375e
commit ca78ad1de9
160 changed files with 290 additions and 50 deletions

View File

@ -22,6 +22,7 @@
#include "string-util.h"
#include "strv.h"
#include "terminal-util.h"
#include "util.h"
static char** arg_listen = NULL;
static bool arg_accept = false;

View File

@ -8,6 +8,7 @@
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "sd-bus.h"

View File

@ -1,5 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "sd-device.h"
#include "alloc-util.h"

View File

@ -4,6 +4,8 @@
#include <errno.h>
#include <glob.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include "dirent-util.h"
#include "glob-util.h"

View File

@ -5,6 +5,7 @@
#include <errno.h>
#include <net/if.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include "alloc-util.h"

View File

@ -6,6 +6,7 @@
#include <sys/stat.h>
#include "alloc-util.h"
#include "format-util.h"
#include "fs-util.h"
#include "macro.h"
#include "mkdir.h"

View File

@ -1,11 +1,13 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include <errno.h>
#include <fcntl.h>
#include <malloc.h>
#include <stddef.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/un.h>
#include <syslog.h>

View File

@ -1,6 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
#include <fcntl.h>
#include <stdbool.h>
#include <stddef.h>
#include <sys/stat.h>

View File

@ -5,12 +5,12 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include "alloc-util.h"
#include "extract-word.h"
#include "macro.h"
#include "string-util.h"
#include "util.h"
char *strv_find(char **l, const char *name) _pure_;
char *strv_find_prefix(char **l, const char *name) _pure_;

View File

@ -1,31 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
#include <alloca.h>
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
#include <limits.h>
#include <locale.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/inotify.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/statfs.h>
#include <sys/sysmacros.h>
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
#include "format-util.h"
#include "macro.h"
#include "time-util.h"
static inline const char* yes_no(bool b) {
return b ? "yes" : "no";

View File

@ -7,6 +7,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "alloc-util.h"
#include "conf-files.h"
@ -20,7 +22,6 @@
#include "pretty-print.h"
#include "string-util.h"
#include "strv.h"
#include "util.h"
static bool arg_cat_config = false;
static PagerFlags arg_pager_flags = 0;

View File

@ -1,6 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include <stdio_ext.h>
#include <fcntl.h>
#include "alloc-util.h"
#include "async.h"

View File

@ -3,11 +3,14 @@
#include <grp.h>
#include <pwd.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "clean-ipc.h"
#include "dynamic-user.h"
#include "fd-util.h"
#include "fileio.h"
#include "format-util.h"
#include "fs-util.h"
#include "io-util.h"
#include "nscd-flush.h"

View File

@ -19,6 +19,7 @@ typedef struct Manager Manager;
#include "missing_resource.h"
#include "namespace.h"
#include "nsflags.h"
#include "time-util.h"
#define EXEC_STDIN_DATA_MAX (64U*1024U*1024U)

View File

@ -5,6 +5,9 @@
***/
#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "alloc-util.h"
@ -12,7 +15,6 @@
#include "fileio.h"
#include "ima-setup.h"
#include "log.h"
#include "util.h"
#define IMA_SECFS_DIR "/sys/kernel/security/ima"
#define IMA_SECFS_POLICY IMA_SECFS_DIR "/policy"

View File

@ -8,6 +8,7 @@
#include "loopback-setup.h"
#include "missing.h"
#include "netlink-util.h"
#include "time-util.h"
#define LOOPBACK_SETUP_TIMEOUT_USEC (5 * USEC_PER_SEC)

View File

@ -17,6 +17,7 @@
#include "alloc-util.h"
#include "audit-fd.h"
#include "bus-util.h"
#include "format-util.h"
#include "log.h"
#include "path-util.h"
#include "selinux-util.h"

View File

@ -13,6 +13,7 @@
#include "selinux-setup.h"
#include "selinux-util.h"
#include "string-util.h"
#include "time-util.h"
#include "util.h"
#if HAVE_SELINUX

View File

@ -2,6 +2,8 @@
#include <errno.h>
#include <signal.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "sd-messages.h"

View File

@ -1,5 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "alloc-util.h"
#include "fd-util.h"
#include "io-util.h"

View File

@ -12,6 +12,7 @@
#include <stdio_ext.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "alloc-util.h"
#include "dirent-util.h"

View File

@ -1,5 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include "alloc-util.h"

View File

@ -1,6 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include <sys/statvfs.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "alloc-util.h"
#include "coredump-vacuum.h"

View File

@ -3,6 +3,8 @@
#include <dwarf.h>
#include <elfutils/libdwfl.h>
#include <stdio_ext.h>
#include <sys/types.h>
#include <unistd.h>
#include "alloc-util.h"
#include "fd-util.h"

View File

@ -1,7 +1,10 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include <errno.h>
#include <fcntl.h>
#include <stdio_ext.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "alloc-util.h"
#include "dropin.h"

View File

@ -4,6 +4,9 @@
#include <mntent.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "sd-device.h"

View File

@ -1,5 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include <unistd.h>
#include "alloc-util.h"
#include "generator.h"
#include "mkdir.h"
@ -9,7 +11,6 @@
#include "string-util.h"
#include "strv.h"
#include "unit-name.h"
#include "util.h"
static const char *arg_dest = NULL;
static char *arg_default_unit = NULL;

View File

@ -1,5 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "fuzz.h"
#include "sd-dhcp-server.c"

View File

@ -2,6 +2,7 @@
#include <linux/sockios.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include "fd-util.h"
#include "fuzz.h"

View File

@ -2,6 +2,7 @@
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include "alloc-util.h"
#include "fstab-util.h"
@ -13,7 +14,6 @@
#include "special.h"
#include "string-util.h"
#include "unit-name.h"
#include "util.h"
static const char *arg_dest = "/tmp";
static char *arg_resume_device = NULL;

View File

@ -3,6 +3,8 @@
#include <errno.h>
#include <string.h>
#include <sys/utsname.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "alloc-util.h"

View File

@ -1,5 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include <fcntl.h>
#include "alloc-util.h"
#include "build.h"
#include "curl-util.h"

View File

@ -7,6 +7,7 @@
#include "sd-event.h"
#include "hashmap.h"
#include "time-util.h"
typedef struct CurlGlue CurlGlue;

View File

@ -1,6 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include <getopt.h>
#include <locale.h>
#include "sd-event.h"
#include "sd-id128.h"

View File

@ -1,6 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include <getopt.h>
#include <locale.h>
#include "alloc-util.h"
#include "btrfs-util.h"

View File

@ -1,6 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include <getopt.h>
#include <locale.h>
#include "sd-event.h"
#include "sd-id128.h"

View File

@ -1,5 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/xattr.h>
#include "alloc-util.h"

View File

@ -1,6 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include <getopt.h>
#include <locale.h>
#include "sd-event.h"
#include "sd-id128.h"

View File

@ -1,9 +1,12 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "fd-util.h"
#include "log.h"
#include "qcow2-util.h"
#include "util.h"
int main(int argc, char *argv[]) {
_cleanup_close_ int sfd = -1, dfd = -1;

View File

@ -4,6 +4,8 @@
#include <errno.h>
#include <stdio.h>
#include <sys/epoll.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "sd-bus.h"

View File

@ -5,6 +5,8 @@
#include <microhttpd.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "sd-bus.h"

View File

@ -6,6 +6,8 @@
#include <stdio.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "sd-id128.h"

View File

@ -2,6 +2,7 @@
#pragma once
#include <stdbool.h>
#include <stdio.h>
#include "sd-id128.h"

View File

@ -4,6 +4,8 @@
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#if HAVE_XZ

View File

@ -11,6 +11,7 @@
#include "journal-def.h"
#include "journal-file.h"
#include "memory-util.h"
#include "time-util.h"
static uint64_t journal_file_tag_seqnum(JournalFile *f) {
uint64_t r;

View File

@ -12,9 +12,9 @@
#include "hashmap.h"
#include "journal-def.h"
#include "macro.h"
#include "mmap-cache.h"
#include "sparse-endian.h"
#include "time-util.h"
typedef struct JournalMetrics {
/* For all these: -1 means "pick automatically", and 0 means "no limit enforced" */

View File

@ -6,6 +6,8 @@
#include "sd-id128.h"
#include "time-util.h"
typedef struct ClientContext ClientContext;
#include "journald-server.h"

View File

@ -9,7 +9,7 @@
#include "list.h"
#include "random-util.h"
#include "string-util.h"
#include "util.h"
#include "time-util.h"
#define POOLS_MAX 5
#define BUCKETS_MAX 127

View File

@ -1,7 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
#include "util.h"
#include "time-util.h"
typedef struct JournalRateLimit JournalRateLimit;

View File

@ -16,6 +16,7 @@ typedef struct Server Server;
#include "journald-stream.h"
#include "list.h"
#include "prioq.h"
#include "time-util.h"
typedef enum Storage {
STORAGE_AUTO,

View File

@ -1,5 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include <sys/stat.h>
#if HAVE_LZ4
#include <lz4.h>
#endif

View File

@ -1,6 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include <fcntl.h>
#include <unistd.h>
#include "sd-journal.h"

View File

@ -11,7 +11,7 @@
#include "dhcp-internal.h"
#include "hashmap.h"
#include "log.h"
#include "util.h"
#include "time-util.h"
typedef struct DHCPClientId {
size_t length;

View File

@ -6,6 +6,7 @@
***/
#include "log.h"
#include "time-util.h"
#include "sd-ndisc.h"

View File

@ -9,6 +9,9 @@
#include <stdio_ext.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "sd-dhcp-lease.h"

View File

@ -21,7 +21,7 @@
#include "random-util.h"
#include "siphash24.h"
#include "string-util.h"
#include "util.h"
#include "time-util.h"
/* Constants from the RFC */
#define PROBE_WAIT_USEC (1U * USEC_PER_SEC)

View File

@ -5,6 +5,7 @@
#include <netinet/icmp6.h>
#include <arpa/inet.h>
#include <unistd.h>
#include "sd-radv.h"

View File

@ -5,6 +5,7 @@
#include <netinet/icmp6.h>
#include <arpa/inet.h>
#include <unistd.h>
#include "sd-ndisc.h"

View File

@ -1,5 +1,8 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include <unistd.h>
#include <sys/types.h>
#include "bus-internal.h"
#include "bus-message.h"
#include "bus-signature.h"

View File

@ -14,7 +14,7 @@
#include "list.h"
#include "prioq.h"
#include "socket-util.h"
#include "util.h"
#include "time-util.h"
/* Note that we use the new /run prefix here (instead of /var/run) since we require them to be aliases and
* that way we become independent of /var being mounted */

View File

@ -1,6 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include <sys/wait.h>
#include <unistd.h>
#include "sd-bus.h"

View File

@ -1,5 +1,8 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include <fcntl.h>
#include <unistd.h>
#include "sd-device.h"
#include "alloc-util.h"

View File

@ -6,7 +6,7 @@
#include "hashmap.h"
#include "string-util.h"
#include "tests.h"
#include "util.h"
#include "time-util.h"
static void test_sd_device_one(sd_device *d) {
const char *syspath, *subsystem, *val;

View File

@ -2,6 +2,7 @@
#include <ctype.h>
#include <stdio.h>
#include <sys/stat.h>
#include "alloc-util.h"
#include "conf-files.h"

View File

@ -10,6 +10,7 @@
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include "sd-hwdb.h"
@ -20,6 +21,7 @@
#include "hwdb-util.h"
#include "nulstr-util.h"
#include "string-util.h"
#include "time-util.h"
struct sd_hwdb {
unsigned n_ref;

View File

@ -11,6 +11,7 @@
#include "log.h"
#include "string-util.h"
#include "strv.h"
#include "time-util.h"
#include "util.h"
static char* format_uids(char **buf, uid_t* uids, int count) {

View File

@ -8,6 +8,7 @@
#include "list.h"
#include "netlink-types.h"
#include "prioq.h"
#include "time-util.h"
#define RTNL_DEFAULT_TIMEOUT ((usec_t) (25 * USEC_PER_SEC))

View File

@ -1,5 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include <stdio.h>
#include "af-list.h"
#include "alloc-util.h"
#include "in-addr-util.h"

View File

@ -3,6 +3,8 @@
#include <errno.h>
#include <stdio_ext.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "bus-util.h"

View File

@ -2,6 +2,8 @@
#include <errno.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#if HAVE_XKBCOMMON

View File

@ -3,6 +3,7 @@
#include <errno.h>
#include <pwd.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
#include "sd-device.h"

View File

@ -3,6 +3,8 @@
#include <errno.h>
#include <fcntl.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "alloc-util.h"

View File

@ -4,6 +4,7 @@
#include <fcntl.h>
#include <stdio_ext.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
#include "sd-messages.h"

View File

@ -8,6 +8,7 @@
#include <stdio_ext.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <unistd.h>
#include "sd-messages.h"

View File

@ -11,6 +11,7 @@
#include "hashmap.h"
#include "list.h"
#include "set.h"
#include "time-util.h"
typedef struct Manager Manager;

View File

@ -10,6 +10,9 @@
#include <security/pam_modules.h>
#include <security/pam_modutil.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "alloc-util.h"
#include "audit-util.h"
@ -31,7 +34,6 @@
#include "stdio-util.h"
#include "strv.h"
#include "terminal-util.h"
#include "util.h"
static int parse_argv(
pam_handle_t *handle,

View File

@ -7,6 +7,7 @@
#include "bus-error.h"
#include "fs-util.h"
#include "format-util.h"
#include "label.h"
#include "main-func.h"
#include "mkdir.h"

View File

@ -4,6 +4,7 @@
#include <string.h>
#include <unistd.h>
#include <stdio_ext.h>
#include <sys/stat.h>
#include "sd-messages.h"

View File

@ -7,6 +7,7 @@ typedef enum KillWho KillWho;
#include "list.h"
#include "machined.h"
#include "operation.h"
#include "time-util.h"
typedef enum MachineState {
MACHINE_OPENING, /* Machine is being registered */

View File

@ -2,6 +2,8 @@
#include <errno.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "sd-daemon.h"

View File

@ -14,6 +14,7 @@
#include "escape.h"
#include "fd-util.h"
#include "fileio.h"
#include "format-util.h"
#include "fs-util.h"
#include "fstab-util.h"
#include "main-func.h"

View File

@ -4,6 +4,9 @@
#include <linux/if_addrlabel.h>
#include <net/if.h>
#include <stdbool.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "sd-device.h"
#include "sd-hwdb.h"

View File

@ -4,6 +4,7 @@
#include <linux/if.h>
#include <linux/fib_rules.h>
#include <stdio_ext.h>
#include <unistd.h>
#include "sd-daemon.h"
#include "sd-netlink.h"

View File

@ -2,6 +2,7 @@
#pragma once
#include "networkd-link.h"
#include "time-util.h"
typedef struct NDiscRDNSS {
usec_t valid_until;

View File

@ -1,5 +1,8 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include <sys/stat.h>
#include <sys/types.h>
#include "sd-daemon.h"
#include "sd-event.h"

View File

@ -7,6 +7,7 @@
#include "hashmap.h"
#include "network-util.h"
#include "time-util.h"
typedef struct Manager Manager;
typedef struct Link Link;

View File

@ -1,6 +1,8 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include <getopt.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "sd-daemon.h"

View File

@ -5,6 +5,7 @@
#include "alloc-util.h"
#include "fd-util.h"
#include "fileio.h"
#include "format-util.h"
#include "fs-util.h"
#include "mkdir.h"
#include "mount-util.h"

View File

@ -6,6 +6,7 @@
#include "alloc-util.h"
#include "escape.h"
#include "fd-util.h"
#include "format-util.h"
#include "fs-util.h"
#include "label.h"
#include "mkdir.h"

View File

@ -9,6 +9,7 @@
#include "cap-list.h"
#include "cpu-set-util.h"
#include "env-util.h"
#include "format-util.h"
#include "fs-util.h"
#include "hostname-util.h"
#include "json.h"

View File

@ -3,6 +3,7 @@
#include <errno.h>
#include <linux/netlink.h>
#include <sys/capability.h>
#include <sys/socket.h>
#include <sys/types.h>
#if HAVE_SECCOMP

View File

@ -17,6 +17,7 @@
#include "missing_resource.h"
#include "nspawn-expose-ports.h"
#include "nspawn-mount.h"
#include "time-util.h"
typedef enum StartMode {
START_PID1, /* Run parameters as command line as process 1 */

View File

@ -1,5 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include <fcntl.h>
#include <grp.h>
#include <sys/types.h>
#include <unistd.h>

View File

@ -10,6 +10,7 @@
#include "bus-common-errors.h"
#include "env-util.h"
#include "errno-util.h"
#include "format-util.h"
#include "hostname-util.h"
#include "in-addr-util.h"
#include "macro.h"

View File

@ -5,6 +5,8 @@
#include <nss.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include "sd-bus.h"

View File

@ -10,6 +10,7 @@
#include "dirent-util.h"
#include "env-util.h"
#include "fd-util.h"
#include "format-util.h"
#include "fs-util.h"
#include "list.h"
#include "macro.h"

View File

@ -25,6 +25,7 @@
#include "pretty-print.h"
#include "stat-util.h"
#include "strv.h"
#include "util.h"
static const char *arg_target = NULL;
static bool arg_dry_run = false;

View File

@ -1,5 +1,10 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "alloc-util.h"
#include "bus-common-errors.h"
#include "bus-label.h"

View File

@ -1,5 +1,8 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include <sys/stat.h>
#include <sys/types.h>
#include "sd-bus.h"
#include "sd-daemon.h"

View File

@ -4,6 +4,8 @@
#include <stdbool.h>
#include <stdio.h>
#include <sys/prctl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "main-func.h"

Some files were not shown because too many files have changed in this diff Show More