1 /*
2  * Copyright (c) 2006-2018, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2022-10-24     flybreak     the first version
9  */
10 
11 #ifndef __DFS_TMPFS_H__
12 #define __DFS_TMPFS_H__
13 
14 #include <rtthread.h>
15 
16 #define TMPFS_NAME_MAX  32
17 #define TMPFS_MAGIC     0x0B0B0B0B
18 
19 #define TMPFS_TYPE_FILE   0x00
20 #define TMPFS_TYPE_DIR    0x01
21 
22 struct tmpfs_sb;
23 
24 struct tmpfs_file
25 {
26     rt_uint32_t      type;     /* file type */
27     char name[TMPFS_NAME_MAX]; /* file name */
28     rt_list_t     subdirs;     /* file subdir list */
29     rt_list_t     sibling;     /* file sibling list */
30     struct tmpfs_sb *sb;       /* superblock ptr */
31     rt_uint8_t      *data;     /* file date ptr */
32     rt_size_t        size;     /* file size */
33 };
34 
35 
36 struct tmpfs_sb
37 {
38     rt_uint32_t       magic;       /* TMPFS_MAGIC */
39     struct tmpfs_file root;        /* root dir */
40     rt_size_t         df_size;     /* df size */
41     rt_list_t         sibling;     /* sb sibling list */
42     struct rt_spinlock lock;       /* tmpfs lock */
43 };
44 
45 int dfs_tmpfs_init(void);
46 
47 #endif
48 
49