Blender  V3.3
BLI_mmap.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2020 Blender Foundation. All rights reserved. */
3 
4 #pragma once
5 
10 #include "BLI_compiler_attrs.h"
11 #include "BLI_utildefines.h"
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 /* Memory-mapped file IO that implements all the OS-specific details and error handling. */
18 
19 struct BLI_mmap_file;
20 
21 typedef struct BLI_mmap_file BLI_mmap_file;
22 
23 /* Prepares an opened file for memory-mapped IO.
24  * May return NULL if the operation fails.
25  * Note that this seeks to the end of the file to determine its length. */
27 
28 /* Reads length bytes from file at the given offset into dest.
29  * Returns whether the operation was successful (may fail when reading beyond the file
30  * end or when IO errors occur). */
31 bool BLI_mmap_read(BLI_mmap_file *file, void *dest, size_t offset, size_t length)
33 
35 
37 
38 #ifdef __cplusplus
39 }
40 #endif
#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.c:178
BLI_mmap_file * BLI_mmap_open(int fd) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
Definition: BLI_mmap.c:131
void BLI_mmap_free(BLI_mmap_file *file) ATTR_NONNULL(1)
Definition: BLI_mmap.c:210
void * BLI_mmap_get_pointer(BLI_mmap_file *file) ATTR_WARN_UNUSED_RESULT
Definition: BLI_mmap.c:205
FILE * file
SyclQueue void * dest
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
T length(const vec_base< T, Size > &a)