summaryrefslogtreecommitdiff
path: root/include/libcamera/base/memfd.h
blob: b0edd2de5d83b0ecef6bdc0bc9204220ec47d098 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
 * Copyright (C) 2024, Ideas on Board Oy
 *
 * Anonymous file creation
 */

#pragma once

#include <stddef.h>

#include <libcamera/base/flags.h>
#include <libcamera/base/unique_fd.h>

namespace libcamera {

class MemFd
{
public:
	enum class Seal {
		None = 0,
		Shrink = (1 << 0),
		Grow = (1 << 1),
	};

	using Seals = Flags<Seal>;

	static UniqueFD create(const char *name, std::size_t size,
			       Seals seals = Seal::None);
};

LIBCAMERA_FLAGS_ENABLE_OPERATORS(MemFd::Seal)

} /* namespace libcamera */