]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
file_utils: hide unnecessary symbols
authorChristian Brauner <christian.brauner@ubuntu.com>
Mon, 20 Jul 2020 14:21:38 +0000 (16:21 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Mon, 20 Jul 2020 14:31:53 +0000 (16:31 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/Makefile.am
src/lxc/file_utils.h
src/tests/Makefile.am

index d1a4498cda764c34172b2f9d57e0a9db3fab03b8..0cb3be168091febb78b6aa4de154fd43d81ab95d 100644 (file)
@@ -336,6 +336,7 @@ lxc_attach_SOURCES = tools/lxc_attach.c \
                     conf.c conf.h \
                     confile.c confile.h \
                     confile_utils.c confile_utils.h \
+                    file_utils.c file_utils.h \
                     rexec.c rexec.h \
                     string_utils.c string_utils.h
 lxc_autostart_SOURCES = tools/lxc_autostart.c \
@@ -345,6 +346,7 @@ lxc_autostart_SOURCES = tools/lxc_autostart.c \
                        conf.c conf.h \
                        confile.c confile.h \
                        confile_utils.c confile_utils.h \
+                       file_utils.c file_utils.h \
                        string_utils.c string_utils.h
 lxc_cgroup_SOURCES = tools/lxc_cgroup.c \
                     tools/arguments.c tools/arguments.h \
@@ -353,6 +355,7 @@ lxc_cgroup_SOURCES = tools/lxc_cgroup.c \
                     conf.c conf.h \
                     confile.c confile.h \
                     confile_utils.c confile_utils.h \
+                    file_utils.c file_utils.h \
                     string_utils.c string_utils.h
 lxc_config_SOURCES = tools/lxc_config.c \
                     tools/arguments.c tools/arguments.h \
@@ -361,6 +364,7 @@ lxc_config_SOURCES = tools/lxc_config.c \
                     conf.c conf.h \
                     confile.c confile.h \
                     confile_utils.c confile_utils.h \
+                    file_utils.c file_utils.h \
                     string_utils.c string_utils.h
 lxc_console_SOURCES = tools/lxc_console.c \
                      tools/arguments.c tools/arguments.h \
@@ -369,6 +373,7 @@ lxc_console_SOURCES = tools/lxc_console.c \
                      conf.c conf.h \
                      confile.c confile.h \
                      confile_utils.c confile_utils.h \
+                     file_utils.c file_utils.h \
                      string_utils.c string_utils.h
 lxc_destroy_SOURCES = tools/lxc_destroy.c \
                      tools/arguments.c tools/arguments.h \
@@ -377,6 +382,7 @@ lxc_destroy_SOURCES = tools/lxc_destroy.c \
                      conf.c conf.h \
                      confile.c confile.h \
                      confile_utils.c confile_utils.h \
+                     file_utils.c file_utils.h \
                      string_utils.c string_utils.h
 lxc_device_SOURCES = tools/lxc_device.c \
                     tools/arguments.c tools/arguments.h \
@@ -385,6 +391,7 @@ lxc_device_SOURCES = tools/lxc_device.c \
                     conf.c conf.h \
                     confile.c confile.h \
                     confile_utils.c confile_utils.h \
+                    file_utils.c file_utils.h \
                     string_utils.c string_utils.h
 lxc_execute_SOURCES = tools/lxc_execute.c \
                      tools/arguments.c tools/arguments.h \
@@ -393,6 +400,7 @@ lxc_execute_SOURCES = tools/lxc_execute.c \
                      conf.c conf.h \
                      confile.c confile.h \
                      confile_utils.c confile_utils.h \
+                     file_utils.c file_utils.h \
                      string_utils.c string_utils.h
 lxc_freeze_SOURCES = tools/lxc_freeze.c \
                     tools/arguments.c tools/arguments.h \
@@ -401,6 +409,7 @@ lxc_freeze_SOURCES = tools/lxc_freeze.c \
                     conf.c conf.h \
                     confile.c confile.h \
                     confile_utils.c confile_utils.h \
+                    file_utils.c file_utils.h \
                     string_utils.c string_utils.h
 lxc_info_SOURCES = tools/lxc_info.c \
                   tools/arguments.c tools/arguments.h \
@@ -409,6 +418,7 @@ lxc_info_SOURCES = tools/lxc_info.c \
                   conf.c conf.h \
                   confile.c confile.h \
                   confile_utils.c confile_utils.h \
+                  file_utils.c file_utils.h \
                   string_utils.c string_utils.h
 lxc_monitor_SOURCES = tools/lxc_monitor.c \
                      tools/arguments.c tools/arguments.h \
@@ -417,6 +427,7 @@ lxc_monitor_SOURCES = tools/lxc_monitor.c \
                      conf.c conf.h \
                      confile.c confile.h \
                      confile_utils.c confile_utils.h \
+                     file_utils.c file_utils.h \
                      macro.h \
                      string_utils.c string_utils.h
 lxc_ls_SOURCES = tools/lxc_ls.c \
@@ -426,6 +437,7 @@ lxc_ls_SOURCES = tools/lxc_ls.c \
                 conf.c conf.h \
                 confile.c confile.h \
                 confile_utils.c confile_utils.h \
+                file_utils.c file_utils.h \
                 memory_utils.h \
                 string_utils.c string_utils.h
 lxc_copy_SOURCES = tools/lxc_copy.c \
@@ -435,6 +447,7 @@ lxc_copy_SOURCES = tools/lxc_copy.c \
                   conf.c conf.h \
                   confile.c confile.h \
                   confile_utils.c confile_utils.h \
+                  file_utils.c file_utils.h \
                   storage/storage_utils.c storage/storage_utils.h \
                   string_utils.c string_utils.h
 lxc_start_SOURCES = tools/lxc_start.c \
@@ -444,6 +457,7 @@ lxc_start_SOURCES = tools/lxc_start.c \
                    conf.c conf.h \
                    confile.c confile.h \
                    confile_utils.c confile_utils.h \
+                   file_utils.c file_utils.h \
                    string_utils.c string_utils.h
 lxc_stop_SOURCES = tools/lxc_stop.c \
                   tools/arguments.c tools/arguments.h \
@@ -452,6 +466,7 @@ lxc_stop_SOURCES = tools/lxc_stop.c \
                   conf.c conf.h \
                   confile.c confile.h \
                   confile_utils.c confile_utils.h \
+                  file_utils.c file_utils.h \
                   string_utils.c string_utils.h
 lxc_top_SOURCES = tools/lxc_top.c \
                  tools/arguments.c tools/arguments.h \
@@ -460,6 +475,7 @@ lxc_top_SOURCES = tools/lxc_top.c \
                  conf.c conf.h \
                  confile.c confile.h \
                  confile_utils.c confile_utils.h \
+                 file_utils.c file_utils.h \
                  string_utils.c string_utils.h
 lxc_unfreeze_SOURCES = tools/lxc_unfreeze.c \
                       tools/arguments.c tools/arguments.h \
@@ -468,6 +484,7 @@ lxc_unfreeze_SOURCES = tools/lxc_unfreeze.c \
                       conf.c conf.h \
                       confile.c confile.h \
                       confile_utils.c confile_utils.h \
+                      file_utils.c file_utils.h \
                       string_utils.c string_utils.h
 lxc_unshare_SOURCES = tools/lxc_unshare.c \
                      tools/arguments.c tools/arguments.h \
@@ -476,6 +493,7 @@ lxc_unshare_SOURCES = tools/lxc_unshare.c \
                      conf.c conf.h \
                      confile.c confile.h \
                      confile_utils.c confile_utils.h \
+                     file_utils.c file_utils.h \
                      string_utils.c string_utils.h \
                      syscall_numbers.h \
                      syscall_wrappers.h
@@ -486,6 +504,7 @@ lxc_wait_SOURCES = tools/lxc_wait.c \
                   conf.c conf.h \
                   confile.c confile.h \
                   confile_utils.c confile_utils.h \
+                  file_utils.c file_utils.h \
                   string_utils.c string_utils.h
 lxc_create_SOURCES = tools/lxc_create.c \
                     tools/arguments.c tools/arguments.h \
@@ -494,6 +513,7 @@ lxc_create_SOURCES = tools/lxc_create.c \
                     conf.c conf.h \
                     confile.c confile.h \
                     confile_utils.c confile_utils.h \
+                    file_utils.c file_utils.h \
                     storage/storage_utils.c storage/storage_utils.h \
                     string_utils.c string_utils.h
 lxc_snapshot_SOURCES = tools/lxc_snapshot.c \
@@ -503,6 +523,7 @@ lxc_snapshot_SOURCES = tools/lxc_snapshot.c \
                       conf.c conf.h \
                       confile.c confile.h \
                       confile_utils.c confile_utils.h \
+                      file_utils.c file_utils.h \
                       string_utils.c string_utils.h
 lxc_checkpoint_SOURCES = tools/lxc_checkpoint.c \
                         tools/arguments.c tools/arguments.h \
@@ -511,6 +532,7 @@ lxc_checkpoint_SOURCES = tools/lxc_checkpoint.c \
                         conf.c conf.h \
                         confile.c confile.h \
                         confile_utils.c confile_utils.h \
+                        file_utils.c file_utils.h \
                         string_utils.c string_utils.h
 endif
 
@@ -520,6 +542,7 @@ init_lxc_SOURCES = cmd/lxc_init.c \
                   compiler.h \
                   error.c error.h \
                   initutils.c initutils.h \
+                  file_utils.c file_utils.h \
                   memory_utils.h \
                   parse.c parse.h \
                   process_utils.c process_utils.h \
@@ -534,6 +557,7 @@ lxc_monitord_SOURCES = cmd/lxc_monitord.c \
                       conf.c conf.h \
                       confile.c confile.h \
                       confile_utils.c confile_utils.h \
+                      file_utils.c file_utils.h \
                       log.c log.h \
                       mainloop.c mainloop.h \
                       monitor.c monitor.h \
@@ -548,6 +572,7 @@ lxc_user_nic_SOURCES = cmd/lxc_user_nic.c \
                       conf.c conf.h \
                       confile.c confile.h \
                       confile_utils.c confile_utils.h \
+                      file_utils.c file_utils.h \
                       log.c log.h \
                       memory_utils.h \
                       network.c network.h \
@@ -555,7 +580,6 @@ lxc_user_nic_SOURCES = cmd/lxc_user_nic.c \
                       parse.c parse.h \
                       process_utils.c process_utils.h \
                       syscall_numbers.h \
-                      file_utils.c file_utils.h \
                       string_utils.c string_utils.h \
                       syscall_wrappers.h
 lxc_usernsexec_SOURCES = cmd/lxc_usernsexec.c \
index 6f11ec9d7ad0e3fba0ddcbeca1fbd5fb5acd29a0..a759a6f3611efabf2189f869acd73219a1f2c39d 100644 (file)
 #include "compiler.h"
 
 /* read and write whole files */
-extern int lxc_write_to_file(const char *filename, const void *buf,
-                            size_t count, bool add_newline, mode_t mode)
-__access_r(2, 3);
+__hidden extern int lxc_write_to_file(const char *filename, const void *buf, size_t count,
+                                     bool add_newline, mode_t mode) __access_r(2, 3);
 
-extern int lxc_readat(int dirfd, const char *filename, void *buf, size_t count)
-__access_w(3, 4);
+__hidden extern int lxc_readat(int dirfd, const char *filename, void *buf, size_t count)
+    __access_w(3, 4);
 
-extern int lxc_writeat(int dirfd, const char *filename, const void *buf,
-                      size_t count)
-__access_r(3, 4);
+__hidden extern int lxc_writeat(int dirfd, const char *filename, const void *buf, size_t count)
+    __access_r(3, 4);
 
-extern int lxc_write_openat(const char *dir, const char *filename,
-                           const void *buf, size_t count)
-__access_r(3, 4);
+__hidden extern int lxc_write_openat(const char *dir, const char *filename, const void *buf,
+                                    size_t count) __access_r(3, 4);
 
-extern int lxc_read_from_file(const char *filename, void *buf, size_t count)
-__access_w(2, 3);
+__hidden extern int lxc_read_from_file(const char *filename, void *buf, size_t count)
+    __access_w(2, 3);
 
 /* send and receive buffers completely */
-extern ssize_t lxc_write_nointr(int fd, const void *buf, size_t count)
-__access_r(2, 3);
+__hidden extern ssize_t lxc_write_nointr(int fd, const void *buf, size_t count) __access_r(2, 3);
 
-extern ssize_t lxc_pwrite_nointr(int fd, const void *buf, size_t count,
-                                off_t offset)
-__access_r(2, 3);
+__hidden extern ssize_t lxc_pwrite_nointr(int fd, const void *buf, size_t count, off_t offset)
+    __access_r(2, 3);
 
-extern ssize_t lxc_send_nointr(int sockfd, void *buf, size_t len, int flags)
-__access_r(2, 3);
+__hidden extern ssize_t lxc_send_nointr(int sockfd, void *buf, size_t len, int flags)
+    __access_r(2, 3);
 
-extern ssize_t lxc_read_nointr(int fd, void *buf, size_t count)
-__access_w(2, 3);
+__hidden extern ssize_t lxc_read_nointr(int fd, void *buf, size_t count) __access_w(2, 3);
 
-extern ssize_t lxc_read_nointr_expect(int fd, void *buf, size_t count,
-                                     const void *expected_buf)
-__access_w(2, 3);
+__hidden extern ssize_t lxc_read_nointr_expect(int fd, void *buf, size_t count,
+                                              const void *expected_buf) __access_w(2, 3);
 
-extern ssize_t lxc_read_file_expect(const char *path, void *buf, size_t count,
-                                     const void *expected_buf)
-__access_w(2, 3);
+__hidden extern ssize_t lxc_read_file_expect(const char *path, void *buf, size_t count,
+                                            const void *expected_buf) __access_w(2, 3);
 
-extern ssize_t lxc_recv_nointr(int sockfd, void *buf, size_t len, int flags)
-__access_w(2, 3);
+__hidden extern ssize_t lxc_recv_nointr(int sockfd, void *buf, size_t len, int flags)
+    __access_w(2, 3);
 
-ssize_t lxc_recvmsg_nointr_iov(int sockfd, struct iovec *iov, size_t iovlen,
-                              int flags);
+__hidden extern ssize_t lxc_recvmsg_nointr_iov(int sockfd, struct iovec *iov, size_t iovlen,
+                                              int flags);
 
-extern bool file_exists(const char *f);
-extern int print_to_file(const char *file, const char *content);
-extern int is_dir(const char *path);
-extern int lxc_count_file_lines(const char *fn);
-extern int lxc_make_tmpfile(char *template, bool rm);
+__hidden extern bool file_exists(const char *f);
+__hidden extern int print_to_file(const char *file, const char *content);
+__hidden extern int is_dir(const char *path);
+__hidden extern int lxc_count_file_lines(const char *fn);
+__hidden extern int lxc_make_tmpfile(char *template, bool rm);
 
 /* __typeof__ should be safe to use with all compilers. */
 typedef __typeof__(((struct statfs *)NULL)->f_type) fs_type_magic;
-extern bool has_fs_type(const char *path, fs_type_magic magic_val);
-extern bool fhas_fs_type(int fd, fs_type_magic magic_val);
-extern bool is_fs_type(const struct statfs *fs, fs_type_magic magic_val);
-extern FILE *fopen_cloexec(const char *path, const char *mode);
-extern ssize_t lxc_sendfile_nointr(int out_fd, int in_fd, off_t *offset,
-                                  size_t count);
-extern char *file_to_buf(const char *path, size_t *length);
-extern int fd_to_buf(int fd, char **buf, size_t *length);
-extern int fd_to_fd(int from, int to);
-extern int lxc_open_dirfd(const char *dir);
-extern FILE *fdopen_cached(int fd, const char *mode, void **caller_freed_buffer);
-extern FILE *fopen_cached(const char *path, const char *mode,
-                         void **caller_freed_buffer);
-extern int timens_offset_write(clockid_t clk_id, int64_t s_offset, int64_t ns_offset);
+__hidden extern bool has_fs_type(const char *path, fs_type_magic magic_val);
+__hidden extern bool fhas_fs_type(int fd, fs_type_magic magic_val);
+__hidden extern bool is_fs_type(const struct statfs *fs, fs_type_magic magic_val);
+__hidden extern FILE *fopen_cloexec(const char *path, const char *mode);
+__hidden extern ssize_t lxc_sendfile_nointr(int out_fd, int in_fd, off_t *offset, size_t count);
+__hidden extern char *file_to_buf(const char *path, size_t *length);
+__hidden extern int fd_to_buf(int fd, char **buf, size_t *length);
+__hidden extern int fd_to_fd(int from, int to);
+__hidden extern int lxc_open_dirfd(const char *dir);
+__hidden extern FILE *fdopen_cached(int fd, const char *mode, void **caller_freed_buffer);
+__hidden extern FILE *fopen_cached(const char *path, const char *mode, void **caller_freed_buffer);
+__hidden extern int timens_offset_write(clockid_t clk_id, int64_t s_offset, int64_t ns_offset);
 
 #endif /* __LXC_FILE_UTILS_H */
index bdf8fdcce652fc2c19c2f2624c8e213d44ebf341..5309d5a7d69dc6de9a0ac8ceab5bc4cb3cb9c3d5 100644 (file)
@@ -2,9 +2,31 @@ if ENABLE_TESTS
 
 LDADD = ../lxc/liblxc.la
 
-lxc_test_api_reboot_SOURCES = api_reboot.c
+lxc_test_api_reboot_SOURCES = api_reboot.c \
+                             ../lxc/af_unix.c ../lxc/af_unix.h \
+                             ../lxc/caps.c ../lxc/caps.h \
+                             ../lxc/commands.c ../lxc/commands.h \
+                             ../lxc/commands_utils.c ../lxc/commands_utils.h \
+                             ../lxc/conf.c ../lxc/conf.h \
+                             ../lxc/confile.c ../lxc/confile.h \
+                             ../lxc/confile_utils.c ../lxc/confile_utils.h \
+                             ../lxc/file_utils.c ../lxc/file_utils.h \
+                             ../lxc/network.c ../lxc/network.h \
+                             ../lxc/nl.c ../lxc/nl.h \
+                             ../lxc/string_utils.c ../lxc/string_utils.h
 lxc_test_apparmor_SOURCES = aa.c
-lxc_test_attach_SOURCES = attach.c
+lxc_test_attach_SOURCES = attach.c \
+                         ../lxc/af_unix.c ../lxc/af_unix.h \
+                         ../lxc/caps.c ../lxc/caps.h \
+                         ../lxc/commands.c ../lxc/commands.h \
+                         ../lxc/commands_utils.c ../lxc/commands_utils.h \
+                         ../lxc/conf.c ../lxc/conf.h \
+                         ../lxc/confile.c ../lxc/confile.h \
+                         ../lxc/confile_utils.c ../lxc/confile_utils.h \
+                         ../lxc/file_utils.c ../lxc/file_utils.h \
+                         ../lxc/network.c ../lxc/network.h \
+                         ../lxc/nl.c ../lxc/nl.h \
+                         ../lxc/string_utils.c ../lxc/string_utils.h
 lxc_test_basic_SOURCES = basic.c
 lxc_test_cgpath_SOURCES = cgpath.c \
                          ../lxc/af_unix.c ../lxc/af_unix.h \
@@ -14,6 +36,7 @@ lxc_test_cgpath_SOURCES = cgpath.c \
                          ../lxc/conf.c ../lxc/conf.h \
                          ../lxc/confile.c ../lxc/confile.h \
                          ../lxc/confile_utils.c ../lxc/confile_utils.h \
+                         ../lxc/file_utils.c ../lxc/file_utils.h \
                          ../lxc/network.c ../lxc/network.h \
                          ../lxc/nl.c ../lxc/nl.h \
                          ../lxc/string_utils.c ../lxc/string_utils.h
@@ -28,6 +51,7 @@ lxc_test_config_jump_table_SOURCES = config_jump_table.c \
                                     ../lxc/conf.c ../lxc/conf.h \
                                     ../lxc/confile.c ../lxc/confile.h \
                                     ../lxc/confile_utils.c ../lxc/confile_utils.h \
+                                    ../lxc/file_utils.c ../lxc/file_utils.h \
                                     ../lxc/network.c ../lxc/network.h \
                                     ../lxc/nl.c ../lxc/nl.h \
                                     ../lxc/string_utils.c ../lxc/string_utils.h
@@ -45,7 +69,10 @@ lxc_test_list_SOURCES = list.c
 lxc_test_locktests_SOURCES = locktests.c
 lxc_test_lxcpath_SOURCES = lxcpath.c
 lxc_test_may_control_SOURCES = may_control.c
-lxc_test_mount_injection_SOURCES = mount_injection.c lxctest.h
+lxc_test_mount_injection_SOURCES = mount_injection.c \
+                                  lxctest.h \
+                                  ../lxc/file_utils.c ../lxc/file_utils.h \
+                                  ../lxc/string_utils.c ../lxc/string_utils.h
 lxc_test_parse_config_file_SOURCES = parse_config_file.c \
                                     lxctest.h \
                                     ../lxc/af_unix.c ../lxc/af_unix.h \
@@ -53,6 +80,7 @@ lxc_test_parse_config_file_SOURCES = parse_config_file.c \
                                     ../lxc/conf.c ../lxc/conf.h \
                                     ../lxc/confile.c ../lxc/confile.h \
                                     ../lxc/confile_utils.c ../lxc/confile_utils.h \
+                                    ../lxc/file_utils.c ../lxc/file_utils.h \
                                     ../lxc/network.c ../lxc/network.h \
                                     ../lxc/nl.c ../lxc/nl.h \
                                     ../lxc/string_utils.c ../lxc/string_utils.h
@@ -67,7 +95,9 @@ lxc_test_saveconfig_SOURCES = saveconfig.c
 lxc_test_share_ns_SOURCES = share_ns.c \
                            lxctest.h \
                            ../lxc/compiler.h
-lxc_test_shortlived_SOURCES = shortlived.c
+lxc_test_shortlived_SOURCES = shortlived.c \
+                             ../lxc/file_utils.c ../lxc/file_utils.h \
+                             ../lxc/string_utils.c ../lxc/string_utils.h
 lxc_test_shutdowntest_SOURCES = shutdowntest.c
 lxc_test_snapshot_SOURCES = snapshot.c
 lxc_test_startone_SOURCES = startone.c
@@ -83,6 +113,7 @@ lxc_test_utils_SOURCES = lxc-test-utils.c \
                          ../lxc/conf.c ../lxc/conf.h \
                          ../lxc/confile.c ../lxc/confile.h \
                          ../lxc/confile_utils.c ../lxc/confile_utils.h \
+                         ../lxc/file_utils.c ../lxc/file_utils.h \
                          ../lxc/network.c ../lxc/network.h \
                          ../lxc/nl.c ../lxc/nl.h \
                          ../lxc/string_utils.c ../lxc/string_utils.h