X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcommon%2Fcompat%2Fdirectory-handle.c;h=eb1cd926e6e2df0979d041a21532a7a6b141b050;hb=ab5be9fa2eb5ba9600a82cd18fd3cfcbac69169a;hp=15ee5b5de68902cc0933209337c41dd1122df898;hpb=0e98551307eb5a7a59cc74982b386dc95f4c4f89;p=lttng-tools.git diff --git a/src/common/compat/directory-handle.c b/src/common/compat/directory-handle.c index 15ee5b5de..eb1cd926e 100644 --- a/src/common/compat/directory-handle.c +++ b/src/common/compat/directory-handle.c @@ -1,18 +1,8 @@ /* - * Copyright (C) 2019 - Jérémie Galarneau + * Copyright (C) 2019 Jérémie Galarneau * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2 only, - * as published by the Free Software Foundation. + * SPDX-License-Identifier: GPL-2.0-only * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include @@ -36,9 +26,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,13 +231,20 @@ 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) { return fstatat(handle->dirfd, path, st, 0); } +LTTNG_HIDDEN +bool lttng_directory_handle_uses_fd( + const struct lttng_directory_handle *handle) +{ + return handle->dirfd != AT_FDCWD; +} + static int lttng_directory_handle_mkdir( const struct lttng_directory_handle *handle, @@ -602,7 +596,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) { @@ -620,6 +614,13 @@ end: return ret; } +LTTNG_HIDDEN +bool lttng_directory_handle_uses_fd( + const struct lttng_directory_handle *handle) +{ + return false; +} + static int lttng_directory_handle_mkdir(const struct lttng_directory_handle *handle, const char *subdirectory, mode_t mode)