From: Jérémie Galarneau Date: Wed, 29 Jan 2020 04:37:49 +0000 (-0500) Subject: directory-handle: make lttng_directory_handle_stat public X-Git-Tag: v2.12.0-rc1~39 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=57b1431829d660508840fc820a19ee27f5e1a711;p=lttng-tools.git directory-handle: make lttng_directory_handle_stat public Allow users of the directory handle API to perform stat() calls relative to a directory handle (through statat() or stat(), depending on the implementation). Signed-off-by: Jérémie Galarneau Change-Id: I4415da6d719999ad051678d0defd9e3edf93c19a --- diff --git a/src/common/compat/directory-handle.c b/src/common/compat/directory-handle.c index 15ee5b5de..9548da216 100644 --- a/src/common/compat/directory-handle.c +++ b/src/common/compat/directory-handle.c @@ -36,9 +36,6 @@ * of the internal API below. */ static -int lttng_directory_handle_stat(const struct lttng_directory_handle *handle, - const char *path, struct stat *st); -static int lttng_directory_handle_mkdir( const struct lttng_directory_handle *handle, const char *path, mode_t mode); @@ -244,7 +241,7 @@ void lttng_directory_handle_invalidate(struct lttng_directory_handle *handle) handle->dirfd = -1; } -static +LTTNG_HIDDEN int lttng_directory_handle_stat(const struct lttng_directory_handle *handle, const char *path, struct stat *st) { @@ -602,7 +599,7 @@ void lttng_directory_handle_invalidate(struct lttng_directory_handle *handle) handle->base_path = NULL; } -static +LTTNG_HIDDEN int lttng_directory_handle_stat(const struct lttng_directory_handle *handle, const char *subdirectory, struct stat *st) { diff --git a/src/common/compat/directory-handle.h b/src/common/compat/directory-handle.h index 0ad5c8510..551fa50b4 100644 --- a/src/common/compat/directory-handle.h +++ b/src/common/compat/directory-handle.h @@ -18,8 +18,9 @@ #ifndef _COMPAT_DIRECTORY_HANDLE_H #define _COMPAT_DIRECTORY_HANDLE_H -#include #include +#include +#include #include enum lttng_directory_handle_rmdir_recursive_flags { @@ -257,6 +258,15 @@ int lttng_directory_handle_remove_subdirectory_recursive_as_user( const struct lttng_credentials *creds, int flags); +/* + * stat() a file relative to a directory handle. + */ +LTTNG_HIDDEN +int lttng_directory_handle_stat( + const struct lttng_directory_handle *handle, + const char *name, + struct stat *stat_buf); + /* * Compare two directory handles. *