• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* ----------------------------------------------------------------------------
2  * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved.
3  * Description: LiteOS VFS Private Headfile
4  * Author: Huawei LiteOS Team
5  * Create: 2023-1-31
6  * Redistribution and use in source and binary forms, with or without modification,
7  * are permitted provided that the following conditions are met:
8  * 1. Redistributions of source code must retain the above copyright notice, this list of
9  * conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright notice, this list
11  * of conditions and the following disclaimer in the documentation and/or other materials
12  * provided with the distribution.
13  * 3. Neither the name of the copyright holder nor the names of its contributors may be used
14  * to endorse or promote products derived from this software without specific prior written
15  * permission.
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
18  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
20  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
23  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
26  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  * --------------------------------------------------------------------------- */
28 
29 #ifndef _VFS_EXTEND_H
30 #define _VFS_EXTEND_H
31 
32 #include "los_fs.h"
33 
34 #define MS_RDONLY 1
35 #define MS_NOSYNC 2
36 
37 #define FALLOC_FL_KEEP_SIZE 1 /* extend size */
38 
39 #ifdef LOSCFG_FS_FAT
40 /* Format options (3rd argument of format) */
41 #define FMT_FAT      0x01
42 #define FMT_FAT32    0x02
43 #define FMT_ANY      0x07
44 #define FMT_ERASE    0x08
45 
46 /* system time flag for FAT */
47 #define FAT_SYSTEM_TIME_ENABLE   0x01
48 #define FAT_SYSTEM_TIME_DISABLE  0x00
49 #endif
50 
51 #ifdef LOSCFG_FS_PROC
52 #define PROCFS_MOUNT_POINT      "/proc"
53 #define PROCFS_MOUNT_POINT_SIZE (sizeof(PROCFS_MOUNT_POINT) - 1)
54 #endif
55 
56 #ifdef LOSCFG_FS_YAFFS
57 #define YAFFS_MOUNT_POINT       "/yaffs"
58 #define YAFFS_MOUNT_POINT_SIZE  (sizeof(YAFFS_MOUNT_POINT) - 1)
59 #endif
60 
61 #ifdef LOSCFG_FS_RAMFS
62 #define RAMFS_MOUNT_POINT       "/ramfs"
63 #define RAMFS_MOUNT_POINT_SIZE  (sizeof(RAMFS_MOUNT_POINT) - 1)
64 #endif
65 
66 /* yaffs and fatfs cache configur */
67 /* config block size for fat file system, only can be 0,32,64,128,256,512,1024 */
68 
69 #define CONFIG_FS_FAT_SECTOR_PER_BLOCK  256
70 #define CONFIG_NFILE_DESCRIPTORS_PER_BLOCK CONFIG_NFILE_DESCRIPTORS
71 /* config block num for fat file system */
72 
73 #ifdef LOSCFG_FS_FAT_BLOCK_NUMS
74 #define CONFIG_FS_FAT_BLOCK_NUMS        LOSCFG_FS_FAT_BLOCK_NUMS
75 #else
76 #define CONFIG_FS_FAT_BLOCK_NUMS        32
77 #endif
78 
79 #ifdef LOSCFG_FS_FAT_CACHE_SYNC_THREAD
80 
81 /* config the priority of sync task */
82 
83 #define CONFIG_FS_FAT_SYNC_THREAD_PRIO  10
84 
85 /* config dirty ratio of bcache for fat file system */
86 
87 #define CONFIG_FS_FAT_DIRTY_RATIO       50
88 
89 /* config time interval of sync thread for fat file system, in milliseconds */
90 
91 #define CONFIG_FS_FAT_SYNC_INTERVAL     5000
92 #endif
93 
94 #define CONFIG_FS_FLASH_BLOCK_NUM 1
95 
96 /* page numbers of per yaffs block */
97 
98 #define CONFIG_FS_YLIB_PAGE_PER_BLOCK (64 * CONFIG_FS_FLASH_BLOCK_NUM)
99 
100 /* config erase size for yaffs file system */
101 
102 #define CONFIG_FS_YAFFS_BLOCK_ERASE_SIZE (2048 * CONFIG_FS_YLIB_PAGE_PER_BLOCK)
103 
104 /* config block size for yaffs file system */
105 
106 #define CONFIG_FS_YAFFS_BLOCK_SIZE  ((2048 + 64) * CONFIG_FS_YLIB_PAGE_PER_BLOCK)
107 
108 /* config cache size for yaffs file system */
109 
110 #define CONFIG_FS_YAFFS_BLOCK_CACHE_MEMSIZE (16*CONFIG_FS_YAFFS_BLOCK_SIZE)
111 
112 #endif /* _VFS_EXTEND_H */
113