From 58db1a61c88a41eec7e0dffe656d9ece53d899cc Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Fri, 3 Sep 2021 09:25:56 +0200 Subject: [PATCH] build: add src/include to build and simplify header inclusions Signed-off-by: Christian Brauner --- hooks/unmount-namespace.c | 2 +- src/lxc/Makefile.am | 1 + src/lxc/af_unix.c | 2 +- src/lxc/cgroups/cgfsng.c | 4 ++-- src/lxc/cgroups/cgroup2_devices.h | 4 ++-- src/lxc/cmd/lxc_user_nic.c | 2 +- src/lxc/conf.c | 12 ++++++------ src/lxc/confile.c | 6 +++--- src/lxc/confile_utils.c | 2 +- src/lxc/criu.c | 4 ++-- src/lxc/initutils.c | 2 +- src/lxc/log.c | 2 +- src/lxc/lxccontainer.c | 2 +- src/lxc/monitor.c | 2 +- src/lxc/network.c | 4 ++-- src/lxc/pam/pam_cgfs.c | 4 ++-- src/lxc/rexec.c | 2 +- src/lxc/start.c | 2 +- src/lxc/storage/btrfs.c | 4 ++-- src/lxc/storage/nbd.c | 2 +- src/lxc/storage/rbd.c | 2 +- src/lxc/storage/storage.c | 2 +- src/lxc/storage/storage.h | 2 +- src/lxc/storage/storage_utils.c | 2 +- src/lxc/string_utils.c | 4 ++-- src/lxc/string_utils.h | 6 +++--- src/lxc/terminal.c | 2 +- src/lxc/tools/include/getsubopt.c | 2 +- src/lxc/tools/lxc_copy.c | 2 +- src/lxc/tools/lxc_device.c | 2 +- src/lxc/utils.c | 4 ++-- src/lxc/utils.h | 2 +- src/tests/Makefile.am | 1 + src/tests/api_reboot.c | 2 +- src/tests/arch_parse.c | 2 +- src/tests/attach.c | 2 +- src/tests/cgpath.c | 2 +- src/tests/device_add_remove.c | 2 +- src/tests/get_item.c | 2 +- src/tests/shortlived.c | 2 +- 40 files changed, 57 insertions(+), 55 deletions(-) diff --git a/hooks/unmount-namespace.c b/hooks/unmount-namespace.c index 99b284481..c0c8b191c 100644 --- a/hooks/unmount-namespace.c +++ b/hooks/unmount-namespace.c @@ -40,7 +40,7 @@ #include <../src/config.h> #if IS_BIONIC -#include <../src/include/lxcmntent.h> +#include "lxcmntent.h" #else #include #endif diff --git a/src/lxc/Makefile.am b/src/lxc/Makefile.am index d13cbc160..3c1f0a3dd 100644 --- a/src/lxc/Makefile.am +++ b/src/lxc/Makefile.am @@ -230,6 +230,7 @@ AM_CFLAGS += -DLXCROOTFSMOUNT=\"$(LXCROOTFSMOUNT)\" \ -DSBINDIR=\"$(SBINDIR)\" \ -DAPPARMOR_CACHE_DIR=\"$(APPARMOR_CACHE_DIR)\" \ -I $(top_srcdir)/src \ + -I $(top_srcdir)/src/include \ -I $(top_srcdir)/src/lxc \ -I $(top_srcdir)/src/lxc/storage \ -I $(top_srcdir)/src/lxc/cgroups diff --git a/src/lxc/af_unix.c b/src/lxc/af_unix.c index 92debcf6c..4f8e2fad6 100644 --- a/src/lxc/af_unix.c +++ b/src/lxc/af_unix.c @@ -23,7 +23,7 @@ #include "utils.h" #ifndef HAVE_STRLCPY -#include "include/strlcpy.h" +#include "strlcpy.h" #endif lxc_log_define(af_unix, lxc); diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c index 1f8080241..0e9cbcec6 100644 --- a/src/lxc/cgroups/cgfsng.c +++ b/src/lxc/cgroups/cgfsng.c @@ -54,11 +54,11 @@ #include "utils.h" #ifndef HAVE_STRLCPY -#include "include/strlcpy.h" +#include "strlcpy.h" #endif #ifndef HAVE_STRLCAT -#include "include/strlcat.h" +#include "strlcat.h" #endif lxc_log_define(cgfsng, cgroup); diff --git a/src/lxc/cgroups/cgroup2_devices.h b/src/lxc/cgroups/cgroup2_devices.h index c8a1606a1..31896d292 100644 --- a/src/lxc/cgroups/cgroup2_devices.h +++ b/src/lxc/cgroups/cgroup2_devices.h @@ -24,8 +24,8 @@ #include "memory_utils.h" #include "syscall_numbers.h" -#include "include/bpf.h" -#include "include/bpf_common.h" +#include "bpf.h" +#include "bpf_common.h" #ifndef HAVE_BPF static inline int bpf_lxc(int cmd, union bpf_attr *attr, size_t size) diff --git a/src/lxc/cmd/lxc_user_nic.c b/src/lxc/cmd/lxc_user_nic.c index 6ead30b64..16ee4651d 100644 --- a/src/lxc/cmd/lxc_user_nic.c +++ b/src/lxc/cmd/lxc_user_nic.c @@ -43,7 +43,7 @@ #include "utils.h" #ifndef HAVE_STRLCPY -#include "include/strlcpy.h" +#include "strlcpy.h" #endif #define usernic_debug_stream(stream, format, ...) \ diff --git a/src/lxc/conf.c b/src/lxc/conf.c index 86ad68b52..be9d3072b 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -75,7 +75,7 @@ #if HAVE_OPENPTY #include #else -#include <../include/openpty.h> +#include "openpty.h" #endif #if HAVE_LIBCAP @@ -83,25 +83,25 @@ #endif #ifndef HAVE_STRLCAT -#include "include/strlcat.h" +#include "strlcat.h" #endif #if IS_BIONIC -#include <../include/lxcmntent.h> +#include "lxcmntent.h" #else #include #endif #if !defined(HAVE_PRLIMIT) && defined(HAVE_PRLIMIT64) -#include <../include/prlimit.h> +#include "prlimit.h" #endif #ifndef HAVE_STRLCPY -#include "include/strlcpy.h" +#include "strlcpy.h" #endif #ifndef HAVE_STRCHRNUL -#include "include/strchrnul.h" +#include "strchrnul.h" #endif lxc_log_define(conf, lxc); diff --git a/src/lxc/confile.c b/src/lxc/confile.c index a5f7249b7..9a2fcc3fc 100644 --- a/src/lxc/confile.c +++ b/src/lxc/confile.c @@ -29,7 +29,7 @@ #include "config.h" #include "confile.h" #include "confile_utils.h" -#include "../include/netns_ifaddrs.h" +#include "netns_ifaddrs.h" #include "log.h" #include "lxcseccomp.h" #include "macro.h" @@ -40,11 +40,11 @@ #include "utils.h" #ifndef HAVE_STRLCPY -#include "include/strlcpy.h" +#include "strlcpy.h" #endif #ifndef HAVE_STRLCAT -#include "include/strlcat.h" +#include "strlcat.h" #endif lxc_log_define(confile, lxc); diff --git a/src/lxc/confile_utils.c b/src/lxc/confile_utils.c index fff20375c..77627513c 100644 --- a/src/lxc/confile_utils.c +++ b/src/lxc/confile_utils.c @@ -25,7 +25,7 @@ #include "utils.h" #ifndef HAVE_STRLCPY -#include "include/strlcpy.h" +#include "strlcpy.h" #endif lxc_log_define(confile_utils, lxc); diff --git a/src/lxc/criu.c b/src/lxc/criu.c index 4452d0b0c..9143100fa 100644 --- a/src/lxc/criu.c +++ b/src/lxc/criu.c @@ -29,13 +29,13 @@ #include "utils.h" #if IS_BIONIC -#include <../include/lxcmntent.h> +#include "lxcmntent.h" #else #include #endif #ifndef HAVE_STRLCPY -#include "include/strlcpy.h" +#include "strlcpy.h" #endif #define CRIU_VERSION "2.0" diff --git a/src/lxc/initutils.c b/src/lxc/initutils.c index 5f2a42454..397e94692 100644 --- a/src/lxc/initutils.c +++ b/src/lxc/initutils.c @@ -20,7 +20,7 @@ #include "process_utils.h" #ifndef HAVE_STRLCPY -#include "include/strlcpy.h" +#include "strlcpy.h" #endif static char *copy_global_config_value(char *p) diff --git a/src/lxc/log.c b/src/lxc/log.c index be3a16fcc..9c5053ec9 100644 --- a/src/lxc/log.c +++ b/src/lxc/log.c @@ -27,7 +27,7 @@ #include "utils.h" #ifndef HAVE_STRLCPY -#include "include/strlcpy.h" +#include "strlcpy.h" #endif #if HAVE_DLOG diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c index 3b18d00ff..9ed50894b 100644 --- a/src/lxc/lxccontainer.c +++ b/src/lxc/lxccontainer.c @@ -25,7 +25,7 @@ #include #include -#include "../include/netns_ifaddrs.h" +#include "netns_ifaddrs.h" #include "af_unix.h" #include "api_extensions.h" #include "attach.h" diff --git a/src/lxc/monitor.c b/src/lxc/monitor.c index 26f1ec04b..1c1d7039a 100644 --- a/src/lxc/monitor.c +++ b/src/lxc/monitor.c @@ -33,7 +33,7 @@ #include "utils.h" #ifndef HAVE_STRLCPY -#include "include/strlcpy.h" +#include "strlcpy.h" #endif lxc_log_define(monitor, lxc); diff --git a/src/lxc/network.c b/src/lxc/network.c index 15ed81bd5..32963a0ea 100644 --- a/src/lxc/network.c +++ b/src/lxc/network.c @@ -26,7 +26,7 @@ #include #include -#include "../include/netns_ifaddrs.h" +#include "netns_ifaddrs.h" #include "af_unix.h" #include "conf.h" #include "config.h" @@ -42,7 +42,7 @@ #include "utils.h" #ifndef HAVE_STRLCPY -#include "include/strlcpy.h" +#include "strlcpy.h" #endif lxc_log_define(network, lxc); diff --git a/src/lxc/pam/pam_cgfs.c b/src/lxc/pam/pam_cgfs.c index 74d10a760..91efe5c80 100644 --- a/src/lxc/pam/pam_cgfs.c +++ b/src/lxc/pam/pam_cgfs.c @@ -34,11 +34,11 @@ #include #ifndef HAVE_STRLCPY -#include "include/strlcpy.h" +#include "strlcpy.h" #endif #ifndef HAVE_STRLCAT -#include "include/strlcat.h" +#include "strlcat.h" #endif #define pam_cgfs_debug_stream(stream, format, ...) \ diff --git a/src/lxc/rexec.c b/src/lxc/rexec.c index 060df680e..2d6345651 100644 --- a/src/lxc/rexec.c +++ b/src/lxc/rexec.c @@ -19,7 +19,7 @@ #include "syscall_wrappers.h" #if IS_BIONIC -#include "../include/fexecve.h" +#include "fexecve.h" #endif #define LXC_MEMFD_REXEC_SEALS \ diff --git a/src/lxc/start.c b/src/lxc/start.c index 7f0903f1b..a96aa27d8 100644 --- a/src/lxc/start.c +++ b/src/lxc/start.c @@ -63,7 +63,7 @@ #endif #ifndef HAVE_STRLCPY -#include "include/strlcpy.h" +#include "strlcpy.h" #endif lxc_log_define(start, lxc); diff --git a/src/lxc/storage/btrfs.c b/src/lxc/storage/btrfs.c index b115e10bb..22ba1484c 100644 --- a/src/lxc/storage/btrfs.c +++ b/src/lxc/storage/btrfs.c @@ -26,11 +26,11 @@ #include "utils.h" #ifndef HAVE_STRLCPY -#include "include/strlcpy.h" +#include "strlcpy.h" #endif #ifndef HAVE_STRLCAT -#include "include/strlcat.h" +#include "strlcat.h" #endif lxc_log_define(btrfs, lxc); diff --git a/src/lxc/storage/nbd.c b/src/lxc/storage/nbd.c index ba4207380..06515b833 100644 --- a/src/lxc/storage/nbd.c +++ b/src/lxc/storage/nbd.c @@ -22,7 +22,7 @@ #include "utils.h" #ifndef HAVE_STRLCPY -#include "include/strlcpy.h" +#include "strlcpy.h" #endif lxc_log_define(nbd, lxc); diff --git a/src/lxc/storage/rbd.c b/src/lxc/storage/rbd.c index 7a8a8b8be..f387ac21a 100644 --- a/src/lxc/storage/rbd.c +++ b/src/lxc/storage/rbd.c @@ -18,7 +18,7 @@ #include "utils.h" #ifndef HAVE_STRLCPY -#include "include/strlcpy.h" +#include "strlcpy.h" #endif lxc_log_define(rbd, lxc); diff --git a/src/lxc/storage/storage.c b/src/lxc/storage/storage.c index a8c4be5f3..e40ecee1f 100644 --- a/src/lxc/storage/storage.c +++ b/src/lxc/storage/storage.c @@ -43,7 +43,7 @@ #include "zfs.h" #ifndef HAVE_STRLCPY -#include "include/strlcpy.h" +#include "strlcpy.h" #endif #ifndef BLKGETSIZE64 diff --git a/src/lxc/storage/storage.h b/src/lxc/storage/storage.h index 91e08b7fc..0f14fd260 100644 --- a/src/lxc/storage/storage.h +++ b/src/lxc/storage/storage.h @@ -9,7 +9,7 @@ #include #if IS_BIONIC -#include <../include/lxcmntent.h> +#include "lxcmntent.h" #else #include #endif diff --git a/src/lxc/storage/storage_utils.c b/src/lxc/storage/storage_utils.c index 2839f0ce7..de82e4d41 100644 --- a/src/lxc/storage/storage_utils.c +++ b/src/lxc/storage/storage_utils.c @@ -31,7 +31,7 @@ #include "utils.h" #ifndef HAVE_STRLCPY -#include "include/strlcpy.h" +#include "strlcpy.h" #endif #ifndef BLKGETSIZE64 diff --git a/src/lxc/string_utils.c b/src/lxc/string_utils.c index b1d6dc9bc..372d660cb 100644 --- a/src/lxc/string_utils.c +++ b/src/lxc/string_utils.c @@ -35,11 +35,11 @@ #include "string_utils.h" #ifndef HAVE_STRLCPY -#include "include/strlcpy.h" +#include "strlcpy.h" #endif #ifndef HAVE_STRLCAT -#include "include/strlcat.h" +#include "strlcat.h" #endif char **lxc_va_arg_list_to_argv(va_list ap, size_t skip, int do_strdup) diff --git a/src/lxc/string_utils.h b/src/lxc/string_utils.h index ac916c6b6..2c1af4a88 100644 --- a/src/lxc/string_utils.h +++ b/src/lxc/string_utils.h @@ -11,15 +11,15 @@ #include "macro.h" #ifndef HAVE_STRLCAT -#include "include/strlcat.h" +#include "strlcat.h" #endif #ifndef HAVE_STRLCPY -#include "include/strlcpy.h" +#include "strlcpy.h" #endif #ifndef HAVE_STRCHRNUL -#include "include/strchrnul.h" +#include "strchrnul.h" #endif /* convert variadic argument lists to arrays (for execl type argument lists) */ diff --git a/src/lxc/terminal.c b/src/lxc/terminal.c index 7327893b3..543e947bb 100644 --- a/src/lxc/terminal.c +++ b/src/lxc/terminal.c @@ -32,7 +32,7 @@ #if HAVE_OPENPTY #include #else -#include <../include/openpty.h> +#include "openpty.h" #endif #define LXC_TERMINAL_BUFFER_SIZE 1024 diff --git a/src/lxc/tools/include/getsubopt.c b/src/lxc/tools/include/getsubopt.c index c01131a70..96d582ac0 100644 --- a/src/lxc/tools/include/getsubopt.c +++ b/src/lxc/tools/include/getsubopt.c @@ -7,7 +7,7 @@ #include "config.h" #ifndef HAVE_STRCHRNUL -#include "../../../include/strchrnul.h" +#include "strchrnul.h" #endif /* Parse comma separated suboption from *OPTIONP and match against diff --git a/src/lxc/tools/lxc_copy.c b/src/lxc/tools/lxc_copy.c index a786a300c..94b339f63 100644 --- a/src/lxc/tools/lxc_copy.c +++ b/src/lxc/tools/lxc_copy.c @@ -27,7 +27,7 @@ #include "utils.h" #ifndef HAVE_GETSUBOPT -#include "include/getsubopt.h" +#include "getsubopt.h" #endif lxc_log_define(lxc_copy, lxc); diff --git a/src/lxc/tools/lxc_device.c b/src/lxc/tools/lxc_device.c index c6641f45a..62d5ac86e 100644 --- a/src/lxc/tools/lxc_device.c +++ b/src/lxc/tools/lxc_device.c @@ -12,7 +12,7 @@ #include -#include "../../include/netns_ifaddrs.h" +#include "netns_ifaddrs.h" #include "arguments.h" #include "config.h" #include "log.h" diff --git a/src/lxc/utils.c b/src/lxc/utils.c index 55995405c..c2cfecf88 100644 --- a/src/lxc/utils.c +++ b/src/lxc/utils.c @@ -40,11 +40,11 @@ #include "utils.h" #ifndef HAVE_STRLCPY -#include "include/strlcpy.h" +#include "strlcpy.h" #endif #ifndef HAVE_STRLCAT -#include "include/strlcat.h" +#include "strlcat.h" #endif #ifndef O_PATH diff --git a/src/lxc/utils.h b/src/lxc/utils.h index 272e2dbef..51fb8874b 100644 --- a/src/lxc/utils.h +++ b/src/lxc/utils.h @@ -35,7 +35,7 @@ __hidden extern char *get_rundir(void); /* Define getline() if missing from the C library */ #ifndef HAVE_GETLINE #ifdef HAVE_FGETLN -#include <../include/getline.h> +#include "getline.h" #endif #endif diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am index ef8330efd..a64d61302 100644 --- a/src/tests/Makefile.am +++ b/src/tests/Makefile.am @@ -1288,6 +1288,7 @@ AM_CFLAGS += -DLXCROOTFSMOUNT=\"$(LXCROOTFSMOUNT)\" \ -DRUNTIME_PATH=\"$(RUNTIME_PATH)\" \ -DSBINDIR=\"$(SBINDIR)\" \ -I $(top_srcdir)/src \ + -I $(top_srcdir)/src/include \ -I $(top_srcdir)/src/lxc \ -I $(top_srcdir)/src/lxc/cgroups \ -I $(top_srcdir)/src/lxc/tools \ diff --git a/src/tests/api_reboot.c b/src/tests/api_reboot.c index 91ba9f656..bf051b8b5 100644 --- a/src/tests/api_reboot.c +++ b/src/tests/api_reboot.c @@ -32,7 +32,7 @@ #include "utils.h" #ifndef HAVE_STRLCPY -#include "include/strlcpy.h" +#include "strlcpy.h" #endif #define TSTNAME "lxc-api-reboot" diff --git a/src/tests/arch_parse.c b/src/tests/arch_parse.c index 47a2518da..95792ddd1 100644 --- a/src/tests/arch_parse.c +++ b/src/tests/arch_parse.c @@ -31,7 +31,7 @@ #include "../lxc/memory_utils.h" #ifndef HAVE_STRLCPY -#include "include/strlcpy.h" +#include "strlcpy.h" #endif static const char *const arches[] = { diff --git a/src/tests/attach.c b/src/tests/attach.c index 3e43c7b06..f4ff5efbb 100644 --- a/src/tests/attach.c +++ b/src/tests/attach.c @@ -33,7 +33,7 @@ #include #ifndef HAVE_STRLCPY -#include "include/strlcpy.h" +#include "strlcpy.h" #endif #define TSTNAME "lxc-attach-test" diff --git a/src/tests/cgpath.c b/src/tests/cgpath.c index b1e5ffc74..81b2162fe 100644 --- a/src/tests/cgpath.c +++ b/src/tests/cgpath.c @@ -36,7 +36,7 @@ #include "utils.h" #ifndef HAVE_STRLCPY -#include "include/strlcpy.h" +#include "strlcpy.h" #endif #define MYNAME "lxctest1" diff --git a/src/tests/device_add_remove.c b/src/tests/device_add_remove.c index dd5c5d3ec..a03f7d19a 100644 --- a/src/tests/device_add_remove.c +++ b/src/tests/device_add_remove.c @@ -25,7 +25,7 @@ #include "utils.h" #ifndef HAVE_STRLCPY -#include "include/strlcpy.h" +#include "strlcpy.h" #endif #define NAME "device_add_remove_test" diff --git a/src/tests/get_item.c b/src/tests/get_item.c index 111fc4af9..5ebe5508d 100644 --- a/src/tests/get_item.c +++ b/src/tests/get_item.c @@ -32,7 +32,7 @@ #include "utils.h" #ifndef HAVE_STRLCPY -#include "include/strlcpy.h" +#include "strlcpy.h" #endif #define MYNAME "lxctest1" diff --git a/src/tests/shortlived.c b/src/tests/shortlived.c index 5c3d27548..c66e97ede 100644 --- a/src/tests/shortlived.c +++ b/src/tests/shortlived.c @@ -32,7 +32,7 @@ #include "utils.h" #ifndef HAVE_STRLCPY -#include "include/strlcpy.h" +#include "strlcpy.h" #endif #define MYNAME "shortlived" -- 2.39.5