RTEMS 6.1-rc1
rtl-obj-cache.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/*
4 * COPYRIGHT (c) 2012, 2018 Chris Johns <chrisj@rtems.org>
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
26 */
57#if !defined (_RTEMS_RTL_OBJ_CACHE_H_)
58#define _RTEMS_RTL_OBJ_CACHE_H_
59
60#include <fcntl.h>
61#include <stdbool.h>
62#include <stdint.h>
63#include <stdlib.h>
64
65#ifdef __cplusplus
66extern "C" {
67#endif /* __cplusplus */
68
72typedef struct rtems_rtl_obj_cache
73{
74 int fd;
75 size_t file_size;
76 off_t offset;
77 size_t size;
78 size_t level;
80 uint8_t* buffer;
82
93
100
107
125 int fd,
126 off_t offset,
127 void** buffer,
128 size_t* length);
129
142 int fd,
143 off_t offset,
144 void* buffer,
145 size_t length);
146
147#ifdef __cplusplus
148}
149#endif /* __cplusplus */
150
151#endif
void rtems_rtl_obj_cache_flush(rtems_rtl_obj_cache *cache)
Definition: rtl-obj-cache.c:83
bool rtems_rtl_obj_cache_open(rtems_rtl_obj_cache *cache, size_t size)
Definition: rtl-obj-cache.c:54
bool rtems_rtl_obj_cache_read_byval(rtems_rtl_obj_cache *cache, int fd, off_t offset, void *buffer, size_t length)
Definition: rtl-obj-cache.c:262
bool rtems_rtl_obj_cache_read(rtems_rtl_obj_cache *cache, int fd, off_t offset, void **buffer, size_t *length)
Definition: rtl-obj-cache.c:94
struct rtems_rtl_obj_cache rtems_rtl_obj_cache
void rtems_rtl_obj_cache_close(rtems_rtl_obj_cache *cache)
Definition: rtl-obj-cache.c:71
Definition: rtl-obj-cache.h:73
size_t file_size
Definition: rtl-obj-cache.h:75
uint8_t * buffer
Definition: rtl-obj-cache.h:80
int fd
Definition: rtl-obj-cache.h:74
size_t size
Definition: rtl-obj-cache.h:77
off_t offset
Definition: rtl-obj-cache.h:76
size_t level
Definition: rtl-obj-cache.h:78
unsigned size
Definition: tte.h:1