summaryrefslogtreecommitdiff
path: root/include/libcamera/base/memfd.h
blob: 705d9929efd1b72312fa6d3c43611be66d106d82 (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
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
 * Copyright (C) 2024, Ideas on Board Oy
 *
 * Anonymous file creation
 */

#pragma once

#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 */