summaryrefslogtreecommitdiff
path: root/src/ipa/raspberrypi/controller/metadata.h
diff options
context:
space:
mode:
authorHarvey Yang <chenghaoyang@chromium.org>2023-03-31 08:45:45 +0000
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2023-04-05 08:24:11 +0300
commitc1cc37b2eeea33cbc0bdd1fe0d3ce57d2f321a85 (patch)
tree209c98a2446ce60059c1cba30c2321bcfe3d3df3 /src/ipa/raspberrypi/controller/metadata.h
parent44eed506c285f090b97377f3cc3023cd09221cac (diff)
utils: ipc: Update parser.py
Make the local mojom library the first priority in the sys path, to avoid mixing the local one with the system one in build. Tested on chromebook soraka-libcamera. Signed-off-by: Harvey Yang <chenghaoyang@chromium.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/ipa/raspberrypi/controller/metadata.h')
0 files changed, 0 insertions, 0 deletions
'n62' href='#n62'>62 63 64 65 66 67 68 69 70 71
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
 * Copyright (C) 2020, Google Inc.
 *
 * file.h - File I/O operations
 */
#ifndef __LIBCAMERA_FILE_H__
#define __LIBCAMERA_FILE_H__

#include <map>
#include <string>
#include <sys/types.h>

#include <libcamera/span.h>

namespace libcamera {

class File
{
public:
	enum MapFlag {
		MapNoOption = 0,
		MapPrivate = (1 << 0),
	};

	enum OpenMode {
		NotOpen = 0,
		ReadOnly = (1 << 0),
		WriteOnly = (1 << 1),
		ReadWrite = ReadOnly | WriteOnly,
	};

	File(const std::string &name);
	File();
	~File();

	File(const File &) = delete;
	File &operator=(const File &) = delete;

	const std::string &fileName() const { return name_; }
	void setFileName(const std::string &name);
	bool exists() const;

	bool open(OpenMode mode);
	bool isOpen() const { return fd_ != -1; }
	OpenMode openMode() const { return mode_; }
	void close();

	int error() const { return error_; }
	ssize_t size() const;

	Span<uint8_t> map(off_t offset = 0, ssize_t size = -1,
			  MapFlag flags = MapNoOption);
	bool unmap(uint8_t *addr);

	static bool exists(const std::string &name);

private:
	void unmapAll();

	std::string name_;
	int fd_;
	OpenMode mode_;

	int error_;
	std::map<void *, size_t> maps_;
};

} /* namespace libcamera */

#endif /* __LIBCAMERA_FILE_H__ */