*
*/
-#include <common/compat/directory-handle.h>
-#include <common/error.h>
-#include <common/macros.h>
-#include <common/runas.h>
-#include <common/credentials.h>
+#include <common/compat/directory-handle.hpp>
+#include <common/error.hpp>
+#include <common/macros.hpp>
+#include <common/runas.hpp>
+#include <common/credentials.hpp>
#include <lttng/constant.h>
-#include <common/dynamic-array.h>
+#include <common/dynamic-array.hpp>
#include <sys/types.h>
#include <sys/stat.h>
int dirfd)
{
int ret;
- struct lttng_directory_handle *handle = (lttng_directory_handle *) zmalloc(sizeof(*handle));
+ struct lttng_directory_handle *handle = zmalloc<lttng_directory_handle>();
struct stat stat_buf;
if (!handle) {
{
int ret;
struct lttng_directory_handle *handle =
- container_of(ref, struct lttng_directory_handle, ref);
+ lttng::utils::container_of(ref, <tng_directory_handle::ref);
if (handle->destroy_cb) {
handle->destroy_cb(handle, handle->destroy_cb_data);
static
struct lttng_directory_handle *_lttng_directory_handle_create(char *path)
{
- struct lttng_directory_handle *handle = zmalloc(sizeof(*handle));
+ struct lttng_directory_handle *handle = zmalloc<lttng_directory_handle>();
if (!handle) {
goto end;
handle_path_len, LTTNG_PATH_MAX);
goto end;
}
- new_path = zmalloc(handle_path_len);
+ new_path = zmalloc<char>(handle_path_len);
if (!new_path) {
PERROR("Failed to initialize directory handle");
goto end;
void lttng_directory_handle_release(struct urcu_ref *ref)
{
struct lttng_directory_handle *handle =
- container_of(ref, struct lttng_directory_handle, ref);
+ lttng::utils::container_of(ref, <tng_directory_handle::ref);
free(handle->base_path);
lttng_directory_handle_invalidate(handle);
return ret;
}
+namespace {
struct rmdir_frame {
ssize_t parent_frame_idx;
DIR *dir;
/* Size including '\0'. */
size_t path_size;
};
+} /* namespace */
static
void rmdir_frame_fini(void *data)