From: Jérémie Galarneau Date: Mon, 2 Mar 2020 22:45:17 +0000 (-0500) Subject: Fix: fd-tracker: mark symbols as hidden X-Git-Tag: v2.12.0-rc2~45 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=9792ace395bb0cd984230692a66a016cb541bc39;p=lttng-tools.git Fix: fd-tracker: mark symbols as hidden The fd-tracker is part of libcommon and, as such, its symbols must be marked as hidden since it is linked into liblttng-ctl. Signed-off-by: Jérémie Galarneau Change-Id: I007d950c0e3f7e059ba372c4d20b096c3069febb --- diff --git a/src/common/fd-tracker/fd-tracker.c b/src/common/fd-tracker/fd-tracker.c index 033ae40f8..6c8434875 100644 --- a/src/common/fd-tracker/fd-tracker.c +++ b/src/common/fd-tracker/fd-tracker.c @@ -360,6 +360,7 @@ end: return ret; } +LTTNG_HIDDEN struct fd_tracker *fd_tracker_create(const char *unlinked_file_path, unsigned int capacity) { @@ -405,6 +406,7 @@ error: return NULL; } +LTTNG_HIDDEN void fd_tracker_log(struct fd_tracker *tracker) { struct fs_handle_tracked *handle; @@ -453,6 +455,7 @@ void fd_tracker_log(struct fd_tracker *tracker) pthread_mutex_unlock(&tracker->lock); } +LTTNG_HIDDEN int fd_tracker_destroy(struct fd_tracker *tracker) { int ret = 0; @@ -488,6 +491,7 @@ end: return ret; } +LTTNG_HIDDEN struct fs_handle *fd_tracker_open_fs_handle(struct fd_tracker *tracker, struct lttng_directory_handle *directory, const char *path, @@ -605,6 +609,7 @@ static int fd_tracker_suspend_handles( return left_to_close ? -EMFILE : 0; } +LTTNG_HIDDEN int fd_tracker_open_unsuspendable_fd(struct fd_tracker *tracker, int *out_fds, const char **names, @@ -702,6 +707,7 @@ end_free_entries: goto end_unlock; } +LTTNG_HIDDEN int fd_tracker_close_unsuspendable_fd(struct fd_tracker *tracker, int *fds_in, unsigned int fd_count, diff --git a/src/common/fd-tracker/fd-tracker.h b/src/common/fd-tracker/fd-tracker.h index 5776f6829..504f92a3e 100644 --- a/src/common/fd-tracker/fd-tracker.h +++ b/src/common/fd-tracker/fd-tracker.h @@ -9,6 +9,7 @@ #define FD_TRACKER_H #include +#include #include #include @@ -48,10 +49,12 @@ typedef int (*fd_close_cb)(void *, int *in_fds); * under which unlinked files will be stored for as long as a reference to them * is held. */ +LTTNG_HIDDEN struct fd_tracker *fd_tracker_create(const char *unlinked_file_path, unsigned int capacity); /* Returns an error if file descriptors are leaked. */ +LTTNG_HIDDEN int fd_tracker_destroy(struct fd_tracker *tracker); /* @@ -76,6 +79,7 @@ int fd_tracker_destroy(struct fd_tracker *tracker); * (e.g. truncation) may react differently than if the file descriptor was kept * open. */ +LTTNG_HIDDEN struct fs_handle *fd_tracker_open_fs_handle(struct fd_tracker *tracker, struct lttng_directory_handle *directory, const char *path, @@ -104,6 +108,7 @@ struct fs_handle *fd_tracker_open_fs_handle(struct fd_tracker *tracker, * - EMFILE: too many unsuspendable fds are opened and the tracker can't * accomodate the request for a new unsuspendable entry. */ +LTTNG_HIDDEN int fd_tracker_open_unsuspendable_fd(struct fd_tracker *tracker, int *out_fds, const char **names, @@ -126,6 +131,7 @@ int fd_tracker_open_unsuspendable_fd(struct fd_tracker *tracker, * Closed fds are set to -1 in the fds array which, in the event of an error, * allows the user to know which file descriptors are no longer being tracked. */ +LTTNG_HIDDEN int fd_tracker_close_unsuspendable_fd(struct fd_tracker *tracker, int *fds, unsigned int fd_count, @@ -135,6 +141,7 @@ int fd_tracker_close_unsuspendable_fd(struct fd_tracker *tracker, /* * Log the contents of the fd_tracker. */ +LTTNG_HIDDEN void fd_tracker_log(struct fd_tracker *tracker); /* @@ -152,12 +159,14 @@ void fd_tracker_log(struct fd_tracker *tracker); * Returns the fd on success, otherwise a negative value may be returned * if the restoration of the fd failed. */ +LTTNG_HIDDEN int fs_handle_get_fd(struct fs_handle *handle); /* * Used by the application to signify that it is no longer using the * underlying fd and that it may be suspended. */ +LTTNG_HIDDEN void fs_handle_put_fd(struct fs_handle *handle); /* @@ -172,11 +181,13 @@ void fs_handle_put_fd(struct fs_handle *handle); * Returns 0 on success, otherwise a negative value will be returned * if the operation failed. */ +LTTNG_HIDDEN int fs_handle_unlink(struct fs_handle *handle); /* * Frees the handle and discards the underlying fd. */ +LTTNG_HIDDEN int fs_handle_close(struct fs_handle *handle); #endif /* FD_TRACKER_H */ diff --git a/src/common/fd-tracker/inode.c b/src/common/fd-tracker/inode.c index 16dd49a6f..82799aee7 100644 --- a/src/common/fd-tracker/inode.c +++ b/src/common/fd-tracker/inode.c @@ -245,7 +245,7 @@ static void lttng_inode_get(struct lttng_inode *inode) urcu_ref_get(&inode->ref); } -struct lttng_unlinked_file_pool *lttng_unlinked_file_pool_create( +LTTNG_HIDDEN struct lttng_unlinked_file_pool *lttng_unlinked_file_pool_create( const char *path) { struct lttng_unlinked_file_pool *pool = zmalloc(sizeof(*pool)); @@ -268,7 +268,7 @@ error: return NULL; } -void lttng_unlinked_file_pool_destroy( +LTTNG_HIDDEN void lttng_unlinked_file_pool_destroy( struct lttng_unlinked_file_pool *pool) { if (!pool) { @@ -281,12 +281,13 @@ void lttng_unlinked_file_pool_destroy( free(pool); } -void lttng_inode_put(struct lttng_inode *inode) +LTTNG_HIDDEN void lttng_inode_put(struct lttng_inode *inode) { urcu_ref_put(&inode->ref, lttng_inode_release); } -struct lttng_directory_handle *lttng_inode_get_location_directory_handle( +LTTNG_HIDDEN struct lttng_directory_handle * +lttng_inode_get_location_directory_handle( struct lttng_inode *inode) { if (inode->location.directory_handle) { @@ -298,7 +299,7 @@ struct lttng_directory_handle *lttng_inode_get_location_directory_handle( return inode->location.directory_handle; } -void lttng_inode_borrow_location(struct lttng_inode *inode, +LTTNG_HIDDEN void lttng_inode_borrow_location(struct lttng_inode *inode, const struct lttng_directory_handle **out_directory_handle, const char **out_path) { @@ -310,7 +311,7 @@ void lttng_inode_borrow_location(struct lttng_inode *inode, } } -int lttng_inode_rename( +LTTNG_HIDDEN int lttng_inode_rename( struct lttng_inode *inode, struct lttng_directory_handle *old_directory_handle, const char *old_path, @@ -380,7 +381,7 @@ end: return ret; } -int lttng_inode_unlink(struct lttng_inode *inode) +LTTNG_HIDDEN int lttng_inode_unlink(struct lttng_inode *inode) { int ret = 0; @@ -446,7 +447,7 @@ end: return inode; } -struct lttng_inode_registry *lttng_inode_registry_create(void) +LTTNG_HIDDEN struct lttng_inode_registry *lttng_inode_registry_create(void) { struct lttng_inode_registry *registry = zmalloc(sizeof(*registry)); @@ -473,7 +474,8 @@ error: return NULL; } -void lttng_inode_registry_destroy(struct lttng_inode_registry *registry) +LTTNG_HIDDEN void lttng_inode_registry_destroy( + struct lttng_inode_registry *registry) { if (!registry) { return; @@ -486,7 +488,7 @@ void lttng_inode_registry_destroy(struct lttng_inode_registry *registry) free(registry); } -struct lttng_inode *lttng_inode_registry_get_inode( +LTTNG_HIDDEN struct lttng_inode *lttng_inode_registry_get_inode( struct lttng_inode_registry *registry, struct lttng_directory_handle *handle, const char *path, diff --git a/src/common/fd-tracker/inode.h b/src/common/fd-tracker/inode.h index 7e95c0726..67e63eca4 100644 --- a/src/common/fd-tracker/inode.h +++ b/src/common/fd-tracker/inode.h @@ -24,15 +24,19 @@ struct lttng_directory_handle; * by the fd-tracker. Users of the fd-tracker should account for this extra * file descriptor. */ +LTTNG_HIDDEN struct lttng_unlinked_file_pool *lttng_unlinked_file_pool_create( const char *path); +LTTNG_HIDDEN void lttng_unlinked_file_pool_destroy( struct lttng_unlinked_file_pool *pool); /* The inode registry is protected by the fd-tracker's lock. */ +LTTNG_HIDDEN struct lttng_inode_registry *lttng_inode_registry_create(void); +LTTNG_HIDDEN struct lttng_inode *lttng_inode_registry_get_inode( struct lttng_inode_registry *registry, struct lttng_directory_handle *handle, @@ -40,16 +44,20 @@ struct lttng_inode *lttng_inode_registry_get_inode( int fd, struct lttng_unlinked_file_pool *pool); +LTTNG_HIDDEN void lttng_inode_registry_destroy(struct lttng_inode_registry *registry); +LTTNG_HIDDEN void lttng_inode_borrow_location(struct lttng_inode *inode, const struct lttng_directory_handle **out_directory_handle, const char **out_path); /* Returns a new reference to the inode's location directory handle. */ +LTTNG_HIDDEN struct lttng_directory_handle *lttng_inode_get_location_directory_handle( struct lttng_inode *inode); +LTTNG_HIDDEN int lttng_inode_rename(struct lttng_inode *inode, struct lttng_directory_handle *old_directory_handle, const char *old_path, @@ -57,8 +65,10 @@ int lttng_inode_rename(struct lttng_inode *inode, const char *new_path, bool overwrite); +LTTNG_HIDDEN int lttng_inode_unlink(struct lttng_inode *inode); +LTTNG_HIDDEN void lttng_inode_put(struct lttng_inode *inode); #endif /* FD_TRACKER_INODE_H */