From 9e20bf04e03d48fa516cd1000c527f87b9a4e67e Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Mon, 20 Jul 2020 18:11:02 +0200 Subject: [PATCH] namespace: hide unnecessary symbols Signed-off-by: Christian Brauner --- src/lxc/Makefile.am | 25 +++++++++++++++++++++++++ src/lxc/namespace.h | 14 ++++++++------ src/tests/Makefile.am | 6 ++++++ 3 files changed, 39 insertions(+), 6 deletions(-) diff --git a/src/lxc/Makefile.am b/src/lxc/Makefile.am index b4cc216a3..84c13eefd 100644 --- a/src/lxc/Makefile.am +++ b/src/lxc/Makefile.am @@ -339,6 +339,7 @@ lxc_attach_SOURCES = tools/lxc_attach.c \ file_utils.c file_utils.h \ initutils.c initutils.h \ log.c log.h \ + namespace.c namespace.h \ rexec.c rexec.h \ string_utils.c string_utils.h if ENABLE_SECCOMP @@ -355,6 +356,7 @@ lxc_autostart_SOURCES = tools/lxc_autostart.c \ file_utils.c file_utils.h \ initutils.c initutils.h \ log.c log.h \ + namespace.c namespace.h \ string_utils.c string_utils.h if ENABLE_SECCOMP lxc_autostart_SOURCES += seccomp.c lxcseccomp.h @@ -370,6 +372,7 @@ lxc_cgroup_SOURCES = tools/lxc_cgroup.c \ file_utils.c file_utils.h \ initutils.c initutils.h \ log.c log.h \ + namespace.c namespace.h \ string_utils.c string_utils.h if ENABLE_SECCOMP lxc_cgroup_SOURCES += seccomp.c lxcseccomp.h @@ -385,6 +388,7 @@ lxc_config_SOURCES = tools/lxc_config.c \ file_utils.c file_utils.h \ initutils.c initutils.h \ log.c log.h \ + namespace.c namespace.h \ string_utils.c string_utils.h if ENABLE_SECCOMP lxc_config_SOURCES += seccomp.c lxcseccomp.h @@ -400,6 +404,7 @@ lxc_console_SOURCES = tools/lxc_console.c \ file_utils.c file_utils.h \ initutils.c initutils.h \ log.c log.h \ + namespace.c namespace.h \ string_utils.c string_utils.h if ENABLE_SECCOMP lxc_console_SOURCES += seccomp.c lxcseccomp.h @@ -415,6 +420,7 @@ lxc_destroy_SOURCES = tools/lxc_destroy.c \ file_utils.c file_utils.h \ initutils.c initutils.h \ log.c log.h \ + namespace.c namespace.h \ string_utils.c string_utils.h if ENABLE_SECCOMP lxc_destroy_SOURCES += seccomp.c lxcseccomp.h @@ -430,6 +436,7 @@ lxc_device_SOURCES = tools/lxc_device.c \ file_utils.c file_utils.h \ initutils.c initutils.h \ log.c log.h \ + namespace.c namespace.h \ string_utils.c string_utils.h if ENABLE_SECCOMP lxc_device_SOURCES += seccomp.c lxcseccomp.h @@ -445,6 +452,7 @@ lxc_execute_SOURCES = tools/lxc_execute.c \ file_utils.c file_utils.h \ initutils.c initutils.h \ log.c log.h \ + namespace.c namespace.h \ string_utils.c string_utils.h if ENABLE_SECCOMP lxc_execute_SOURCES += seccomp.c lxcseccomp.h @@ -460,6 +468,7 @@ lxc_freeze_SOURCES = tools/lxc_freeze.c \ file_utils.c file_utils.h \ initutils.c initutils.h \ log.c log.h \ + namespace.c namespace.h \ string_utils.c string_utils.h if ENABLE_SECCOMP lxc_freeze_SOURCES += seccomp.c lxcseccomp.h @@ -475,6 +484,7 @@ lxc_info_SOURCES = tools/lxc_info.c \ file_utils.c file_utils.h \ initutils.c initutils.h \ log.c log.h \ + namespace.c namespace.h \ string_utils.c string_utils.h if ENABLE_SECCOMP lxc_info_SOURCES += seccomp.c lxcseccomp.h @@ -492,6 +502,7 @@ lxc_monitor_SOURCES = tools/lxc_monitor.c \ log.c log.h \ macro.h \ monitor.c monitor.h \ + namespace.c namespace.h \ string_utils.c string_utils.h if ENABLE_SECCOMP lxc_monitor_SOURCES += seccomp.c lxcseccomp.h @@ -508,6 +519,7 @@ lxc_ls_SOURCES = tools/lxc_ls.c \ initutils.c initutils.h \ log.c log.h \ memory_utils.h \ + namespace.c namespace.h \ string_utils.c string_utils.h if ENABLE_SECCOMP lxc_ls_SOURCES += seccomp.c lxcseccomp.h @@ -523,6 +535,7 @@ lxc_copy_SOURCES = tools/lxc_copy.c \ file_utils.c file_utils.h \ initutils.c initutils.h \ log.c log.h \ + namespace.c namespace.h \ storage/storage_utils.c storage/storage_utils.h \ string_utils.c string_utils.h if ENABLE_SECCOMP @@ -539,6 +552,7 @@ lxc_start_SOURCES = tools/lxc_start.c \ file_utils.c file_utils.h \ initutils.c initutils.h \ log.c log.h \ + namespace.c namespace.h \ string_utils.c string_utils.h if ENABLE_SECCOMP lxc_start_SOURCES += seccomp.c lxcseccomp.h @@ -555,6 +569,7 @@ lxc_stop_SOURCES = tools/lxc_stop.c \ initutils.c initutils.h \ log.c log.h \ mainloop.c mainloop.h \ + namespace.c namespace.h \ string_utils.c string_utils.h if ENABLE_SECCOMP lxc_stop_SOURCES += seccomp.c lxcseccomp.h @@ -571,6 +586,7 @@ lxc_top_SOURCES = tools/lxc_top.c \ initutils.c initutils.h \ log.c log.h \ mainloop.c mainloop.h \ + namespace.c namespace.h \ string_utils.c string_utils.h if ENABLE_SECCOMP lxc_top_SOURCES += seccomp.c lxcseccomp.h @@ -586,6 +602,7 @@ lxc_unfreeze_SOURCES = tools/lxc_unfreeze.c \ file_utils.c file_utils.h \ initutils.c initutils.h \ log.c log.h \ + namespace.c namespace.h \ string_utils.c string_utils.h if ENABLE_SECCOMP lxc_unfreeze_SOURCES += seccomp.c lxcseccomp.h @@ -601,6 +618,7 @@ lxc_unshare_SOURCES = tools/lxc_unshare.c \ file_utils.c file_utils.h \ initutils.c initutils.h \ log.c log.h \ + namespace.c namespace.h \ string_utils.c string_utils.h \ syscall_numbers.h \ syscall_wrappers.h @@ -618,6 +636,7 @@ lxc_wait_SOURCES = tools/lxc_wait.c \ file_utils.c file_utils.h \ initutils.c initutils.h \ log.c log.h \ + namespace.c namespace.h \ string_utils.c string_utils.h if ENABLE_SECCOMP lxc_wait_SOURCES += seccomp.c lxcseccomp.h @@ -633,6 +652,7 @@ lxc_create_SOURCES = tools/lxc_create.c \ file_utils.c file_utils.h \ initutils.c initutils.h \ log.c log.h \ + namespace.c namespace.h \ storage/storage_utils.c storage/storage_utils.h \ string_utils.c string_utils.h if ENABLE_SECCOMP @@ -649,6 +669,7 @@ lxc_snapshot_SOURCES = tools/lxc_snapshot.c \ file_utils.c file_utils.h \ initutils.c initutils.h \ log.c log.h \ + namespace.c namespace.h \ string_utils.c string_utils.h if ENABLE_SECCOMP lxc_snapshot_SOURCES += seccomp.c lxcseccomp.h @@ -664,6 +685,7 @@ lxc_checkpoint_SOURCES = tools/lxc_checkpoint.c \ file_utils.c file_utils.h \ initutils.c initutils.h \ log.c log.h \ + namespace.c namespace.h \ string_utils.c string_utils.h if ENABLE_SECCOMP lxc_checkpoint_SOURCES += seccomp.c lxcseccomp.h @@ -702,6 +724,7 @@ lxc_monitord_SOURCES = cmd/lxc_monitord.c \ log.c log.h \ mainloop.c mainloop.h \ monitor.c monitor.h \ + namespace.c namespace.h \ process_utils.c process_utils.h \ string_utils.c string_utils.h \ syscall_numbers.h \ @@ -721,6 +744,7 @@ lxc_user_nic_SOURCES = cmd/lxc_user_nic.c \ initutils.c initutils.h \ log.c log.h \ memory_utils.h \ + namespace.c namespace.h \ network.c network.h \ nl.c nl.h \ parse.c parse.h \ @@ -744,6 +768,7 @@ lxc_usernsexec_SOURCES = cmd/lxc_usernsexec.c \ log.c log.h \ macro.h \ memory_utils.h \ + namespace.c namespace.h \ string_utils.c string_utils.h \ syscall_wrappers.h \ utils.c utils.h diff --git a/src/lxc/namespace.h b/src/lxc/namespace.h index 59b26fa60..4e3fc3dfc 100644 --- a/src/lxc/namespace.h +++ b/src/lxc/namespace.h @@ -7,6 +7,8 @@ #include #include +#include "compiler.h" + enum { LXC_NS_USER, LXC_NS_MNT, @@ -19,16 +21,16 @@ enum { LXC_NS_MAX }; -extern const struct ns_info { +__hidden extern const struct ns_info { const char *proc_name; int clone_flag; const char *flag_name; const char *env_name; } ns_info[LXC_NS_MAX]; -extern int lxc_namespace_2_cloneflag(const char *namespace); -extern int lxc_namespace_2_ns_idx(const char *namespace); -extern int lxc_namespace_2_std_identifiers(char *namespaces); -extern int lxc_fill_namespace_flags(char *flaglist, int *flags); +__hidden extern int lxc_namespace_2_cloneflag(const char *namespace); +__hidden extern int lxc_namespace_2_ns_idx(const char *namespace); +__hidden extern int lxc_namespace_2_std_identifiers(char *namespaces); +__hidden extern int lxc_fill_namespace_flags(char *flaglist, int *flags); -#endif +#endif /* __LXC_NAMESPACE_H */ diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am index b660e0a0d..7c26aa0e1 100644 --- a/src/tests/Makefile.am +++ b/src/tests/Makefile.am @@ -19,6 +19,7 @@ lxc_test_api_reboot_SOURCES = api_reboot.c \ ../lxc/initutils.c ../lxc/initutils.h \ ../lxc/log.c ../lxc/log.h \ ../lxc/mainloop.c ../lxc/mainloop.h \ + ../lxc/namespace.c ../lxc/namespace.h \ ../lxc/network.c ../lxc/network.h \ ../lxc/nl.c ../lxc/nl.h \ ../lxc/string_utils.c ../lxc/string_utils.h @@ -39,6 +40,7 @@ lxc_test_attach_SOURCES = attach.c \ ../lxc/initutils.c ../lxc/initutils.h \ ../lxc/log.c ../lxc/log.h \ ../lxc/mainloop.c ../lxc/mainloop.h \ + ../lxc/namespace.c ../lxc/namespace.h \ ../lxc/network.c ../lxc/network.h \ ../lxc/nl.c ../lxc/nl.h \ ../lxc/string_utils.c ../lxc/string_utils.h @@ -59,6 +61,7 @@ lxc_test_cgpath_SOURCES = cgpath.c \ ../lxc/initutils.c ../lxc/initutils.h \ ../lxc/log.c ../lxc/log.h \ ../lxc/mainloop.c ../lxc/mainloop.h \ + ../lxc/namespace.c ../lxc/namespace.h \ ../lxc/network.c ../lxc/network.h \ ../lxc/nl.c ../lxc/nl.h \ ../lxc/string_utils.c ../lxc/string_utils.h @@ -81,6 +84,7 @@ lxc_test_config_jump_table_SOURCES = config_jump_table.c \ ../lxc/initutils.c ../lxc/initutils.h \ ../lxc/log.c ../lxc/log.h \ ../lxc/mainloop.c ../lxc/mainloop.h \ + ../lxc/namespace.c ../lxc/namespace.h \ ../lxc/network.c ../lxc/network.h \ ../lxc/nl.c ../lxc/nl.h \ ../lxc/string_utils.c ../lxc/string_utils.h @@ -121,6 +125,7 @@ lxc_test_parse_config_file_SOURCES = parse_config_file.c \ ../lxc/file_utils.c ../lxc/file_utils.h \ ../lxc/initutils.c ../lxc/initutils.h \ ../lxc/log.c ../lxc/log.h \ + ../lxc/namespace.c ../lxc/namespace.h \ ../lxc/network.c ../lxc/network.h \ ../lxc/nl.c ../lxc/nl.h \ ../lxc/string_utils.c ../lxc/string_utils.h @@ -164,6 +169,7 @@ lxc_test_utils_SOURCES = lxc-test-utils.c \ ../lxc/initutils.c ../lxc/initutils.h \ ../lxc/log.c ../lxc/log.h \ ../lxc/mainloop.c ../lxc/mainloop.h \ + ../lxc/namespace.c ../lxc/namespace.h \ ../lxc/network.c ../lxc/network.h \ ../lxc/nl.c ../lxc/nl.h \ ../lxc/string_utils.c ../lxc/string_utils.h -- 2.47.2