Skip to content

Commit

Permalink
uuid: hide unnecessary symbols
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Jul 21, 2020
1 parent 5f1b098 commit 78ad1eb
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 42 deletions.
75 changes: 50 additions & 25 deletions src/lxc/Makefile.am
Expand Up @@ -357,7 +357,8 @@ lxc_attach_SOURCES = tools/lxc_attach.c \
string_utils.c string_utils.h \
sync.c sync.h \
terminal.c terminal.h \
utils.c utils.h
utils.c utils.h \
uuid.c uuid.h
if ENABLE_SECCOMP
lxc_attach_SOURCES += seccomp.c lxcseccomp.h
endif
Expand Down Expand Up @@ -389,7 +390,8 @@ lxc_autostart_SOURCES = tools/lxc_autostart.c \
string_utils.c string_utils.h \
sync.c sync.h \
terminal.c terminal.h \
utils.c utils.h
utils.c utils.h \
uuid.c uuid.h
if ENABLE_SECCOMP
lxc_autostart_SOURCES += seccomp.c lxcseccomp.h
endif
Expand Down Expand Up @@ -421,7 +423,8 @@ lxc_cgroup_SOURCES = tools/lxc_cgroup.c \
string_utils.c string_utils.h \
sync.c sync.h \
terminal.c terminal.h \
utils.c utils.h
utils.c utils.h \
uuid.c uuid.h
if ENABLE_SECCOMP
lxc_cgroup_SOURCES += seccomp.c lxcseccomp.h
endif
Expand Down Expand Up @@ -453,7 +456,8 @@ lxc_config_SOURCES = tools/lxc_config.c \
string_utils.c string_utils.h \
sync.c sync.h \
terminal.c terminal.h \
utils.c utils.h
utils.c utils.h \
uuid.c uuid.h
if ENABLE_SECCOMP
lxc_config_SOURCES += seccomp.c lxcseccomp.h
endif
Expand Down Expand Up @@ -485,7 +489,8 @@ lxc_console_SOURCES = tools/lxc_console.c \
string_utils.c string_utils.h \
sync.c sync.h \
terminal.c terminal.h \
utils.c utils.h
utils.c utils.h \
uuid.c uuid.h
if ENABLE_SECCOMP
lxc_console_SOURCES += seccomp.c lxcseccomp.h
endif
Expand Down Expand Up @@ -517,7 +522,8 @@ lxc_destroy_SOURCES = tools/lxc_destroy.c \
string_utils.c string_utils.h \
sync.c sync.h \
terminal.c terminal.h \
utils.c utils.h
utils.c utils.h \
uuid.c uuid.h
if ENABLE_SECCOMP
lxc_destroy_SOURCES += seccomp.c lxcseccomp.h
endif
Expand Down Expand Up @@ -549,7 +555,8 @@ lxc_device_SOURCES = tools/lxc_device.c \
string_utils.c string_utils.h \
sync.c sync.h \
terminal.c terminal.h \
utils.c utils.h
utils.c utils.h \
uuid.c uuid.h
if ENABLE_SECCOMP
lxc_device_SOURCES += seccomp.c lxcseccomp.h
endif
Expand Down Expand Up @@ -581,7 +588,8 @@ lxc_execute_SOURCES = tools/lxc_execute.c \
string_utils.c string_utils.h \
sync.c sync.h \
terminal.c terminal.h \
utils.c utils.h
utils.c utils.h \
uuid.c uuid.h
if ENABLE_SECCOMP
lxc_execute_SOURCES += seccomp.c lxcseccomp.h
endif
Expand Down Expand Up @@ -613,7 +621,8 @@ lxc_freeze_SOURCES = tools/lxc_freeze.c \
string_utils.c string_utils.h \
sync.c sync.h \
terminal.c terminal.h \
utils.c utils.h
utils.c utils.h \
uuid.c uuid.h
if ENABLE_SECCOMP
lxc_freeze_SOURCES += seccomp.c lxcseccomp.h
endif
Expand Down Expand Up @@ -645,7 +654,8 @@ lxc_info_SOURCES = tools/lxc_info.c \
string_utils.c string_utils.h \
sync.c sync.h \
terminal.c terminal.h \
utils.c utils.h
utils.c utils.h \
uuid.c uuid.h
if ENABLE_SECCOMP
lxc_info_SOURCES += seccomp.c lxcseccomp.h
endif
Expand Down Expand Up @@ -678,7 +688,8 @@ lxc_monitor_SOURCES = tools/lxc_monitor.c \
string_utils.c string_utils.h \
sync.c sync.h \
terminal.c terminal.h \
utils.c utils.h
utils.c utils.h \
uuid.c uuid.h
if ENABLE_SECCOMP
lxc_monitor_SOURCES += seccomp.c lxcseccomp.h
endif
Expand Down Expand Up @@ -711,7 +722,8 @@ lxc_ls_SOURCES = tools/lxc_ls.c \
string_utils.c string_utils.h \
sync.c sync.h \
terminal.c terminal.h \
utils.c utils.h
utils.c utils.h \
uuid.c uuid.h
if ENABLE_SECCOMP
lxc_ls_SOURCES += seccomp.c lxcseccomp.h
endif
Expand Down Expand Up @@ -744,7 +756,8 @@ lxc_copy_SOURCES = tools/lxc_copy.c \
string_utils.c string_utils.h \
sync.c sync.h \
terminal.c terminal.h \
utils.c utils.h
utils.c utils.h \
uuid.c uuid.h
if ENABLE_SECCOMP
lxc_copy_SOURCES += seccomp.c lxcseccomp.h
endif
Expand Down Expand Up @@ -776,7 +789,8 @@ lxc_start_SOURCES = tools/lxc_start.c \
string_utils.c string_utils.h \
sync.c sync.h \
terminal.c terminal.h \
utils.c utils.h
utils.c utils.h \
uuid.c uuid.h
if ENABLE_SECCOMP
lxc_start_SOURCES += seccomp.c lxcseccomp.h
endif
Expand Down Expand Up @@ -808,7 +822,8 @@ lxc_stop_SOURCES = tools/lxc_stop.c \
string_utils.c string_utils.h \
sync.c sync.h \
terminal.c terminal.h \
utils.c utils.h
utils.c utils.h \
uuid.c uuid.h
if ENABLE_SECCOMP
lxc_stop_SOURCES += seccomp.c lxcseccomp.h
endif
Expand Down Expand Up @@ -840,7 +855,8 @@ lxc_top_SOURCES = tools/lxc_top.c \
string_utils.c string_utils.h \
sync.c sync.h \
terminal.c terminal.h \
utils.c utils.h
utils.c utils.h \
uuid.c uuid.h
if ENABLE_SECCOMP
lxc_top_SOURCES += seccomp.c lxcseccomp.h
endif
Expand Down Expand Up @@ -872,7 +888,8 @@ lxc_unfreeze_SOURCES = tools/lxc_unfreeze.c \
string_utils.c string_utils.h \
sync.c sync.h \
terminal.c terminal.h \
utils.c utils.h
utils.c utils.h \
uuid.c uuid.h
if ENABLE_SECCOMP
lxc_unfreeze_SOURCES += seccomp.c lxcseccomp.h
endif
Expand Down Expand Up @@ -906,7 +923,8 @@ lxc_unshare_SOURCES = tools/lxc_unshare.c \
syscall_numbers.h \
syscall_wrappers.h \
terminal.c terminal.h \
utils.c utils.h
utils.c utils.h \
uuid.c uuid.h
if ENABLE_SECCOMP
lxc_unshare_SOURCES += seccomp.c lxcseccomp.h
endif
Expand Down Expand Up @@ -938,7 +956,8 @@ lxc_wait_SOURCES = tools/lxc_wait.c \
string_utils.c string_utils.h \
sync.c sync.h \
terminal.c terminal.h \
utils.c utils.h
utils.c utils.h \
uuid.c uuid.h
if ENABLE_SECCOMP
lxc_wait_SOURCES += seccomp.c lxcseccomp.h
endif
Expand Down Expand Up @@ -971,7 +990,8 @@ lxc_create_SOURCES = tools/lxc_create.c \
string_utils.c string_utils.h \
sync.c sync.h \
terminal.c terminal.h \
utils.c utils.h
utils.c utils.h \
uuid.c uuid.h
if ENABLE_SECCOMP
lxc_create_SOURCES += seccomp.c lxcseccomp.h
endif
Expand Down Expand Up @@ -1003,7 +1023,8 @@ lxc_snapshot_SOURCES = tools/lxc_snapshot.c \
string_utils.c string_utils.h \
sync.c sync.h \
terminal.c terminal.h \
utils.c utils.h
utils.c utils.h \
uuid.c uuid.h
if ENABLE_SECCOMP
lxc_snapshot_SOURCES += seccomp.c lxcseccomp.h
endif
Expand Down Expand Up @@ -1035,7 +1056,8 @@ lxc_checkpoint_SOURCES = tools/lxc_checkpoint.c \
string_utils.c string_utils.h \
sync.c sync.h \
terminal.c terminal.h \
utils.c utils.h
utils.c utils.h \
uuid.c uuid.h
if ENABLE_SECCOMP
lxc_checkpoint_SOURCES += seccomp.c lxcseccomp.h
endif
Expand Down Expand Up @@ -1090,7 +1112,8 @@ lxc_monitord_SOURCES = cmd/lxc_monitord.c \
sync.c sync.h \
syscall_numbers.h \
terminal.c terminal.h \
utils.c utils.h
utils.c utils.h \
uuid.c uuid.h
if ENABLE_SECCOMP
lxc_monitord_SOURCES += seccomp.c lxcseccomp.h
endif
Expand Down Expand Up @@ -1125,7 +1148,8 @@ lxc_user_nic_SOURCES = cmd/lxc_user_nic.c \
syscall_numbers.h \
syscall_wrappers.h \
terminal.c terminal.h \
utils.c utils.h
utils.c utils.h \
uuid.c uuid.h
if ENABLE_SECCOMP
lxc_user_nic_SOURCES += seccomp.c lxcseccomp.h
endif
Expand Down Expand Up @@ -1160,7 +1184,8 @@ lxc_usernsexec_SOURCES = cmd/lxc_usernsexec.c \
sync.c sync.h \
syscall_wrappers.h \
terminal.c terminal.h \
utils.c utils.h
utils.c utils.h \
uuid.c uuid.h
if ENABLE_SECCOMP
lxc_usernsexec_SOURCES += seccomp.c lxcseccomp.h
endif
Expand Down
18 changes: 10 additions & 8 deletions src/lxc/uuid.h
Expand Up @@ -9,16 +9,18 @@
#define __STDC_FORMAT_MACROS
#include <inttypes.h>

