Blender V5.0
BLI_mmap.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2020 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
10
11#include "BLI_compiler_attrs.h"
12#include "BLI_utildefines.h"
13
14/* Memory-mapped file IO that implements all the OS-specific details and error handling. */
15
16struct BLI_mmap_file;
17
19
20/* Prepares an opened file for memory-mapped IO.
21 * May return NULL if the operation fails.
22 * Note that this seeks to the end of the file to determine its length. */
24
25/* Reads length bytes from file at the given offset into dest.
26 * Returns whether the operation was successful (may fail when reading beyond the file
27 * end or when IO errors occur). */
28bool BLI_mmap_read(BLI_mmap_file *file, void *dest, size_t offset, size_t length)
30
34
#define ATTR_WARN_UNUSED_RESULT
#define ATTR_MALLOC
#define ATTR_NONNULL(...)
bool BLI_mmap_read(BLI_mmap_file *file, void *dest, size_t offset, size_t length) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition BLI_mmap.cc:459
void * BLI_mmap_get_pointer(BLI_mmap_file *file) ATTR_WARN_UNUSED_RESULT
Definition BLI_mmap.cc:472
void BLI_mmap_free(BLI_mmap_file *file) ATTR_NONNULL(1)
Definition BLI_mmap.cc:487
bool BLI_mmap_any_io_error(const BLI_mmap_file *file) ATTR_WARN_UNUSED_RESULT
Definition BLI_mmap.cc:482
BLI_mmap_file * BLI_mmap_open(int fd) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
Definition BLI_mmap.cc:367
size_t BLI_mmap_get_length(const BLI_mmap_file *file) ATTR_WARN_UNUSED_RESULT
Definition BLI_mmap.cc:477
float length(VecOp< float, D >) RET