picox  0.1
xramfs.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_xramfs_h_
41 #define picox_filesystem_xramfs_h_
42 
43 
46 
47 
48 #ifdef __cplusplus
49 extern "C" {
50 #endif /* __cplusplus */
51 
52 
75 #define X_RAMFS_TAG (X_MAKE_TAG('X', 'R', 'A', 'F'))
76 typedef struct
77 {
79  XTag m_tag;
80  XPicoAllocator m_alloc;
81  void* m_rootdir;
82  void* m_curdir;
83 } XRamFs;
84 
85 
96 XError xramfs_init(XRamFs* fs, void* mem, size_t size);
97 
98 
104 void xramfs_deinit(XRamFs* fs);
105 
106 
113 void xramfs_init_vfs(XRamFs* fs, XVirtualFs* vfs);
114 
115 XStream* xramfs_init_stream(XStream* stream, XFile* fp);
116 XError xramfs_open(XRamFs* fs, const char* path, XOpenMode mode, XFile** o_fp);
117 XError xramfs_close(XFile* fp);
118 XError xramfs_read(XFile* fp, void* dst, size_t size, size_t* nread);
119 XError xramfs_write(XFile* fp, const void* src, size_t size, size_t* nwritten);
120 XError xramfs_seek(XFile* fp, XOffset pos, XSeekMode whence);
121 XError xramfs_tell(XFile* fp, XSize* pos);
122 XError xramfs_flush(XFile* fp);
123 XError xramfs_mkdir(XRamFs* fs, const char* path);
124 XError xramfs_opendir(XRamFs* fs, const char* path, XDir** o_dir);
125 XError xramfs_readdir(XDir* dir, XDirEnt* dirent, XDirEnt** result);
126 XError xramfs_closedir(XDir* dir);
127 XError xramfs_chdir(XRamFs* fs, const char* path);
128 XError xramfs_getcwd(XRamFs* fs, char* buf, size_t size);
129 XError xramfs_remove(XRamFs* fs, const char* path);
130 XError xramfs_rename(XRamFs* fs, const char* oldpath, const char* newpath);
131 XError xramfs_stat(XRamFs* fs, const char* path, XStat* statbuf);
132 XError xramfs_utime(XRamFs* fs, const char* path, XTime time);
133 
134 
140 #ifdef __cplusplus
141 }
142 #endif /* __cplusplus */
143 
144 
145 #endif /* picox_filesystem_xramfs_h_ */
Definition: xfscore.h:182
uint32_t XTime
time_tの代替をするシステム時刻を格納するための型です
Definition: xtime.h:80
XOpenMode
ファイルオープン等のモードです
Definition: xstddef.h:435
XError
errnoの代替として使用する共通のエラーコードを表す列挙型です
Definition: xstddef.h:367
ディレクトリエントリ情報を格納する構造体です
Definition: xfscore.h:109
void xramfs_init_vfs(XRamFs *fs, XVirtualFs *vfs)
仮想ファイルシステムを初期化します
Definition: xramfs.c:170
uint32_t XSize
何らかの大きさを表すのに十分なサイズを備えた符号なし整数型です
Definition: xstddef.h:251
ファイル操作のハンドル構造体です
Definition: xfscore.h:70
uint32_t XTag
何らかのIDを格納するための符号なし整数が型です
Definition: xstddef.h:269
Definition: xramfs.h:76
Pico variable memory allocator.
int32_t XOffset
何らかのオフセットを表すのに十分な大きさをもった符号あり整数型です
Definition: xstddef.h:261
ストリームを表す抽象型です
Definition: xstream.h:152
void xramfs_deinit(XRamFs *fs)
ファイルシステムの終了処理を行います
Definition: xramfs.c:162
Definition: xpico_allocator.h:68
XSeekMode
シークの起点を指定する列挙型です
Definition: xstddef.h:340
ディレクトリ操作のハンドル構造体です
Definition: xfscore.h:82
ファイル情報を格納する構造体です
Definition: xfscore.h:92
XError xramfs_init(XRamFs *fs, void *mem, size_t size)
ファイルシステムを初期化します
Definition: xramfs.c:134