picox  0.1
xromfs.h
[詳解]
1 
15 /*
16  * License: MIT license
17  * Copyright (c) <2016> <MaskedW [maskedw00@gmail.com]>
18  *
19  * Permission is hereby granted, free of charge, to any person
20  * obtaining a copy of this software and associated documentation
21  * files (the "Software"), to deal in the Software without
22  * restriction, including without limitation the rights to use, copy,
23  * modify, merge, publish, distribute, sublicense, and/or sell copies
24  * of the Software, and to permit persons to whom the Software is
25  * furnished to do so, subject to the following conditions:
26  *
27  * The above copyright notice and this permission notice shall be
28  * included in all copies or substantial portions of the Software.
29  *
30  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
31  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
33  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
34  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
35  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
36  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37  * SOFTWARE.
38  */
39 
40 #ifndef picox_filesystem_xromfs_h_
41 #define picox_filesystem_xromfs_h_
42 
43 
45 
46 
47 #ifdef __cplusplus
48 extern "C" {
49 #endif /* __cplusplus */
50 
51 
78 #define X_ROMFS_TAG (X_MAKE_TAG('X', 'R', 'O', 'F'))
79 typedef struct
80 {
82  XTag m_tag;
83  const char* m_top;
84  const char* m_rootdir;
85  const char* m_curdir;
86 } XRomFs;
87 
88 
96 XError xromfs_init(XRomFs* fs, const void* romimage);
97 
98 
104 void xromfs_deinit(XRomFs* fs);
105 
106 
113 void xromfs_init_vfs(XRomFs* fs, XVirtualFs* vfs);
114 
115 
116 XStream* xromfs_init_stream(XStream* stream, XFile* fp);
117 XError xromfs_open(XRomFs* fs, const char* path, XOpenMode mode, XFile** o_fp);
118 XError xromfs_close(XFile* fp);
119 XError xromfs_read(XFile* fp, void* dst, size_t size, size_t* nread);
120 XError xromfs_seek(XFile* fp, XOffset pos, XSeekMode whence);
121 XError xromfs_tell(XFile* fp, XSize* pos);
122 XError xromfs_opendir(XRomFs* fs, const char* path, XDir** o_dir);
123 XError xromfs_readdir(XDir* dir, XDirEnt* dirent, XDirEnt** result);
124 XError xromfs_closedir(XDir* dir);
125 XError xromfs_chdir(XRomFs* fs, const char* path);
126 XError xromfs_getcwd(XRomFs* fs, char* buf, size_t size);
127 XError xromfs_stat(XRomFs* fs, const char* path, XStat* statbuf);
128 
129 
135 #ifdef __cplusplus
136 }
137 #endif /* __cplusplus */
138 
139 
140 #endif /* picox_filesystem_xromfs_h_ */
Definition: xfscore.h:182
Definition: xromfs.h:79
void xromfs_deinit(XRomFs *fs)
ファイルシステムの終了処理を行います
Definition: xromfs.c:154
XOpenMode
ファイルオープン等のモードです
Definition: xstddef.h:435
XError
errnoの代替として使用する共通のエラーコードを表す列挙型です
Definition: xstddef.h:367
ディレクトリエントリ情報を格納する構造体です
Definition: xfscore.h:109
uint32_t XSize
何らかの大きさを表すのに十分なサイズを備えた符号なし整数型です
Definition: xstddef.h:251
ファイル操作のハンドル構造体です
Definition: xfscore.h:70
XError xromfs_init(XRomFs *fs, const void *romimage)
ファイルシステムを初期化します
Definition: xromfs.c:115
uint32_t XTag
何らかのIDを格納するための符号なし整数が型です
Definition: xstddef.h:269
void xromfs_init_vfs(XRomFs *fs, XVirtualFs *vfs)
仮想ファイルシステムを初期化します
Definition: xromfs.c:161
int32_t XOffset
何らかのオフセットを表すのに十分な大きさをもった符号あり整数型です
Definition: xstddef.h:261
ストリームを表す抽象型です
Definition: xstream.h:152
XSeekMode
シークの起点を指定する列挙型です
Definition: xstddef.h:340
ディレクトリ操作のハンドル構造体です
Definition: xfscore.h:82
ファイル情報を格納する構造体です
Definition: xfscore.h:92