RTEMS CPU Kit with SuperCore  4.11.3
rtl-obj-cache.h
Go to the documentation of this file.
1 /*
2  * COPYRIGHT (c) 2012 Chris Johns <chrisj@rtems.org>
3  *
4  * The license and distribution terms for this file may be
5  * found in the file LICENSE in this distribution or at
6  * http://www.rtems.org/license/LICENSE.
7  */
38 #if !defined (_RTEMS_RTL_OBJ_CACHE_H_)
39 #define _RTEMS_RTL_OBJ_CACHE_H_
40 
41 #include <fcntl.h>
42 #include <stdbool.h>
43 #include <stdint.h>
44 #include <stdlib.h>
45 
46 #ifdef __cplusplus
47 extern "C" {
48 #endif /* __cplusplus */
49 
53 typedef struct rtems_rtl_obj_cache_s
54 {
55  int fd;
56  size_t file_size;
57  off_t offset;
58  size_t size;
59  size_t level;
61  uint8_t* buffer;
63 
74 
81 
88 
106  int fd,
107  off_t offset,
108  void** buffer,
109  size_t* length);
110 
123  int fd,
124  off_t offset,
125  void* buffer,
126  size_t length);
127 
128 #ifdef __cplusplus
129 }
130 #endif /* __cplusplus */
131 
132 #endif
uint8_t * buffer
The buffer.
Definition: rtl-obj-cache.h:61
void rtems_rtl_obj_cache_close(rtems_rtl_obj_cache_t *cache)
Close a cache.
Definition: rtl-obj-cache.c:49
off_t offset
The base offset of the buffer.
Definition: rtl-obj-cache.h:57
size_t file_size
The size of the file.
Definition: rtl-obj-cache.h:56
bool rtems_rtl_obj_cache_read(rtems_rtl_obj_cache_t *cache, int fd, off_t offset, void **buffer, size_t *length)
Read data by reference.
Definition: rtl-obj-cache.c:72
The buffer cache.
Definition: rtl-obj-cache.h:53
bool rtems_rtl_obj_cache_open(rtems_rtl_obj_cache_t *cache, size_t size)
Open a cache allocating a single buffer of the size passed.
Definition: rtl-obj-cache.c:32
bool rtems_rtl_obj_cache_read_byval(rtems_rtl_obj_cache_t *cache, int fd, off_t offset, void *buffer, size_t length)
Read data by value.
Definition: rtl-obj-cache.c:236
void rtems_rtl_obj_cache_flush(rtems_rtl_obj_cache_t *cache)
Flush the cache.
Definition: rtl-obj-cache.c:61
size_t size
The size of the cache.
Definition: rtl-obj-cache.h:58
size_t level
The amount of data in the cache.
Definition: rtl-obj-cache.h:59
struct rtems_rtl_obj_cache_s rtems_rtl_obj_cache_t
The buffer cache.
int fd
The file descriptor of the data in the cache.
Definition: rtl-obj-cache.h:55