#include "compiler.h"

typedef union lxc_id128 lxc_id128_t;

union lxc_id128 {
uint8_t bytes[16];
uint64_t qwords[2];
}
;
extern int lxc_id128_randomize(lxc_id128_t *ret);
extern int lxc_id128_write(const char *p, lxc_id128_t id);
extern int lxc_id128_write_fd(int fd, lxc_id128_t id);
extern char *id128_to_uuid_string(lxc_id128_t id, char s[37]);
uint8_t bytes[16];
uint64_t qwords[2];
};

__hidden extern int lxc_id128_randomize(lxc_id128_t *ret);
__hidden extern int lxc_id128_write(const char *p, lxc_id128_t id);
__hidden extern int lxc_id128_write_fd(int fd, lxc_id128_t id);
__hidden extern char *id128_to_uuid_string(lxc_id128_t id, char s[37]);

#endif /* __LXC_UUID_H */
27 changes: 18 additions & 9 deletions src/tests/Makefile.am
Expand Up @@ -33,7 +33,8 @@ lxc_test_api_reboot_SOURCES = api_reboot.c \
../lxc/sync.c ../lxc/sync.h \
../lxc/string_utils.c ../lxc/string_utils.h \
../lxc/terminal.c ../lxc/terminal.h \
../lxc/utils.c ../lxc/utils.h
../lxc/utils.c ../lxc/utils.h \
../lxc/uuid.c ../lxc/uuid.h
if ENABLE_SECCOMP
lxc_test_api_reboot_SOURCES += ../lxc/seccomp.c ../lxc/lxcseccomp.h
endif
Expand Down Expand Up @@ -64,7 +65,8 @@ lxc_test_apparmor_SOURCES = aa.c \
../lxc/sync.c ../lxc/sync.h \
../lxc/string_utils.c ../lxc/string_utils.h \
../lxc/terminal.c ../lxc/terminal.h \
../lxc/utils.c ../lxc/utils.h
../lxc/utils.c ../lxc/utils.h \
../lxc/uuid.c ../lxc/uuid.h
if ENABLE_SECCOMP
lxc_test_apparmor_SOURCES += ../lxc/seccomp.c ../lxc/lxcseccomp.h
endif
Expand Down Expand Up @@ -95,7 +97,8 @@ lxc_test_attach_SOURCES = attach.c \
../lxc/sync.c ../lxc/sync.h \
../lxc/string_utils.c ../lxc/string_utils.h \
../lxc/terminal.c ../lxc/terminal.h \
../lxc/utils.c ../lxc/utils.h
../lxc/utils.c ../lxc/utils.h \
../lxc/uuid.c ../lxc/uuid.h
if ENABLE_SECCOMP
lxc_test_attach_SOURCES += ../lxc/seccomp.c ../lxc/lxcseccomp.h
endif
Expand Down Expand Up @@ -127,7 +130,8 @@ lxc_test_cgpath_SOURCES = cgpath.c \
../lxc/sync.c ../lxc/sync.h \
../lxc/string_utils.c ../lxc/string_utils.h \
../lxc/terminal.c ../lxc/terminal.h \
../lxc/utils.c ../lxc/utils.h
../lxc/utils.c ../lxc/utils.h \
../lxc/uuid.c ../lxc/uuid.h
if ENABLE_SECCOMP
lxc_test_cgpath_SOURCES += ../lxc/seccomp.c ../lxc/lxcseccomp.h
endif
Expand Down Expand Up @@ -161,7 +165,8 @@ lxc_test_config_jump_table_SOURCES = config_jump_table.c \
../lxc/sync.c ../lxc/sync.h \
../lxc/string_utils.c ../lxc/string_utils.h \
../lxc/terminal.c ../lxc/terminal.h \
../lxc/utils.c ../lxc/utils.h
../lxc/utils.c ../lxc/utils.h \
../lxc/uuid.c ../lxc/uuid.h
if ENABLE_SECCOMP
lxc_test_config_jump_table_SOURCES += ../lxc/seccomp.c ../lxc/lxcseccomp.h
endif
Expand Down Expand Up @@ -203,7 +208,8 @@ lxc_test_locktests_SOURCES = locktests.c \
../lxc/sync.c ../lxc/sync.h \
../lxc/string_utils.c ../lxc/string_utils.h \
../lxc/terminal.c ../lxc/terminal.h \
../lxc/utils.c ../lxc/utils.h
../lxc/utils.c ../lxc/utils.h \
../lxc/uuid.c ../lxc/uuid.h
if ENABLE_SECCOMP
lxc_test_locktests_SOURCES += ../lxc/seccomp.c ../lxc/lxcseccomp.h
endif
Expand Down Expand Up @@ -237,7 +243,8 @@ lxc_test_mount_injection_SOURCES = mount_injection.c \
../lxc/sync.c ../lxc/sync.h \
../lxc/string_utils.c ../lxc/string_utils.h \
../lxc/terminal.c ../lxc/terminal.h \
../lxc/utils.c ../lxc/utils.h
../lxc/utils.c ../lxc/utils.h \
../lxc/uuid.c ../lxc/uuid.h
if ENABLE_SECCOMP
lxc_test_mount_injection_SOURCES += ../lxc/seccomp.c ../lxc/lxcseccomp.h
endif
Expand Down Expand Up @@ -269,7 +276,8 @@ lxc_test_parse_config_file_SOURCES = parse_config_file.c \
../lxc/sync.c ../lxc/sync.h \
../lxc/string_utils.c ../lxc/string_utils.h \
../lxc/terminal.c ../lxc/terminal.h \
../lxc/utils.c ../lxc/utils.h
../lxc/utils.c ../lxc/utils.h \
../lxc/uuid.c ../lxc/uuid.h
if ENABLE_SECCOMP
lxc_test_parse_config_file_SOURCES += ../lxc/seccomp.c ../lxc/lxcseccomp.h
endif
Expand Down Expand Up @@ -324,7 +332,8 @@ lxc_test_utils_SOURCES = lxc-test-utils.c \
../lxc/sync.c ../lxc/sync.h \
../lxc/string_utils.c ../lxc/string_utils.h \
../lxc/terminal.c ../lxc/terminal.h \
../lxc/utils.c ../lxc/utils.h
../lxc/utils.c ../lxc/utils.h \
../lxc/uuid.c ../lxc/uuid.h
if ENABLE_SECCOMP
lxc_test_utils_SOURCES += ../lxc/seccomp.c ../lxc/lxcseccomp.h
endif
Expand Down

0 comments on commit 78ad1eb

Please sign in to comment.