VSF Documented
vsf_romfs.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Copyright(C)2009-2022 by VSF Team *
3 * *
4 * Licensed under the Apache License, Version 2.0 (the "License"); *
5 * you may not use this file except in compliance with the License. *
6 * You may obtain a copy of the License at *
7 * *
8 * http://www.apache.org/licenses/LICENSE-2.0 *
9 * *
10 * Unless required by applicable law or agreed to in writing, software *
11 * distributed under the License is distributed on an "AS IS" BASIS, *
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13 * See the License for the specific language governing permissions and *
14 * limitations under the License. *
15 * *
16 ****************************************************************************/
17
18#ifndef __VSF_ROMFS_H__
19#define __VSF_ROMFS_H__
20
21/*============================ INCLUDES ======================================*/
22
23#include "../../vsf_fs_cfg.h"
24
25#if VSF_USE_FS == ENABLED && VSF_FS_USE_ROMFS == ENABLED
26
27#if defined(__VSF_ROMFS_CLASS_IMPLEMENT)
28# define __VSF_CLASS_IMPLEMENT__
29#elif defined(__VSF_ROMFS_CLASS_INHERIT__)
30# define __VSF_CLASS_INHERIT__
31#endif
32
33#include "utilities/ooc_class.h"
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39/*============================ MACROS ========================================*/
40
41#ifndef VSF_ROMFS_CFG_DIRECT_ACCESS
42# define VSF_ROMFS_CFG_DIRECT_ACCESS ENABLED
43#endif
44
45/*============================ MACROFIED FUNCTIONS ===========================*/
46/*============================ TYPES =========================================*/
47
56
58 public_member(
59 implement(vk_file_t)
60 )
61 private_member(
63 vk_romfs_header_t *image;
64 vk_romfs_header_t *header;
65#endif
66 uint8_t level;
67 )
68};
69
71 vk_romfs_file_t root;
72
73 vk_romfs_header_t *image;
74 // image_size/alignment is necessary only if is_chained is true
75 uint32_t image_size;
77 // used to chian multiple romfs
78 bool is_chained;
79};
80
81/*============================ GLOBAL VARIABLES ==============================*/
82
83extern const vk_fs_op_t vk_romfs_op;
84
85/*============================ PROTOTYPES ====================================*/
86
87#if defined(__VSF_ROMFS_CLASS_INHERIT__) || defined(__VSF_ROMFS_CLASS_IMPLEMENT)
90#endif
91
92#ifdef __cplusplus
93}
94#endif
95
96#undef __VSF_ROMFS_CLASS_IMPLEMENT
97#undef __VSF_ROMFS_CLASS_INHERIT__
98
99#endif // VSF_USE_FS && VSF_FS_USE_ROMFS
100#endif // __VSF_ROMFS_H__
#define ENABLED
Definition __type.h:28
Definition vsf_fs.h:114
Definition vsf_fs.h:92
Definition vsf_romfs.h:57
Definition vsf_romfs.h:70
#define vsf_class(__name)
Definition ooc_class.h:48
unsigned uint32_t
Definition stdint.h:9
unsigned char uint8_t
Definition stdint.h:5
Definition vsf_romfs.h:48
uint32_t checksum
Definition vsf_romfs.h:52
uint8_t name[16]
Definition vsf_romfs.h:53
uint32_t nextfh
Definition vsf_romfs.h:49
uint32_t spec
Definition vsf_romfs.h:50
uint32_t size
Definition vsf_romfs.h:51
uint_fast32_t alignment
Definition vsf_heap.h:135
vk_romfs_header_t * vsf_romfs_chain_get_next(vk_romfs_info_t *fsinfo, vk_romfs_header_t *image, bool force)
Definition vsf_romfs.c:106
bool vsf_romfs_is_image_valid(vk_romfs_header_t *image)
Definition vsf_romfs.c:101
struct vk_romfs_header_t VSF_CAL_PACKED
const vk_fs_op_t vk_romfs_op
#define VSF_ROMFS_CFG_DIRECT_ACCESS
Definition vsf_romfs.h:42