/*
- * Copyright (C) 2019 - Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ * Copyright (C) 2019 Jérémie Galarneau <jeremie.galarneau@efficios.com>
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License, version 2.1 only,
- * as published by the Free Software Foundation.
+ * SPDX-License-Identifier: LGPL-2.1-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 Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser 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
*/
#ifndef LTTNG_TRACE_CHUNK_H
#define LTTNG_TRACE_CHUNK_H
-#include <common/macros.h>
-#include <common/credentials.h>
#include <common/compat/directory-handle.h>
+#include <common/credentials.h>
+#include <common/fd-tracker/fd-tracker.h>
+#include <common/macros.h>
+#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
-#include <stdbool.h>
/*
* A trace chunk is a group of directories and files forming a (or a set of)
*/
struct lttng_trace_chunk;
+struct fd_tracker;
enum lttng_trace_chunk_status {
LTTNG_TRACE_CHUNK_STATUS_OK,
LTTNG_HIDDEN
struct lttng_trace_chunk *lttng_trace_chunk_create(
uint64_t chunk_id,
- time_t chunk_creation_time);
+ time_t chunk_creation_time,
+ const char *path);
+
+LTTNG_HIDDEN
+void lttng_trace_chunk_set_fd_tracker(struct lttng_trace_chunk *chunk,
+ struct fd_tracker *fd_tracker);
/*
* Copy a trace chunk. The copy that is returned is always a _user_
enum lttng_trace_chunk_status lttng_trace_chunk_override_name(
struct lttng_trace_chunk *chunk, const char *name);
+LTTNG_HIDDEN
+enum lttng_trace_chunk_status lttng_trace_chunk_rename_path(
+ struct lttng_trace_chunk *chunk, const char *path);
+
LTTNG_HIDDEN
enum lttng_trace_chunk_status lttng_trace_chunk_get_credentials(
struct lttng_trace_chunk *chunk,
struct lttng_trace_chunk *chunk,
struct lttng_directory_handle *chunk_directory);
+LTTNG_HIDDEN
+enum lttng_trace_chunk_status
+lttng_trace_chunk_get_session_output_directory_handle(
+ struct lttng_trace_chunk *chunk,
+ struct lttng_directory_handle **handle);
+
LTTNG_HIDDEN
enum lttng_trace_chunk_status lttng_trace_chunk_borrow_chunk_directory_handle(
struct lttng_trace_chunk *chunk,
LTTNG_HIDDEN
enum lttng_trace_chunk_status lttng_trace_chunk_open_file(
- struct lttng_trace_chunk *chunk, const char *filename,
- int flags, mode_t mode, int *out_fd, bool expect_no_file);
+ struct lttng_trace_chunk *chunk,
+ const char *filename,
+ int flags,
+ mode_t mode,
+ int *out_fd,
+ bool expect_no_file);
+
+LTTNG_HIDDEN
+enum lttng_trace_chunk_status lttng_trace_chunk_open_fs_handle(
+ struct lttng_trace_chunk *chunk,
+ const char *filename,
+ int flags,
+ mode_t mode,
+ struct fs_handle **out_handle,
+ bool expect_no_file);
LTTNG_HIDDEN
int lttng_trace_chunk_unlink_file(struct lttng_trace_chunk *chunk,
const char *lttng_trace_chunk_command_type_get_name(
enum lttng_trace_chunk_command_type command);
+LTTNG_HIDDEN
+bool lttng_trace_chunk_ids_equal(const struct lttng_trace_chunk *chunk_a,
+ const struct lttng_trace_chunk *chunk_b);
+
/* Returns true on success. */
LTTNG_HIDDEN
bool lttng_trace_chunk_get(struct lttng_trace_chunk *chunk);